From 1a8bd22fa3d89884864c7876160f56240dd60781 Mon Sep 17 00:00:00 2001 From: Kara Erickson Date: Mon, 14 Oct 2019 11:39:44 -0700 Subject: [PATCH] =?UTF-8?q?refactor(core):=20rename=20ngLocaleIdDef=20to?= =?UTF-8?q?=20=C9=B5loc=20(#33212)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LocaleID 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 ngLocaleIdDef to loc. 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 #33212 --- packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts | 2 +- packages/core/src/render3/definition.ts | 4 ++-- packages/core/src/render3/fields.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts index 2f14dde105..ea2c2b142a 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts @@ -324,7 +324,7 @@ export class NgModuleDecoratorHandler implements DecoratorHandler(type: any, throwNotFound?: boolean): NgModuleD } export function getNgLocaleIdDef(type: any): string|null { - return (type as any)[NG_LOCALE_ID_DEF] || null; + return (type as any)[NG_LOC_ID_DEF] || null; } diff --git a/packages/core/src/render3/fields.ts b/packages/core/src/render3/fields.ts index 90f433ed03..299ab5b035 100644 --- a/packages/core/src/render3/fields.ts +++ b/packages/core/src/render3/fields.ts @@ -12,7 +12,7 @@ export const NG_COMP_DEF = getClosureSafeProperty({ɵcmp: getClosureSafeProperty export const NG_DIR_DEF = getClosureSafeProperty({ɵdir: getClosureSafeProperty}); export const NG_PIPE_DEF = getClosureSafeProperty({ɵpipe: getClosureSafeProperty}); export const NG_MOD_DEF = getClosureSafeProperty({ɵmod: getClosureSafeProperty}); -export const NG_LOCALE_ID_DEF = getClosureSafeProperty({ngLocaleIdDef: getClosureSafeProperty}); +export const NG_LOC_ID_DEF = getClosureSafeProperty({ɵloc: getClosureSafeProperty}); export const NG_BASE_DEF = getClosureSafeProperty({ngBaseDef: getClosureSafeProperty}); export const NG_FACTORY_DEF = getClosureSafeProperty({ɵfac: getClosureSafeProperty});