@angular/compiler-cli 17.3.0-next.1 → 17.3.0

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 (40) hide show
  1. package/bundles/{chunk-YVYW546M.js → chunk-3ESFLGKJ.js} +61 -31
  2. package/bundles/chunk-3ESFLGKJ.js.map +6 -0
  3. package/bundles/{chunk-7VU7HCQZ.js → chunk-6X7GQ6BQ.js} +2 -1
  4. package/bundles/{chunk-7VU7HCQZ.js.map → chunk-6X7GQ6BQ.js.map} +1 -1
  5. package/bundles/{chunk-IIZOI4XA.js → chunk-E5DF5SRS.js} +3 -3
  6. package/bundles/{chunk-FPKC3HSK.js → chunk-GQ63H5AL.js} +2 -2
  7. package/bundles/{chunk-2CAUFIKU.js → chunk-OXIOYWLB.js} +3 -3
  8. package/bundles/{chunk-5A5Y7O22.js → chunk-X6GFRI46.js} +187 -132
  9. package/bundles/chunk-X6GFRI46.js.map +6 -0
  10. package/bundles/{chunk-Q5Y7HH3O.js → chunk-YUMIYLNL.js} +1 -1
  11. package/bundles/{chunk-Q5Y7HH3O.js.map → chunk-YUMIYLNL.js.map} +1 -1
  12. package/bundles/index.js +6 -6
  13. package/bundles/linker/babel/index.js +2 -2
  14. package/bundles/linker/index.js +2 -2
  15. package/bundles/private/migrations.js +3 -3
  16. package/bundles/private/tooling.js +3 -3
  17. package/bundles/src/bin/ng_xi18n.js +5 -5
  18. package/bundles/src/bin/ngc.js +5 -5
  19. package/bundles_metadata.json +1 -1
  20. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  21. package/package.json +2 -2
  22. package/src/ngtsc/annotations/component/src/handler.d.ts +2 -0
  23. package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +9 -4
  24. package/src/ngtsc/core/src/compiler.d.ts +1 -7
  25. package/src/ngtsc/reflection/index.d.ts +1 -1
  26. package/src/ngtsc/reflection/src/type_to_value.d.ts +1 -0
  27. package/src/ngtsc/transform/src/api.d.ts +2 -0
  28. package/src/ngtsc/transform/src/compilation.d.ts +1 -2
  29. package/src/ngtsc/typecheck/api/checker.d.ts +6 -1
  30. package/src/ngtsc/typecheck/src/checker.d.ts +2 -1
  31. package/src/ngtsc/typecheck/src/oob.d.ts +1 -3
  32. package/src/ngtsc/typecheck/src/symbol_util.d.ts +10 -0
  33. package/src/ngtsc/typecheck/template_semantics/api/api.d.ts +18 -0
  34. package/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.d.ts +15 -0
  35. package/bundles/chunk-5A5Y7O22.js.map +0 -6
  36. package/bundles/chunk-YVYW546M.js.map +0 -6
  37. package/src/ngtsc/typecheck/src/template_semantics.d.ts +0 -21
  38. /package/bundles/{chunk-IIZOI4XA.js.map → chunk-E5DF5SRS.js.map} +0 -0
  39. /package/bundles/{chunk-FPKC3HSK.js.map → chunk-GQ63H5AL.js.map} +0 -0
  40. /package/bundles/{chunk-2CAUFIKU.js.map → chunk-OXIOYWLB.js.map} +0 -0
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
9
9
  import { AstObject, AstValue } from '../../ast/ast_value';
10
- export declare const PLACEHOLDER_VERSION = "17.3.0-next.1";
10
+ export declare const PLACEHOLDER_VERSION = "17.3.0";
11
11
  export declare const SHOULD_USE_TEMPLATE_PIPELINE_FOR_LINKER = true;
12
12
  export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
13
13
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "17.3.0-next.1",
3
+ "version": "17.3.0",
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": "17.3.0-next.1",
56
+ "@angular/compiler": "17.3.0",
57
57
  "typescript": ">=5.2 <5.5"
58
58
  },
59
59
  "repository": {
@@ -20,6 +20,7 @@ import { ComponentScopeReader, DtsModuleScopeResolver, LocalModuleScopeRegistry,
20
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
+ import { TemplateSemanticsChecker } from '../../../typecheck/template_semantics/api/api';
23
24
  import { Xi18nContext } from '../../../xi18n';
24
25
  import { InjectableClassRegistry, ReferencesRegistry, ResourceLoader } from '../../common';
25
26
  import { ComponentAnalysisData, ComponentResolutionData } from './metadata';
@@ -86,6 +87,7 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
86
87
  index(context: IndexingContext, node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>): null;
87
88
  typeCheck(ctx: TypeCheckContext, node: ClassDeclaration, meta: Readonly<ComponentAnalysisData>): void;
88
89
  extendedTemplateCheck(component: ts.ClassDeclaration, extendedTemplateChecker: ExtendedTemplateChecker): ts.Diagnostic[];
90
+ templateSemanticsCheck(component: ts.ClassDeclaration, templateSemanticsChecker: TemplateSemanticsChecker): ts.Diagnostic[];
89
91
  resolve(node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>, symbol: ComponentSymbol): ResolveResult<ComponentResolutionData>;
90
92
  xi18n(ctx: Xi18nContext, node: ClassDeclaration, analysis: Readonly<ComponentAnalysisData>): void;
91
93
  updateResources(node: ClassDeclaration, analysis: ComponentAnalysisData): void;
@@ -19,14 +19,17 @@ import { ClassMember, ReflectionHost } from '../../../reflection';
19
19
  * Similarly, signal-based queries follow the same pattern and are also
20
20
  * declared through initializer APIs.
21
21
  */
22
- export type InitializerApiFunction = 'input' | 'model' | 'ɵoutput' | 'output' | 'viewChild' | 'viewChildren' | 'contentChild' | 'contentChildren';
22
+ export interface InitializerApiFunction {
23
+ owningModule: '@angular/core' | '@angular/core/rxjs-interop';
24
+ functionName: ('input' | 'model' | 'output' | 'outputFromObservable' | 'viewChild' | 'viewChildren' | 'contentChild' | 'contentChildren');
25
+ }
23
26
  /**
24
27
  * Metadata describing an Angular class member that was recognized through
25
28
  * a function initializer. Like `input`, `input.required` or `viewChild`.
26
29
  */
27
30
  interface InitializerFunctionMetadata {
28
- /** Name of the initializer API function that was recognized. */
29
- apiName: InitializerApiFunction;
31
+ /** Initializer API function that was recognized. */
32
+ api: InitializerApiFunction;
30
33
  /** Node referring to the call expression. */
31
34
  call: ts.CallExpression;
32
35
  /** Whether the initializer is required or not. E.g. `input.required` was used. */
@@ -39,5 +42,7 @@ interface InitializerFunctionMetadata {
39
42
  * Note that multiple possible initializer API function names can be specified,
40
43
  * allowing for checking multiple types in one pass.
41
44
  */
42
- export declare function tryParseInitializerApiMember<FnNames extends InitializerApiFunction[]>(fnNames: FnNames, member: Pick<ClassMember, 'value'>, reflector: ReflectionHost, importTracker: ImportedSymbolsTracker): InitializerFunctionMetadata | null;
45
+ export declare function tryParseInitializerApiMember<Functions extends InitializerApiFunction[]>(functions: Functions, member: Pick<ClassMember, 'value'>, reflector: ReflectionHost, importTracker: ImportedSymbolsTracker): (InitializerFunctionMetadata & {
46
+ api: Functions[number];
47
+ } | null);
43
48
  export {};
@@ -253,13 +253,7 @@ export declare class NgCompiler {
253
253
  private getTemplateDiagnostics;
254
254
  private getTemplateDiagnosticsForFile;
255
255
  private getNonTemplateDiagnostics;
256
- /**
257
- * Calls the `extendedTemplateCheck` phase of the trait compiler
258
- * @param sf optional parameter to get diagnostics for a certain file
259
- * or all files in the program if `sf` is undefined
260
- * @returns generated extended template diagnostics
261
- */
262
- private getExtendedTemplateDiagnostics;
256
+ private runAdditionalChecks;
263
257
  private makeCompilation;
264
258
  }
265
259
  /**
@@ -6,6 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  export * from './src/host';
9
- export { typeNodeToValueExpr } from './src/type_to_value';
9
+ export { typeNodeToValueExpr, entityNameToValue } from './src/type_to_value';
10
10
  export { TypeScriptReflectionHost, filterToMembersWithDecorator, reflectIdentifierOfDeclaration, reflectNameOfDeclaration, reflectObjectLiteral, reflectTypeEntityToDeclaration } from './src/typescript';
11
11
  export { isNamedClassDeclaration, isNamedFunctionDeclaration, isNamedVariableDeclaration } from './src/util';
@@ -22,3 +22,4 @@ export declare function typeToValue(typeNode: ts.TypeNode | null, checker: ts.Ty
22
22
  * This will return `null` if an equivalent expression cannot be constructed.
23
23
  */
24
24
  export declare function typeNodeToValueExpr(node: ts.TypeNode): ts.Expression | null;
25
+ export declare function entityNameToValue(node: ts.EntityName): ts.Expression | null;
@@ -14,6 +14,7 @@ import { ClassDeclaration, Decorator, ReflectionHost } from '../../reflection';
14
14
  import { ImportManager } from '../../translator';
15
15
  import { TypeCheckContext } from '../../typecheck/api';
16
16
  import { ExtendedTemplateChecker } from '../../typecheck/extended/api';
17
+ import { TemplateSemanticsChecker } from '../../typecheck/template_semantics/api/api';
17
18
  import { Xi18nContext } from '../../xi18n';
18
19
  /**
19
20
  * Specifies the compilation mode that is used for the compilation.
@@ -146,6 +147,7 @@ export interface DecoratorHandler<D, A, S extends SemanticSymbol | null, R> {
146
147
  xi18n?(bundle: Xi18nContext, node: ClassDeclaration, analysis: Readonly<A>): void;
147
148
  typeCheck?(ctx: TypeCheckContext, node: ClassDeclaration, analysis: Readonly<A>, resolution: Readonly<R>): void;
148
149
  extendedTemplateCheck?(component: ts.ClassDeclaration, extendedTemplateChecker: ExtendedTemplateChecker): ts.Diagnostic[];
150
+ templateSemanticsCheck?(component: ts.ClassDeclaration, templateSemanticsChecker: TemplateSemanticsChecker): ts.Diagnostic[];
149
151
  /**
150
152
  * Generate a description of the field which should be added to the class, including any
151
153
  * initialization code to be generated.
@@ -14,7 +14,6 @@ import { IndexingContext } from '../../indexer';
14
14
  import { PerfRecorder } from '../../perf';
15
15
  import { ClassDeclaration, DeclarationNode, Decorator, ReflectionHost } from '../../reflection';
16
16
  import { ProgramTypeCheckAdapter, TypeCheckContext } from '../../typecheck/api';
17
- import { ExtendedTemplateChecker } from '../../typecheck/extended/api';
18
17
  import { Xi18nContext } from '../../xi18n';
19
18
  import { CompilationMode, CompileResult, DecoratorHandler } from './api';
20
19
  import { DtsTransformRegistry } from './declaration';
@@ -110,7 +109,7 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
110
109
  * `ts.SourceFile`.
111
110
  */
112
111
  typeCheck(sf: ts.SourceFile, ctx: TypeCheckContext): void;
113
- extendedTemplateCheck(sf: ts.SourceFile, extendedTemplateChecker: ExtendedTemplateChecker): ts.Diagnostic[];
112
+ runAdditionalChecks(sf: ts.SourceFile, check: (clazz: ts.ClassDeclaration, handler: DecoratorHandler<unknown, unknown, SemanticSymbol | null, unknown>) => ts.Diagnostic[] | null): ts.Diagnostic[];
114
113
  index(ctx: IndexingContext): void;
115
114
  xi18n(bundle: Xi18nContext): void;
116
115
  updateResources(clazz: DeclarationNode): void;
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TmplAstElement, TmplAstNode, TmplAstTemplate, TmplAstTextAttribute } from '@angular/compiler';
8
+ import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TmplAstElement, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstTextAttribute, TmplAstVariable } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { AbsoluteFsPath } from '../../../../src/ngtsc/file_system';
11
11
  import { ErrorCode } from '../../diagnostics';
@@ -179,6 +179,11 @@ export interface TemplateTypeChecker {
179
179
  * the next request.
180
180
  */
181
181
  invalidateClass(clazz: ts.ClassDeclaration): void;
182
+ /**
183
+ * Gets the target of a template expression, if possible.
184
+ * See `BoundTarget.getExpressionTarget` for more information.
185
+ */
186
+ getExpressionTarget(expression: AST, clazz: ts.ClassDeclaration): TmplAstReference | TmplAstVariable | null;
182
187
  /**
183
188
  * Constructs a `ts.Diagnostic` for a given `ParseSourceSpan` within a template.
184
189
  */
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TmplAstElement, TmplAstNode, TmplAstTemplate, TmplAstTextAttribute } from '@angular/compiler';
8
+ import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead, TmplAstElement, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstTextAttribute, TmplAstVariable } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { ErrorCode } from '../../diagnostics';
11
11
  import { AbsoluteFsPath } from '../../file_system';
@@ -95,6 +95,7 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
95
95
  getExpressionCompletionLocation(ast: PropertyRead | SafePropertyRead, component: ts.ClassDeclaration): TcbLocation | null;
96
96
  getLiteralCompletionLocation(node: LiteralPrimitive | TmplAstTextAttribute, component: ts.ClassDeclaration): TcbLocation | null;
97
97
  invalidateClass(clazz: ts.ClassDeclaration): void;
98
+ getExpressionTarget(expression: AST, clazz: ts.ClassDeclaration): TmplAstReference | TmplAstVariable | null;
98
99
  makeTemplateDiagnostic<T extends ErrorCode>(clazz: ts.ClassDeclaration, sourceSpan: ParseSourceSpan, category: ts.DiagnosticCategory, errorCode: T, message: string, relatedInformation?: {
99
100
  text: string;
100
101
  start: number;
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { BindingPipe, PropertyRead, PropertyWrite, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstElement, TmplAstForLoopBlock, TmplAstForLoopBlockEmpty, TmplAstHoverDeferredTrigger, TmplAstIfBlockBranch, TmplAstInteractionDeferredTrigger, TmplAstReference, TmplAstTemplate, TmplAstVariable, TmplAstViewportDeferredTrigger } from '@angular/compiler';
8
+ import { BindingPipe, PropertyRead, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstElement, TmplAstForLoopBlock, TmplAstForLoopBlockEmpty, TmplAstHoverDeferredTrigger, TmplAstIfBlockBranch, TmplAstInteractionDeferredTrigger, TmplAstReference, TmplAstTemplate, TmplAstVariable, TmplAstViewportDeferredTrigger } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { ClassDeclaration } from '../../reflection';
11
11
  import { TemplateDiagnostic, TemplateId } from '../api';
@@ -57,7 +57,6 @@ export interface OutOfBandDiagnosticRecorder {
57
57
  * @param element the element which hosts a component that was defer-loaded.
58
58
  */
59
59
  deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void;
60
- illegalAssignmentToTemplateVar(templateId: TemplateId, assignment: PropertyWrite, target: TmplAstVariable): void;
61
60
  /**
62
61
  * Reports a duplicate declaration of a template variable.
63
62
  *
@@ -107,7 +106,6 @@ export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnos
107
106
  missingPipe(templateId: TemplateId, ast: BindingPipe): void;
108
107
  deferredPipeUsedEagerly(templateId: TemplateId, ast: BindingPipe): void;
109
108
  deferredComponentUsedEagerly(templateId: TemplateId, element: TmplAstElement): void;
110
- illegalAssignmentToTemplateVar(templateId: TemplateId, assignment: PropertyWrite, target: TmplAstVariable): void;
111
109
  duplicateTemplateVar(templateId: TemplateId, variable: TmplAstVariable, firstDecl: TmplAstVariable): void;
112
110
  requiresInlineTcb(templateId: TemplateId, node: ClassDeclaration): void;
113
111
  requiresInlineTypeConstructors(templateId: TemplateId, node: ClassDeclaration, directives: ClassDeclaration[]): void;
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Symbol } from '../api';
9
+ /** Returns whether a symbol is a reference to a signal. */
10
+ export declare function isSignalReference(symbol: Symbol): boolean;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import ts from 'typescript';
9
+ import { TemplateDiagnostic } from '../../api';
10
+ /**
11
+ * Interface to generate diagnostics related to the semantics of a component's template.
12
+ */
13
+ export interface TemplateSemanticsChecker {
14
+ /**
15
+ * Run `TemplateSemanticsChecker`s for a component and return the generated `ts.Diagnostic`s.
16
+ */
17
+ getDiagnosticsForComponent(component: ts.ClassDeclaration): TemplateDiagnostic[];
18
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import ts from 'typescript';
9
+ import { TemplateDiagnostic, TemplateTypeChecker } from '../../api';
10
+ import { TemplateSemanticsChecker } from '../api/api';
11
+ export declare class TemplateSemanticsCheckerImpl implements TemplateSemanticsChecker {
12
+ private templateTypeChecker;
13
+ constructor(templateTypeChecker: TemplateTypeChecker);
14
+ getDiagnosticsForComponent(component: ts.ClassDeclaration): TemplateDiagnostic[];
15
+ }