refactor(core): rename ngPipeDef to ɵpipe (#33142)

Pipe defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngPipeDef to pipe. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.

PR Close #33142
This commit is contained in:
Kara Erickson
2019-10-11 19:19:59 -07:00
committed by Miško Hevery
parent f433d6604b
commit d62eff7316
17 changed files with 50 additions and 52 deletions

View File

@ -705,7 +705,7 @@ export const ɵɵdefineDirective = ɵɵdefineComponent as any as<T>(directiveDef
* ```
* class MyPipe implements PipeTransform {
* // Generated by Angular Template Compiler
* static ngPipeDef = definePipe({
* static ɵpipe = definePipe({
* ...
* });
* }

View File

@ -10,7 +10,7 @@ import {getClosureSafeProperty} from '../util/property';
export const NG_COMP_DEF = getClosureSafeProperty({ɵcmp: getClosureSafeProperty});
export const NG_DIR_DEF = getClosureSafeProperty({ɵdir: getClosureSafeProperty});
export const NG_PIPE_DEF = getClosureSafeProperty({ngPipeDef: getClosureSafeProperty});
export const NG_PIPE_DEF = getClosureSafeProperty({ɵpipe: getClosureSafeProperty});
export const NG_MODULE_DEF = getClosureSafeProperty({ngModuleDef: getClosureSafeProperty});
export const NG_LOCALE_ID_DEF = getClosureSafeProperty({ngLocaleIdDef: getClosureSafeProperty});
export const NG_BASE_DEF = getClosureSafeProperty({ngBaseDef: getClosureSafeProperty});

View File

@ -88,10 +88,10 @@ export enum DirectiveDefFlags {
}
/**
* A subclass of `Type` which has a static `ngPipeDef`:`PipeDef` field making it
* A subclass of `Type` which has a static `ɵpipe`:`PipeDef` field making it
* consumable for rendering.
*/
export interface PipeType<T> extends Type<T> { ngPipeDef: never; }
export interface PipeType<T> extends Type<T> { ɵpipe: never; }
/**
* @codeGenApi

View File

@ -450,7 +450,7 @@ export function transitiveScopesFor<T>(
};
maybeUnwrapFn(def.declarations).forEach(declared => {
const declaredWithDefs = declared as Type<any>& { ngPipeDef?: any; };
const declaredWithDefs = declared as Type<any>& { ɵpipe?: any; };
if (getPipeDef(declaredWithDefs)) {
scopes.compilation.pipes.add(declared);
@ -489,7 +489,7 @@ export function transitiveScopesFor<T>(
ɵcmp?: any;
ɵdir?: any;
ngModuleDef?: NgModuleDef<E>;
ngPipeDef?: any;
ɵpipe?: any;
};
// Either the type is a module, a pipe, or a component/directive (which may not have a

View File

@ -37,7 +37,7 @@ export function compilePipe(type: Type<any>, meta: Pipe): void {
if (ngPipeDef === null) {
const metadata = getPipeMetadata(type, meta);
ngPipeDef = getCompilerFacade().compilePipe(
angularCoreEnv, `ng:///${metadata.name}/ngPipeDef.js`, metadata);
angularCoreEnv, `ng:///${metadata.name}/ɵpipe.js`, metadata);
}
return ngPipeDef;
},