refactor(core): rename ngModuleDef to ɵmod (#33142)

Module 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
ngModuleDef to mod. 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-14 07:20:26 -07:00
committed by Miško Hevery
parent d62eff7316
commit fc93dafab1
24 changed files with 87 additions and 89 deletions

View File

@ -268,14 +268,14 @@ A.ɵdir = ɵngcc0.ɵɵdefineDirective({ type: A, selectors: [["", "a", ""]] });
decorationAnalyses, switchMarkerAnalyses, privateDeclarationsAnalyses);
const addDefinitionsSpy = testFormatter.addDefinitions as jasmine.Spy;
const definitions: string = addDefinitionsSpy.calls.first().args[2];
const ngModuleDef = definitions.indexOf('ngModuleDef');
expect(ngModuleDef).not.toEqual(-1, 'ngModuleDef should exist');
const ngModuleDef = definitions.indexOf('ɵmod');
expect(ngModuleDef).not.toEqual(-1, 'ɵmod should exist');
const ngInjectorDef = definitions.indexOf('ngInjectorDef');
expect(ngInjectorDef).not.toEqual(-1, 'ngInjectorDef should exist');
const setClassMetadata = definitions.indexOf('setClassMetadata');
expect(setClassMetadata).not.toEqual(-1, 'setClassMetadata call should exist');
expect(setClassMetadata)
.toBeGreaterThan(ngModuleDef, 'setClassMetadata should follow ngModuleDef');
.toBeGreaterThan(ngModuleDef, 'setClassMetadata should follow ɵmod');
expect(setClassMetadata)
.toBeGreaterThan(ngInjectorDef, 'setClassMetadata should follow ngInjectorDef');
});