@angular/compiler-cli 21.2.3 → 21.2.5
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.
- package/bundles/{chunk-KJC7YNMY.js → chunk-76LW45YI.js} +4 -3
- package/bundles/chunk-76LW45YI.js.map +6 -0
- package/bundles/{chunk-FLWAEX6T.js → chunk-HVJBZFLS.js} +4 -3
- package/bundles/chunk-HVJBZFLS.js.map +6 -0
- package/bundles/{chunk-G7GFT6BU.js → chunk-IEBNHER4.js} +1 -0
- package/bundles/chunk-IEBNHER4.js.map +6 -0
- package/bundles/{chunk-XYYEESKY.js → chunk-KWAGEHJJ.js} +2 -1
- package/bundles/chunk-KWAGEHJJ.js.map +6 -0
- package/bundles/{chunk-6JHVJEKD.js → chunk-RLAJEKGV.js} +3 -2
- package/bundles/chunk-RLAJEKGV.js.map +6 -0
- package/bundles/{chunk-6HOSNZU5.js → chunk-SEJGUMO2.js} +1 -0
- package/bundles/chunk-SEJGUMO2.js.map +6 -0
- package/bundles/{chunk-CSUVPNMK.js → chunk-SOKUOCYN.js} +51 -4
- package/bundles/chunk-SOKUOCYN.js.map +6 -0
- package/bundles/{chunk-NU2SXS64.js → chunk-SVK6KGAO.js} +2 -1
- package/bundles/chunk-SVK6KGAO.js.map +6 -0
- package/bundles/{chunk-CEBE44Q5.js → chunk-UTWH365F.js} +1 -0
- package/bundles/chunk-UTWH365F.js.map +6 -0
- package/bundles/{chunk-HYJ2H3FU.js → chunk-Y5V7YWTG.js} +1 -0
- package/bundles/chunk-Y5V7YWTG.js.map +6 -0
- package/bundles/{chunk-L3PEIUBN.js → chunk-YF2MWLZG.js} +364 -412
- package/bundles/chunk-YF2MWLZG.js.map +6 -0
- package/bundles/index.js +10 -9
- package/bundles/index.js.map +6 -0
- package/bundles/linker/babel/index.js +74 -16
- package/bundles/linker/babel/index.js.map +6 -0
- package/bundles/linker/index.js +5 -4
- package/bundles/linker/index.js.map +6 -0
- package/bundles/private/localize.js +6 -5
- package/bundles/private/localize.js.map +6 -0
- package/bundles/private/migrations.js +7 -6
- package/bundles/private/migrations.js.map +6 -0
- package/bundles/private/testing.js +6 -5
- package/bundles/private/testing.js.map +6 -0
- package/bundles/private/tooling.js +6 -5
- package/bundles/private/tooling.js.map +6 -0
- package/bundles/src/bin/ng_xi18n.js +9 -8
- package/bundles/src/bin/ng_xi18n.js.map +6 -0
- package/bundles/src/bin/ngc.js +9 -8
- package/bundles/src/bin/ngc.js.map +6 -0
- package/linker/babel/src/ast/babel_ast_factory.d.ts +15 -8
- package/linker/src/file_linker/emit_scopes/emit_scope.d.ts +3 -3
- package/linker/src/file_linker/emit_scopes/local_emit_scope.d.ts +1 -1
- package/linker/src/file_linker/file_linker.d.ts +2 -2
- package/linker/src/file_linker/linker_environment.d.ts +4 -4
- package/linker/src/file_linker/partial_linkers/partial_linker_selector.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/linker/src/file_linker/translator.d.ts +2 -2
- package/linker/src/linker_import_generator.d.ts +2 -2
- package/package.json +2 -2
- package/src/ngtsc/translator/src/api/ast_factory.d.ts +38 -6
- package/src/ngtsc/translator/src/translator.d.ts +8 -2
- package/src/ngtsc/translator/src/typescript_ast_factory.d.ts +12 -6
- package/src/ngtsc/typecheck/api/api.d.ts +2 -1
- package/src/ngtsc/typecheck/index.d.ts +0 -1
- package/src/ngtsc/typecheck/src/diagnostics.d.ts +1 -31
- package/src/ngtsc/typecheck/src/environment.d.ts +2 -9
- package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +1 -20
- package/src/ngtsc/typecheck/src/tcb_adapter.d.ts +2 -1
- package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -4
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -4
- package/src/ngtsc/typecheck/src/type_check_file.d.ts +0 -1
- package/src/ngtsc/typecheck/src/type_constructor.d.ts +1 -1
|
@@ -12,14 +12,14 @@ import { AstFactory } from '../../../src/ngtsc/translator';
|
|
|
12
12
|
import { AstHost } from '../ast/ast_host';
|
|
13
13
|
import { LinkerOptions } from './linker_options';
|
|
14
14
|
import { Translator } from './translator';
|
|
15
|
-
export declare class LinkerEnvironment<TStatement, TExpression> {
|
|
15
|
+
export declare class LinkerEnvironment<TStatement, TExpression, TType> {
|
|
16
16
|
readonly fileSystem: ReadonlyFileSystem;
|
|
17
17
|
readonly logger: Logger;
|
|
18
18
|
readonly host: AstHost<TExpression>;
|
|
19
|
-
readonly factory: AstFactory<TStatement, TExpression>;
|
|
19
|
+
readonly factory: AstFactory<TStatement, TExpression, TType>;
|
|
20
20
|
readonly options: LinkerOptions;
|
|
21
|
-
readonly translator: Translator<TStatement, TExpression>;
|
|
21
|
+
readonly translator: Translator<TStatement, TExpression, TType>;
|
|
22
22
|
readonly sourceFileLoader: SourceFileLoader | null;
|
|
23
23
|
private constructor();
|
|
24
|
-
static create<TStatement, TExpression>(fileSystem: ReadonlyFileSystem, logger: Logger, host: AstHost<TExpression>, factory: AstFactory<TStatement, TExpression>, options: Partial<LinkerOptions>): LinkerEnvironment<TStatement, TExpression>;
|
|
24
|
+
static create<TStatement, TExpression, TType>(fileSystem: ReadonlyFileSystem, logger: Logger, host: AstHost<TExpression>, factory: AstFactory<TStatement, TExpression, TType>, options: Partial<LinkerOptions>): LinkerEnvironment<TStatement, TExpression, TType>;
|
|
25
25
|
}
|
|
@@ -48,7 +48,7 @@ export interface LinkerRange<TExpression> {
|
|
|
48
48
|
* `minVersion` of the partial-declaration should be updated, the new linker implementation should
|
|
49
49
|
* be added to the end of the collection, and the version of the previous linker should be updated.
|
|
50
50
|
*/
|
|
51
|
-
export declare function createLinkerMap<TStatement, TExpression>(environment: LinkerEnvironment<TStatement, TExpression>, sourceUrl: AbsoluteFsPath, code: string): Map<string, LinkerRange<TExpression>[]>;
|
|
51
|
+
export declare function createLinkerMap<TStatement, TExpression, TType>(environment: LinkerEnvironment<TStatement, TExpression, TType>, sourceUrl: AbsoluteFsPath, code: string): Map<string, LinkerRange<TExpression>[]>;
|
|
52
52
|
/**
|
|
53
53
|
* A helper that selects the appropriate `PartialLinker` for a given declaration.
|
|
54
54
|
*
|
|
@@ -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 = "21.2.
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "21.2.5";
|
|
11
11
|
export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
|
|
12
12
|
/**
|
|
13
13
|
* Parses the value of an enum from the AST value's symbol name.
|
|
@@ -13,9 +13,9 @@ import { AstFactory } from '../../../src/ngtsc/translator/src/api/ast_factory';
|
|
|
13
13
|
* Generic translator helper class, which exposes methods for translating expressions and
|
|
14
14
|
* statements.
|
|
15
15
|
*/
|
|
16
|
-
export declare class Translator<TStatement, TExpression> {
|
|
16
|
+
export declare class Translator<TStatement, TExpression, TType> {
|
|
17
17
|
private factory;
|
|
18
|
-
constructor(factory: AstFactory<TStatement, TExpression>);
|
|
18
|
+
constructor(factory: AstFactory<TStatement, TExpression, TType>);
|
|
19
19
|
/**
|
|
20
20
|
* Translate the given output AST in the context of an expression.
|
|
21
21
|
*/
|
|
@@ -14,10 +14,10 @@ import { AstFactory, ImportGenerator, ImportRequest } from '../../src/ngtsc/tran
|
|
|
14
14
|
* must be achieved by property access on an `ng` namespace identifier, which is passed in via the
|
|
15
15
|
* constructor.
|
|
16
16
|
*/
|
|
17
|
-
export declare class LinkerImportGenerator<TStatement, TExpression> implements ImportGenerator<null, TExpression> {
|
|
17
|
+
export declare class LinkerImportGenerator<TStatement, TExpression, TType> implements ImportGenerator<null, TExpression> {
|
|
18
18
|
private factory;
|
|
19
19
|
private ngImport;
|
|
20
|
-
constructor(factory: AstFactory<TStatement, TExpression>, ngImport: TExpression);
|
|
20
|
+
constructor(factory: AstFactory<TStatement, TExpression, TType>, ngImport: TExpression);
|
|
21
21
|
addImport(request: ImportRequest<null>): TExpression;
|
|
22
22
|
private assertModuleName;
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "21.2.
|
|
3
|
+
"version": "21.2.5",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typescript": "5.9.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@angular/compiler": "21.2.
|
|
46
|
+
"@angular/compiler": "21.2.5",
|
|
47
47
|
"typescript": ">=5.9 <6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* It is up to the caller to do this - e.g. only call `createTaggedTemplate()` or pass `let`|`const`
|
|
13
13
|
* to `createVariableDeclaration()` if the final JS will allow it.
|
|
14
14
|
*/
|
|
15
|
-
export interface AstFactory<TStatement, TExpression> {
|
|
15
|
+
export interface AstFactory<TStatement, TExpression, TType> {
|
|
16
16
|
/**
|
|
17
17
|
* Attach the `leadingComments` to the given `statement` node.
|
|
18
18
|
*
|
|
@@ -84,7 +84,7 @@ export interface AstFactory<TStatement, TExpression> {
|
|
|
84
84
|
* @param parameters the names of the function's parameters.
|
|
85
85
|
* @param body a statement (or a block of statements) that are the body of the function.
|
|
86
86
|
*/
|
|
87
|
-
createFunctionDeclaration(functionName: string, parameters:
|
|
87
|
+
createFunctionDeclaration(functionName: string, parameters: Parameter<TType>[], body: TStatement): TStatement;
|
|
88
88
|
/**
|
|
89
89
|
* Create an expression that represents a function
|
|
90
90
|
* (e.g. `function foo(param1, param2) { stmt; }`).
|
|
@@ -93,7 +93,7 @@ export interface AstFactory<TStatement, TExpression> {
|
|
|
93
93
|
* @param parameters the names of the function's parameters.
|
|
94
94
|
* @param body a statement (or a block of statements) that are the body of the function.
|
|
95
95
|
*/
|
|
96
|
-
createFunctionExpression(functionName: string | null, parameters:
|
|
96
|
+
createFunctionExpression(functionName: string | null, parameters: Parameter<TType>[], body: TStatement): TExpression;
|
|
97
97
|
/**
|
|
98
98
|
* Create an expression that represents an arrow function
|
|
99
99
|
* (e.g. `(param1, param2) => body`).
|
|
@@ -101,7 +101,7 @@ export interface AstFactory<TStatement, TExpression> {
|
|
|
101
101
|
* @param parameters the names of the function's parameters.
|
|
102
102
|
* @param body an expression or block of statements that are the body of the function.
|
|
103
103
|
*/
|
|
104
|
-
createArrowFunctionExpression(parameters:
|
|
104
|
+
createArrowFunctionExpression(parameters: Parameter<TType>[], body: TExpression | TStatement): TExpression;
|
|
105
105
|
/**
|
|
106
106
|
* Creates an expression that represents a dynamic import
|
|
107
107
|
* (e.g. `import('./some/path')`)
|
|
@@ -216,9 +216,9 @@ export interface AstFactory<TStatement, TExpression> {
|
|
|
216
216
|
*
|
|
217
217
|
* @param variableName the name of the variable.
|
|
218
218
|
* @param initializer if not `null` then this expression is assigned to the declared variable.
|
|
219
|
-
* @param
|
|
219
|
+
* @param variableType whether this variable should be declared as `var`, `let` or `const`.
|
|
220
220
|
*/
|
|
221
|
-
createVariableDeclaration(variableName: string, initializer: TExpression | null, type:
|
|
221
|
+
createVariableDeclaration(variableName: string, initializer: TExpression | null, variableType: VariableDeclarationType, type: TType | null): TStatement;
|
|
222
222
|
/**
|
|
223
223
|
* Create a regular expression literal (e.g. `/\d+/g`).
|
|
224
224
|
*
|
|
@@ -232,6 +232,32 @@ export interface AstFactory<TStatement, TExpression> {
|
|
|
232
232
|
* @param target Expression of the spread element.
|
|
233
233
|
*/
|
|
234
234
|
createSpreadElement(expression: TExpression): TExpression;
|
|
235
|
+
/**
|
|
236
|
+
* Create a type node for a built-in type.
|
|
237
|
+
* @param type Type that should be created.
|
|
238
|
+
*/
|
|
239
|
+
createBuiltInType(type: BuiltInType): TType;
|
|
240
|
+
/**
|
|
241
|
+
* Create an expression type.
|
|
242
|
+
* @param expression Expression to be turned into a type node.
|
|
243
|
+
* @param typeParams Type parameters for the expression.
|
|
244
|
+
*/
|
|
245
|
+
createExpressionType(expression: TExpression, typeParams: TType[] | null): TType;
|
|
246
|
+
/**
|
|
247
|
+
* Create an array type.
|
|
248
|
+
* @param elementType Type of the array elements.
|
|
249
|
+
*/
|
|
250
|
+
createArrayType(elementType: TType): TType;
|
|
251
|
+
/**
|
|
252
|
+
* Create a map type.
|
|
253
|
+
* @param valueType Type of the map values.
|
|
254
|
+
*/
|
|
255
|
+
createMapType(valueType: TType): TType;
|
|
256
|
+
/**
|
|
257
|
+
* Forward a transplanted type.
|
|
258
|
+
* @param type Type to be transplanted, if supported.
|
|
259
|
+
*/
|
|
260
|
+
transplantType(type: TType): TType;
|
|
235
261
|
/**
|
|
236
262
|
* Attach a source map range to the given node.
|
|
237
263
|
*
|
|
@@ -249,6 +275,12 @@ export type VariableDeclarationType = 'const' | 'let' | 'var';
|
|
|
249
275
|
* The unary operators supported by the `AstFactory`.
|
|
250
276
|
*/
|
|
251
277
|
export type UnaryOperator = '+' | '-' | '!';
|
|
278
|
+
/** Supported built-in types. */
|
|
279
|
+
export type BuiltInType = 'any' | 'boolean' | 'number' | 'string' | 'function' | 'never' | 'unknown';
|
|
280
|
+
export interface Parameter<TType> {
|
|
281
|
+
name: string;
|
|
282
|
+
type: TType | null;
|
|
283
|
+
}
|
|
252
284
|
/**
|
|
253
285
|
* The binary operators supported by the `AstFactory`.
|
|
254
286
|
*/
|
|
@@ -16,14 +16,14 @@ export interface TranslatorOptions<TExpression> {
|
|
|
16
16
|
recordWrappedNode?: RecordWrappedNodeFn<TExpression>;
|
|
17
17
|
annotateForClosureCompiler?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression> implements o.ExpressionVisitor, o.StatementVisitor {
|
|
19
|
+
export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression, TType> implements o.ExpressionVisitor, o.StatementVisitor, o.TypeVisitor {
|
|
20
20
|
private factory;
|
|
21
21
|
private imports;
|
|
22
22
|
private contextFile;
|
|
23
23
|
private downlevelTaggedTemplates;
|
|
24
24
|
private downlevelVariableDeclarations;
|
|
25
25
|
private recordWrappedNode;
|
|
26
|
-
constructor(factory: AstFactory<TStatement, TExpression>, imports: ImportGenerator<TFile, TExpression>, contextFile: TFile, options: TranslatorOptions<TExpression>);
|
|
26
|
+
constructor(factory: AstFactory<TStatement, TExpression, TType>, imports: ImportGenerator<TFile, TExpression>, contextFile: TFile, options: TranslatorOptions<TExpression>);
|
|
27
27
|
visitDeclareVarStmt(stmt: o.DeclareVarStmt, context: Context): TStatement;
|
|
28
28
|
visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, context: Context): TStatement;
|
|
29
29
|
visitExpressionStmt(stmt: o.ExpressionStatement, context: Context): TStatement;
|
|
@@ -37,6 +37,11 @@ export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression>
|
|
|
37
37
|
visitLiteralExpr(ast: o.LiteralExpr, _context: Context): TExpression;
|
|
38
38
|
visitRegularExpressionLiteral(ast: o.RegularExpressionLiteralExpr, context: any): TExpression;
|
|
39
39
|
visitLocalizedString(ast: o.LocalizedString, context: Context): TExpression;
|
|
40
|
+
visitBuiltinType(ast: o.BuiltinType): TType | null;
|
|
41
|
+
visitExpressionType(ast: o.ExpressionType, context: Context): TType;
|
|
42
|
+
visitArrayType(ast: o.ArrayType, context: Context): TType;
|
|
43
|
+
visitMapType(ast: o.MapType, context: Context): TType;
|
|
44
|
+
visitTransplantedType(type: o.TransplantedType<TType>): TType;
|
|
40
45
|
private createTaggedTemplateExpression;
|
|
41
46
|
/**
|
|
42
47
|
* Translate the tagged template literal into a call that is compatible with ES5, using the
|
|
@@ -66,4 +71,5 @@ export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression>
|
|
|
66
71
|
private setSourceMapRange;
|
|
67
72
|
private attachComments;
|
|
68
73
|
private getTemplateLiteralFromAst;
|
|
74
|
+
private translateParams;
|
|
69
75
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
|
-
import { AstFactory, BinaryOperator, LeadingComment, ObjectLiteralProperty, SourceMapRange, TemplateLiteral, UnaryOperator, VariableDeclarationType } from './api/ast_factory';
|
|
9
|
+
import { AstFactory, BinaryOperator, BuiltInType, LeadingComment, ObjectLiteralProperty, Parameter, SourceMapRange, TemplateLiteral, UnaryOperator, VariableDeclarationType } from './api/ast_factory';
|
|
10
10
|
/**
|
|
11
11
|
* A TypeScript flavoured implementation of the AstFactory.
|
|
12
12
|
*/
|
|
13
|
-
export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts.Expression> {
|
|
13
|
+
export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts.Expression, ts.TypeNode> {
|
|
14
14
|
private annotateForClosureCompiler;
|
|
15
15
|
private externalSourceFiles;
|
|
16
16
|
private readonly UNARY_OPERATORS;
|
|
@@ -27,9 +27,10 @@ export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts
|
|
|
27
27
|
createElementAccess: (expression: ts.Expression, index: number | ts.Expression) => ts.ElementAccessExpression;
|
|
28
28
|
createExpressionStatement: (expression: ts.Expression) => ts.ExpressionStatement;
|
|
29
29
|
createDynamicImport(url: string | ts.Expression): ts.CallExpression;
|
|
30
|
-
createFunctionDeclaration(functionName: string, parameters:
|
|
31
|
-
createFunctionExpression(functionName: string | null, parameters:
|
|
32
|
-
createArrowFunctionExpression(parameters:
|
|
30
|
+
createFunctionDeclaration(functionName: string, parameters: Parameter<ts.TypeNode>[], body: ts.Statement): ts.Statement;
|
|
31
|
+
createFunctionExpression(functionName: string | null, parameters: Parameter<ts.TypeNode>[], body: ts.Statement): ts.Expression;
|
|
32
|
+
createArrowFunctionExpression(parameters: Parameter<ts.TypeNode>[], body: ts.Statement | ts.Expression): ts.Expression;
|
|
33
|
+
private createParameter;
|
|
33
34
|
createIdentifier: (text: string) => ts.Identifier;
|
|
34
35
|
createIfStatement(condition: ts.Expression, thenStatement: ts.Statement, elseStatement: ts.Statement | null): ts.Statement;
|
|
35
36
|
createLiteral(value: string | number | boolean | null | undefined): ts.Expression;
|
|
@@ -45,9 +46,14 @@ export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts
|
|
|
45
46
|
createTypeOfExpression: (expression: ts.Expression) => ts.TypeOfExpression;
|
|
46
47
|
createVoidExpression: (expression: ts.Expression) => ts.VoidExpression;
|
|
47
48
|
createUnaryExpression(operator: UnaryOperator, operand: ts.Expression): ts.Expression;
|
|
48
|
-
createVariableDeclaration(variableName: string, initializer: ts.Expression | null, type:
|
|
49
|
+
createVariableDeclaration(variableName: string, initializer: ts.Expression | null, variableType: VariableDeclarationType, type: ts.TypeNode | null): ts.Statement;
|
|
49
50
|
createRegularExpressionLiteral(body: string, flags: string | null): ts.Expression;
|
|
50
51
|
setSourceMapRange<T extends ts.Node>(node: T, sourceMapRange: SourceMapRange | null): T;
|
|
52
|
+
createBuiltInType(type: BuiltInType): ts.TypeNode;
|
|
53
|
+
createExpressionType(expression: ts.Expression, typeParams: ts.TypeNode[] | null): ts.TypeNode;
|
|
54
|
+
createArrayType(elementType: ts.TypeNode): ts.TypeNode;
|
|
55
|
+
createMapType(valueType: ts.TypeNode): ts.TypeNode;
|
|
56
|
+
transplantType(type: ts.TypeNode): ts.TypeNode;
|
|
51
57
|
}
|
|
52
58
|
export declare function createTemplateMiddle(cooked: string, raw: string): ts.TemplateMiddle;
|
|
53
59
|
export declare function createTemplateTail(cooked: string, raw: string): ts.TemplateTail;
|
|
@@ -64,7 +64,7 @@ export interface TcbDirectiveMetadata {
|
|
|
64
64
|
typeParameters: TcbTypeParameter[] | null;
|
|
65
65
|
inputs: ClassPropertyMapping<TcbInputMapping>;
|
|
66
66
|
outputs: ClassPropertyMapping;
|
|
67
|
-
|
|
67
|
+
requiresInlineTypeCtor: boolean;
|
|
68
68
|
ngTemplateGuards: TemplateGuardMeta[];
|
|
69
69
|
hasNgTemplateContextGuard: boolean;
|
|
70
70
|
hasNgFieldDirective: boolean;
|
|
@@ -79,6 +79,7 @@ export interface TcbDirectiveMetadata {
|
|
|
79
79
|
export interface TcbComponentMetadata {
|
|
80
80
|
ref: TcbReferenceMetadata;
|
|
81
81
|
typeParameters: TcbTypeParameter[] | null;
|
|
82
|
+
typeArguments: string[] | null;
|
|
82
83
|
}
|
|
83
84
|
export interface TcbTypeCheckBlockMetadata {
|
|
84
85
|
id: TypeCheckId;
|
|
@@ -8,5 +8,4 @@
|
|
|
8
8
|
export { FileTypeCheckingData, TemplateTypeCheckerImpl } from './src/checker';
|
|
9
9
|
export { TypeCheckContextImpl, getTemplateDiagnostics } from './src/context';
|
|
10
10
|
export { TypeCheckShimGenerator } from './src/shim';
|
|
11
|
-
export { typeCheckFilePath } from './src/type_check_file';
|
|
12
11
|
export { createHostElement } from './src/host_bindings';
|
|
@@ -5,39 +5,9 @@
|
|
|
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.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { AbsoluteSourceSpan, ParseSourceSpan } from '@angular/compiler';
|
|
9
8
|
import ts from 'typescript';
|
|
10
|
-
import { TemplateDiagnostic
|
|
9
|
+
import { TemplateDiagnostic } from '../api';
|
|
11
10
|
import { TypeCheckSourceResolver } from './tcb_util';
|
|
12
|
-
/**
|
|
13
|
-
* Wraps the node in parenthesis such that inserted span comments become attached to the proper
|
|
14
|
-
* node. This is an alias for `ts.factory.createParenthesizedExpression` with the benefit that it
|
|
15
|
-
* signifies that the inserted parenthesis are for diagnostic purposes, not for correctness of the
|
|
16
|
-
* rendered TCB code.
|
|
17
|
-
*
|
|
18
|
-
* Note that it is important that nodes and its attached comment are not wrapped into parenthesis
|
|
19
|
-
* by default, as it prevents correct translation of e.g. diagnostics produced for incorrect method
|
|
20
|
-
* arguments. Such diagnostics would then be produced for the parenthesised node whereas the
|
|
21
|
-
* positional comment would be located within that node, resulting in a mismatch.
|
|
22
|
-
*/
|
|
23
|
-
export declare function wrapForDiagnostics(expr: ts.Expression): ts.Expression;
|
|
24
|
-
/**
|
|
25
|
-
* Wraps the node in parenthesis such that inserted span comments become attached to the proper
|
|
26
|
-
* node. This is an alias for `ts.factory.createParenthesizedExpression` with the benefit that it
|
|
27
|
-
* signifies that the inserted parenthesis are for use by the type checker, not for correctness of
|
|
28
|
-
* the rendered TCB code.
|
|
29
|
-
*/
|
|
30
|
-
export declare function wrapForTypeChecker(expr: ts.Expression): ts.Expression;
|
|
31
|
-
/**
|
|
32
|
-
* Adds a synthetic comment to the expression that represents the parse span of the provided node.
|
|
33
|
-
* This comment can later be retrieved as trivia of a node to recover original source locations.
|
|
34
|
-
*/
|
|
35
|
-
export declare function addParseSpanInfo(node: ts.Node, span: AbsoluteSourceSpan | ParseSourceSpan): void;
|
|
36
|
-
/**
|
|
37
|
-
* Adds a synthetic comment to the function declaration that contains the type checking ID
|
|
38
|
-
* of the class declaration.
|
|
39
|
-
*/
|
|
40
|
-
export declare function addTypeCheckId(tcb: ts.FunctionDeclaration, id: TypeCheckId): void;
|
|
41
11
|
/**
|
|
42
12
|
* Determines if the diagnostic should be reported. Some diagnostics are produced because of the
|
|
43
13
|
* way TCBs are generated; those diagnostics should not be reported as type check errors of the
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { ReferenceEmitter } from '../../imports';
|
|
10
|
+
import { ReflectionHost } from '../../reflection';
|
|
11
11
|
import { ImportManager } from '../../translator';
|
|
12
12
|
import { TcbDirectiveMetadata, TcbPipeMetadata, TcbReferenceKey, TcbReferenceMetadata, TypeCheckingConfig } from '../api';
|
|
13
13
|
import { ReferenceEmitEnvironment } from './reference_emit_environment';
|
|
@@ -39,13 +39,6 @@ export declare class Environment extends ReferenceEmitEnvironment {
|
|
|
39
39
|
*/
|
|
40
40
|
typeCtorFor(dir: TcbDirectiveMetadata): TcbExpr;
|
|
41
41
|
pipeInst(pipe: TcbPipeMetadata): TcbExpr;
|
|
42
|
-
/**
|
|
43
|
-
* Generate a `ts.Expression` that references the given node.
|
|
44
|
-
*
|
|
45
|
-
* This may involve importing the node into the file if it's not declared there already.
|
|
46
|
-
*/
|
|
47
|
-
reference(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>): TcbExpr;
|
|
48
|
-
private emitTypeParameters;
|
|
49
42
|
getPreludeStatements(): TcbExpr[];
|
|
50
43
|
}
|
|
51
44
|
export declare function getTcbReferenceKey(ref: TcbReferenceMetadata): TcbReferenceKey;
|
|
@@ -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.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { TransplantedType
|
|
8
|
+
import { TransplantedType } from '@angular/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ImportFlags, Reference, ReferenceEmitter } from '../../imports';
|
|
11
11
|
import { ReflectionHost } from '../../reflection';
|
|
@@ -31,30 +31,11 @@ export declare class ReferenceEmitEnvironment {
|
|
|
31
31
|
* This may involve importing the node into the file if it's not declared there already.
|
|
32
32
|
*/
|
|
33
33
|
referenceType(ref: Reference, flags?: ImportFlags): ts.TypeNode;
|
|
34
|
-
/**
|
|
35
|
-
* Generates a `ts.TypeNode` from a `TcbReferenceMetadata` object.
|
|
36
|
-
* This is used by the TCB operations which do not hold on to the original `ts.Declaration`.
|
|
37
|
-
*
|
|
38
|
-
* Note: It's important that we do not try to evaluate the `typeParameters` here and pad them
|
|
39
|
-
* out with `any` type arguments. If we supply `any` to a generic pipe (e.g. `var _pipe1: MyPipe<any>;`),
|
|
40
|
-
* it destroys the generic constraints and degrades the `transform` signature. When they are omitted
|
|
41
|
-
* entirely, TypeScript implicitly flags an error, which the Angular compiler filters out, and
|
|
42
|
-
* crucially recovers by falling back to constraint inference (e.g. `var _pipe1: MyPipe;` infers
|
|
43
|
-
* bounds safely).
|
|
44
|
-
*/
|
|
45
|
-
referenceTcbType(ref: TcbReferenceMetadata): ts.TypeNode;
|
|
46
34
|
/**
|
|
47
35
|
* Generates a `TcbExpr` from a `TcbReferenceMetadata` object.
|
|
48
36
|
*/
|
|
49
37
|
referenceTcbValue(ref: TcbReferenceMetadata): TcbExpr;
|
|
50
38
|
referenceExternalSymbol(moduleName: string, name: string): TcbExpr;
|
|
51
|
-
/**
|
|
52
|
-
* Generate a `ts.TypeNode` that references a given type from the provided module.
|
|
53
|
-
*
|
|
54
|
-
* This will involve importing the type into the file, and will also add type parameters if
|
|
55
|
-
* provided.
|
|
56
|
-
*/
|
|
57
|
-
referenceExternalType(moduleName: string, name: string, typeParams?: Type[]): ts.TypeNode;
|
|
58
39
|
/**
|
|
59
40
|
* Generates a `ts.TypeNode` representing a type that is being referenced from a different place
|
|
60
41
|
* in the program. Any type references inside the transplanted type will be rewritten so that
|
|
@@ -10,11 +10,12 @@ import { Environment } from './environment';
|
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
11
|
import { ClassDeclaration } from '../../reflection';
|
|
12
12
|
import ts from 'typescript';
|
|
13
|
+
import { TcbGenericContextBehavior } from './ops/context';
|
|
13
14
|
/**
|
|
14
15
|
* Adapts the compiler's `TypeCheckBlockMetadata` (which includes full TS AST nodes)
|
|
15
16
|
* into a purely detached `TcbTypeCheckBlockMetadata` that can be mapped to JSON.
|
|
16
17
|
*/
|
|
17
|
-
export declare function adaptTypeCheckBlockMetadata(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, meta: TypeCheckBlockMetadata, env: Environment): {
|
|
18
|
+
export declare function adaptTypeCheckBlockMetadata(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, meta: TypeCheckBlockMetadata, env: Environment, genericContextBehavior: TcbGenericContextBehavior): {
|
|
18
19
|
tcbMeta: TcbTypeCheckBlockMetadata;
|
|
19
20
|
component: TcbComponentMetadata;
|
|
20
21
|
};
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
9
|
export declare function isAccessExpression(node: ts.Node): node is ts.ElementAccessExpression | ts.PropertyAccessExpression;
|
|
10
|
-
/**
|
|
11
|
-
* Creates a TypeScript node representing a numeric value.
|
|
12
|
-
*/
|
|
13
|
-
export declare function tsNumericExpression(value: number): ts.NumericLiteral | ts.PrefixUnaryExpression;
|
|
14
10
|
/**
|
|
15
11
|
* Check if a node represents a directive declaration in a TypeCheck Block.
|
|
16
12
|
* Directive declarations can be either:
|
|
@@ -5,12 +5,10 @@
|
|
|
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.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import ts from 'typescript';
|
|
9
8
|
import { TcbComponentMetadata, TcbTypeCheckBlockMetadata } from '../api';
|
|
10
9
|
import { DomSchemaChecker } from './dom';
|
|
11
10
|
import { Environment } from './environment';
|
|
12
11
|
import { OutOfBandDiagnosticRecorder } from './oob';
|
|
13
|
-
import { TcbGenericContextBehavior } from './ops/context';
|
|
14
12
|
/**
|
|
15
13
|
* Given a `ts.ClassDeclaration` for a component, and metadata regarding that component, compose a
|
|
16
14
|
* "type check block" function.
|
|
@@ -26,7 +24,7 @@ import { TcbGenericContextBehavior } from './ops/context';
|
|
|
26
24
|
*
|
|
27
25
|
* @param env an `Environment` into which type-checking code will be generated.
|
|
28
26
|
* @param ref a `Reference` to the component class which should be type-checked.
|
|
29
|
-
* @param name
|
|
27
|
+
* @param name Name of the generated function.
|
|
30
28
|
* @param meta metadata about the component's template and the function being generated.
|
|
31
29
|
* @param domSchemaChecker used to check and record errors regarding improper usage of DOM elements
|
|
32
30
|
* and bindings.
|
|
@@ -35,4 +33,4 @@ import { TcbGenericContextBehavior } from './ops/context';
|
|
|
35
33
|
* @param genericContextBehavior controls how generic parameters (especially parameters with generic
|
|
36
34
|
* bounds) will be referenced from the generated TCB code.
|
|
37
35
|
*/
|
|
38
|
-
export declare function generateTypeCheckBlock(env: Environment, component: TcbComponentMetadata, name:
|
|
36
|
+
export declare function generateTypeCheckBlock(env: Environment, component: TcbComponentMetadata, name: string, meta: TcbTypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder): string;
|
|
@@ -10,7 +10,7 @@ import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
|
10
10
|
import { TypeCtorMetadata, TcbTypeParameter } from '../api';
|
|
11
11
|
import { ReferenceEmitEnvironment } from './reference_emit_environment';
|
|
12
12
|
import { TcbExpr } from './ops/codegen';
|
|
13
|
-
export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironment, meta: TypeCtorMetadata, nodeTypeRef:
|
|
13
|
+
export declare function generateTypeCtorDeclarationFn(env: ReferenceEmitEnvironment, meta: TypeCtorMetadata, nodeTypeRef: TcbExpr, typeParams: TcbTypeParameter[] | undefined): TcbExpr;
|
|
14
14
|
/**
|
|
15
15
|
* Generate an inline type constructor for the given class and metadata.
|
|
16
16
|
*
|