
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
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {getCompilerFacade} from '../../compiler/compiler_facade';
|
|
import {reflectDependencies} from '../../di/jit/util';
|
|
import {Type} from '../../interface/type';
|
|
import {Pipe} from '../../metadata/directives';
|
|
import {NG_PIPE_DEF} from '../fields';
|
|
|
|
import {angularCoreEnv} from './environment';
|
|
|
|
export function compilePipe(type: Type<any>, meta: Pipe): void {
|
|
let ngPipeDef: any = null;
|
|
Object.defineProperty(type, NG_PIPE_DEF, {
|
|
get: () => {
|
|
if (ngPipeDef === null) {
|
|
const typeName = type.name;
|
|
ngPipeDef =
|
|
getCompilerFacade().compilePipe(angularCoreEnv, `ng:///${typeName}/ngPipeDef.js`, {
|
|
type: type,
|
|
typeArgumentCount: 0,
|
|
name: typeName,
|
|
deps: reflectDependencies(type),
|
|
pipeName: meta.name,
|
|
pure: meta.pure !== undefined ? meta.pure : true
|
|
});
|
|
}
|
|
return ngPipeDef;
|
|
},
|
|
// Make the property configurable in dev mode to allow overriding in tests
|
|
configurable: !!ngDevMode,
|
|
});
|
|
}
|