@angular/compiler-cli 16.2.0-next.1 → 16.2.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bundles/{chunk-ADNHTL54.js → chunk-DKWZY2MH.js} +6 -5
  2. package/bundles/{chunk-ADNHTL54.js.map → chunk-DKWZY2MH.js.map} +1 -1
  3. package/bundles/{chunk-LVVIYUZC.js → chunk-E72KZKRK.js} +52 -9
  4. package/bundles/chunk-E72KZKRK.js.map +6 -0
  5. package/bundles/{chunk-CWFGODIP.js → chunk-GRJYX2PA.js} +2 -2
  6. package/bundles/{chunk-LOZJLM26.js → chunk-IPC76KA7.js} +14 -1
  7. package/bundles/chunk-IPC76KA7.js.map +6 -0
  8. package/bundles/{chunk-3SPKRPX3.js → chunk-YZ3WOD5G.js} +134 -57
  9. package/bundles/chunk-YZ3WOD5G.js.map +6 -0
  10. package/bundles/index.js +4 -4
  11. package/bundles/linker/babel/index.js +5 -2
  12. package/bundles/linker/babel/index.js.map +1 -1
  13. package/bundles/linker/index.js +2 -2
  14. package/bundles/private/migrations.js +2 -2
  15. package/bundles/src/bin/ng_xi18n.js +4 -4
  16. package/bundles/src/bin/ngc.js +4 -4
  17. package/bundles_metadata.json +1 -1
  18. package/linker/babel/src/ast/babel_ast_factory.d.ts +1 -0
  19. package/package.json +2 -2
  20. package/src/ngtsc/annotations/component/src/handler.d.ts +5 -2
  21. package/src/ngtsc/annotations/component/src/resources.d.ts +1 -0
  22. package/src/ngtsc/annotations/directive/src/handler.d.ts +1 -0
  23. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +5 -2
  24. package/src/ngtsc/annotations/src/injectable.d.ts +1 -0
  25. package/src/ngtsc/annotations/src/pipe.d.ts +1 -0
  26. package/src/ngtsc/core/src/compiler.d.ts +1 -0
  27. package/src/ngtsc/transform/src/api.d.ts +7 -2
  28. package/src/ngtsc/transform/src/compilation.d.ts +2 -1
  29. package/src/ngtsc/translator/src/api/ast_factory.d.ts +7 -0
  30. package/src/ngtsc/translator/src/translator.d.ts +1 -0
  31. package/src/ngtsc/translator/src/typescript_ast_factory.d.ts +1 -0
  32. package/bundles/chunk-3SPKRPX3.js.map +0 -6
  33. package/bundles/chunk-LOZJLM26.js.map +0 -6
  34. package/bundles/chunk-LVVIYUZC.js.map +0 -6
  35. /package/bundles/{chunk-CWFGODIP.js.map → chunk-GRJYX2PA.js.map} +0 -0
@@ -29,6 +29,7 @@ export declare class BabelAstFactory implements AstFactory<t.Statement, t.Expres
29
29
  createFunctionExpression(functionName: string | null, parameters: string[], body: t.Statement): t.Expression;
30
30
  createIdentifier: typeof t.identifier;
31
31
  createIfStatement: typeof t.ifStatement;
32
+ createDynamicImport(url: string): t.Expression;
32
33
  createLiteral(value: string | number | boolean | null | undefined): t.Expression;
33
34
  createNewExpression: typeof t.newExpression;
34
35
  createObjectLiteral(properties: ObjectLiteralProperty<t.Expression>[]): t.Expression;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "16.2.0-next.1",
3
+ "version": "16.2.0-next.3",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -53,7 +53,7 @@
53
53
  "yargs": "^17.2.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@angular/compiler": "16.2.0-next.1",
56
+ "@angular/compiler": "16.2.0-next.3",
57
57
  "typescript": ">=4.9.3 <5.2"
58
58
  },
59
59
  "repository": {
@@ -17,7 +17,7 @@ import { PartialEvaluator } from '../../../partial_evaluator';
17
17
  import { PerfRecorder } from '../../../perf';
18
18
  import { ClassDeclaration, Decorator, ReflectionHost } from '../../../reflection';
19
19
  import { ComponentScopeReader, DtsModuleScopeResolver, LocalModuleScopeRegistry, TypeCheckScopeRegistry } from '../../../scope';
20
- import { AnalysisOutput, CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence, ResolveResult } from '../../../transform';
20
+ import { AnalysisOutput, CompilationMode, CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence, ResolveResult } from '../../../transform';
21
21
  import { TypeCheckContext } from '../../../typecheck/api';
22
22
  import { ExtendedTemplateChecker } from '../../../typecheck/extended/api';
23
23
  import { Xi18nContext } from '../../../xi18n';
@@ -46,6 +46,7 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
46
46
  private enableI18nLegacyMessageIdFormat;
47
47
  private usePoisonedData;
48
48
  private i18nNormalizeLineEndingsInICUs;
49
+ private enabledBlockTypes;
49
50
  private moduleResolver;
50
51
  private cycleAnalyzer;
51
52
  private cycleHandlingStrategy;
@@ -58,7 +59,8 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
58
59
  private perf;
59
60
  private hostDirectivesResolver;
60
61
  private includeClassMetadata;
61
- constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, metaReader: MetadataReader, scopeReader: ComponentScopeReader, dtsScopeReader: DtsModuleScopeResolver, scopeRegistry: LocalModuleScopeRegistry, typeCheckScopeRegistry: TypeCheckScopeRegistry, resourceRegistry: ResourceRegistry, isCore: boolean, strictCtorDeps: boolean, resourceLoader: ResourceLoader, rootDirs: ReadonlyArray<string>, defaultPreserveWhitespaces: boolean, i18nUseExternalIds: boolean, enableI18nLegacyMessageIdFormat: boolean, usePoisonedData: boolean, i18nNormalizeLineEndingsInICUs: boolean, moduleResolver: ModuleResolver, cycleAnalyzer: CycleAnalyzer, cycleHandlingStrategy: CycleHandlingStrategy, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, depTracker: DependencyTracker | null, injectableRegistry: InjectableClassRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, hostDirectivesResolver: HostDirectivesResolver, includeClassMetadata: boolean);
62
+ private readonly compilationMode;
63
+ constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, metaReader: MetadataReader, scopeReader: ComponentScopeReader, dtsScopeReader: DtsModuleScopeResolver, scopeRegistry: LocalModuleScopeRegistry, typeCheckScopeRegistry: TypeCheckScopeRegistry, resourceRegistry: ResourceRegistry, isCore: boolean, strictCtorDeps: boolean, resourceLoader: ResourceLoader, rootDirs: ReadonlyArray<string>, defaultPreserveWhitespaces: boolean, i18nUseExternalIds: boolean, enableI18nLegacyMessageIdFormat: boolean, usePoisonedData: boolean, i18nNormalizeLineEndingsInICUs: boolean, enabledBlockTypes: Set<string>, moduleResolver: ModuleResolver, cycleAnalyzer: CycleAnalyzer, cycleHandlingStrategy: CycleHandlingStrategy, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, depTracker: DependencyTracker | null, injectableRegistry: InjectableClassRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, hostDirectivesResolver: HostDirectivesResolver, includeClassMetadata: boolean, compilationMode: CompilationMode);
62
64
  private literalCache;
63
65
  private elementSchemaRegistry;
64
66
  /**
@@ -84,6 +86,7 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
84
86
  updateResources(node: ClassDeclaration, analysis: ComponentAnalysisData): void;
85
87
  compileFull(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, resolution: Readonly<ComponentResolutionData>, pool: ConstantPool): CompileResult[];
86
88
  compilePartial(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, resolution: Readonly<ComponentResolutionData>): CompileResult[];
89
+ compileLocal(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, pool: ConstantPool): CompileResult[];
87
90
  /**
88
91
  * Check whether adding an import from `origin` to the source-file corresponding to `expr` would
89
92
  * create a cyclic import.
@@ -98,6 +98,7 @@ export interface ExtractTemplateOptions {
98
98
  usePoisonedData: boolean;
99
99
  enableI18nLegacyMessageIdFormat: boolean;
100
100
  i18nNormalizeLineEndingsInICUs: boolean;
101
+ enabledBlockTypes: Set<string>;
101
102
  }
102
103
  export declare function extractTemplate(node: ClassDeclaration, template: TemplateDeclaration, evaluator: PartialEvaluator, depTracker: DependencyTracker | null, resourceLoader: ResourceLoader, options: ExtractTemplateOptions): ParsedTemplateWithSource;
103
104
  export declare function parseTemplateDeclaration(node: ClassDeclaration, decorator: Decorator, component: Map<string, ts.Expression>, containingFile: string, evaluator: PartialEvaluator, depTracker: DependencyTracker | null, resourceLoader: ResourceLoader, defaultPreserveWhitespaces: boolean): TemplateDeclaration;
@@ -56,6 +56,7 @@ export declare class DirectiveDecoratorHandler implements DecoratorHandler<Decor
56
56
  resolve(node: ClassDeclaration, analysis: DirectiveHandlerData, symbol: DirectiveSymbol): ResolveResult<unknown>;
57
57
  compileFull(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, resolution: Readonly<unknown>, pool: ConstantPool): CompileResult[];
58
58
  compilePartial(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, resolution: Readonly<unknown>): CompileResult[];
59
+ compileLocal(node: ClassDeclaration, analysis: Readonly<DirectiveHandlerData>, pool: ConstantPool): CompileResult[];
59
60
  /**
60
61
  * Checks if a given class uses Angular features and returns the TypeScript node
61
62
  * that indicated the usage. Classes are considered using Angular features if they
@@ -14,7 +14,7 @@ import { PartialEvaluator } from '../../../partial_evaluator';
14
14
  import { PerfRecorder } from '../../../perf';
15
15
  import { ClassDeclaration, Decorator, ReflectionHost } from '../../../reflection';
16
16
  import { LocalModuleScopeRegistry } from '../../../scope';
17
- import { AnalysisOutput, CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence, ResolveResult } from '../../../transform';
17
+ import { AnalysisOutput, CompilationMode, CompileResult, DecoratorHandler, DetectResult, HandlerPrecedence, ResolveResult } from '../../../transform';
18
18
  import { InjectableClassRegistry, ReferencesRegistry } from '../../common';
19
19
  export interface NgModuleAnalysis {
20
20
  mod: R3NgModuleMetadata;
@@ -81,7 +81,9 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
81
81
  private injectableRegistry;
82
82
  private perf;
83
83
  private includeClassMetadata;
84
- constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaReader: MetadataReader, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, referencesRegistry: ReferencesRegistry, exportedProviderStatusResolver: ExportedProviderStatusResolver, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, isCore: boolean, refEmitter: ReferenceEmitter, annotateForClosureCompiler: boolean, onlyPublishPublicTypings: boolean, injectableRegistry: InjectableClassRegistry, perf: PerfRecorder, includeClassMetadata: boolean);
84
+ private includeSelectorScope;
85
+ private readonly compilationMode;
86
+ constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaReader: MetadataReader, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, referencesRegistry: ReferencesRegistry, exportedProviderStatusResolver: ExportedProviderStatusResolver, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, isCore: boolean, refEmitter: ReferenceEmitter, annotateForClosureCompiler: boolean, onlyPublishPublicTypings: boolean, injectableRegistry: InjectableClassRegistry, perf: PerfRecorder, includeClassMetadata: boolean, includeSelectorScope: boolean, compilationMode: CompilationMode);
85
87
  readonly precedence = HandlerPrecedence.PRIMARY;
86
88
  readonly name = "NgModuleDecoratorHandler";
87
89
  detect(node: ClassDeclaration, decorators: Decorator[] | null): DetectResult<Decorator> | undefined;
@@ -91,6 +93,7 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
91
93
  resolve(node: ClassDeclaration, analysis: Readonly<NgModuleAnalysis>): ResolveResult<NgModuleResolution>;
92
94
  compileFull(node: ClassDeclaration, { inj, mod, fac, classMetadata, declarations, remoteScopesMayRequireCycleProtection }: Readonly<NgModuleAnalysis>, { injectorImports }: Readonly<NgModuleResolution>): CompileResult[];
93
95
  compilePartial(node: ClassDeclaration, { inj, fac, mod, classMetadata }: Readonly<NgModuleAnalysis>, { injectorImports }: Readonly<NgModuleResolution>): CompileResult[];
96
+ compileLocal(node: ClassDeclaration, { inj, mod, fac, classMetadata, declarations, remoteScopesMayRequireCycleProtection }: Readonly<NgModuleAnalysis>): CompileResult[];
94
97
  /**
95
98
  * Add class metadata statements, if provided, to the `ngModuleStatements`.
96
99
  */
@@ -52,5 +52,6 @@ export declare class InjectableDecoratorHandler implements DecoratorHandler<Deco
52
52
  resolve(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>, symbol: null): ResolveResult<unknown>;
53
53
  compileFull(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>): CompileResult[];
54
54
  compilePartial(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>): CompileResult[];
55
+ compileLocal(node: ClassDeclaration, analysis: Readonly<InjectableHandlerData>): CompileResult[];
55
56
  private compile;
56
57
  }
@@ -49,4 +49,5 @@ export declare class PipeDecoratorHandler implements DecoratorHandler<Decorator,
49
49
  resolve(node: ClassDeclaration): ResolveResult<unknown>;
50
50
  compileFull(node: ClassDeclaration, analysis: Readonly<PipeHandlerData>): CompileResult[];
51
51
  compilePartial(node: ClassDeclaration, analysis: Readonly<PipeHandlerData>): CompileResult[];
52
+ compileLocal(node: ClassDeclaration, analysis: Readonly<PipeHandlerData>): CompileResult[];
52
53
  }
@@ -126,6 +126,7 @@ export declare class NgCompiler {
126
126
  private moduleResolver;
127
127
  private resourceManager;
128
128
  private cycleAnalyzer;
129
+ private enabledBlockTypes;
129
130
  readonly ignoreForDiagnostics: Set<ts.SourceFile>;
130
131
  readonly ignoreForEmit: Set<ts.SourceFile>;
131
132
  readonly enableTemplateTypeChecker: boolean;
@@ -150,8 +150,8 @@ export interface DecoratorHandler<D, A, S extends SemanticSymbol | null, R> {
150
150
  * Generate a description of the field which should be added to the class, including any
151
151
  * initialization code to be generated.
152
152
  *
153
- * If the compilation mode is configured as partial, and an implementation of `compilePartial` is
154
- * provided, then this method is not called.
153
+ * If the compilation mode is configured as other than full but an implementation of the
154
+ * corresponding method is not provided, then this method is called as a fallback.
155
155
  */
156
156
  compileFull(node: ClassDeclaration, analysis: Readonly<A>, resolution: Readonly<R>, constantPool: ConstantPool): CompileResult | CompileResult[];
157
157
  /**
@@ -163,6 +163,11 @@ export interface DecoratorHandler<D, A, S extends SemanticSymbol | null, R> {
163
163
  * `compileFull` is.
164
164
  */
165
165
  compilePartial?(node: ClassDeclaration, analysis: Readonly<A>, resolution: Readonly<R>): CompileResult | CompileResult[];
166
+ /**
167
+ * Generates code based on each individual source file without using its
168
+ * dependencies (suitable for local dev edit/refresh workflow)
169
+ */
170
+ compileLocal(node: ClassDeclaration, analysis: Readonly<A>, constantPool: ConstantPool): CompileResult | CompileResult[];
166
171
  }
167
172
  /**
168
173
  * The output of detecting a trait for a declaration as the result of the first phase of the
@@ -90,7 +90,8 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
90
90
  recordFor(clazz: ClassDeclaration): ClassRecord | null;
91
91
  getAnalyzedRecords(): Map<ts.SourceFile, ClassRecord[]>;
92
92
  /**
93
- * Import a `ClassRecord` from a previous compilation.
93
+ * Import a `ClassRecord` from a previous compilation (only to be used in global compilation
94
+ * modes)
94
95
  *
95
96
  * Traits from the `ClassRecord` have accurate metadata, but the `handler` is from the old program
96
97
  * and needs to be updated (matching is done by name). A new pending trait is created and then
@@ -93,6 +93,13 @@ export interface AstFactory<TStatement, TExpression> {
93
93
  * @param body a statement (or a block of statements) that are the body of the function.
94
94
  */
95
95
  createFunctionExpression(functionName: string | null, parameters: string[], body: TStatement): TExpression;
96
+ /**
97
+ * Creates an expression that represents a dynamic import
98
+ * (e.g. `import('./some/path')`)
99
+ *
100
+ * @param url the URL that should by used in the dynamic import
101
+ */
102
+ createDynamicImport(url: string): TExpression;
96
103
  /**
97
104
  * Create an identifier.
98
105
  *
@@ -45,6 +45,7 @@ export declare class ExpressionTranslatorVisitor<TStatement, TExpression> implem
45
45
  private createES5TaggedTemplateFunctionCall;
46
46
  visitExternalExpr(ast: o.ExternalExpr, _context: Context): TExpression;
47
47
  visitConditionalExpr(ast: o.ConditionalExpr, context: Context): TExpression;
48
+ visitDynamicImportExpr(ast: o.DynamicImportExpr, context: any): TExpression;
48
49
  visitNotExpr(ast: o.NotExpr, context: Context): TExpression;
49
50
  visitFunctionExpr(ast: o.FunctionExpr, context: Context): TExpression;
50
51
  visitBinaryOperatorExpr(ast: o.BinaryOperatorExpr, context: Context): TExpression;
@@ -23,6 +23,7 @@ export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts
23
23
  createConditional(condition: ts.Expression, whenTrue: ts.Expression, whenFalse: ts.Expression): ts.Expression;
24
24
  createElementAccess: (expression: ts.Expression, index: number | ts.Expression) => ts.ElementAccessExpression;
25
25
  createExpressionStatement: (expression: ts.Expression) => ts.ExpressionStatement;
26
+ createDynamicImport(url: string): ts.CallExpression;
26
27
  createFunctionDeclaration(functionName: string, parameters: string[], body: ts.Statement): ts.Statement;
27
28
  createFunctionExpression(functionName: string | null, parameters: string[], body: ts.Statement): ts.Expression;
28
29
  createIdentifier: (text: string) => ts.Identifier;