From 392473ec79d80905191ee65658608afabcaa8a43 Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Thu, 11 Apr 2019 11:04:30 +0200 Subject: [PATCH] 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 --- packages/core/src/di/jit/injectable.ts | 2 +- packages/core/src/render3/jit/directive.ts | 2 +- packages/core/src/render3/jit/module.ts | 4 ++-- packages/core/src/render3/jit/pipe.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/src/di/jit/injectable.ts b/packages/core/src/di/jit/injectable.ts index 128985b578..bd0e2e4bca 100644 --- a/packages/core/src/di/jit/injectable.ts +++ b/packages/core/src/di/jit/injectable.ts @@ -71,7 +71,7 @@ export function compileInjectable(type: Type, srcMeta?: Injectable): void { throw new Error(`Unreachable state.`); } def = getCompilerFacade().compileInjectable( - angularCoreDiEnv, `ng://${type.name}/ngInjectableDef.js`, compilerMeta); + angularCoreDiEnv, `ng:///${type.name}/ngInjectableDef.js`, compilerMeta); } return def; }, diff --git a/packages/core/src/render3/jit/directive.ts b/packages/core/src/render3/jit/directive.ts index 42e00d89f6..5f7dd714e3 100644 --- a/packages/core/src/render3/jit/directive.ts +++ b/packages/core/src/render3/jit/directive.ts @@ -123,7 +123,7 @@ export function compileDirective(type: Type, directive: Directive): void { get: () => { if (ngDirectiveDef === null) { const name = type && type.name; - const sourceMapUrl = `ng://${name}/ngDirectiveDef.js`; + const sourceMapUrl = `ng:///${name}/ngDirectiveDef.js`; const compiler = getCompilerFacade(); const facade = directiveMetadata(type as ComponentType, directive); facade.typeSourceSpan = compiler.createParseSourceSpan('Directive', name, sourceMapUrl); diff --git a/packages/core/src/render3/jit/module.ts b/packages/core/src/render3/jit/module.ts index de29b27e51..3777b0cf1c 100644 --- a/packages/core/src/render3/jit/module.ts +++ b/packages/core/src/render3/jit/module.ts @@ -107,7 +107,7 @@ export function compileNgModuleDefs(moduleType: NgModuleType, ngModule: NgModule get: () => { if (ngModuleDef === null) { ngModuleDef = getCompilerFacade().compileNgModule( - angularCoreEnv, `ng://${moduleType.name}/ngModuleDef.js`, { + angularCoreEnv, `ng:///${moduleType.name}/ngModuleDef.js`, { type: moduleType, bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY, resolveForwardRef), declarations: declarations.map(resolveForwardRef), @@ -142,7 +142,7 @@ export function compileNgModuleDefs(moduleType: NgModuleType, ngModule: NgModule ], }; ngInjectorDef = getCompilerFacade().compileInjector( - angularCoreEnv, `ng://${moduleType.name}/ngInjectorDef.js`, meta); + angularCoreEnv, `ng:///${moduleType.name}/ngInjectorDef.js`, meta); } return ngInjectorDef; }, diff --git a/packages/core/src/render3/jit/pipe.ts b/packages/core/src/render3/jit/pipe.ts index 479151d8fe..702160bf11 100644 --- a/packages/core/src/render3/jit/pipe.ts +++ b/packages/core/src/render3/jit/pipe.ts @@ -21,7 +21,7 @@ export function compilePipe(type: Type, meta: Pipe): void { if (ngPipeDef === null) { const typeName = type.name; ngPipeDef = - getCompilerFacade().compilePipe(angularCoreEnv, `ng://${typeName}/ngPipeDef.js`, { + getCompilerFacade().compilePipe(angularCoreEnv, `ng:///${typeName}/ngPipeDef.js`, { type: type, typeArgumentCount: 0, name: typeName,