@angular/compiler-cli 22.0.0-next.2 → 22.0.0-next.4
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-M42SPZWZ.js → chunk-33PKOB6H.js} +5 -4
- package/bundles/chunk-33PKOB6H.js.map +6 -0
- package/bundles/{chunk-RA2TLETR.js → chunk-6IEU2J75.js} +38 -7
- package/bundles/chunk-6IEU2J75.js.map +6 -0
- package/bundles/{chunk-FLWAEX6T.js → chunk-AI2LKYE3.js} +4 -3
- package/bundles/chunk-AI2LKYE3.js.map +6 -0
- package/bundles/{chunk-OBSXELUC.js → chunk-ARNGIZEA.js} +48 -50
- package/bundles/chunk-ARNGIZEA.js.map +6 -0
- package/bundles/{chunk-2KXHLD7K.js → chunk-BCQGTZBZ.js} +128 -92
- package/bundles/chunk-BCQGTZBZ.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-CSUVPNMK.js → chunk-L35AQF75.js} +84 -36
- package/bundles/chunk-L35AQF75.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-NUARCIAS.js → chunk-TXJNNYJ4.js} +2 -1
- package/bundles/chunk-TXJNNYJ4.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/index.js +11 -10
- 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/hybrid_analysis.js +6 -5
- package/bundles/private/hybrid_analysis.js.map +6 -0
- package/bundles/private/localize.js +6 -5
- package/bundles/private/localize.js.map +6 -0
- package/bundles/private/migrations.js +8 -7
- package/bundles/private/migrations.js.map +6 -0
- package/bundles/private/testing.js +42 -14
- package/bundles/private/testing.js.map +6 -0
- package/bundles/private/tooling.js +7 -6
- package/bundles/private/tooling.js.map +6 -0
- package/bundles/src/bin/ng_xi18n.js +10 -9
- package/bundles/src/bin/ng_xi18n.js.map +6 -0
- package/bundles/src/bin/ngc.js +10 -9
- 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/file_system/testing/index.d.ts +1 -1
- package/src/ngtsc/file_system/testing/src/test_helper.d.ts +1 -0
- 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/src/tcb_adapter.d.ts +2 -1
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +1 -2
|
@@ -12,7 +12,7 @@ import { EmitScope } from './emit_scope';
|
|
|
12
12
|
* there is no clear shared scope for constant statements. In this case they are bundled with the
|
|
13
13
|
* translated definition and will be emitted into an IIFE.
|
|
14
14
|
*/
|
|
15
|
-
export declare class LocalEmitScope<TStatement, TExpression> extends EmitScope<TStatement, TExpression> {
|
|
15
|
+
export declare class LocalEmitScope<TStatement, TExpression, TType> extends EmitScope<TStatement, TExpression, TType> {
|
|
16
16
|
/**
|
|
17
17
|
* Translate the given Output AST definition expression into a generic `TExpression`.
|
|
18
18
|
*
|
|
@@ -5,11 +5,11 @@ export declare const NO_STATEMENTS: Readonly<any[]>;
|
|
|
5
5
|
/**
|
|
6
6
|
* This class is responsible for linking all the partial declarations found in a single file.
|
|
7
7
|
*/
|
|
8
|
-
export declare class FileLinker<TConstantScope, TStatement, TExpression> {
|
|
8
|
+
export declare class FileLinker<TConstantScope, TStatement, TExpression, TType> {
|
|
9
9
|
private linkerEnvironment;
|
|
10
10
|
private linkerSelector;
|
|
11
11
|
private emitScopes;
|
|
12
|
-
constructor(linkerEnvironment: LinkerEnvironment<TStatement, TExpression>, sourceUrl: AbsoluteFsPath, code: string);
|
|
12
|
+
constructor(linkerEnvironment: LinkerEnvironment<TStatement, TExpression, TType>, sourceUrl: AbsoluteFsPath, code: string);
|
|
13
13
|
/**
|
|
14
14
|
* Return true if the given callee name matches a partial declaration that can be linked.
|
|
15
15
|
*/
|
|
@@ -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 = "22.0.0-next.
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "22.0.0-next.4";
|
|
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": "22.0.0-next.
|
|
3
|
+
"version": "22.0.0-next.4",
|
|
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": "22.0.0-next.
|
|
46
|
+
"@angular/compiler": "22.0.0-next.4",
|
|
47
47
|
"typescript": ">=5.9 <6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -9,4 +9,4 @@ export { Folder, MockFileSystem } from './src/mock_file_system';
|
|
|
9
9
|
export { MockFileSystemNative } from './src/mock_file_system_native';
|
|
10
10
|
export { MockFileSystemPosix } from './src/mock_file_system_posix';
|
|
11
11
|
export { MockFileSystemWindows } from './src/mock_file_system_windows';
|
|
12
|
-
export { initMockFileSystem, runInEachFileSystem, TestFile } from './src/test_helper';
|
|
12
|
+
export { initMockFileSystem, lockMockFileSystem, runInEachFileSystem, TestFile, } from './src/test_helper';
|
|
@@ -13,4 +13,5 @@ export interface RunInEachFileSystemFn {
|
|
|
13
13
|
osX(callback: (os: string) => void): void;
|
|
14
14
|
}
|
|
15
15
|
export declare const runInEachFileSystem: RunInEachFileSystemFn;
|
|
16
|
+
export declare function lockMockFileSystem(): void;
|
|
16
17
|
export declare function initMockFileSystem(os: string, cwd?: AbsoluteFsPath): MockFileSystem;
|
|
@@ -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;
|
|
@@ -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
|
};
|
|
@@ -9,7 +9,6 @@ import { TcbComponentMetadata, TcbTypeCheckBlockMetadata } from '../api';
|
|
|
9
9
|
import { DomSchemaChecker } from './dom';
|
|
10
10
|
import { Environment } from './environment';
|
|
11
11
|
import { OutOfBandDiagnosticRecorder } from './oob';
|
|
12
|
-
import { TcbGenericContextBehavior } from './ops/context';
|
|
13
12
|
/**
|
|
14
13
|
* Given a `ts.ClassDeclaration` for a component, and metadata regarding that component, compose a
|
|
15
14
|
* "type check block" function.
|
|
@@ -34,4 +33,4 @@ import { TcbGenericContextBehavior } from './ops/context';
|
|
|
34
33
|
* @param genericContextBehavior controls how generic parameters (especially parameters with generic
|
|
35
34
|
* bounds) will be referenced from the generated TCB code.
|
|
36
35
|
*/
|
|
37
|
-
export declare function generateTypeCheckBlock(env: Environment, component: TcbComponentMetadata, name: string, meta: TcbTypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder
|
|
36
|
+
export declare function generateTypeCheckBlock(env: Environment, component: TcbComponentMetadata, name: string, meta: TcbTypeCheckBlockMetadata, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder): string;
|