refactor(core): rename ngDirectiveDef to ɵdir (#33110)

Directive 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
ngDirectiveDef to dir. 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.

Note that the other "defs" (ngFactoryDef, etc) will be
prefixed and shortened in follow-up PRs, in an attempt to
limit how large and conflict-y this change is.

PR Close #33110
This commit is contained in:
Kara Erickson
2019-10-11 12:28:12 -07:00
committed by Miško Hevery
parent d8249d1230
commit 1a67d70bf8
47 changed files with 150 additions and 156 deletions

View File

@ -54,16 +54,16 @@ export const ngClassFactoryDef = ngClassFactoryDef__PRE_R3__;
* While this is a base class that NgClass extends from, the
* class itself acts as a container for non-VE code to setup
* a link to the `[class]` host binding (via the static
* `ngDirectiveDef` property on the class).
* `ɵdir` property on the class).
*
* Note that the `ngDirectiveDef` property's code is switched
* Note that the `ɵdir` property's code is switched
* depending if VE is present or not (this allows for the
* binding code to be set only for newer versions of Angular).
*
* @publicApi
*/
export class NgClassBase {
static ngDirectiveDef: any = ngClassDirectiveDef;
static ɵdir: any = ngClassDirectiveDef;
static ngFactoryDef: any = ngClassFactoryDef;
constructor(protected _delegate: NgClassImpl) {}

View File

@ -54,16 +54,16 @@ export const ngStyleFactoryDef = ngStyleDirectiveDef__PRE_R3__;
* While this is a base class that NgStyle extends from, the
* class itself acts as a container for non-VE code to setup
* a link to the `[style]` host binding (via the static
* `ngDirectiveDef` property on the class).
* `ɵdir` property on the class).
*
* Note that the `ngDirectiveDef` property's code is switched
* Note that the `ɵdir` property's code is switched
* depending if VE is present or not (this allows for the
* binding code to be set only for newer versions of Angular).
*
* @publicApi
*/
export class NgStyleBase {
static ngDirectiveDef: any = ngStyleDirectiveDef;
static ɵdir: any = ngStyleDirectiveDef;
static ngFactory: any = ngStyleFactoryDef;
constructor(protected _delegate: NgStyleImpl) {}