fix(core): consistently use ng:/// for sourcemap URLs (#29826)
Currently, in jit mode, `ngInjectableDef`, `ngDirectiveDef`, `ngPipeDef` and `ngModuleDef` use `ng://`, which display them in the top domain in Chrome Dev Tools, whereas `ngComponentDef` uses `ng:///` which display components in a separate domain. You can currently see: ``` AppModule UserService ng:// |_ AppComponent |_ template.html |_ AppComponent.js ... ``` This commits replaces all `ng://` with `ng:///` to display every Angular entity in the `ng://` domain. ``` ng:// |_ AppModule |_ UserService |_ AppComponent ... ``` PR Close #29826
This commit is contained in:
parent
345a3cd9aa
commit
392473ec79
|
@ -71,7 +71,7 @@ export function compileInjectable(type: Type<any>, srcMeta?: Injectable): void {
|
||||||
throw new Error(`Unreachable state.`);
|
throw new Error(`Unreachable state.`);
|
||||||
}
|
}
|
||||||
def = getCompilerFacade().compileInjectable(
|
def = getCompilerFacade().compileInjectable(
|
||||||
angularCoreDiEnv, `ng://${type.name}/ngInjectableDef.js`, compilerMeta);
|
angularCoreDiEnv, `ng:///${type.name}/ngInjectableDef.js`, compilerMeta);
|
||||||
}
|
}
|
||||||
return def;
|
return def;
|
||||||
},
|
},
|
||||||
|
|
|
@ -123,7 +123,7 @@ export function compileDirective(type: Type<any>, directive: Directive): void {
|
||||||
get: () => {
|
get: () => {
|
||||||
if (ngDirectiveDef === null) {
|
if (ngDirectiveDef === null) {
|
||||||
const name = type && type.name;
|
const name = type && type.name;
|
||||||
const sourceMapUrl = `ng://${name}/ngDirectiveDef.js`;
|
const sourceMapUrl = `ng:///${name}/ngDirectiveDef.js`;
|
||||||
const compiler = getCompilerFacade();
|
const compiler = getCompilerFacade();
|
||||||
const facade = directiveMetadata(type as ComponentType<any>, directive);
|
const facade = directiveMetadata(type as ComponentType<any>, directive);
|
||||||
facade.typeSourceSpan = compiler.createParseSourceSpan('Directive', name, sourceMapUrl);
|
facade.typeSourceSpan = compiler.createParseSourceSpan('Directive', name, sourceMapUrl);
|
||||||
|
|
|
@ -107,7 +107,7 @@ export function compileNgModuleDefs(moduleType: NgModuleType, ngModule: NgModule
|
||||||
get: () => {
|
get: () => {
|
||||||
if (ngModuleDef === null) {
|
if (ngModuleDef === null) {
|
||||||
ngModuleDef = getCompilerFacade().compileNgModule(
|
ngModuleDef = getCompilerFacade().compileNgModule(
|
||||||
angularCoreEnv, `ng://${moduleType.name}/ngModuleDef.js`, {
|
angularCoreEnv, `ng:///${moduleType.name}/ngModuleDef.js`, {
|
||||||
type: moduleType,
|
type: moduleType,
|
||||||
bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY, resolveForwardRef),
|
bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY, resolveForwardRef),
|
||||||
declarations: declarations.map(resolveForwardRef),
|
declarations: declarations.map(resolveForwardRef),
|
||||||
|
@ -142,7 +142,7 @@ export function compileNgModuleDefs(moduleType: NgModuleType, ngModule: NgModule
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
ngInjectorDef = getCompilerFacade().compileInjector(
|
ngInjectorDef = getCompilerFacade().compileInjector(
|
||||||
angularCoreEnv, `ng://${moduleType.name}/ngInjectorDef.js`, meta);
|
angularCoreEnv, `ng:///${moduleType.name}/ngInjectorDef.js`, meta);
|
||||||
}
|
}
|
||||||
return ngInjectorDef;
|
return ngInjectorDef;
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,7 +21,7 @@ export function compilePipe(type: Type<any>, meta: Pipe): void {
|
||||||
if (ngPipeDef === null) {
|
if (ngPipeDef === null) {
|
||||||
const typeName = type.name;
|
const typeName = type.name;
|
||||||
ngPipeDef =
|
ngPipeDef =
|
||||||
getCompilerFacade().compilePipe(angularCoreEnv, `ng://${typeName}/ngPipeDef.js`, {
|
getCompilerFacade().compilePipe(angularCoreEnv, `ng:///${typeName}/ngPipeDef.js`, {
|
||||||
type: type,
|
type: type,
|
||||||
typeArgumentCount: 0,
|
typeArgumentCount: 0,
|
||||||
name: typeName,
|
name: typeName,
|
||||||
|
|
Loading…
Reference in New Issue