refactor(core): rename ngInjectableDef to ɵprov (#33151)
Injectable 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 ngInjectableDef to "prov" (for "provider", since injector defs are known as "inj"). 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 #33151
This commit is contained in:

committed by
Matias Niemelä

parent
cda9248b33
commit
86104b82b8
@ -331,9 +331,9 @@ The above will create the following layout:
|
||||
| `EXPANDO`
|
||||
| 11..18| cumulativeBloom | templateBloom
|
||||
| | *sub-section: `component` and `directives`*
|
||||
| 19 | `factory(Child.ɵcmp.factory)`* | `Child`
|
||||
| 19 | `factory(Child.ɵcmp.factory)`* | `Child`
|
||||
| | *sub-section: `providers`*
|
||||
| 20 | `factory(ServiceA.ngInjectableDef.factory)`* | `ServiceA`
|
||||
| 20 | `factory(ServiceA.ɵprov.factory)`* | `ServiceA`
|
||||
| 22 | `'someServiceBValue'`* | `ServiceB`
|
||||
| | *sub-section: `viewProviders`*
|
||||
| 22 | `factory(()=> new Service())`* | `ServiceC`
|
||||
@ -420,7 +420,7 @@ A pseudo-implementation of `inject` function.
|
||||
```typescript
|
||||
function inject(token: any): any {
|
||||
let injectableDef;
|
||||
if (typeof token === 'function' && injectableDef = token.ngInjectableDef) {
|
||||
if (typeof token === 'function' && injectableDef = token.ɵprov) {
|
||||
const provideIn = injectableDef.provideIn;
|
||||
if (provideIn === '__node_injector__') {
|
||||
// if we are injecting `Injector` than create a wrapper object around the inject but which
|
||||
|
Reference in New Issue
Block a user