feat(compiler-cli): mark ability to use partial compilation mode as stable (#41518)
This commit marks the `compilationMode` compiler option as stable, such that libraries can be compiled in partial compilation mode. In partial compilation mode, the compiler's output changes from fully compiled AOT definitions to an intermediate form using partial declarations. This form is suitable to be published to NPM, which now allows libraries to be compiled and published using the Ivy compiler. Please be aware that libraries that have been compiled using this mode can only be used in Angular 12 applications and up; they cannot be used when Ivy is disabled (i.e. when using View Engine) or in versions of Angular prior to 12. The `compilationMode` option has no effect if `enableIvy: false` is used. Closes #41496 PR Close #41518
This commit is contained in:
parent
aa0e54fe97
commit
6ba67c6fff
|
@ -67,6 +67,15 @@ Modifies how Angular-specific annotations are emitted to improve tree-shaking. N
|
|||
When `true`, use [Tsickle](https://github.com/angular/tsickle) to annotate the emitted JavaScript with [JSDoc](https://jsdoc.app/) comments needed by the
|
||||
[Closure Compiler](https://github.com/google/closure-compiler). Default is `false`.
|
||||
|
||||
### `compilationMode`
|
||||
|
||||
Specifies the compilation mode to use. The following modes are available:
|
||||
|
||||
- `'full'`: generates fully AOT-compiled code according to the version of Angular that is currently being used.
|
||||
- `'partial'`: generates code in a stable, but intermediate form suitable for a published library.
|
||||
|
||||
The default value is `'full'`.
|
||||
|
||||
### `disableExpressionLowering`
|
||||
|
||||
When `true` (the default), transforms code that is or could be used in an annotation, to allow it to be imported from template factory modules. See [metadata rewriting](guide/aot-compiler#metadata-rewriting) for more information.
|
||||
|
|
|
@ -43,3 +43,7 @@ export interface StrictTemplateOptions {
|
|||
strictSafeNavigationTypes?: boolean;
|
||||
strictTemplates?: boolean;
|
||||
}
|
||||
|
||||
export interface TargetOptions {
|
||||
compilationMode?: 'full' | 'partial';
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {BazelAndG3Options, I18nOptions, LegacyNgcOptions, MiscOptions, NgcCompatibilityOptions, StrictTemplateOptions} from './public_options';
|
||||
import {BazelAndG3Options, I18nOptions, LegacyNgcOptions, MiscOptions, NgcCompatibilityOptions, StrictTemplateOptions, TargetOptions} from './public_options';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -36,22 +36,6 @@ export interface TestOnlyOptions {
|
|||
tracePerformance?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that specify compilation target.
|
||||
*/
|
||||
export interface TargetOptions {
|
||||
/**
|
||||
* Specifies the compilation mode to use. The following modes are available:
|
||||
* - 'full': generates fully AOT compiled code using Ivy instructions.
|
||||
* - 'partial': generates code in a stable, but intermediate form suitable to be published to NPM.
|
||||
*
|
||||
* To become public once the linker is ready.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
compilationMode?: 'full'|'partial';
|
||||
}
|
||||
|
||||
/**
|
||||
* A merged interface of all of the various Angular compiler options, as well as the standard
|
||||
* `ts.CompilerOptions`.
|
||||
|
|
|
@ -340,6 +340,22 @@ export interface I18nOptions {
|
|||
i18nNormalizeLineEndingsInICUs?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that specify compilation target.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface TargetOptions {
|
||||
/**
|
||||
* Specifies the compilation mode to use. The following modes are available:
|
||||
* - 'full': generates fully AOT compiled code using Ivy instructions.
|
||||
* - 'partial': generates code in a stable, but intermediate form suitable for publication to NPM.
|
||||
*
|
||||
* The default value is 'full'.
|
||||
*/
|
||||
compilationMode?: 'full'|'partial';
|
||||
}
|
||||
|
||||
/**
|
||||
* Miscellaneous options that don't fall into any other category
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue