refactor(compiler): remove unused __BUILD_OPTIMIZER_*
constants (#41040)
These constants were created in a very early phase of Ivy development. They have never been used in the framework, no the build-optimizer tool. PR Close #41040
This commit is contained in:
parent
11e16c7b41
commit
d44c7c209d
@ -415,55 +415,6 @@ except for the call to `ɵɵdefineInjector` would generate a `{ __symbolic: 'err
|
|||||||
value which is ignored by the ivy compiler. This allows the system to ignore
|
value which is ignored by the ivy compiler. This allows the system to ignore
|
||||||
the difference between manually and mechanically created module definitions.
|
the difference between manually and mechanically created module definitions.
|
||||||
|
|
||||||
|
|
||||||
## Manual Considerations
|
|
||||||
|
|
||||||
With this proposal, the compiler treats manually and mechanically generated
|
|
||||||
Angular definitions identically. This allows flexibility not only in the future
|
|
||||||
for how the declarations are mechanically produced, it also allows an alternative
|
|
||||||
mechanism to generate declarations that can be easily explored without altering the
|
|
||||||
compiler or dependent tool chain. It also allows third-party code generators
|
|
||||||
with possibly different component syntaxes to generate a component that is fully
|
|
||||||
understood by the compiler.
|
|
||||||
|
|
||||||
Unfortunately, manually generated modules contain references to
|
|
||||||
classes that might not be necessary at runtime. Manually or third-party
|
|
||||||
components can get the same payload properties of an Angular generated
|
|
||||||
component by annotating the `ngSelector` and `ngModuleScope` properties with
|
|
||||||
`// @__BUILD_OPTIMIZER_REMOVE_` comment which will cause the build optimizer
|
|
||||||
to remove the declaration.
|
|
||||||
|
|
||||||
##### Example
|
|
||||||
|
|
||||||
For example the above manually created module would have better payload
|
|
||||||
properties by including a `// @__BUILD_OPTIMIZER_REMOVE_` comment:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
export class MyModule {
|
|
||||||
static ɵinj = ɵɵdefineInjector({
|
|
||||||
providers: [{
|
|
||||||
provide: Service, useClass: ServiceImpl
|
|
||||||
}],
|
|
||||||
imports: [CommonModule, UtilityModule]
|
|
||||||
});
|
|
||||||
|
|
||||||
// @__BUILD_OPTIMIZER_REMOVE_
|
|
||||||
static ngModuleScope = [{
|
|
||||||
type: MyComponent,
|
|
||||||
selector: 'my-comp'
|
|
||||||
}, {
|
|
||||||
type: MyDirective,
|
|
||||||
selector: '[my-dir]'
|
|
||||||
}, {
|
|
||||||
type: MyPipe,
|
|
||||||
name: 'myPipe'
|
|
||||||
}, {
|
|
||||||
type: UtilityModule,
|
|
||||||
isModule: true
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## `ngc` output (non-Bazel)
|
## `ngc` output (non-Bazel)
|
||||||
|
|
||||||
The cases that `ngc` handle are producing an application and producing a
|
The cases that `ngc` handle are producing an application and producing a
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google LLC All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comment to insert above back-patch
|
|
||||||
*/
|
|
||||||
export const BUILD_OPTIMIZER_COLOCATE = '@__BUILD_OPTIMIZER_COLOCATE__';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comment to mark removable expressions
|
|
||||||
*/
|
|
||||||
export const BUILD_OPTIMIZER_REMOVE = '@__BUILD_OPTIMIZER_REMOVE__';
|
|
Loading…
x
Reference in New Issue
Block a user