@angular/compiler-cli 21.2.1 → 22.0.0-next.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.
- package/bundles/{chunk-IG22BDVK.js → chunk-5KB2MYHH.js} +875 -1172
- package/bundles/{chunk-WBUBKNAO.js → chunk-DZUTWYAK.js} +1 -1
- package/bundles/chunk-FLWAEX6T.js +1 -1
- package/bundles/{chunk-VO3Q626H.js → chunk-GZL3HSYM.js} +2 -2
- package/bundles/{chunk-PW54LIP6.js → chunk-TYSFQCFS.js} +1 -1
- package/bundles/index.js +4 -4
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/testing.js +1 -1
- package/bundles/private/tooling.js +1 -1
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +3 -3
- package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
- package/src/ngtsc/typecheck/src/comments.d.ts +0 -7
- package/src/ngtsc/typecheck/src/environment.d.ts +7 -6
- package/src/ngtsc/typecheck/src/expression.d.ts +3 -15
- package/src/ngtsc/typecheck/src/host_bindings.d.ts +1 -1
- package/src/ngtsc/typecheck/src/ops/base.d.ts +3 -3
- package/src/ngtsc/typecheck/src/ops/bindings.d.ts +8 -3
- package/src/ngtsc/typecheck/src/ops/codegen.d.ts +74 -0
- package/src/ngtsc/typecheck/src/ops/context.d.ts +1 -2
- package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +3 -3
- package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +4 -4
- package/src/ngtsc/typecheck/src/ops/element.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/events.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/expression.d.ts +5 -5
- package/src/ngtsc/typecheck/src/ops/for_block.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/host.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/inputs.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/let.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/references.d.ts +3 -3
- package/src/ngtsc/typecheck/src/ops/schema.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/scope.d.ts +9 -9
- package/src/ngtsc/typecheck/src/ops/selectorless.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/template.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/variables.d.ts +6 -6
- package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +2 -5
- package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -37
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +1 -1
- package/src/ngtsc/typecheck/src/type_check_file.d.ts +3 -2
- package/src/ngtsc/typecheck/src/type_constructor.d.ts +3 -2
|
@@ -455,7 +455,7 @@ import { compileDirectiveFromMetadata, makeBindingParser, ParseLocation, ParseSo
|
|
|
455
455
|
// packages/compiler-cli/linker/src/file_linker/partial_linkers/util.js
|
|
456
456
|
import { createMayBeForwardRefExpression, outputAst as o2 } from "@angular/compiler";
|
|
457
457
|
import semver from "semver";
|
|
458
|
-
var PLACEHOLDER_VERSION = "
|
|
458
|
+
var PLACEHOLDER_VERSION = "22.0.0-next.0";
|
|
459
459
|
function wrapReference(wrapped) {
|
|
460
460
|
return { value: wrapped, type: wrapped };
|
|
461
461
|
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TrackedIncrementalBuildStrategy,
|
|
9
9
|
freshCompilationTicket,
|
|
10
10
|
incrementalFromCompilerTicket
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TYSFQCFS.js";
|
|
12
12
|
import {
|
|
13
13
|
ActivePerfRecorder,
|
|
14
14
|
OptimizeFor,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
TsCreateProgramDriver,
|
|
19
19
|
replaceTsWithNgInErrors,
|
|
20
20
|
retagAllTsFiles
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-5KB2MYHH.js";
|
|
22
22
|
import {
|
|
23
23
|
absoluteFrom,
|
|
24
24
|
createFileSystemTsReadDirectoryFn,
|
package/bundles/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isTsDiagnostic,
|
|
18
18
|
performCompilation,
|
|
19
19
|
readConfiguration
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GZL3HSYM.js";
|
|
21
21
|
import {
|
|
22
22
|
ConsoleLogger,
|
|
23
23
|
LogLevel
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
freshCompilationTicket,
|
|
35
35
|
incrementalFromStateTicket,
|
|
36
36
|
isDocEntryWithSourceInfo
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-TYSFQCFS.js";
|
|
38
38
|
import {
|
|
39
39
|
ActivePerfRecorder,
|
|
40
40
|
ErrorCode,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
getInitializerApiJitTransform,
|
|
47
47
|
isLocalCompilationDiagnostics,
|
|
48
48
|
ngErrorCode
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-5KB2MYHH.js";
|
|
50
50
|
import "./chunk-CSUVPNMK.js";
|
|
51
51
|
import {
|
|
52
52
|
InvalidFileSystem,
|
|
@@ -77,7 +77,7 @@ import "./chunk-G7GFT6BU.js";
|
|
|
77
77
|
|
|
78
78
|
// packages/compiler-cli/src/version.js
|
|
79
79
|
import { Version } from "@angular/compiler";
|
|
80
|
-
var VERSION = new Version("
|
|
80
|
+
var VERSION = new Version("22.0.0-next.0");
|
|
81
81
|
|
|
82
82
|
// packages/compiler-cli/private/tooling.js
|
|
83
83
|
var GLOBAL_DEFS_FOR_TERSER = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
DiagnosticCategoryLabel,
|
|
7
7
|
NgCompiler
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-TYSFQCFS.js";
|
|
9
9
|
import {
|
|
10
10
|
CompilationMode,
|
|
11
11
|
DtsMetadataReader,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
queryDecoratorNames,
|
|
33
33
|
reflectObjectLiteral,
|
|
34
34
|
unwrapExpression
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-5KB2MYHH.js";
|
|
36
36
|
import "../chunk-CSUVPNMK.js";
|
|
37
37
|
import {
|
|
38
38
|
getFileSystem,
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
import {
|
|
7
7
|
main,
|
|
8
8
|
readCommandLineAndConfiguration
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-DZUTWYAK.js";
|
|
10
10
|
import {
|
|
11
11
|
EmitFlags
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-GZL3HSYM.js";
|
|
13
|
+
import "../../chunk-TYSFQCFS.js";
|
|
14
|
+
import "../../chunk-5KB2MYHH.js";
|
|
15
15
|
import "../../chunk-CSUVPNMK.js";
|
|
16
16
|
import {
|
|
17
17
|
setFileSystem
|
package/bundles/src/bin/ngc.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-DZUTWYAK.js";
|
|
9
|
+
import "../../chunk-GZL3HSYM.js";
|
|
10
|
+
import "../../chunk-TYSFQCFS.js";
|
|
11
|
+
import "../../chunk-5KB2MYHH.js";
|
|
12
12
|
import "../../chunk-CSUVPNMK.js";
|
|
13
13
|
import {
|
|
14
14
|
setFileSystem
|
|
@@ -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 = "
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "22.0.0-next.0";
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0-next.0",
|
|
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": "
|
|
46
|
+
"@angular/compiler": "22.0.0-next.0",
|
|
47
47
|
"typescript": ">=5.9 <6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
],
|
|
63
63
|
"license": "MIT",
|
|
64
64
|
"engines": {
|
|
65
|
-
"node": "^
|
|
65
|
+
"node": "^22.22.0 || >=24.13.1"
|
|
66
66
|
},
|
|
67
67
|
"bugs": {
|
|
68
68
|
"url": "https://github.com/angular/angular/issues"
|
|
@@ -43,6 +43,10 @@ export declare enum ErrorCode {
|
|
|
43
43
|
* and the given access modifiers (e.g. `private`) are not allowed.
|
|
44
44
|
*/
|
|
45
45
|
INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY = 1053,
|
|
46
|
+
/**
|
|
47
|
+
* Raised whenever there are duplicate binding property names for outputs, inputs & models.
|
|
48
|
+
*/
|
|
49
|
+
DUPLICATE_BINDING_NAME = 1054,
|
|
46
50
|
/**
|
|
47
51
|
* An Angular feature, like inputs, outputs or queries is incorrectly
|
|
48
52
|
* declared on a static member.
|
|
@@ -26,13 +26,6 @@ export declare enum ExpressionIdentifier {
|
|
|
26
26
|
EVENT_PARAMETER = "EP",
|
|
27
27
|
VARIABLE_AS_EXPRESSION = "VAE"
|
|
28
28
|
}
|
|
29
|
-
/** Tags the node with the given expression identifier. */
|
|
30
|
-
export declare function addExpressionIdentifier(node: ts.Node, identifier: ExpressionIdentifier): void;
|
|
31
|
-
/**
|
|
32
|
-
* Tag the `ts.Node` with an indication that any errors arising from the evaluation of the node
|
|
33
|
-
* should be ignored.
|
|
34
|
-
*/
|
|
35
|
-
export declare function markIgnoreDiagnostics(node: ts.Node): void;
|
|
36
29
|
/** Returns true if the node has a marker that indicates diagnostics errors should be ignored. */
|
|
37
30
|
export declare function hasIgnoreForDiagnosticsMarker(node: ts.Node, sourceFile: ts.SourceFile): boolean;
|
|
38
31
|
export interface FindOptions<T extends ts.Node> {
|
|
@@ -11,6 +11,7 @@ import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
|
11
11
|
import { ImportManager } from '../../translator';
|
|
12
12
|
import { TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
|
|
13
13
|
import { ReferenceEmitEnvironment } from './reference_emit_environment';
|
|
14
|
+
import { TcbExpr } from './ops/codegen';
|
|
14
15
|
/**
|
|
15
16
|
* A context which hosts one or more Type Check Blocks (TCBs).
|
|
16
17
|
*
|
|
@@ -26,9 +27,9 @@ export declare class Environment extends ReferenceEmitEnvironment {
|
|
|
26
27
|
readonly config: TypeCheckingConfig;
|
|
27
28
|
private nextIds;
|
|
28
29
|
private typeCtors;
|
|
29
|
-
protected typeCtorStatements:
|
|
30
|
+
protected typeCtorStatements: TcbExpr[];
|
|
30
31
|
private pipeInsts;
|
|
31
|
-
protected pipeInstStatements:
|
|
32
|
+
protected pipeInstStatements: TcbExpr[];
|
|
32
33
|
constructor(config: TypeCheckingConfig, importManager: ImportManager, refEmitter: ReferenceEmitter, reflector: ReflectionHost, contextFile: ts.SourceFile);
|
|
33
34
|
/**
|
|
34
35
|
* Get an expression referring to a type constructor for the given directive.
|
|
@@ -36,14 +37,14 @@ export declare class Environment extends ReferenceEmitEnvironment {
|
|
|
36
37
|
* Depending on the shape of the directive itself, this could be either a reference to a declared
|
|
37
38
|
* type constructor, or to an inline type constructor.
|
|
38
39
|
*/
|
|
39
|
-
typeCtorFor(dir: TypeCheckableDirectiveMeta):
|
|
40
|
-
pipeInst(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>):
|
|
40
|
+
typeCtorFor(dir: TypeCheckableDirectiveMeta): TcbExpr;
|
|
41
|
+
pipeInst(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>): TcbExpr;
|
|
41
42
|
/**
|
|
42
43
|
* Generate a `ts.Expression` that references the given node.
|
|
43
44
|
*
|
|
44
45
|
* This may involve importing the node into the file if it's not declared there already.
|
|
45
46
|
*/
|
|
46
|
-
reference(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>):
|
|
47
|
+
reference(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>): TcbExpr;
|
|
47
48
|
private emitTypeParameters;
|
|
48
|
-
getPreludeStatements():
|
|
49
|
+
getPreludeStatements(): TcbExpr[];
|
|
49
50
|
}
|
|
@@ -6,22 +6,10 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST } from '@angular/compiler';
|
|
9
|
-
import
|
|
9
|
+
import { TcbExpr } from './ops/codegen';
|
|
10
10
|
import { TypeCheckingConfig } from '../api';
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Historically this expression was using `null as any`, but a newly-added check in TypeScript 5.6
|
|
15
|
-
* (https://devblogs.microsoft.com/typescript/announcing-typescript-5-6-beta/#disallowed-nullish-and-truthy-checks)
|
|
16
|
-
* started flagging it as always being nullish. Other options that were considered:
|
|
17
|
-
* - `NaN as any` or `Infinity as any` - not used, because they don't work if the `noLib` compiler
|
|
18
|
-
* option is enabled. Also they require more characters.
|
|
19
|
-
* - Some flavor of function call, like `isNan(0) as any` - requires even more characters than the
|
|
20
|
-
* NaN option and has the same issue with `noLib`.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getAnyExpression(): ts.AsExpression;
|
|
23
|
-
/**
|
|
24
|
-
* Convert an `AST` to TypeScript code directly, without going through an intermediate `Expression`
|
|
12
|
+
* Convert an `AST` to a `TcbExpr` directly, without going through an intermediate `Expression`
|
|
25
13
|
* AST.
|
|
26
14
|
*/
|
|
27
|
-
export declare function
|
|
15
|
+
export declare function astToTcbExpr(ast: AST, maybeResolve: (ast: AST) => TcbExpr | null, config: TypeCheckingConfig): TcbExpr;
|
|
@@ -23,7 +23,7 @@ export declare function createHostElement(type: 'component' | 'directive', selec
|
|
|
23
23
|
* Creates an AST node that can be used as a guard in `if` statements to distinguish TypeScript
|
|
24
24
|
* nodes used for checking host bindings from ones used for checking templates.
|
|
25
25
|
*/
|
|
26
|
-
export declare function createHostBindingsBlockGuard():
|
|
26
|
+
export declare function createHostBindingsBlockGuard(): string;
|
|
27
27
|
/**
|
|
28
28
|
* Determines if a given node is a guard that indicates that descendant nodes are used to check
|
|
29
29
|
* host bindings.
|
|
@@ -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
|
|
8
|
+
import { TcbExpr } from './codegen';
|
|
9
9
|
/**
|
|
10
10
|
* A code generation operation that's involved in the construction of a Type Check Block.
|
|
11
11
|
*
|
|
@@ -30,7 +30,7 @@ export declare abstract class TcbOp {
|
|
|
30
30
|
* code to generate, parse and type-check, overall positively contributing to performance.
|
|
31
31
|
*/
|
|
32
32
|
abstract readonly optional: boolean;
|
|
33
|
-
abstract execute():
|
|
33
|
+
abstract execute(): TcbExpr | null;
|
|
34
34
|
/**
|
|
35
35
|
* Replacement value or operation used while this `TcbOp` is executing (i.e. to resolve circular
|
|
36
36
|
* references during its execution).
|
|
@@ -39,5 +39,5 @@ export declare abstract class TcbOp {
|
|
|
39
39
|
* `TcbOp` can be returned in cases where additional code generation is necessary to deal with
|
|
40
40
|
* circular references.
|
|
41
41
|
*/
|
|
42
|
-
circularFallback(): TcbOp |
|
|
42
|
+
circularFallback(): TcbOp | TcbExpr;
|
|
43
43
|
}
|
|
@@ -11,6 +11,7 @@ import { TypeCheckableDirectiveMeta } from '../../api';
|
|
|
11
11
|
import { ClassPropertyName } from '../../../metadata';
|
|
12
12
|
import { Reference } from '../../../imports';
|
|
13
13
|
import { Context } from './context';
|
|
14
|
+
import { TcbExpr } from './codegen';
|
|
14
15
|
export interface TcbBoundAttribute {
|
|
15
16
|
value: AST | string;
|
|
16
17
|
sourceSpan: ParseSourceSpan;
|
|
@@ -33,9 +34,13 @@ export interface TcbDirectiveBoundInput {
|
|
|
33
34
|
*/
|
|
34
35
|
field: string;
|
|
35
36
|
/**
|
|
36
|
-
* The `
|
|
37
|
+
* The `TcbExpr` corresponding with the input binding expression.
|
|
37
38
|
*/
|
|
38
|
-
expression:
|
|
39
|
+
expression: TcbExpr;
|
|
40
|
+
/**
|
|
41
|
+
* The input's original value expression.
|
|
42
|
+
*/
|
|
43
|
+
originalExpression: AST | string;
|
|
39
44
|
/**
|
|
40
45
|
* The source span of the full attribute binding.
|
|
41
46
|
*/
|
|
@@ -61,4 +66,4 @@ export declare function checkSplitTwoWayBinding(inputName: string, output: TmplA
|
|
|
61
66
|
/**
|
|
62
67
|
* Potentially widens the type of `expr` according to the type-checking configuration.
|
|
63
68
|
*/
|
|
64
|
-
export declare function widenBinding(expr:
|
|
69
|
+
export declare function widenBinding(expr: TcbExpr, tcb: Context, originalValue: string | AST): TcbExpr;
|
|
@@ -0,0 +1,74 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { AbsoluteSourceSpan, ParseSourceSpan } from '@angular/compiler';
|
|
9
|
+
import ts from 'typescript';
|
|
10
|
+
import { ExpressionIdentifier } from '../comments';
|
|
11
|
+
/** Represents an expression generated within a type check block. */
|
|
12
|
+
export declare class TcbExpr {
|
|
13
|
+
private source;
|
|
14
|
+
/** Text for the content containing the expression's location information. */
|
|
15
|
+
private spanComment;
|
|
16
|
+
/** Text for the content containing the expression's identifier. */
|
|
17
|
+
private identifierComment;
|
|
18
|
+
/**
|
|
19
|
+
* Text of the comment instructing the type checker to
|
|
20
|
+
* ignore diagnostics coming from this expression.
|
|
21
|
+
*/
|
|
22
|
+
private ignoreComment;
|
|
23
|
+
constructor(source: string);
|
|
24
|
+
/**
|
|
25
|
+
* Converts the node's current state to a string.
|
|
26
|
+
* @param ignoreComments Whether the comments associated with the expression should be skipped.
|
|
27
|
+
*/
|
|
28
|
+
print(ignoreComments?: boolean): string;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a synthetic comment to the expression that represents the parse span of the provided node.
|
|
31
|
+
* This comment can later be retrieved as trivia of a node to recover original source locations.
|
|
32
|
+
* @param span Span from the parser containing the location information.
|
|
33
|
+
*/
|
|
34
|
+
addParseSpanInfo(span: AbsoluteSourceSpan | ParseSourceSpan): this;
|
|
35
|
+
/** Marks the expression to be ignored for diagnostics. */
|
|
36
|
+
markIgnoreDiagnostics(): this;
|
|
37
|
+
/**
|
|
38
|
+
* Wraps the expression in parenthesis such that inserted
|
|
39
|
+
* span comments become attached to the proper node.
|
|
40
|
+
*/
|
|
41
|
+
wrapForTypeChecker(): this;
|
|
42
|
+
/**
|
|
43
|
+
* Tags the expression with an identifier.
|
|
44
|
+
* @param identifier Identifier to apply to the expression.
|
|
45
|
+
*/
|
|
46
|
+
addExpressionIdentifier(identifier: ExpressionIdentifier): this;
|
|
47
|
+
/**
|
|
48
|
+
* `toString` implementation meant to catch errors like accidentally
|
|
49
|
+
* writing `foo ${expr} bar` instead of `foo ${expr.print()} bar`.
|
|
50
|
+
*/
|
|
51
|
+
toString(): never;
|
|
52
|
+
/** Format a comment string as a TypeScript comment. */
|
|
53
|
+
private formatComment;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Declares a variable with a specific type.
|
|
57
|
+
* @param identifier Identifier used to refer to the variable.
|
|
58
|
+
* @param type Type that the variable should be initialized to.
|
|
59
|
+
*/
|
|
60
|
+
export declare function declareVariable(identifier: TcbExpr, type: TcbExpr): TcbExpr;
|
|
61
|
+
/**
|
|
62
|
+
* Formats an array of `TcbExpr` as a block of single statements.
|
|
63
|
+
* @param expressions Expressions to format.
|
|
64
|
+
* @param singleLine Whether to print them on a single line or across multiple. Defaults to multiple.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getStatementsBlock(expressions: TcbExpr[], singleLine?: boolean): string;
|
|
67
|
+
/** Wraps a string value in quotes and escapes relevant characters. */
|
|
68
|
+
export declare function quoteAndEscape(value: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Prints a TypeScript node as a string.
|
|
71
|
+
*
|
|
72
|
+
* @deprecated This is a temporary method until all code generation code has been migrated.
|
|
73
|
+
*/
|
|
74
|
+
export declare function tempPrint(node: ts.Node, sourceFile: ts.SourceFile): string;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { BoundTarget, SchemaMetadata } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { DomSchemaChecker } from '../dom';
|
|
11
10
|
import { OutOfBandDiagnosticRecorder } from '../oob';
|
|
12
11
|
import { TypeCheckableDirectiveMeta, TypeCheckId } from '../../api';
|
|
@@ -62,6 +61,6 @@ export declare class Context {
|
|
|
62
61
|
* Currently this uses a monotonically increasing counter, but in the future the variable name
|
|
63
62
|
* might change depending on the type of data being stored.
|
|
64
63
|
*/
|
|
65
|
-
allocateId():
|
|
64
|
+
allocateId(): string;
|
|
66
65
|
getPipeByName(name: string): PipeMeta | null;
|
|
67
66
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { DirectiveOwner } 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
|
import { TypeCheckableDirectiveMeta } from '../../api';
|
|
@@ -32,7 +32,7 @@ export declare class TcbDirectiveCtorOp extends TcbOp {
|
|
|
32
32
|
private customFormControlType;
|
|
33
33
|
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, dir: TypeCheckableDirectiveMeta, customFormControlType: CustomFormControlType | null);
|
|
34
34
|
get optional(): boolean;
|
|
35
|
-
execute():
|
|
35
|
+
execute(): TcbExpr;
|
|
36
36
|
circularFallback(): TcbOp;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -55,5 +55,5 @@ export declare class TcbDirectiveCtorCircularFallbackOp extends TcbOp {
|
|
|
55
55
|
private dir;
|
|
56
56
|
constructor(tcb: Context, scope: Scope, dir: TypeCheckableDirectiveMeta);
|
|
57
57
|
get optional(): boolean;
|
|
58
|
-
execute():
|
|
58
|
+
execute(): TcbExpr;
|
|
59
59
|
}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { DirectiveOwner } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import type { Context } from './context';
|
|
11
10
|
import type { Scope } from './scope';
|
|
12
11
|
import { TcbOp } from './base';
|
|
12
|
+
import { TcbExpr } from './codegen';
|
|
13
13
|
import { TypeCheckableDirectiveMeta } from '../../api';
|
|
14
14
|
/**
|
|
15
15
|
* A `TcbOp` which constructs an instance of a directive. For generic directives, generic
|
|
@@ -22,7 +22,7 @@ export declare abstract class TcbDirectiveTypeOpBase extends TcbOp {
|
|
|
22
22
|
protected dir: TypeCheckableDirectiveMeta;
|
|
23
23
|
constructor(tcb: Context, scope: Scope, node: DirectiveOwner, dir: TypeCheckableDirectiveMeta);
|
|
24
24
|
get optional(): boolean;
|
|
25
|
-
execute():
|
|
25
|
+
execute(): TcbExpr;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* A `TcbOp` which constructs an instance of a non-generic directive _without_ setting any of its
|
|
@@ -38,7 +38,7 @@ export declare class TcbNonGenericDirectiveTypeOp extends TcbDirectiveTypeOpBase
|
|
|
38
38
|
* Creates a variable declaration for this op's directive of the argument type. Returns the id of
|
|
39
39
|
* the newly created variable.
|
|
40
40
|
*/
|
|
41
|
-
execute():
|
|
41
|
+
execute(): TcbExpr;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* A `TcbOp` which constructs an instance of a generic directive with its generic parameters set
|
|
@@ -49,5 +49,5 @@ export declare class TcbNonGenericDirectiveTypeOp extends TcbDirectiveTypeOpBase
|
|
|
49
49
|
* type parameters set to `any`.
|
|
50
50
|
*/
|
|
51
51
|
export declare class TcbGenericDirectiveTypeWithAnyParamsOp extends TcbDirectiveTypeOpBase {
|
|
52
|
-
execute():
|
|
52
|
+
execute(): TcbExpr;
|
|
53
53
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstElement } 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
|
/**
|
|
@@ -22,5 +22,5 @@ export declare class TcbElementOp extends TcbOp {
|
|
|
22
22
|
private element;
|
|
23
23
|
constructor(tcb: Context, scope: Scope, element: TmplAstElement);
|
|
24
24
|
get optional(): boolean;
|
|
25
|
-
execute():
|
|
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 { AST, DirectiveOwner, TmplAstBoundAttribute, TmplAstBoundEvent } 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
|
import { TypeCheckableDirectiveMeta } from '../../api';
|
|
@@ -17,7 +17,7 @@ import { LocalSymbol } from './references';
|
|
|
17
17
|
* `ts.Expression`, with special handling of the `$event` variable that can be used within event
|
|
18
18
|
* bindings.
|
|
19
19
|
*/
|
|
20
|
-
export declare function tcbEventHandlerExpression(ast: AST, tcb: Context, scope: Scope):
|
|
20
|
+
export declare function tcbEventHandlerExpression(ast: AST, tcb: Context, scope: Scope): TcbExpr;
|
|
21
21
|
/**
|
|
22
22
|
* A `TcbOp` which generates code to check event bindings on an element that correspond with the
|
|
23
23
|
* outputs of a directive.
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, PropertyRead, TmplAstLetDeclaration } 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
|
/**
|
|
14
14
|
* Process an `AST` expression and convert it into a `ts.Expression`, generating references to the
|
|
15
15
|
* correct identifiers in the current scope.
|
|
16
16
|
*/
|
|
17
|
-
export declare function tcbExpression(ast: AST, tcb: Context, scope: Scope):
|
|
17
|
+
export declare function tcbExpression(ast: AST, tcb: Context, scope: Scope): TcbExpr;
|
|
18
18
|
/**
|
|
19
19
|
* Wraps an expression in an `unwrapSignal` call which extracts the signal's value.
|
|
20
20
|
*/
|
|
21
|
-
export declare function unwrapWritableSignal(expression:
|
|
21
|
+
export declare function unwrapWritableSignal(expression: TcbExpr, tcb: Context): TcbExpr;
|
|
22
22
|
/**
|
|
23
23
|
* A `TcbOp` which renders an Angular expression (e.g. `{{foo() && bar.baz}}`).
|
|
24
24
|
*
|
|
@@ -51,14 +51,14 @@ export declare class TcbExpressionTranslator {
|
|
|
51
51
|
protected tcb: Context;
|
|
52
52
|
protected scope: Scope;
|
|
53
53
|
constructor(tcb: Context, scope: Scope);
|
|
54
|
-
translate(ast: AST):
|
|
54
|
+
translate(ast: AST): TcbExpr;
|
|
55
55
|
/**
|
|
56
56
|
* Resolve an `AST` expression within the given scope.
|
|
57
57
|
*
|
|
58
58
|
* Some `AST` expressions refer to top-level concepts (references, variables, the component
|
|
59
59
|
* context). This method assists in resolving those.
|
|
60
60
|
*/
|
|
61
|
-
protected resolve(ast: AST):
|
|
61
|
+
protected resolve(ast: AST): TcbExpr | null;
|
|
62
62
|
private getTargetNodeExpression;
|
|
63
63
|
protected isValidLetDeclarationAccess(target: TmplAstLetDeclaration, ast: PropertyRead): boolean;
|
|
64
64
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, TmplAstForLoopBlock } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import { TcbExpressionTranslator } from './expression';
|
|
11
10
|
import type { Context } from './context';
|
|
12
11
|
import type { Scope } from './scope';
|
|
13
12
|
import { TcbOp } from './base';
|
|
13
|
+
import { TcbExpr } from './codegen';
|
|
14
14
|
/**
|
|
15
15
|
* A `TcbOp` which renders a `for` block as a TypeScript `for...of` loop.
|
|
16
16
|
*
|
|
@@ -28,5 +28,5 @@ export declare class TcbForLoopTrackTranslator extends TcbExpressionTranslator {
|
|
|
28
28
|
private block;
|
|
29
29
|
private allowedVariables;
|
|
30
30
|
constructor(tcb: Context, scope: Scope, block: TmplAstForLoopBlock);
|
|
31
|
-
protected resolve(ast: AST):
|
|
31
|
+
protected resolve(ast: AST): TcbExpr | null;
|
|
32
32
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstHostElement } 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
|
/**
|
|
@@ -21,5 +21,5 @@ export declare class TcbHostElementOp extends TcbOp {
|
|
|
21
21
|
private element;
|
|
22
22
|
readonly optional = true;
|
|
23
23
|
constructor(tcb: Context, scope: Scope, element: TmplAstHostElement);
|
|
24
|
-
execute():
|
|
24
|
+
execute(): TcbExpr;
|
|
25
25
|
}
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AST, TmplAstBoundAttribute, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstTemplate } from '@angular/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
9
|
import type { Context } from './context';
|
|
11
10
|
import type { Scope } from './scope';
|
|
12
11
|
import { TypeCheckableDirectiveMeta } from '../../api';
|
|
13
12
|
import { TcbOp } from './base';
|
|
13
|
+
import { TcbExpr } from './codegen';
|
|
14
14
|
import { CustomFormControlType } from './signal_forms';
|
|
15
15
|
import { LocalSymbol } from './references';
|
|
16
16
|
/**
|
|
17
17
|
* Translates the given attribute binding to a `ts.Expression`.
|
|
18
18
|
*/
|
|
19
|
-
export declare function translateInput(value: AST | string, tcb: Context, scope: Scope):
|
|
19
|
+
export declare function translateInput(value: AST | string, tcb: Context, scope: Scope): TcbExpr;
|
|
20
20
|
/**
|
|
21
21
|
* A `TcbOp` which generates code to check input bindings on an element that correspond with the
|
|
22
22
|
* members of a directive.
|