@angular/compiler-cli 21.2.1 → 21.2.2

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 (41) hide show
  1. package/bundles/{chunk-WBUBKNAO.js → chunk-32EO3D75.js} +1 -1
  2. package/bundles/chunk-FLWAEX6T.js +1 -1
  3. package/bundles/{chunk-IG22BDVK.js → chunk-OECV6WLT.js} +862 -1172
  4. package/bundles/{chunk-PW54LIP6.js → chunk-RJ3Y43GR.js} +1 -1
  5. package/bundles/{chunk-VO3Q626H.js → chunk-SPPRVX7S.js} +2 -2
  6. package/bundles/index.js +4 -4
  7. package/bundles/private/migrations.js +2 -2
  8. package/bundles/private/testing.js +1 -1
  9. package/bundles/private/tooling.js +1 -1
  10. package/bundles/src/bin/ng_xi18n.js +4 -4
  11. package/bundles/src/bin/ngc.js +4 -4
  12. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  13. package/package.json +2 -2
  14. package/src/ngtsc/typecheck/src/comments.d.ts +0 -7
  15. package/src/ngtsc/typecheck/src/environment.d.ts +7 -6
  16. package/src/ngtsc/typecheck/src/expression.d.ts +3 -15
  17. package/src/ngtsc/typecheck/src/host_bindings.d.ts +1 -1
  18. package/src/ngtsc/typecheck/src/ops/base.d.ts +3 -3
  19. package/src/ngtsc/typecheck/src/ops/bindings.d.ts +8 -3
  20. package/src/ngtsc/typecheck/src/ops/codegen.d.ts +74 -0
  21. package/src/ngtsc/typecheck/src/ops/context.d.ts +1 -2
  22. package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +3 -3
  23. package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +4 -4
  24. package/src/ngtsc/typecheck/src/ops/element.d.ts +2 -2
  25. package/src/ngtsc/typecheck/src/ops/events.d.ts +2 -2
  26. package/src/ngtsc/typecheck/src/ops/expression.d.ts +5 -5
  27. package/src/ngtsc/typecheck/src/ops/for_block.d.ts +2 -2
  28. package/src/ngtsc/typecheck/src/ops/host.d.ts +2 -2
  29. package/src/ngtsc/typecheck/src/ops/inputs.d.ts +2 -2
  30. package/src/ngtsc/typecheck/src/ops/let.d.ts +2 -2
  31. package/src/ngtsc/typecheck/src/ops/references.d.ts +3 -3
  32. package/src/ngtsc/typecheck/src/ops/schema.d.ts +2 -2
  33. package/src/ngtsc/typecheck/src/ops/scope.d.ts +9 -9
  34. package/src/ngtsc/typecheck/src/ops/selectorless.d.ts +2 -2
  35. package/src/ngtsc/typecheck/src/ops/template.d.ts +2 -2
  36. package/src/ngtsc/typecheck/src/ops/variables.d.ts +6 -6
  37. package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +2 -5
  38. package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -37
  39. package/src/ngtsc/typecheck/src/type_check_block.d.ts +1 -1
  40. package/src/ngtsc/typecheck/src/type_check_file.d.ts +3 -2
  41. package/src/ngtsc/typecheck/src/type_constructor.d.ts +3 -2
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { TmplAstComponent, TmplAstElement, TmplAstHostElement } from '@angular/compiler';
9
- import ts from 'typescript';
10
9
  import { TcbOp } from './base';
10
+ import { TcbExpr } from './codegen';
11
11
  import { Context } from './context';
12
12
  /**
13
13
  * A `TcbOp` which feeds elements and unclaimed properties to the `DomSchemaChecker`.
@@ -26,6 +26,6 @@ export declare class TcbDomSchemaCheckerOp extends TcbOp {
26
26
  private claimedInputs;
27
27
  constructor(tcb: Context, element: TmplAstElement | TmplAstComponent | TmplAstHostElement, checkElement: boolean, claimedInputs: Set<string> | null);
28
28
  get optional(): boolean;
29
- execute(): ts.Expression | null;
29
+ execute(): TcbExpr | null;
30
30
  private getTagName;
31
31
  }
@@ -6,7 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { TmplAstForLoopBlock, TmplAstHostElement, TmplAstIfBlockBranch, TmplAstLetDeclaration, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
9
- import ts from 'typescript';
9
+ import { TcbExpr } from './codegen';
10
10
  import { TypeCheckableDirectiveMeta } from '../../api';
11
11
  import { Context } from './context';
12
12
  import { LocalSymbol } from './references';
@@ -30,7 +30,7 @@ export declare class Scope {
30
30
  /**
31
31
  * A queue of operations which need to be performed to generate the TCB code for this scope.
32
32
  *
33
- * This array can contain either a `TcbOp` which has yet to be executed, or a `ts.Expression|null`
33
+ * This array can contain either a `TcbOp` which has yet to be executed, or a `TcbExpr|null`
34
34
  * representing the memoized result of executing the operation. As operations are executed, their
35
35
  * results are written into the `opQueue`, overwriting the original operation.
36
36
  *
@@ -101,7 +101,7 @@ export declare class Scope {
101
101
  * @param children Child nodes that should be appended to the TCB.
102
102
  * @param guard an expression that is applied to this scope for type narrowing purposes.
103
103
  */
104
- static forNodes(tcb: Context, parentScope: Scope | null, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard: ts.Expression | null): Scope;
104
+ static forNodes(tcb: Context, parentScope: Scope | null, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard: TcbExpr | null): Scope;
105
105
  /** Registers a local variable with a scope. */
106
106
  private static registerVariable;
107
107
  /**
@@ -123,20 +123,20 @@ export declare class Scope {
123
123
  * @param directive if present, a directive type on a `TmplAstElement` or `TmplAstTemplate` to
124
124
  * look up instead of the default for an element or template node.
125
125
  */
126
- resolve(node: LocalSymbol, directive?: TypeCheckableDirectiveMeta): ts.Identifier | ts.NonNullExpression;
126
+ resolve(node: LocalSymbol, directive?: TypeCheckableDirectiveMeta): TcbExpr;
127
127
  /**
128
128
  * Add a statement to this scope.
129
129
  */
130
- addStatement(stmt: ts.Statement): void;
130
+ addStatement(stmt: TcbExpr): void;
131
131
  /**
132
132
  * Get the statements.
133
133
  */
134
- render(): ts.Statement[];
134
+ render(): TcbExpr[];
135
135
  /**
136
136
  * Returns an expression of all template guards that apply to this scope, including those of
137
137
  * parent scopes. If no guards have been applied, null is returned.
138
138
  */
139
- guards(): ts.Expression | null;
139
+ guards(): TcbExpr | null;
140
140
  /** Returns whether a template symbol is defined locally within the current scope. */
141
141
  isLocal(node: TmplAstVariable | TmplAstLetDeclaration | TmplAstReference): boolean;
142
142
  /**
@@ -150,10 +150,10 @@ export declare class Scope {
150
150
  * @param children Child nodes that should be appended to the TCB.
151
151
  * @param guard an expression that is applied to this scope for type narrowing purposes.
152
152
  */
153
- createChildScope(parentScope: Scope, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard: ts.Expression | null): Scope;
153
+ createChildScope(parentScope: Scope, scopedNode: TmplAstTemplate | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstHostElement | null, children: TmplAstNode[] | null, guard: TcbExpr | null): Scope;
154
154
  private resolveLocal;
155
155
  /**
156
- * Like `executeOp`, but assert that the operation actually returned `ts.Expression`.
156
+ * Like `executeOp`, but assert that the operation actually returned `TcbExpr`.
157
157
  */
158
158
  private resolveOp;
159
159
  /**
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { TmplAstComponent } from '@angular/compiler';
9
- import ts from 'typescript';
10
9
  import { TcbOp } from './base';
10
+ import { TcbExpr } from './codegen';
11
11
  import { Context } from './context';
12
12
  import type { Scope } from './scope';
13
13
  export declare function getComponentTagName(node: TmplAstComponent): string;
@@ -22,5 +22,5 @@ export declare class TcbComponentNodeOp extends TcbOp {
22
22
  private component;
23
23
  readonly optional = true;
24
24
  constructor(tcb: Context, scope: Scope, component: TmplAstComponent);
25
- execute(): ts.Identifier;
25
+ execute(): TcbExpr;
26
26
  }
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { TmplAstTemplate } from '@angular/compiler';
9
- import ts from 'typescript';
10
9
  import { TcbOp } from './base';
10
+ import { TcbExpr } from './codegen';
11
11
  import type { Context } from './context';
12
12
  import type { Scope } from './scope';
13
13
  /**
@@ -20,7 +20,7 @@ export declare class TcbTemplateContextOp extends TcbOp {
20
20
  private scope;
21
21
  constructor(tcb: Context, scope: Scope);
22
22
  readonly optional = true;
23
- execute(): ts.Identifier;
23
+ execute(): TcbExpr;
24
24
  }
25
25
  /**
26
26
  * A `TcbOp` which descends into a `TmplAstTemplate`'s children and generates type-checking code for
@@ -6,10 +6,10 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { TmplAstTemplate, TmplAstVariable } from '@angular/compiler';
9
- import ts from 'typescript';
10
9
  import { TcbOp } from './base';
11
10
  import type { Context } from './context';
12
11
  import type { Scope } from './scope';
12
+ import { TcbExpr } from './codegen';
13
13
  /**
14
14
  * A `TcbOp` which renders a variable that is implicitly available within a block (e.g. `$count`
15
15
  * in a `@for` block).
@@ -21,9 +21,9 @@ export declare class TcbBlockImplicitVariableOp extends TcbOp {
21
21
  private scope;
22
22
  private type;
23
23
  private variable;
24
- constructor(tcb: Context, scope: Scope, type: ts.TypeNode, variable: TmplAstVariable);
24
+ constructor(tcb: Context, scope: Scope, type: TcbExpr, variable: TmplAstVariable);
25
25
  readonly optional = true;
26
- execute(): ts.Identifier;
26
+ execute(): TcbExpr;
27
27
  }
28
28
  /**
29
29
  * A `TcbOp` which creates an expression for particular let- `TmplAstVariable` on a
@@ -38,7 +38,7 @@ export declare class TcbTemplateVariableOp extends TcbOp {
38
38
  private variable;
39
39
  constructor(tcb: Context, scope: Scope, template: TmplAstTemplate, variable: TmplAstVariable);
40
40
  get optional(): boolean;
41
- execute(): ts.Identifier;
41
+ execute(): TcbExpr;
42
42
  }
43
43
  /**
44
44
  * A `TcbOp` which renders a variable defined inside of block syntax (e.g. `@if (expr; as var) {}`).
@@ -50,7 +50,7 @@ export declare class TcbBlockVariableOp extends TcbOp {
50
50
  private scope;
51
51
  private initializer;
52
52
  private variable;
53
- constructor(tcb: Context, scope: Scope, initializer: ts.Expression, variable: TmplAstVariable);
53
+ constructor(tcb: Context, scope: Scope, initializer: TcbExpr, variable: TmplAstVariable);
54
54
  get optional(): boolean;
55
- execute(): ts.Identifier;
55
+ execute(): TcbExpr;
56
56
  }
@@ -10,6 +10,7 @@ import ts from 'typescript';
10
10
  import { ImportFlags, Reference, ReferenceEmitter } from '../../imports';
11
11
  import { ReflectionHost } from '../../reflection';
12
12
  import { ImportManager } from '../../translator';
13
+ import { TcbExpr } from './ops/codegen';
13
14
  /**
14
15
  * An environment for a given source file that can be used to emit references.
15
16
  *
@@ -29,11 +30,7 @@ export declare class ReferenceEmitEnvironment {
29
30
  * This may involve importing the node into the file if it's not declared there already.
30
31
  */
31
32
  referenceType(ref: Reference, flags?: ImportFlags): ts.TypeNode;
32
- /**
33
- * Generate a `ts.Expression` that refers to the external symbol. This
34
- * may result in new imports being generated.
35
- */
36
- referenceExternalSymbol(moduleName: string, name: string): ts.Expression;
33
+ referenceExternalSymbol(moduleName: string, name: string): TcbExpr;
37
34
  /**
38
35
  * Generate a `ts.TypeNode` that references a given type from the provided module.
39
36
  *
@@ -6,43 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import ts from 'typescript';
9
- export declare function tsCastToAny(expr: ts.Expression): ts.Expression;
10
- /**
11
- * Create an expression which instantiates an element by its HTML tagName.
12
- *
13
- * Thanks to narrowing of `document.createElement()`, this expression will have its type inferred
14
- * based on the tag name, including for custom elements that have appropriate .d.ts definitions.
15
- */
16
- export declare function tsCreateElement(...tagNames: string[]): ts.Expression;
17
- /**
18
- * Create a `ts.VariableStatement` which declares a variable without explicit initialization.
19
- *
20
- * The initializer `null!` is used to bypass strict variable initialization checks.
21
- *
22
- * Unlike with `tsCreateVariable`, the type of the variable is explicitly specified.
23
- */
24
- export declare function tsDeclareVariable(id: ts.Identifier, type: ts.TypeNode): ts.VariableStatement;
25
- /**
26
- * Creates a `ts.TypeQueryNode` for a coerced input.
27
- *
28
- * For example: `typeof MatInput.ngAcceptInputType_value`, where MatInput is `typeName` and `value`
29
- * is the `coercedInputName`.
30
- *
31
- * @param typeName The `EntityName` of the Directive where the static coerced input is defined.
32
- * @param coercedInputName The field name of the coerced input.
33
- */
34
- export declare function tsCreateTypeQueryForCoercedInput(typeName: ts.EntityName, coercedInputName: string): ts.TypeQueryNode;
35
- /**
36
- * Create a `ts.VariableStatement` that initializes a variable with a given expression.
37
- *
38
- * Unlike with `tsDeclareVariable`, the type of the variable is inferred from the initializer
39
- * expression.
40
- */
41
- export declare function tsCreateVariable(id: ts.Identifier, initializer: ts.Expression, flags?: ts.NodeFlags | null): ts.VariableStatement;
42
- /**
43
- * Construct a `ts.CallExpression` that calls a method on a receiver.
44
- */
45
- export declare function tsCallMethod(receiver: ts.Expression, methodName: string, args?: ts.Expression[]): ts.CallExpression;
46
9
  export declare function isAccessExpression(node: ts.Node): node is ts.ElementAccessExpression | ts.PropertyAccessExpression;
47
10
  /**
48
11
  * Creates a TypeScript node representing a numeric value.
@@ -37,4 +37,4 @@ import { TcbGenericContextBehavior } from './ops/context';
37
37
  * @param genericContextBehavior controls how generic parameters (especially parameters with generic
38
38
  * bounds) will be referenced from the generated TCB code.
39
39
  */
40
- export declare function generateTypeCheckBlock(env: Environment, ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, name: ts.Identifier, meta: TypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, genericContextBehavior: TcbGenericContextBehavior): ts.FunctionDeclaration;
40
+ export declare function generateTypeCheckBlock(env: Environment, ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, name: ts.Identifier, meta: TypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, genericContextBehavior: TcbGenericContextBehavior): string;
@@ -14,6 +14,7 @@ import { DomSchemaChecker } from './dom';
14
14
  import { Environment } from './environment';
15
15
  import { OutOfBandDiagnosticRecorder } from './oob';
16
16
  import { TcbGenericContextBehavior } from './ops/context';
17
+ import { TcbExpr } from './ops/codegen';
17
18
  /**
18
19
  * An `Environment` representing the single type-checking file into which most (if not all) Type
19
20
  * Check Blocks (TCBs) will be generated.
@@ -28,7 +29,7 @@ export declare class TypeCheckFile extends Environment {
28
29
  private tcbStatements;
29
30
  constructor(fileName: AbsoluteFsPath, config: TypeCheckingConfig, refEmitter: ReferenceEmitter, reflector: ReflectionHost, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>);
30
31
  addTypeCheckBlock(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, meta: TypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, genericContextBehavior: TcbGenericContextBehavior): void;
31
- render(removeComments: boolean): string;
32
- getPreludeStatements(): ts.Statement[];
32
+ render(): string;
33
+ getPreludeStatements(): TcbExpr[];
33
34
  }
34
35
  export declare function typeCheckFilePath(rootDirs: AbsoluteFsPath[]): AbsoluteFsPath;
@@ -9,7 +9,8 @@ import ts from 'typescript';
9
9
  import { ClassDeclaration, ReflectionHost } from '../../reflection';
10
10
  import { TypeCtorMetadata } from '../api';
11
11
  import { ReferenceEmitEnvironment } from './reference_emit_environment';
12
- export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironment, meta: TypeCtorMetadata, nodeTypeRef: ts.EntityName, typeParams: ts.TypeParameterDeclaration[] | undefined): ts.Statement;
12
+ import { TcbExpr } from './ops/codegen';
13
+ export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironment, meta: TypeCtorMetadata, nodeTypeRef: ts.EntityName, typeParams: ts.TypeParameterDeclaration[] | undefined): TcbExpr;
13
14
  /**
14
15
  * Generate an inline type constructor for the given class and metadata.
15
16
  *
@@ -45,5 +46,5 @@ export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironm
45
46
  * @param meta additional metadata required to generate the type constructor.
46
47
  * @returns a `ts.MethodDeclaration` for the type constructor.
47
48
  */
48
- export declare function generateInlineTypeCtor(env: ReferenceEmitEnvironment, node: ClassDeclaration<ts.ClassDeclaration>, meta: TypeCtorMetadata): ts.MethodDeclaration;
49
+ export declare function generateInlineTypeCtor(env: ReferenceEmitEnvironment, node: ClassDeclaration<ts.ClassDeclaration>, meta: TypeCtorMetadata): string;
49
50
  export declare function requiresInlineTypeCtor(node: ClassDeclaration<ts.ClassDeclaration>, host: ReflectionHost, env: ReferenceEmitEnvironment): boolean;