@angular/compiler-cli 21.2.4 → 21.2.6
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-NJNVVM2O.js → chunk-76LW45YI.js} +3 -3
- package/bundles/{chunk-HFKTR5QY.js → chunk-HVJBZFLS.js} +3 -3
- package/bundles/chunk-HVJBZFLS.js.map +6 -0
- package/bundles/{chunk-QHHWSWGY.js → chunk-RLAJEKGV.js} +2 -2
- package/bundles/{chunk-I6T4FEIP.js → chunk-SOKUOCYN.js} +51 -5
- package/bundles/chunk-SOKUOCYN.js.map +6 -0
- package/bundles/{chunk-6XM6Y45F.js → chunk-SVK6KGAO.js} +2 -2
- package/bundles/{chunk-XWQSF6XG.js → chunk-YF2MWLZG.js} +363 -412
- package/bundles/chunk-YF2MWLZG.js.map +6 -0
- package/bundles/index.js +5 -5
- package/bundles/linker/babel/index.js +69 -12
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +3 -3
- package/bundles/private/testing.js +2 -2
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +5 -5
- package/bundles/src/bin/ngc.js +5 -5
- 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
- package/bundles/chunk-HFKTR5QY.js.map +0 -6
- package/bundles/chunk-I6T4FEIP.js.map +0 -6
- package/bundles/chunk-XWQSF6XG.js.map +0 -6
- /package/bundles/{chunk-NJNVVM2O.js.map → chunk-76LW45YI.js.map} +0 -0
- /package/bundles/{chunk-QHHWSWGY.js.map → chunk-RLAJEKGV.js.map} +0 -0
- /package/bundles/{chunk-6XM6Y45F.js.map → chunk-SVK6KGAO.js.map} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
Context,
|
|
7
7
|
ExpressionTranslatorVisitor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SOKUOCYN.js";
|
|
9
9
|
import {
|
|
10
10
|
LogicalProjectPath,
|
|
11
11
|
absoluteFrom,
|
|
@@ -229,7 +229,7 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
|
229
229
|
import { VERSION } from "@angular/compiler";
|
|
230
230
|
var DOC_PAGE_BASE_URL = (() => {
|
|
231
231
|
const full = VERSION.full;
|
|
232
|
-
const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.
|
|
232
|
+
const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.6";
|
|
233
233
|
const prefix = isPreRelease ? "next" : `v${VERSION.major}`;
|
|
234
234
|
return `https://${prefix}.angular.dev`;
|
|
235
235
|
})();
|
|
@@ -5544,19 +5544,22 @@ var TypeScriptAstFactory = class {
|
|
|
5544
5544
|
if (!ts26.isBlock(body)) {
|
|
5545
5545
|
throw new Error(`Invalid syntax, expected a block, but got ${ts26.SyntaxKind[body.kind]}.`);
|
|
5546
5546
|
}
|
|
5547
|
-
return ts26.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) =>
|
|
5547
|
+
return ts26.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => this.createParameter(param)), void 0, body);
|
|
5548
5548
|
}
|
|
5549
5549
|
createFunctionExpression(functionName, parameters, body) {
|
|
5550
5550
|
if (!ts26.isBlock(body)) {
|
|
5551
5551
|
throw new Error(`Invalid syntax, expected a block, but got ${ts26.SyntaxKind[body.kind]}.`);
|
|
5552
5552
|
}
|
|
5553
|
-
return ts26.factory.createFunctionExpression(void 0, void 0, functionName ?? void 0, void 0, parameters.map((param) =>
|
|
5553
|
+
return ts26.factory.createFunctionExpression(void 0, void 0, functionName ?? void 0, void 0, parameters.map((param) => this.createParameter(param)), void 0, body);
|
|
5554
5554
|
}
|
|
5555
5555
|
createArrowFunctionExpression(parameters, body) {
|
|
5556
5556
|
if (ts26.isStatement(body) && !ts26.isBlock(body)) {
|
|
5557
5557
|
throw new Error(`Invalid syntax, expected a block, but got ${ts26.SyntaxKind[body.kind]}.`);
|
|
5558
5558
|
}
|
|
5559
|
-
return ts26.factory.createArrowFunction(void 0, void 0, parameters.map((param) =>
|
|
5559
|
+
return ts26.factory.createArrowFunction(void 0, void 0, parameters.map((param) => this.createParameter(param)), void 0, void 0, body);
|
|
5560
|
+
}
|
|
5561
|
+
createParameter(param) {
|
|
5562
|
+
return ts26.factory.createParameterDeclaration(void 0, void 0, param.name, void 0, param.type ?? void 0);
|
|
5560
5563
|
}
|
|
5561
5564
|
createIdentifier = ts26.factory.createIdentifier;
|
|
5562
5565
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
@@ -5631,10 +5634,10 @@ var TypeScriptAstFactory = class {
|
|
|
5631
5634
|
createUnaryExpression(operator, operand) {
|
|
5632
5635
|
return ts26.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
5633
5636
|
}
|
|
5634
|
-
createVariableDeclaration(variableName, initializer, type) {
|
|
5637
|
+
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
5635
5638
|
return ts26.factory.createVariableStatement(void 0, ts26.factory.createVariableDeclarationList([
|
|
5636
|
-
ts26.factory.createVariableDeclaration(variableName, void 0, void 0, initializer ?? void 0)
|
|
5637
|
-
], this.VAR_TYPES[
|
|
5639
|
+
ts26.factory.createVariableDeclaration(variableName, void 0, type ?? void 0, initializer ?? void 0)
|
|
5640
|
+
], this.VAR_TYPES[variableType]));
|
|
5638
5641
|
}
|
|
5639
5642
|
createRegularExpressionLiteral(body, flags) {
|
|
5640
5643
|
return ts26.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
@@ -5655,6 +5658,44 @@ var TypeScriptAstFactory = class {
|
|
|
5655
5658
|
});
|
|
5656
5659
|
return node;
|
|
5657
5660
|
}
|
|
5661
|
+
createBuiltInType(type) {
|
|
5662
|
+
switch (type) {
|
|
5663
|
+
case "any":
|
|
5664
|
+
return ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.AnyKeyword);
|
|
5665
|
+
case "boolean":
|
|
5666
|
+
return ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.BooleanKeyword);
|
|
5667
|
+
case "number":
|
|
5668
|
+
return ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.NumberKeyword);
|
|
5669
|
+
case "string":
|
|
5670
|
+
return ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.StringKeyword);
|
|
5671
|
+
case "function":
|
|
5672
|
+
return ts26.factory.createTypeReferenceNode(ts26.factory.createIdentifier("Function"));
|
|
5673
|
+
case "never":
|
|
5674
|
+
return ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.NeverKeyword);
|
|
5675
|
+
case "unknown":
|
|
5676
|
+
return ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.UnknownKeyword);
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5679
|
+
createExpressionType(expression, typeParams) {
|
|
5680
|
+
const typeName = getEntityTypeFromExpression(expression);
|
|
5681
|
+
return ts26.factory.createTypeReferenceNode(typeName, typeParams ?? void 0);
|
|
5682
|
+
}
|
|
5683
|
+
createArrayType(elementType) {
|
|
5684
|
+
return ts26.factory.createArrayTypeNode(elementType);
|
|
5685
|
+
}
|
|
5686
|
+
createMapType(valueType) {
|
|
5687
|
+
return ts26.factory.createTypeLiteralNode([
|
|
5688
|
+
ts26.factory.createIndexSignature(void 0, [
|
|
5689
|
+
ts26.factory.createParameterDeclaration(void 0, void 0, "key", void 0, ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.StringKeyword))
|
|
5690
|
+
], valueType)
|
|
5691
|
+
]);
|
|
5692
|
+
}
|
|
5693
|
+
transplantType(type) {
|
|
5694
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts26.isTypeNode(type)) {
|
|
5695
|
+
return type;
|
|
5696
|
+
}
|
|
5697
|
+
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
5698
|
+
}
|
|
5658
5699
|
};
|
|
5659
5700
|
function createTemplateMiddle(cooked, raw) {
|
|
5660
5701
|
const node = ts26.factory.createTemplateHead(cooked, raw);
|
|
@@ -5678,6 +5719,19 @@ function attachComments(statement, leadingComments) {
|
|
|
5678
5719
|
}
|
|
5679
5720
|
}
|
|
5680
5721
|
}
|
|
5722
|
+
function getEntityTypeFromExpression(expression) {
|
|
5723
|
+
if (ts26.isIdentifier(expression)) {
|
|
5724
|
+
return expression;
|
|
5725
|
+
}
|
|
5726
|
+
if (ts26.isPropertyAccessExpression(expression)) {
|
|
5727
|
+
const left = getEntityTypeFromExpression(expression.expression);
|
|
5728
|
+
if (!ts26.isIdentifier(expression.name)) {
|
|
5729
|
+
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
5730
|
+
}
|
|
5731
|
+
return ts26.factory.createQualifiedName(left, expression.name);
|
|
5732
|
+
}
|
|
5733
|
+
throw new Error(`Unsupported expression for type reference: ${ts26.SyntaxKind[expression.kind]}`);
|
|
5734
|
+
}
|
|
5681
5735
|
|
|
5682
5736
|
// packages/compiler-cli/src/ngtsc/translator/src/typescript_translator.js
|
|
5683
5737
|
function translateExpression(contextFile, expression, imports, options = {}) {
|
|
@@ -9836,8 +9890,8 @@ function _extractTemplateStyleUrls(template) {
|
|
|
9836
9890
|
}
|
|
9837
9891
|
|
|
9838
9892
|
// packages/compiler-cli/src/ngtsc/annotations/component/src/handler.js
|
|
9839
|
-
import { compileClassDebugInfo, compileHmrInitializer, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareComponentFromMetadata, compileDeferResolverFunction, ConstantPool as ConstantPool2, CssSelector as CssSelector5, DomElementSchemaRegistry as DomElementSchemaRegistry3, ExternalExpr as
|
|
9840
|
-
import
|
|
9893
|
+
import { compileClassDebugInfo, compileHmrInitializer, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareComponentFromMetadata, compileDeferResolverFunction, ConstantPool as ConstantPool2, CssSelector as CssSelector5, DomElementSchemaRegistry as DomElementSchemaRegistry3, ExternalExpr as ExternalExpr10, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser3, outputAst as o5, R3TargetBinder as R3TargetBinder2, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher3, ViewEncapsulation as ViewEncapsulation2, SelectorlessMatcher as SelectorlessMatcher2 } from "@angular/compiler";
|
|
9894
|
+
import ts73 from "typescript";
|
|
9841
9895
|
|
|
9842
9896
|
// packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.js
|
|
9843
9897
|
import ts43 from "typescript";
|
|
@@ -10956,7 +11010,7 @@ var TypeCheckScopeRegistry = class {
|
|
|
10956
11010
|
|
|
10957
11011
|
// packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.js
|
|
10958
11012
|
import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser as makeBindingParser2, R3TargetBinder, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
|
|
10959
|
-
import
|
|
11013
|
+
import ts66 from "typescript";
|
|
10960
11014
|
|
|
10961
11015
|
// packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.js
|
|
10962
11016
|
var DirectiveSymbol = class _DirectiveSymbol extends SemanticSymbol {
|
|
@@ -11045,7 +11099,7 @@ function isBaseClassEqual(current, previous) {
|
|
|
11045
11099
|
}
|
|
11046
11100
|
|
|
11047
11101
|
// packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
|
|
11048
|
-
import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as
|
|
11102
|
+
import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr8, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
|
|
11049
11103
|
|
|
11050
11104
|
// packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
|
|
11051
11105
|
import ts48 from "typescript";
|
|
@@ -11189,7 +11243,7 @@ function isSymbolAliasOf(firstSymbol, lastSymbol, typeChecker) {
|
|
|
11189
11243
|
}
|
|
11190
11244
|
|
|
11191
11245
|
// packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
|
|
11192
|
-
import
|
|
11246
|
+
import ts65 from "typescript";
|
|
11193
11247
|
|
|
11194
11248
|
// packages/compiler-cli/src/ngtsc/program_driver/src/api.js
|
|
11195
11249
|
var NgOriginalFile = Symbol("NgOriginalFile");
|
|
@@ -12781,14 +12835,13 @@ var MagicString = class _MagicString {
|
|
|
12781
12835
|
};
|
|
12782
12836
|
|
|
12783
12837
|
// packages/compiler-cli/src/ngtsc/typecheck/src/context.js
|
|
12784
|
-
import
|
|
12838
|
+
import ts63 from "typescript";
|
|
12785
12839
|
|
|
12786
12840
|
// packages/compiler-cli/src/ngtsc/typecheck/src/tcb_adapter.js
|
|
12787
12841
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan4, ExternalExpr as ExternalExpr7, TransplantedType, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
|
|
12788
12842
|
|
|
12789
12843
|
// packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
|
|
12790
12844
|
import { R3Identifiers as R3Identifiers3 } from "@angular/compiler";
|
|
12791
|
-
import ts56 from "typescript";
|
|
12792
12845
|
|
|
12793
12846
|
// packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.js
|
|
12794
12847
|
import { R3Identifiers as R3Identifiers2 } from "@angular/compiler";
|
|
@@ -13348,9 +13401,8 @@ function generateTcbTypeParameters(typeParameters, sourceFile) {
|
|
|
13348
13401
|
// packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
|
|
13349
13402
|
function generateTypeCtorDeclarationFn(env, meta, nodeTypeRef, typeParams) {
|
|
13350
13403
|
const typeArgs = generateGenericArgs(typeParams);
|
|
13351
|
-
const
|
|
13352
|
-
const
|
|
13353
|
-
const initParam = constructTypeCtorParameter(env, meta, typeRef, typeRefWithGenerics);
|
|
13404
|
+
const typeRefWithGenerics = `${nodeTypeRef.print()}${typeArgs}`;
|
|
13405
|
+
const initParam = constructTypeCtorParameter(env, meta, nodeTypeRef.print(), typeRefWithGenerics);
|
|
13354
13406
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
13355
13407
|
let source;
|
|
13356
13408
|
if (meta.body) {
|
|
@@ -13426,9 +13478,58 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
13426
13478
|
}
|
|
13427
13479
|
|
|
13428
13480
|
// packages/compiler-cli/src/ngtsc/typecheck/src/tcb_adapter.js
|
|
13429
|
-
import
|
|
13430
|
-
|
|
13481
|
+
import ts56 from "typescript";
|
|
13482
|
+
|
|
13483
|
+
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
|
|
13484
|
+
var TcbGenericContextBehavior;
|
|
13485
|
+
(function(TcbGenericContextBehavior2) {
|
|
13486
|
+
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
13487
|
+
TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
|
|
13488
|
+
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
13489
|
+
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
13490
|
+
var Context2 = class {
|
|
13491
|
+
env;
|
|
13492
|
+
domSchemaChecker;
|
|
13493
|
+
oobRecorder;
|
|
13494
|
+
id;
|
|
13495
|
+
boundTarget;
|
|
13496
|
+
pipes;
|
|
13497
|
+
schemas;
|
|
13498
|
+
hostIsStandalone;
|
|
13499
|
+
hostPreserveWhitespaces;
|
|
13500
|
+
nextId = 1;
|
|
13501
|
+
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
|
|
13502
|
+
this.env = env;
|
|
13503
|
+
this.domSchemaChecker = domSchemaChecker;
|
|
13504
|
+
this.oobRecorder = oobRecorder;
|
|
13505
|
+
this.id = id;
|
|
13506
|
+
this.boundTarget = boundTarget;
|
|
13507
|
+
this.pipes = pipes;
|
|
13508
|
+
this.schemas = schemas;
|
|
13509
|
+
this.hostIsStandalone = hostIsStandalone;
|
|
13510
|
+
this.hostPreserveWhitespaces = hostPreserveWhitespaces;
|
|
13511
|
+
}
|
|
13512
|
+
/**
|
|
13513
|
+
* Allocate a new variable name for use within the `Context`.
|
|
13514
|
+
*
|
|
13515
|
+
* Currently this uses a monotonically increasing counter, but in the future the variable name
|
|
13516
|
+
* might change depending on the type of data being stored.
|
|
13517
|
+
*/
|
|
13518
|
+
allocateId() {
|
|
13519
|
+
return `_t${this.nextId++}`;
|
|
13520
|
+
}
|
|
13521
|
+
getPipeByName(name) {
|
|
13522
|
+
if (this.pipes === null || !this.pipes.has(name)) {
|
|
13523
|
+
return null;
|
|
13524
|
+
}
|
|
13525
|
+
return this.pipes.get(name);
|
|
13526
|
+
}
|
|
13527
|
+
};
|
|
13528
|
+
|
|
13529
|
+
// packages/compiler-cli/src/ngtsc/typecheck/src/tcb_adapter.js
|
|
13530
|
+
function adaptTypeCheckBlockMetadata(ref, meta, env, genericContextBehavior) {
|
|
13431
13531
|
const refCache = /* @__PURE__ */ new Map();
|
|
13532
|
+
const dirCache = /* @__PURE__ */ new Map();
|
|
13432
13533
|
const extractRef = (ref2) => {
|
|
13433
13534
|
if (refCache.has(ref2)) {
|
|
13434
13535
|
return refCache.get(ref2);
|
|
@@ -13437,7 +13538,6 @@ function adaptTypeCheckBlockMetadata(ref, meta, env) {
|
|
|
13437
13538
|
refCache.set(ref2, result);
|
|
13438
13539
|
return result;
|
|
13439
13540
|
};
|
|
13440
|
-
const dirCache = /* @__PURE__ */ new Map();
|
|
13441
13541
|
const convertDir = (dir) => {
|
|
13442
13542
|
if (dirCache.has(dir))
|
|
13443
13543
|
return dirCache.get(dir);
|
|
@@ -13470,7 +13570,7 @@ function adaptTypeCheckBlockMetadata(ref, meta, env) {
|
|
|
13470
13570
|
animationTriggerNames: dir.animationTriggerNames,
|
|
13471
13571
|
ngTemplateGuards: dir.ngTemplateGuards,
|
|
13472
13572
|
hasNgTemplateContextGuard: dir.hasNgTemplateContextGuard,
|
|
13473
|
-
hasNgFieldDirective:
|
|
13573
|
+
hasNgFieldDirective: ts56.isClassDeclaration(dir.ref.node) && dir.ref.node.members.some((member) => ts56.isPropertyDeclaration(member) && ts56.isComputedPropertyName(member.name) && ts56.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275NgFieldDirective"),
|
|
13474
13574
|
coercedInputFields: dir.coercedInputFields,
|
|
13475
13575
|
restrictedInputFields: dir.restrictedInputFields,
|
|
13476
13576
|
stringLiteralInputFields: dir.stringLiteralInputFields,
|
|
@@ -13478,36 +13578,21 @@ function adaptTypeCheckBlockMetadata(ref, meta, env) {
|
|
|
13478
13578
|
publicMethods: dir.publicMethods,
|
|
13479
13579
|
ref: extractRef(dir.ref),
|
|
13480
13580
|
isGeneric: dir.isGeneric,
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
if (!node.typeParameters) {
|
|
13484
|
-
return null;
|
|
13485
|
-
}
|
|
13486
|
-
const emitter = new TypeParameterEmitter(node.typeParameters, env.reflector);
|
|
13487
|
-
let emitted;
|
|
13488
|
-
if (!emitter.canEmit((ref2) => env.canReferenceType(ref2))) {
|
|
13489
|
-
emitted = [...node.typeParameters];
|
|
13490
|
-
} else {
|
|
13491
|
-
emitted = emitter.emit((ref2) => env.referenceType(ref2));
|
|
13492
|
-
}
|
|
13493
|
-
return generateTcbTypeParameters(emitted || [], env.contextFile);
|
|
13494
|
-
})(),
|
|
13495
|
-
hasRequiresInlineTypeCtor: requiresInlineTypeCtor(dir.ref.node, env.reflector, env)
|
|
13581
|
+
requiresInlineTypeCtor: requiresInlineTypeCtor(dir.ref.node, env.reflector, env),
|
|
13582
|
+
...adaptGenerics(dir.ref.node, env, TcbGenericContextBehavior.UseEmitter)
|
|
13496
13583
|
};
|
|
13497
13584
|
dirCache.set(dir, tcbDir);
|
|
13498
13585
|
return tcbDir;
|
|
13499
13586
|
};
|
|
13587
|
+
const originalBoundTarget = meta.boundTarget.target;
|
|
13500
13588
|
const adaptedBoundTarget = {
|
|
13501
|
-
target:
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
} : void 0
|
|
13509
|
-
};
|
|
13510
|
-
})(),
|
|
13589
|
+
target: {
|
|
13590
|
+
template: originalBoundTarget.template,
|
|
13591
|
+
host: originalBoundTarget.host ? {
|
|
13592
|
+
node: originalBoundTarget.host.node,
|
|
13593
|
+
directives: originalBoundTarget.host.directives.map(convertDir)
|
|
13594
|
+
} : void 0
|
|
13595
|
+
},
|
|
13511
13596
|
getUsedDirectives: () => meta.boundTarget.getUsedDirectives().map(convertDir),
|
|
13512
13597
|
getEagerlyUsedDirectives: () => meta.boundTarget.getEagerlyUsedDirectives().map(convertDir),
|
|
13513
13598
|
getUsedPipes: () => meta.boundTarget.getUsedPipes(),
|
|
@@ -13565,25 +13650,37 @@ function adaptTypeCheckBlockMetadata(ref, meta, env) {
|
|
|
13565
13650
|
isStandalone: meta.isStandalone,
|
|
13566
13651
|
preserveWhitespaces: meta.preserveWhitespaces
|
|
13567
13652
|
},
|
|
13568
|
-
component:
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
if (!ref.node.typeParameters)
|
|
13573
|
-
return null;
|
|
13574
|
-
const emitter = new TypeParameterEmitter(ref.node.typeParameters, env.reflector);
|
|
13575
|
-
let emitted;
|
|
13576
|
-
if (!emitter.canEmit((r) => env.canReferenceType(r))) {
|
|
13577
|
-
emitted = [...ref.node.typeParameters];
|
|
13578
|
-
} else {
|
|
13579
|
-
emitted = emitter.emit((r) => env.referenceType(r));
|
|
13580
|
-
}
|
|
13581
|
-
return generateTcbTypeParameters(emitted || [], env.contextFile);
|
|
13582
|
-
})()
|
|
13583
|
-
};
|
|
13584
|
-
})()
|
|
13653
|
+
component: {
|
|
13654
|
+
ref: extractRef(ref),
|
|
13655
|
+
...adaptGenerics(ref.node, env, env.config.useContextGenericType ? genericContextBehavior : TcbGenericContextBehavior.FallbackToAny)
|
|
13656
|
+
}
|
|
13585
13657
|
};
|
|
13586
13658
|
}
|
|
13659
|
+
function adaptGenerics(node, env, genericContextBehavior) {
|
|
13660
|
+
let typeParameters;
|
|
13661
|
+
let typeArguments;
|
|
13662
|
+
if (node.typeParameters !== void 0 && node.typeParameters.length > 0) {
|
|
13663
|
+
switch (genericContextBehavior) {
|
|
13664
|
+
case TcbGenericContextBehavior.UseEmitter:
|
|
13665
|
+
const emitter = new TypeParameterEmitter(node.typeParameters, env.reflector);
|
|
13666
|
+
const emittedParams = emitter.canEmit((r) => env.canReferenceType(r)) ? emitter.emit((typeRef) => env.referenceType(typeRef)) : void 0;
|
|
13667
|
+
typeParameters = generateTcbTypeParameters(emittedParams || node.typeParameters, env.contextFile);
|
|
13668
|
+
typeArguments = typeParameters.map((param) => param.name);
|
|
13669
|
+
break;
|
|
13670
|
+
case TcbGenericContextBehavior.CopyClassNodes:
|
|
13671
|
+
typeParameters = generateTcbTypeParameters(node.typeParameters, env.contextFile);
|
|
13672
|
+
typeArguments = typeParameters.map((param) => param.name);
|
|
13673
|
+
break;
|
|
13674
|
+
case TcbGenericContextBehavior.FallbackToAny:
|
|
13675
|
+
typeParameters = generateTcbTypeParameters(node.typeParameters, env.contextFile);
|
|
13676
|
+
typeArguments = new Array(node.typeParameters.length).fill("any");
|
|
13677
|
+
break;
|
|
13678
|
+
}
|
|
13679
|
+
} else {
|
|
13680
|
+
typeParameters = typeArguments = null;
|
|
13681
|
+
}
|
|
13682
|
+
return { typeParameters, typeArguments };
|
|
13683
|
+
}
|
|
13587
13684
|
function extractReferenceMetadata(ref, env) {
|
|
13588
13685
|
let name = ref.debugName || ref.node.name.text;
|
|
13589
13686
|
let moduleName = ref.ownedByModuleGuess;
|
|
@@ -13620,9 +13717,9 @@ function extractReferenceMetadata(ref, env) {
|
|
|
13620
13717
|
return refMeta;
|
|
13621
13718
|
}
|
|
13622
13719
|
function extractNameFromExpr(node) {
|
|
13623
|
-
if (
|
|
13720
|
+
if (ts56.isIdentifier(node)) {
|
|
13624
13721
|
return node.text;
|
|
13625
|
-
} else if (
|
|
13722
|
+
} else if (ts56.isPropertyAccessExpression(node)) {
|
|
13626
13723
|
const receiver = extractNameFromExpr(node.expression);
|
|
13627
13724
|
return receiver !== null ? `${receiver}.${node.name.text}` : null;
|
|
13628
13725
|
}
|
|
@@ -13631,7 +13728,7 @@ function extractNameFromExpr(node) {
|
|
|
13631
13728
|
|
|
13632
13729
|
// packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
|
|
13633
13730
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
13634
|
-
import
|
|
13731
|
+
import ts57 from "typescript";
|
|
13635
13732
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
13636
13733
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
13637
13734
|
var RegistryDomSchemaChecker = class {
|
|
@@ -13657,7 +13754,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13657
13754
|
} else {
|
|
13658
13755
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
13659
13756
|
}
|
|
13660
|
-
const diag = makeTemplateDiagnostic(id, mapping, sourceSpanForDiagnostics,
|
|
13757
|
+
const diag = makeTemplateDiagnostic(id, mapping, sourceSpanForDiagnostics, ts57.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
13661
13758
|
this._diagnostics.push(diag);
|
|
13662
13759
|
}
|
|
13663
13760
|
}
|
|
@@ -13677,7 +13774,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13677
13774
|
2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
|
|
13678
13775
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
13679
13776
|
}
|
|
13680
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
13777
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts57.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
13681
13778
|
this._diagnostics.push(diag);
|
|
13682
13779
|
}
|
|
13683
13780
|
}
|
|
@@ -13688,19 +13785,16 @@ var RegistryDomSchemaChecker = class {
|
|
|
13688
13785
|
}
|
|
13689
13786
|
const errorMessage = `Can't bind to '${name}' since it isn't a known property of '${tagName}'.`;
|
|
13690
13787
|
const mapping = this.resolver.getHostBindingsMapping(id);
|
|
13691
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
13788
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts57.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMessage);
|
|
13692
13789
|
this._diagnostics.push(diag);
|
|
13693
13790
|
break;
|
|
13694
13791
|
}
|
|
13695
13792
|
}
|
|
13696
13793
|
};
|
|
13697
13794
|
|
|
13698
|
-
// packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
|
|
13699
|
-
import ts60 from "typescript";
|
|
13700
|
-
|
|
13701
13795
|
// packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.js
|
|
13702
|
-
import { ExpressionType
|
|
13703
|
-
import
|
|
13796
|
+
import { ExpressionType } from "@angular/compiler";
|
|
13797
|
+
import ts58 from "typescript";
|
|
13704
13798
|
var ReferenceEmitEnvironment = class {
|
|
13705
13799
|
importManager;
|
|
13706
13800
|
refEmitter;
|
|
@@ -13726,33 +13820,6 @@ var ReferenceEmitEnvironment = class {
|
|
|
13726
13820
|
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
|
|
13727
13821
|
return translateType(new ExpressionType(ngExpr.expression), this.contextFile, this.reflector, this.refEmitter, this.importManager);
|
|
13728
13822
|
}
|
|
13729
|
-
/**
|
|
13730
|
-
* Generates a `ts.TypeNode` from a `TcbReferenceMetadata` object.
|
|
13731
|
-
* This is used by the TCB operations which do not hold on to the original `ts.Declaration`.
|
|
13732
|
-
*
|
|
13733
|
-
* Note: It's important that we do not try to evaluate the `typeParameters` here and pad them
|
|
13734
|
-
* out with `any` type arguments. If we supply `any` to a generic pipe (e.g. `var _pipe1: MyPipe<any>;`),
|
|
13735
|
-
* it destroys the generic constraints and degrades the `transform` signature. When they are omitted
|
|
13736
|
-
* entirely, TypeScript implicitly flags an error, which the Angular compiler filters out, and
|
|
13737
|
-
* crucially recovers by falling back to constraint inference (e.g. `var _pipe1: MyPipe;` infers
|
|
13738
|
-
* bounds safely).
|
|
13739
|
-
*/
|
|
13740
|
-
referenceTcbType(ref) {
|
|
13741
|
-
if (ref.unexportedDiagnostic !== null || ref.isLocal || ref.moduleName === null) {
|
|
13742
|
-
if (ref.unexportedDiagnostic !== null) {
|
|
13743
|
-
throw new FatalDiagnosticError(
|
|
13744
|
-
ErrorCode.IMPORT_GENERATION_FAILURE,
|
|
13745
|
-
this.contextFile,
|
|
13746
|
-
// Using context file as fallback origin for external file since we lack exact node
|
|
13747
|
-
makeDiagnosticChain(`Unable to import symbol ${ref.name}.`, [
|
|
13748
|
-
makeDiagnosticChain(ref.unexportedDiagnostic)
|
|
13749
|
-
])
|
|
13750
|
-
);
|
|
13751
|
-
}
|
|
13752
|
-
return ts59.factory.createTypeReferenceNode(ref.name);
|
|
13753
|
-
}
|
|
13754
|
-
return this.referenceExternalType(ref.moduleName, ref.name);
|
|
13755
|
-
}
|
|
13756
13823
|
/**
|
|
13757
13824
|
* Generates a `TcbExpr` from a `TcbReferenceMetadata` object.
|
|
13758
13825
|
*/
|
|
@@ -13773,23 +13840,13 @@ var ReferenceEmitEnvironment = class {
|
|
|
13773
13840
|
exportSymbolName: name,
|
|
13774
13841
|
requestedFile: this.contextFile
|
|
13775
13842
|
});
|
|
13776
|
-
if (
|
|
13843
|
+
if (ts58.isIdentifier(importResult)) {
|
|
13777
13844
|
return new TcbExpr(importResult.text);
|
|
13778
|
-
} else if (
|
|
13845
|
+
} else if (ts58.isIdentifier(importResult.expression)) {
|
|
13779
13846
|
return new TcbExpr(`${importResult.expression.text}.${importResult.name.text}`);
|
|
13780
13847
|
}
|
|
13781
13848
|
throw new Error("Unexpected value returned by import manager");
|
|
13782
13849
|
}
|
|
13783
|
-
/**
|
|
13784
|
-
* Generate a `ts.TypeNode` that references a given type from the provided module.
|
|
13785
|
-
*
|
|
13786
|
-
* This will involve importing the type into the file, and will also add type parameters if
|
|
13787
|
-
* provided.
|
|
13788
|
-
*/
|
|
13789
|
-
referenceExternalType(moduleName, name, typeParams) {
|
|
13790
|
-
const external = new ExternalExpr8({ moduleName, name });
|
|
13791
|
-
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.contextFile, this.reflector, this.refEmitter, this.importManager);
|
|
13792
|
-
}
|
|
13793
13850
|
/**
|
|
13794
13851
|
* Generates a `ts.TypeNode` representing a type that is being referenced from a different place
|
|
13795
13852
|
* in the program. Any type references inside the transplanted type will be rewritten so that
|
|
@@ -13826,16 +13883,13 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
13826
13883
|
if (this.typeCtors.has(key)) {
|
|
13827
13884
|
return new TcbExpr(this.typeCtors.get(key));
|
|
13828
13885
|
}
|
|
13829
|
-
if (dir.
|
|
13886
|
+
if (dir.requiresInlineTypeCtor) {
|
|
13830
13887
|
const typeCtorExpr = `${this.referenceTcbValue(dir.ref).print()}.ngTypeCtor`;
|
|
13831
13888
|
this.typeCtors.set(key, typeCtorExpr);
|
|
13832
13889
|
return new TcbExpr(typeCtorExpr);
|
|
13833
13890
|
} else {
|
|
13834
13891
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
13835
|
-
const nodeTypeRef = this.
|
|
13836
|
-
if (!ts60.isTypeReferenceNode(nodeTypeRef)) {
|
|
13837
|
-
throw new Error(`Expected TypeReferenceNode from reference to ${dir.ref.name}`);
|
|
13838
|
-
}
|
|
13892
|
+
const nodeTypeRef = this.referenceTcbValue(dir.ref);
|
|
13839
13893
|
const meta = {
|
|
13840
13894
|
fnName,
|
|
13841
13895
|
body: true,
|
|
@@ -13846,7 +13900,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
13846
13900
|
coercedInputFields: dir.coercedInputFields
|
|
13847
13901
|
};
|
|
13848
13902
|
const typeParams = dir.typeParameters || void 0;
|
|
13849
|
-
const typeCtor = generateTypeCtorDeclarationFn(this, meta, nodeTypeRef
|
|
13903
|
+
const typeCtor = generateTypeCtorDeclarationFn(this, meta, nodeTypeRef, typeParams);
|
|
13850
13904
|
this.typeCtorStatements.push(typeCtor);
|
|
13851
13905
|
this.typeCtors.set(key, fnName);
|
|
13852
13906
|
return new TcbExpr(fnName);
|
|
@@ -13860,27 +13914,12 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
13860
13914
|
if (this.pipeInsts.has(key)) {
|
|
13861
13915
|
return new TcbExpr(this.pipeInsts.get(key));
|
|
13862
13916
|
}
|
|
13863
|
-
const pipeType = this.
|
|
13917
|
+
const pipeType = this.referenceTcbValue(pipe.ref);
|
|
13864
13918
|
const pipeInstId = `_pipe${this.nextIds.pipeInst++}`;
|
|
13865
13919
|
this.pipeInsts.set(key, pipeInstId);
|
|
13866
|
-
this.pipeInstStatements.push(declareVariable(new TcbExpr(pipeInstId),
|
|
13920
|
+
this.pipeInstStatements.push(declareVariable(new TcbExpr(pipeInstId), pipeType));
|
|
13867
13921
|
return new TcbExpr(pipeInstId);
|
|
13868
13922
|
}
|
|
13869
|
-
/**
|
|
13870
|
-
* Generate a `ts.Expression` that references the given node.
|
|
13871
|
-
*
|
|
13872
|
-
* This may involve importing the node into the file if it's not declared there already.
|
|
13873
|
-
*/
|
|
13874
|
-
reference(ref) {
|
|
13875
|
-
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
|
|
13876
|
-
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
|
|
13877
|
-
const tsExpression = translateExpression(this.contextFile, ngExpr.expression, this.importManager);
|
|
13878
|
-
return new TcbExpr(tempPrint(tsExpression, this.contextFile));
|
|
13879
|
-
}
|
|
13880
|
-
emitTypeParameters(declaration) {
|
|
13881
|
-
const emitter = new TypeParameterEmitter(declaration.typeParameters, this.reflector);
|
|
13882
|
-
return emitter.emit((ref) => this.referenceType(ref));
|
|
13883
|
-
}
|
|
13884
13923
|
getPreludeStatements() {
|
|
13885
13924
|
return [...this.pipeInstStatements, ...this.typeCtorStatements];
|
|
13886
13925
|
}
|
|
@@ -13894,7 +13933,7 @@ function getTcbReferenceKey(ref) {
|
|
|
13894
13933
|
|
|
13895
13934
|
// packages/compiler-cli/src/ngtsc/typecheck/src/oob.js
|
|
13896
13935
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan5, BindingType as BindingType2, ParseSourceSpan as ParseSourceSpan2, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement } from "@angular/compiler";
|
|
13897
|
-
import
|
|
13936
|
+
import ts59 from "typescript";
|
|
13898
13937
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
13899
13938
|
resolver;
|
|
13900
13939
|
getSourceFile;
|
|
@@ -13931,7 +13970,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13931
13970
|
const mapping = this.resolver.getTemplateSourceMapping(id);
|
|
13932
13971
|
const value = ref.value.trim();
|
|
13933
13972
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
13934
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan,
|
|
13973
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
13935
13974
|
}
|
|
13936
13975
|
missingPipe(id, ast, isStandalone) {
|
|
13937
13976
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -13954,7 +13993,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
|
|
|
13954
13993
|
To fix this, import the "${suggestedClassName}" class from "${suggestedImport}" and add it to the "imports" array of the module declaring the component.`;
|
|
13955
13994
|
}
|
|
13956
13995
|
}
|
|
13957
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan,
|
|
13996
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
13958
13997
|
this.recordedPipes.add(ast);
|
|
13959
13998
|
}
|
|
13960
13999
|
deferredPipeUsedEagerly(id, ast) {
|
|
@@ -13967,7 +14006,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
|
|
|
13967
14006
|
if (sourceSpan === null) {
|
|
13968
14007
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
13969
14008
|
}
|
|
13970
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan,
|
|
14009
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
|
|
13971
14010
|
this.recordedPipes.add(ast);
|
|
13972
14011
|
}
|
|
13973
14012
|
deferredComponentUsedEagerly(id, element) {
|
|
@@ -13979,12 +14018,12 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
|
|
|
13979
14018
|
if (sourceSpan === null) {
|
|
13980
14019
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element.name}'.`);
|
|
13981
14020
|
}
|
|
13982
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan,
|
|
14021
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
|
|
13983
14022
|
}
|
|
13984
14023
|
duplicateTemplateVar(id, variable, firstDecl) {
|
|
13985
14024
|
const mapping = this.resolver.getTemplateSourceMapping(id);
|
|
13986
14025
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
13987
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan,
|
|
14026
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
|
|
13988
14027
|
{
|
|
13989
14028
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
13990
14029
|
start: firstDecl.sourceSpan.start.offset,
|
|
@@ -14025,7 +14064,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
|
|
|
14025
14064
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
14026
14065
|
|
|
14027
14066
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
14028
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan,
|
|
14067
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan, ts59.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
14029
14068
|
}
|
|
14030
14069
|
splitTwoWayBinding(id, input, output, inputConsumer, outputConsumer) {
|
|
14031
14070
|
const mapping = this.resolver.getTemplateSourceMapping(id);
|
|
@@ -14069,7 +14108,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
14069
14108
|
}
|
|
14070
14109
|
}
|
|
14071
14110
|
}
|
|
14072
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan,
|
|
14111
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
14073
14112
|
}
|
|
14074
14113
|
missingRequiredInputs(id, element, directiveName, isComponent, inputAliases) {
|
|
14075
14114
|
const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
|
|
@@ -14089,7 +14128,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
14089
14128
|
const end = element.startSourceSpan.end.moveBy(start.offset + name.length - element.startSourceSpan.end.offset);
|
|
14090
14129
|
span = new ParseSourceSpan2(start, end);
|
|
14091
14130
|
}
|
|
14092
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span,
|
|
14131
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
|
|
14093
14132
|
}
|
|
14094
14133
|
illegalForLoopTrackAccess(id, block, access) {
|
|
14095
14134
|
const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, access.sourceSpan);
|
|
@@ -14098,7 +14137,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
14098
14137
|
}
|
|
14099
14138
|
const messageVars = [block.item, ...block.contextVariables.filter((v) => v.value === "$index")].map((v) => `'${v.name}'`).join(", ");
|
|
14100
14139
|
const message = `Cannot access '${access.name}' inside of a track expression. Only ${messageVars} and properties on the containing component are available to this expression.`;
|
|
14101
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan,
|
|
14140
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
|
|
14102
14141
|
}
|
|
14103
14142
|
inaccessibleDeferredTriggerElement(id, trigger) {
|
|
14104
14143
|
let message;
|
|
@@ -14109,7 +14148,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
14109
14148
|
Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
|
|
14110
14149
|
Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
|
|
14111
14150
|
}
|
|
14112
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan,
|
|
14151
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
|
|
14113
14152
|
}
|
|
14114
14153
|
controlFlowPreventingContentProjection(id, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
|
|
14115
14154
|
const blockName = controlFlowNode.nameSpan.toString().trim();
|
|
@@ -14131,43 +14170,43 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
|
|
|
14131
14170
|
if (sourceSpan === null) {
|
|
14132
14171
|
throw new Error(`Assertion failure: no SourceLocation found for property write.`);
|
|
14133
14172
|
}
|
|
14134
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan,
|
|
14173
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
|
|
14135
14174
|
}
|
|
14136
14175
|
letUsedBeforeDefinition(id, node, target) {
|
|
14137
14176
|
const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, node.sourceSpan);
|
|
14138
14177
|
if (sourceSpan === null) {
|
|
14139
14178
|
throw new Error(`Assertion failure: no SourceLocation found for property read.`);
|
|
14140
14179
|
}
|
|
14141
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan,
|
|
14180
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
|
|
14142
14181
|
}
|
|
14143
14182
|
conflictingDeclaration(id, decl) {
|
|
14144
14183
|
const mapping = this.resolver.getTemplateSourceMapping(id);
|
|
14145
14184
|
const errorMsg = `Cannot declare @let called '${decl.name}' as there is another symbol in the template with the same name.`;
|
|
14146
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan,
|
|
14185
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
|
|
14147
14186
|
}
|
|
14148
14187
|
missingNamedTemplateDependency(id, node) {
|
|
14149
14188
|
this._diagnostics.push(makeTemplateDiagnostic(
|
|
14150
14189
|
id,
|
|
14151
14190
|
this.resolver.getTemplateSourceMapping(id),
|
|
14152
14191
|
node.startSourceSpan,
|
|
14153
|
-
|
|
14192
|
+
ts59.DiagnosticCategory.Error,
|
|
14154
14193
|
ngErrorCode(ErrorCode.MISSING_NAMED_TEMPLATE_DEPENDENCY),
|
|
14155
14194
|
// Wording is meant to mimic the wording TS uses in their diagnostic for missing symbols.
|
|
14156
14195
|
`Cannot find name "${node instanceof TmplAstDirective ? node.name : node.componentName}". Selectorless references are only supported to classes or non-type import statements.`
|
|
14157
14196
|
));
|
|
14158
14197
|
}
|
|
14159
14198
|
incorrectTemplateDependencyType(id, node) {
|
|
14160
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan,
|
|
14199
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be a standalone ${node instanceof TmplAstComponent ? "@Component" : "@Directive"}.`));
|
|
14161
14200
|
}
|
|
14162
14201
|
unclaimedDirectiveBinding(id, directive, node) {
|
|
14163
14202
|
const errorMsg = `Directive ${directive.name} does not have an ${node instanceof TmplAstBoundEvent2 ? "output" : "input"} named "${node.name}". Bindings to directives must target existing inputs or outputs.`;
|
|
14164
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.keySpan || node.sourceSpan,
|
|
14203
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.keySpan || node.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.UNCLAIMED_DIRECTIVE_BINDING), errorMsg));
|
|
14165
14204
|
}
|
|
14166
14205
|
deferImplicitTriggerMissingPlaceholder(id, trigger) {
|
|
14167
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan,
|
|
14206
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_MISSING_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block"));
|
|
14168
14207
|
}
|
|
14169
14208
|
deferImplicitTriggerInvalidPlaceholder(id, trigger) {
|
|
14170
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan,
|
|
14209
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block with exactly one root element node"));
|
|
14171
14210
|
}
|
|
14172
14211
|
formFieldUnsupportedBinding(id, node) {
|
|
14173
14212
|
let message;
|
|
@@ -14184,7 +14223,7 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
|
|
|
14184
14223
|
} else {
|
|
14185
14224
|
message = `Setting the '${node.name}' attribute is not allowed on nodes using the '[formField]' directive`;
|
|
14186
14225
|
}
|
|
14187
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan,
|
|
14226
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts59.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
|
|
14188
14227
|
}
|
|
14189
14228
|
};
|
|
14190
14229
|
function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
|
|
@@ -14196,7 +14235,7 @@ function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
|
|
|
14196
14235
|
}
|
|
14197
14236
|
|
|
14198
14237
|
// packages/compiler-cli/src/ngtsc/typecheck/src/shim.js
|
|
14199
|
-
import
|
|
14238
|
+
import ts60 from "typescript";
|
|
14200
14239
|
var TypeCheckShimGenerator = class {
|
|
14201
14240
|
extensionPrefix = "ngtypecheck";
|
|
14202
14241
|
shouldEmit = false;
|
|
@@ -14204,62 +14243,13 @@ var TypeCheckShimGenerator = class {
|
|
|
14204
14243
|
if (priorShimSf !== null) {
|
|
14205
14244
|
return priorShimSf;
|
|
14206
14245
|
}
|
|
14207
|
-
return
|
|
14246
|
+
return ts60.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts60.ScriptTarget.Latest, true, ts60.ScriptKind.TS);
|
|
14208
14247
|
}
|
|
14209
14248
|
static shimFor(fileName) {
|
|
14210
14249
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
14211
14250
|
}
|
|
14212
14251
|
};
|
|
14213
14252
|
|
|
14214
|
-
// packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
|
|
14215
|
-
import ts66 from "typescript";
|
|
14216
|
-
|
|
14217
|
-
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
|
|
14218
|
-
var TcbGenericContextBehavior;
|
|
14219
|
-
(function(TcbGenericContextBehavior2) {
|
|
14220
|
-
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
14221
|
-
TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
|
|
14222
|
-
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
14223
|
-
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
14224
|
-
var Context2 = class {
|
|
14225
|
-
env;
|
|
14226
|
-
domSchemaChecker;
|
|
14227
|
-
oobRecorder;
|
|
14228
|
-
id;
|
|
14229
|
-
boundTarget;
|
|
14230
|
-
pipes;
|
|
14231
|
-
schemas;
|
|
14232
|
-
hostIsStandalone;
|
|
14233
|
-
hostPreserveWhitespaces;
|
|
14234
|
-
nextId = 1;
|
|
14235
|
-
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
|
|
14236
|
-
this.env = env;
|
|
14237
|
-
this.domSchemaChecker = domSchemaChecker;
|
|
14238
|
-
this.oobRecorder = oobRecorder;
|
|
14239
|
-
this.id = id;
|
|
14240
|
-
this.boundTarget = boundTarget;
|
|
14241
|
-
this.pipes = pipes;
|
|
14242
|
-
this.schemas = schemas;
|
|
14243
|
-
this.hostIsStandalone = hostIsStandalone;
|
|
14244
|
-
this.hostPreserveWhitespaces = hostPreserveWhitespaces;
|
|
14245
|
-
}
|
|
14246
|
-
/**
|
|
14247
|
-
* Allocate a new variable name for use within the `Context`.
|
|
14248
|
-
*
|
|
14249
|
-
* Currently this uses a monotonically increasing counter, but in the future the variable name
|
|
14250
|
-
* might change depending on the type of data being stored.
|
|
14251
|
-
*/
|
|
14252
|
-
allocateId() {
|
|
14253
|
-
return `_t${this.nextId++}`;
|
|
14254
|
-
}
|
|
14255
|
-
getPipeByName(name) {
|
|
14256
|
-
if (this.pipes === null || !this.pipes.has(name)) {
|
|
14257
|
-
return null;
|
|
14258
|
-
}
|
|
14259
|
-
return this.pipes.get(name);
|
|
14260
|
-
}
|
|
14261
|
-
};
|
|
14262
|
-
|
|
14263
14253
|
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/scope.js
|
|
14264
14254
|
import { TmplAstBoundText, TmplAstComponent as TmplAstComponent3, TmplAstContent, TmplAstDeferredBlock, TmplAstDirective as TmplAstDirective2, TmplAstElement as TmplAstElement8, TmplAstForLoopBlock as TmplAstForLoopBlock2, TmplAstHostElement as TmplAstHostElement5, TmplAstIcu, TmplAstIfBlock as TmplAstIfBlock2, TmplAstIfBlockBranch, TmplAstLetDeclaration as TmplAstLetDeclaration3, TmplAstReference as TmplAstReference2, TmplAstSwitchBlock as TmplAstSwitchBlock2, TmplAstTemplate as TmplAstTemplate5, TmplAstText as TmplAstText2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
14265
14255
|
|
|
@@ -14495,16 +14485,16 @@ var TcbExprTranslator = class {
|
|
|
14495
14485
|
const head = ast.elements[0];
|
|
14496
14486
|
let result;
|
|
14497
14487
|
if (length === 1) {
|
|
14498
|
-
result = `\`${head.text}\``;
|
|
14488
|
+
result = `\`${this.escapeTemplateLiteral(head.text)}\``;
|
|
14499
14489
|
} else {
|
|
14500
|
-
let parts = [`\`${head.text}`];
|
|
14490
|
+
let parts = [`\`${this.escapeTemplateLiteral(head.text)}`];
|
|
14501
14491
|
const tailIndex = length - 1;
|
|
14502
14492
|
for (let i = 1; i < tailIndex; i++) {
|
|
14503
14493
|
const expr = this.translate(ast.expressions[i - 1]);
|
|
14504
|
-
parts.push(`\${${expr.print()}}${ast.elements[i].text}`);
|
|
14494
|
+
parts.push(`\${${expr.print()}}${this.escapeTemplateLiteral(ast.elements[i].text)}`);
|
|
14505
14495
|
}
|
|
14506
14496
|
const resolvedExpression = this.translate(ast.expressions[tailIndex - 1]);
|
|
14507
|
-
parts.push(`\${${resolvedExpression.print()}}${ast.elements[tailIndex].text}\``);
|
|
14497
|
+
parts.push(`\${${resolvedExpression.print()}}${this.escapeTemplateLiteral(ast.elements[tailIndex].text)}\``);
|
|
14508
14498
|
result = parts.join("");
|
|
14509
14499
|
}
|
|
14510
14500
|
return new TcbExpr(result);
|
|
@@ -14560,6 +14550,9 @@ var TcbExprTranslator = class {
|
|
|
14560
14550
|
}
|
|
14561
14551
|
return new TcbExpr(`(${expr}!(${args}) as any)`);
|
|
14562
14552
|
}
|
|
14553
|
+
escapeTemplateLiteral(value) {
|
|
14554
|
+
return value.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\${/g, "$\\{");
|
|
14555
|
+
}
|
|
14563
14556
|
};
|
|
14564
14557
|
var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
|
|
14565
14558
|
static SINGLETON = new _VeSafeLhsInferenceBugDetector();
|
|
@@ -15295,7 +15288,6 @@ var TcbLetDeclarationOp = class extends TcbOp {
|
|
|
15295
15288
|
|
|
15296
15289
|
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
|
|
15297
15290
|
import { BindingType as BindingType5, R3Identifiers as R3Identifiers5 } from "@angular/compiler";
|
|
15298
|
-
import ts63 from "typescript";
|
|
15299
15291
|
|
|
15300
15292
|
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/signal_forms.js
|
|
15301
15293
|
import { BindingType as BindingType3, Call as Call4, PropertyRead as PropertyRead6, SafeCall as SafeCall3, TmplAstElement as TmplAstElement3, TmplAstHostElement as TmplAstHostElement2 } from "@angular/compiler";
|
|
@@ -15672,12 +15664,8 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
15672
15664
|
if (transformType !== void 0) {
|
|
15673
15665
|
type = new TcbExpr(transformType);
|
|
15674
15666
|
} else {
|
|
15675
|
-
const dirTypeRef = this.tcb.env.
|
|
15676
|
-
|
|
15677
|
-
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.name}`);
|
|
15678
|
-
}
|
|
15679
|
-
const typeName = ts63.isIdentifier(dirTypeRef.typeName) ? dirTypeRef.typeName.text : tempPrint(dirTypeRef.typeName, dirTypeRef.typeName.getSourceFile());
|
|
15680
|
-
type = new TcbExpr(`typeof ${typeName}.ngAcceptInputType_${fieldName}`);
|
|
15667
|
+
const dirTypeRef = this.tcb.env.referenceTcbValue(this.dir.ref);
|
|
15668
|
+
type = new TcbExpr(`typeof ${dirTypeRef.print()}.ngAcceptInputType_${fieldName}`);
|
|
15681
15669
|
}
|
|
15682
15670
|
const id = new TcbExpr(this.tcb.allocateId());
|
|
15683
15671
|
this.scope.addStatement(declareVariable(id, type));
|
|
@@ -15689,10 +15677,6 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
15689
15677
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
15690
15678
|
}
|
|
15691
15679
|
const id = new TcbExpr(this.tcb.allocateId());
|
|
15692
|
-
const dirTypeRef = this.tcb.env.referenceTcbType(this.dir.ref);
|
|
15693
|
-
if (!ts63.isTypeReferenceNode(dirTypeRef)) {
|
|
15694
|
-
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.name}`);
|
|
15695
|
-
}
|
|
15696
15680
|
const type = new TcbExpr(`(typeof ${dirId.print()})[${quoteAndEscape(fieldName)}]`);
|
|
15697
15681
|
const temp = declareVariable(id, type);
|
|
15698
15682
|
this.scope.addStatement(temp);
|
|
@@ -16037,7 +16021,6 @@ ${getStatementsBlock(statements)} }`;
|
|
|
16037
16021
|
|
|
16038
16022
|
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_type.js
|
|
16039
16023
|
import { TmplAstHostElement as TmplAstHostElement3 } from "@angular/compiler";
|
|
16040
|
-
import ts64 from "typescript";
|
|
16041
16024
|
var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
16042
16025
|
tcb;
|
|
16043
16026
|
scope;
|
|
@@ -16054,18 +16037,14 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
16054
16037
|
return true;
|
|
16055
16038
|
}
|
|
16056
16039
|
execute() {
|
|
16057
|
-
const rawType = this.tcb.env.
|
|
16040
|
+
const rawType = this.tcb.env.referenceTcbValue(this.dir.ref);
|
|
16058
16041
|
let type;
|
|
16059
16042
|
let span;
|
|
16060
16043
|
if (this.dir.isGeneric === false || this.dir.typeParameters === null || this.dir.typeParameters.length === 0) {
|
|
16061
|
-
type =
|
|
16044
|
+
type = rawType;
|
|
16062
16045
|
} else {
|
|
16063
|
-
if (!ts64.isTypeReferenceNode(rawType)) {
|
|
16064
|
-
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.name}`);
|
|
16065
|
-
}
|
|
16066
|
-
const typeName = ts64.isIdentifier(rawType.typeName) ? rawType.typeName.text : tempPrint(rawType.typeName, this.tcb.env.contextFile);
|
|
16067
16046
|
const typeArguments = Array(this.dir.typeParameters?.length ?? 0).fill("any").join(", ");
|
|
16068
|
-
type = new TcbExpr(`${
|
|
16047
|
+
type = new TcbExpr(`${rawType.print()}<${typeArguments}>`);
|
|
16069
16048
|
}
|
|
16070
16049
|
if (this.node instanceof TmplAstHostElement3) {
|
|
16071
16050
|
span = this.node.sourceSpan;
|
|
@@ -16215,7 +16194,7 @@ function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
|
16215
16194
|
|
|
16216
16195
|
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/content_projection.js
|
|
16217
16196
|
import { createCssSelectorFromNode, CssSelector as CssSelector3, SelectorMatcher as SelectorMatcher2, TmplAstElement as TmplAstElement7, TmplAstForLoopBlock, TmplAstIfBlock, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate4, TmplAstText } from "@angular/compiler";
|
|
16218
|
-
import
|
|
16197
|
+
import ts61 from "typescript";
|
|
16219
16198
|
var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
16220
16199
|
tcb;
|
|
16221
16200
|
element;
|
|
@@ -16228,7 +16207,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
16228
16207
|
this.element = element;
|
|
16229
16208
|
this.ngContentSelectors = ngContentSelectors;
|
|
16230
16209
|
this.componentName = componentName;
|
|
16231
|
-
this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ?
|
|
16210
|
+
this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts61.DiagnosticCategory.Error : ts61.DiagnosticCategory.Warning;
|
|
16232
16211
|
}
|
|
16233
16212
|
optional = false;
|
|
16234
16213
|
execute() {
|
|
@@ -16838,7 +16817,7 @@ var Scope = class _Scope {
|
|
|
16838
16817
|
getDirectiveOp(dir, node, customFieldType) {
|
|
16839
16818
|
if (!dir.isGeneric) {
|
|
16840
16819
|
return new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir);
|
|
16841
|
-
} else if (!dir.
|
|
16820
|
+
} else if (!dir.requiresInlineTypeCtor || this.tcb.env.config.useInlineTypeConstructors) {
|
|
16842
16821
|
return new TcbDirectiveCtorOp(this.tcb, this, node, dir, customFieldType);
|
|
16843
16822
|
}
|
|
16844
16823
|
return new TcbGenericDirectiveTypeWithAnyParamsOp(this.tcb, this, node, dir);
|
|
@@ -17015,39 +16994,13 @@ var Scope = class _Scope {
|
|
|
17015
16994
|
};
|
|
17016
16995
|
|
|
17017
16996
|
// packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
|
|
17018
|
-
function generateTypeCheckBlock(env, component, name, meta, domSchemaChecker, oobRecorder
|
|
16997
|
+
function generateTypeCheckBlock(env, component, name, meta, domSchemaChecker, oobRecorder) {
|
|
17019
16998
|
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
|
|
17020
|
-
const ctxRawType = env.
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
}
|
|
17024
|
-
|
|
17025
|
-
let typeArguments = void 0;
|
|
17026
|
-
if (component.typeParameters !== void 0) {
|
|
17027
|
-
if (!env.config.useContextGenericType) {
|
|
17028
|
-
genericContextBehavior = TcbGenericContextBehavior.FallbackToAny;
|
|
17029
|
-
}
|
|
17030
|
-
switch (genericContextBehavior) {
|
|
17031
|
-
case TcbGenericContextBehavior.UseEmitter:
|
|
17032
|
-
const emittedParams = component.typeParameters || [];
|
|
17033
|
-
typeParameters = emittedParams;
|
|
17034
|
-
typeArguments = typeParameters.map((param) => param.name);
|
|
17035
|
-
break;
|
|
17036
|
-
case TcbGenericContextBehavior.CopyClassNodes:
|
|
17037
|
-
const copiedParams = component.typeParameters ? [...component.typeParameters] : [];
|
|
17038
|
-
typeParameters = copiedParams;
|
|
17039
|
-
typeArguments = typeParameters.map((param) => param.name);
|
|
17040
|
-
break;
|
|
17041
|
-
case TcbGenericContextBehavior.FallbackToAny:
|
|
17042
|
-
typeArguments = Array.from({ length: component.typeParameters?.length ?? 0 }).map(() => "any");
|
|
17043
|
-
break;
|
|
17044
|
-
}
|
|
17045
|
-
}
|
|
17046
|
-
const sourceFile = env.contextFile;
|
|
17047
|
-
const typeParamsStr = typeParameters === void 0 || typeParameters.length === 0 ? "" : `<${typeParameters.map((p) => p.representation).join(", ")}>`;
|
|
17048
|
-
const typeArgsStr = typeArguments === void 0 || typeArguments.length === 0 ? "" : `<${typeArguments.join(", ")}>`;
|
|
17049
|
-
const typeRef = ts66.isIdentifier(ctxRawType.typeName) ? ctxRawType.typeName.text : tempPrint(ctxRawType.typeName, sourceFile);
|
|
17050
|
-
const thisParamStr = `this: ${typeRef}${typeArgsStr}`;
|
|
16999
|
+
const ctxRawType = env.referenceTcbValue(component.ref);
|
|
17000
|
+
const { typeParameters, typeArguments } = component;
|
|
17001
|
+
const typeParamsStr = !env.config.useContextGenericType || typeParameters === null || typeParameters.length === 0 ? "" : `<${typeParameters.map((p) => p.representation).join(", ")}>`;
|
|
17002
|
+
const typeArgsStr = typeArguments === null || typeArguments.length === 0 ? "" : `<${typeArguments.join(", ")}>`;
|
|
17003
|
+
const thisParamStr = `this: ${ctxRawType.print()}${typeArgsStr}`;
|
|
17051
17004
|
const statements = [];
|
|
17052
17005
|
if (tcb.boundTarget.target.template !== void 0) {
|
|
17053
17006
|
const templateScope = Scope.forNodes(
|
|
@@ -17067,7 +17020,7 @@ function generateTypeCheckBlock(env, component, name, meta, domSchemaChecker, oo
|
|
|
17067
17020
|
const bodyStr = `{
|
|
17068
17021
|
${statements.join("\n")}
|
|
17069
17022
|
}`;
|
|
17070
|
-
const funcDeclStr = `function ${name
|
|
17023
|
+
const funcDeclStr = `function ${name}${typeParamsStr}(${thisParamStr}) ${bodyStr}`;
|
|
17071
17024
|
return `/*${meta.id}*/
|
|
17072
17025
|
${funcDeclStr}`;
|
|
17073
17026
|
}
|
|
@@ -17080,7 +17033,7 @@ ${statements}
|
|
|
17080
17033
|
}
|
|
17081
17034
|
|
|
17082
17035
|
// packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.js
|
|
17083
|
-
import
|
|
17036
|
+
import ts62 from "typescript";
|
|
17084
17037
|
var TypeCheckFile = class extends Environment {
|
|
17085
17038
|
fileName;
|
|
17086
17039
|
isTypeCheckFile = true;
|
|
@@ -17093,13 +17046,13 @@ var TypeCheckFile = class extends Environment {
|
|
|
17093
17046
|
// Type check block code affects code completion and fix suggestions.
|
|
17094
17047
|
// We want to encourage single quotes for now, like we always did.
|
|
17095
17048
|
shouldUseSingleQuotes: () => true
|
|
17096
|
-
}), refEmitter, reflector,
|
|
17049
|
+
}), refEmitter, reflector, ts62.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts62.ScriptTarget.Latest, true));
|
|
17097
17050
|
this.fileName = fileName;
|
|
17098
17051
|
}
|
|
17099
17052
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
17100
|
-
const fnId =
|
|
17101
|
-
const { tcbMeta, component } = adaptTypeCheckBlockMetadata(ref, meta, this);
|
|
17102
|
-
const fn = generateTypeCheckBlock(this, component, fnId, tcbMeta, domSchemaChecker, oobRecorder
|
|
17053
|
+
const fnId = `_tcb${this.nextTcbId++}`;
|
|
17054
|
+
const { tcbMeta, component } = adaptTypeCheckBlockMetadata(ref, meta, this, genericContextBehavior);
|
|
17055
|
+
const fn = generateTypeCheckBlock(this, component, fnId, tcbMeta, domSchemaChecker, oobRecorder);
|
|
17103
17056
|
this.tcbStatements.push(fn);
|
|
17104
17057
|
}
|
|
17105
17058
|
render() {
|
|
@@ -17108,11 +17061,11 @@ var TypeCheckFile = class extends Environment {
|
|
|
17108
17061
|
if (importChanges.updatedImports.size > 0) {
|
|
17109
17062
|
throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
|
|
17110
17063
|
}
|
|
17111
|
-
const printer =
|
|
17064
|
+
const printer = ts62.createPrinter();
|
|
17112
17065
|
let source = "";
|
|
17113
17066
|
const newImports = importChanges.newImports.get(this.contextFile.fileName);
|
|
17114
17067
|
if (newImports !== void 0) {
|
|
17115
|
-
source += newImports.map((i) => printer.printNode(
|
|
17068
|
+
source += newImports.map((i) => printer.printNode(ts62.EmitHint.Unspecified, i, this.contextFile)).join("\n");
|
|
17116
17069
|
}
|
|
17117
17070
|
source += "\n";
|
|
17118
17071
|
source += getStatementsBlock(this.pipeInstStatements);
|
|
@@ -17284,7 +17237,7 @@ var TypeCheckContextImpl = class {
|
|
|
17284
17237
|
if (!this.opMap.has(sf)) {
|
|
17285
17238
|
return null;
|
|
17286
17239
|
}
|
|
17287
|
-
const printer =
|
|
17240
|
+
const printer = ts63.createPrinter({ omitTrailingSemicolon: true });
|
|
17288
17241
|
const importManager = new ImportManager({
|
|
17289
17242
|
// This minimizes noticeable changes with older versions of `ImportManager`.
|
|
17290
17243
|
forceGenerateNamespacesForNewImports: true,
|
|
@@ -17303,7 +17256,7 @@ var TypeCheckContextImpl = class {
|
|
|
17303
17256
|
newImports.get(sf.fileName).forEach((newImport) => {
|
|
17304
17257
|
updates.push({
|
|
17305
17258
|
pos: 0,
|
|
17306
|
-
text: printer.printNode(
|
|
17259
|
+
text: printer.printNode(ts63.EmitHint.Unspecified, newImport, sf)
|
|
17307
17260
|
});
|
|
17308
17261
|
});
|
|
17309
17262
|
}
|
|
@@ -17314,7 +17267,7 @@ var TypeCheckContextImpl = class {
|
|
|
17314
17267
|
updates.push({
|
|
17315
17268
|
pos: oldBindings.getStart(),
|
|
17316
17269
|
deletePos: oldBindings.getEnd(),
|
|
17317
|
-
text: printer.printNode(
|
|
17270
|
+
text: printer.printNode(ts63.EmitHint.Unspecified, newBindings, sf)
|
|
17318
17271
|
});
|
|
17319
17272
|
}
|
|
17320
17273
|
const result = new MagicString(sf.text, { filename: sf.fileName });
|
|
@@ -17373,7 +17326,7 @@ var TypeCheckContextImpl = class {
|
|
|
17373
17326
|
if (!fileData.shimData.has(shimPath)) {
|
|
17374
17327
|
fileData.shimData.set(shimPath, {
|
|
17375
17328
|
domSchemaChecker: new RegistryDomSchemaChecker(fileData.sourceManager),
|
|
17376
|
-
oobRecorder: new OutOfBandDiagnosticRecorderImpl(fileData.sourceManager, (name) => this.compilerHost.getSourceFile(name,
|
|
17329
|
+
oobRecorder: new OutOfBandDiagnosticRecorderImpl(fileData.sourceManager, (name) => this.compilerHost.getSourceFile(name, ts63.ScriptTarget.Latest)),
|
|
17377
17330
|
file: new TypeCheckFile(shimPath, this.config, this.refEmitter, this.reflector, this.compilerHost),
|
|
17378
17331
|
data: /* @__PURE__ */ new Map()
|
|
17379
17332
|
});
|
|
@@ -17399,7 +17352,7 @@ function getTemplateDiagnostics(parseErrors, templateId, sourceMapping) {
|
|
|
17399
17352
|
if (span.start.offset === span.end.offset) {
|
|
17400
17353
|
span.end.offset++;
|
|
17401
17354
|
}
|
|
17402
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
17355
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts63.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
17403
17356
|
});
|
|
17404
17357
|
}
|
|
17405
17358
|
var InlineTcbOp = class {
|
|
@@ -17425,9 +17378,9 @@ var InlineTcbOp = class {
|
|
|
17425
17378
|
}
|
|
17426
17379
|
execute(im, sf, refEmitter) {
|
|
17427
17380
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
17428
|
-
const fnName =
|
|
17429
|
-
const { tcbMeta, component } = adaptTypeCheckBlockMetadata(this.ref, this.meta, env);
|
|
17430
|
-
const fn = generateTypeCheckBlock(env, component, fnName, tcbMeta, this.domSchemaChecker, this.oobRecorder
|
|
17381
|
+
const fnName = `_tcb_${this.ref.node.pos}`;
|
|
17382
|
+
const { tcbMeta, component } = adaptTypeCheckBlockMetadata(this.ref, this.meta, env, TcbGenericContextBehavior.CopyClassNodes);
|
|
17383
|
+
const fn = generateTypeCheckBlock(env, component, fnName, tcbMeta, this.domSchemaChecker, this.oobRecorder);
|
|
17431
17384
|
return fn;
|
|
17432
17385
|
}
|
|
17433
17386
|
};
|
|
@@ -17453,8 +17406,6 @@ var TypeCtorOp = class {
|
|
|
17453
17406
|
};
|
|
17454
17407
|
|
|
17455
17408
|
// packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
|
|
17456
|
-
import { AbsoluteSourceSpan as AbsoluteSourceSpan6 } from "@angular/compiler";
|
|
17457
|
-
import ts69 from "typescript";
|
|
17458
17409
|
function shouldReportDiagnostic(diagnostic) {
|
|
17459
17410
|
const { code } = diagnostic;
|
|
17460
17411
|
if (code === 6133) {
|
|
@@ -17607,7 +17558,7 @@ var DirectiveSourceManager = class {
|
|
|
17607
17558
|
|
|
17608
17559
|
// packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.js
|
|
17609
17560
|
import { AST, ASTWithName as ASTWithName2, ASTWithSource as ASTWithSource2, Binary as Binary2, BindingPipe as BindingPipe2, PropertyRead as PropertyRead8, R3Identifiers as R3Identifiers6, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute5, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstComponent as TmplAstComponent4, TmplAstDirective as TmplAstDirective3, TmplAstElement as TmplAstElement9, TmplAstLetDeclaration as TmplAstLetDeclaration4, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate6, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
17610
|
-
import
|
|
17561
|
+
import ts64 from "typescript";
|
|
17611
17562
|
var SymbolBuilder = class {
|
|
17612
17563
|
tcbPath;
|
|
17613
17564
|
tcbIsShim;
|
|
@@ -17664,7 +17615,7 @@ var SymbolBuilder = class {
|
|
|
17664
17615
|
const elementSourceSpan = element.startSourceSpan ?? element.sourceSpan;
|
|
17665
17616
|
const node = findFirstMatchingNode(this.typeCheckBlock, {
|
|
17666
17617
|
withSpan: elementSourceSpan,
|
|
17667
|
-
filter:
|
|
17618
|
+
filter: ts64.isVariableDeclaration
|
|
17668
17619
|
});
|
|
17669
17620
|
if (node === null) {
|
|
17670
17621
|
return null;
|
|
@@ -17721,7 +17672,7 @@ var SymbolBuilder = class {
|
|
|
17721
17672
|
const seenDirectives = /* @__PURE__ */ new Set();
|
|
17722
17673
|
for (const node of nodes) {
|
|
17723
17674
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
17724
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
17675
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts64.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
17725
17676
|
continue;
|
|
17726
17677
|
}
|
|
17727
17678
|
const declaration = symbol.tsSymbol.valueDeclaration;
|
|
@@ -17756,7 +17707,7 @@ var SymbolBuilder = class {
|
|
|
17756
17707
|
throw new Error("Impossible state: typecheck code path in local compilation mode.");
|
|
17757
17708
|
}
|
|
17758
17709
|
const node = current.directive.node;
|
|
17759
|
-
if (!
|
|
17710
|
+
if (!ts64.isClassDeclaration(node) || seenDirectives.has(node)) {
|
|
17760
17711
|
continue;
|
|
17761
17712
|
}
|
|
17762
17713
|
const symbol = this.getSymbolOfTsNode(node);
|
|
@@ -17846,10 +17797,10 @@ var SymbolBuilder = class {
|
|
|
17846
17797
|
if (!isAccessExpression(n2)) {
|
|
17847
17798
|
return false;
|
|
17848
17799
|
}
|
|
17849
|
-
if (
|
|
17800
|
+
if (ts64.isPropertyAccessExpression(n2)) {
|
|
17850
17801
|
return n2.name.getText() === expectedAccess;
|
|
17851
17802
|
} else {
|
|
17852
|
-
return
|
|
17803
|
+
return ts64.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
|
|
17853
17804
|
}
|
|
17854
17805
|
}
|
|
17855
17806
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, {
|
|
@@ -17859,7 +17810,7 @@ var SymbolBuilder = class {
|
|
|
17859
17810
|
const bindings = [];
|
|
17860
17811
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
17861
17812
|
if (consumer instanceof TmplAstTemplate6 || consumer instanceof TmplAstElement9) {
|
|
17862
|
-
if (!
|
|
17813
|
+
if (!ts64.isPropertyAccessExpression(outputFieldAccess)) {
|
|
17863
17814
|
continue;
|
|
17864
17815
|
}
|
|
17865
17816
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -17882,7 +17833,7 @@ var SymbolBuilder = class {
|
|
|
17882
17833
|
}
|
|
17883
17834
|
});
|
|
17884
17835
|
} else {
|
|
17885
|
-
if (!
|
|
17836
|
+
if (!ts64.isElementAccessExpression(outputFieldAccess)) {
|
|
17886
17837
|
continue;
|
|
17887
17838
|
}
|
|
17888
17839
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -17935,7 +17886,7 @@ var SymbolBuilder = class {
|
|
|
17935
17886
|
let fieldAccessExpr;
|
|
17936
17887
|
let symbolInfo = null;
|
|
17937
17888
|
if (signalInputAssignment !== null) {
|
|
17938
|
-
if (
|
|
17889
|
+
if (ts64.isIdentifier(signalInputAssignment.fieldExpr)) {
|
|
17939
17890
|
continue;
|
|
17940
17891
|
}
|
|
17941
17892
|
const fieldSymbol = this.getSymbolOfTsNode(signalInputAssignment.fieldExpr);
|
|
@@ -17975,7 +17926,7 @@ var SymbolBuilder = class {
|
|
|
17975
17926
|
return null;
|
|
17976
17927
|
}
|
|
17977
17928
|
const [declaration] = tsSymbol.declarations;
|
|
17978
|
-
if (!
|
|
17929
|
+
if (!ts64.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
|
|
17979
17930
|
// The expression identifier could be on the type (for regular directives) or the name
|
|
17980
17931
|
// (for generic directives and the ctor op).
|
|
17981
17932
|
declaration.getSourceFile(),
|
|
@@ -17985,7 +17936,7 @@ var SymbolBuilder = class {
|
|
|
17985
17936
|
return null;
|
|
17986
17937
|
}
|
|
17987
17938
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
17988
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
17939
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts64.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
17989
17940
|
return null;
|
|
17990
17941
|
}
|
|
17991
17942
|
const ref = new Reference(symbol.tsSymbol.valueDeclaration);
|
|
@@ -18009,13 +17960,13 @@ var SymbolBuilder = class {
|
|
|
18009
17960
|
getSymbolOfVariable(variable) {
|
|
18010
17961
|
const node = findFirstMatchingNode(this.typeCheckBlock, {
|
|
18011
17962
|
withSpan: variable.sourceSpan,
|
|
18012
|
-
filter:
|
|
17963
|
+
filter: ts64.isVariableDeclaration
|
|
18013
17964
|
});
|
|
18014
17965
|
if (node === null) {
|
|
18015
17966
|
return null;
|
|
18016
17967
|
}
|
|
18017
17968
|
let nodeValueSymbol = null;
|
|
18018
|
-
if (
|
|
17969
|
+
if (ts64.isForOfStatement(node.parent.parent)) {
|
|
18019
17970
|
nodeValueSymbol = this.getSymbolOfTsNode(node);
|
|
18020
17971
|
} else if (node.initializer !== void 0) {
|
|
18021
17972
|
nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
|
|
@@ -18040,12 +17991,12 @@ var SymbolBuilder = class {
|
|
|
18040
17991
|
const target = this.typeCheckData.boundTarget.getReferenceTarget(ref);
|
|
18041
17992
|
let node = findFirstMatchingNode(this.typeCheckBlock, {
|
|
18042
17993
|
withSpan: ref.sourceSpan,
|
|
18043
|
-
filter:
|
|
17994
|
+
filter: ts64.isVariableDeclaration
|
|
18044
17995
|
});
|
|
18045
17996
|
if (node === null || target === null || node.initializer === void 0) {
|
|
18046
17997
|
return null;
|
|
18047
17998
|
}
|
|
18048
|
-
const originalDeclaration =
|
|
17999
|
+
const originalDeclaration = ts64.isParenthesizedExpression(node.initializer) && ts64.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
18049
18000
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
18050
18001
|
return null;
|
|
18051
18002
|
}
|
|
@@ -18069,7 +18020,7 @@ var SymbolBuilder = class {
|
|
|
18069
18020
|
referenceVarLocation: referenceVarTcbLocation
|
|
18070
18021
|
};
|
|
18071
18022
|
} else {
|
|
18072
|
-
if (!
|
|
18023
|
+
if (!ts64.isClassDeclaration(target.directive.ref.node)) {
|
|
18073
18024
|
return null;
|
|
18074
18025
|
}
|
|
18075
18026
|
return {
|
|
@@ -18086,7 +18037,7 @@ var SymbolBuilder = class {
|
|
|
18086
18037
|
getSymbolOfLetDeclaration(decl) {
|
|
18087
18038
|
const node = findFirstMatchingNode(this.typeCheckBlock, {
|
|
18088
18039
|
withSpan: decl.sourceSpan,
|
|
18089
|
-
filter:
|
|
18040
|
+
filter: ts64.isVariableDeclaration
|
|
18090
18041
|
});
|
|
18091
18042
|
if (node === null) {
|
|
18092
18043
|
return null;
|
|
@@ -18111,7 +18062,7 @@ var SymbolBuilder = class {
|
|
|
18111
18062
|
getSymbolOfPipe(expression) {
|
|
18112
18063
|
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, {
|
|
18113
18064
|
withSpan: expression.nameSpan,
|
|
18114
|
-
filter:
|
|
18065
|
+
filter: ts64.isPropertyAccessExpression
|
|
18115
18066
|
});
|
|
18116
18067
|
if (methodAccess === null) {
|
|
18117
18068
|
return null;
|
|
@@ -18156,7 +18107,7 @@ var SymbolBuilder = class {
|
|
|
18156
18107
|
if (expression instanceof PropertyRead8) {
|
|
18157
18108
|
node = findFirstMatchingNode(this.typeCheckBlock, {
|
|
18158
18109
|
withSpan,
|
|
18159
|
-
filter:
|
|
18110
|
+
filter: ts64.isPropertyAccessExpression
|
|
18160
18111
|
});
|
|
18161
18112
|
}
|
|
18162
18113
|
if (node === null) {
|
|
@@ -18165,10 +18116,10 @@ var SymbolBuilder = class {
|
|
|
18165
18116
|
if (node === null) {
|
|
18166
18117
|
return null;
|
|
18167
18118
|
}
|
|
18168
|
-
while (
|
|
18119
|
+
while (ts64.isParenthesizedExpression(node)) {
|
|
18169
18120
|
node = node.expression;
|
|
18170
18121
|
}
|
|
18171
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
18122
|
+
if (expression instanceof SafePropertyRead4 && ts64.isConditionalExpression(node)) {
|
|
18172
18123
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
18173
18124
|
if (whenTrueSymbol === null) {
|
|
18174
18125
|
return null;
|
|
@@ -18186,13 +18137,13 @@ var SymbolBuilder = class {
|
|
|
18186
18137
|
}
|
|
18187
18138
|
}
|
|
18188
18139
|
getSymbolOfTsNode(node) {
|
|
18189
|
-
while (
|
|
18140
|
+
while (ts64.isParenthesizedExpression(node)) {
|
|
18190
18141
|
node = node.expression;
|
|
18191
18142
|
}
|
|
18192
18143
|
let tsSymbol;
|
|
18193
|
-
if (
|
|
18144
|
+
if (ts64.isPropertyAccessExpression(node)) {
|
|
18194
18145
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
18195
|
-
} else if (
|
|
18146
|
+
} else if (ts64.isCallExpression(node)) {
|
|
18196
18147
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.expression);
|
|
18197
18148
|
} else {
|
|
18198
18149
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -18213,13 +18164,13 @@ var SymbolBuilder = class {
|
|
|
18213
18164
|
};
|
|
18214
18165
|
}
|
|
18215
18166
|
getTcbPositionForNode(node) {
|
|
18216
|
-
if (
|
|
18167
|
+
if (ts64.isTypeReferenceNode(node)) {
|
|
18217
18168
|
return this.getTcbPositionForNode(node.typeName);
|
|
18218
|
-
} else if (
|
|
18169
|
+
} else if (ts64.isQualifiedName(node)) {
|
|
18219
18170
|
return node.right.getStart();
|
|
18220
|
-
} else if (
|
|
18171
|
+
} else if (ts64.isPropertyAccessExpression(node)) {
|
|
18221
18172
|
return node.name.getStart();
|
|
18222
|
-
} else if (
|
|
18173
|
+
} else if (ts64.isElementAccessExpression(node)) {
|
|
18223
18174
|
return node.argumentExpression.getStart();
|
|
18224
18175
|
} else {
|
|
18225
18176
|
return node.getStart();
|
|
@@ -18233,13 +18184,13 @@ function sourceSpanEqual(a, b) {
|
|
|
18233
18184
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
18234
18185
|
}
|
|
18235
18186
|
function unwrapSignalInputWriteTAccessor(expr) {
|
|
18236
|
-
if (!
|
|
18187
|
+
if (!ts64.isElementAccessExpression(expr) || !ts64.isPropertyAccessExpression(expr.argumentExpression)) {
|
|
18237
18188
|
return null;
|
|
18238
18189
|
}
|
|
18239
|
-
if (!
|
|
18190
|
+
if (!ts64.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
|
|
18240
18191
|
return null;
|
|
18241
18192
|
}
|
|
18242
|
-
if (!
|
|
18193
|
+
if (!ts64.isPropertyAccessExpression(expr.expression) && !ts64.isElementAccessExpression(expr.expression) && !ts64.isIdentifier(expr.expression)) {
|
|
18243
18194
|
throw new Error("Unexpected expression for signal input write type.");
|
|
18244
18195
|
}
|
|
18245
18196
|
return {
|
|
@@ -18264,10 +18215,10 @@ function findMatchingDirective(originalSourceFile, directiveDeclarationInTypeChe
|
|
|
18264
18215
|
function collectClassesWithName(sourceFile, className) {
|
|
18265
18216
|
const classes = [];
|
|
18266
18217
|
function visit2(node) {
|
|
18267
|
-
if (
|
|
18218
|
+
if (ts64.isClassDeclaration(node) && node.name?.text === className) {
|
|
18268
18219
|
classes.push(node);
|
|
18269
18220
|
}
|
|
18270
|
-
|
|
18221
|
+
ts64.forEachChild(node, visit2);
|
|
18271
18222
|
}
|
|
18272
18223
|
sourceFile.forEachChild(visit2);
|
|
18273
18224
|
return classes;
|
|
@@ -19079,7 +19030,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
19079
19030
|
}
|
|
19080
19031
|
}
|
|
19081
19032
|
return { kind, symbolName: emitted.node.text, isForwardReference };
|
|
19082
|
-
} else if (emitted instanceof
|
|
19033
|
+
} else if (emitted instanceof ExternalExpr8 && emitted.value.moduleName !== null && emitted.value.name !== null) {
|
|
19083
19034
|
return {
|
|
19084
19035
|
kind,
|
|
19085
19036
|
moduleSpecifier: emitted.value.moduleName,
|
|
@@ -19296,11 +19247,11 @@ function getClassDeclFromSymbol(symbol, checker) {
|
|
|
19296
19247
|
if (decl === void 0) {
|
|
19297
19248
|
return null;
|
|
19298
19249
|
}
|
|
19299
|
-
if (
|
|
19250
|
+
if (ts65.isExportAssignment(decl)) {
|
|
19300
19251
|
const symbol2 = checker.getTypeAtLocation(decl.expression).getSymbol();
|
|
19301
19252
|
return getClassDeclFromSymbol(symbol2, checker);
|
|
19302
19253
|
}
|
|
19303
|
-
if (
|
|
19254
|
+
if (ts65.isExportSpecifier(decl)) {
|
|
19304
19255
|
const symbol2 = checker.getTypeAtLocation(decl).getSymbol();
|
|
19305
19256
|
return getClassDeclFromSymbol(symbol2, checker);
|
|
19306
19257
|
}
|
|
@@ -19333,7 +19284,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
|
|
|
19333
19284
|
const nodeType = typeChecker.getTypeAtLocation(diagNode);
|
|
19334
19285
|
const nodeSymbolDeclarations = nodeType.getSymbol()?.declarations;
|
|
19335
19286
|
const decl = nodeSymbolDeclarations !== void 0 && nodeSymbolDeclarations.length > 0 ? nodeSymbolDeclarations[0] : void 0;
|
|
19336
|
-
if (decl === void 0 || !
|
|
19287
|
+
if (decl === void 0 || !ts65.isClassDeclaration(decl)) {
|
|
19337
19288
|
continue;
|
|
19338
19289
|
}
|
|
19339
19290
|
const directiveForDiagnostic = templateTypeChecker.getDirectiveMetadata(decl);
|
|
@@ -19353,7 +19304,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
|
|
|
19353
19304
|
if (decl === void 0) {
|
|
19354
19305
|
continue;
|
|
19355
19306
|
}
|
|
19356
|
-
if (!
|
|
19307
|
+
if (!ts65.isClassDeclaration(decl)) {
|
|
19357
19308
|
continue;
|
|
19358
19309
|
}
|
|
19359
19310
|
const diagnostic = nodeToDiag.get(decl);
|
|
@@ -19632,7 +19583,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
19632
19583
|
if (!this.typeCheckHostBindings) {
|
|
19633
19584
|
return;
|
|
19634
19585
|
}
|
|
19635
|
-
if (!
|
|
19586
|
+
if (!ts66.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
|
|
19636
19587
|
return;
|
|
19637
19588
|
}
|
|
19638
19589
|
const ref = new Reference(node);
|
|
@@ -19741,17 +19692,17 @@ var DirectiveDecoratorHandler = class {
|
|
|
19741
19692
|
};
|
|
19742
19693
|
|
|
19743
19694
|
// packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.js
|
|
19744
|
-
import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as
|
|
19745
|
-
import
|
|
19695
|
+
import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr9, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr3, R3Identifiers as R3Identifiers7, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
|
|
19696
|
+
import ts68 from "typescript";
|
|
19746
19697
|
|
|
19747
19698
|
// packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.js
|
|
19748
|
-
import
|
|
19699
|
+
import ts67 from "typescript";
|
|
19749
19700
|
function createModuleWithProvidersResolver(reflector, isCore) {
|
|
19750
19701
|
function _reflectModuleFromTypeParam(type, node) {
|
|
19751
|
-
if (!
|
|
19702
|
+
if (!ts67.isTypeReferenceNode(type)) {
|
|
19752
19703
|
return null;
|
|
19753
19704
|
}
|
|
19754
|
-
const typeName = type && (
|
|
19705
|
+
const typeName = type && (ts67.isIdentifier(type.typeName) && type.typeName || ts67.isQualifiedName(type.typeName) && type.typeName.right) || null;
|
|
19755
19706
|
if (typeName === null) {
|
|
19756
19707
|
return null;
|
|
19757
19708
|
}
|
|
@@ -19763,7 +19714,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
19763
19714
|
return null;
|
|
19764
19715
|
}
|
|
19765
19716
|
if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
|
|
19766
|
-
const parent =
|
|
19717
|
+
const parent = ts67.isMethodDeclaration(node) && ts67.isClassDeclaration(node.parent) ? node.parent : null;
|
|
19767
19718
|
const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
|
|
19768
19719
|
throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
|
|
19769
19720
|
}
|
|
@@ -19771,15 +19722,15 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
19771
19722
|
return typeNodeToValueExpr(arg);
|
|
19772
19723
|
}
|
|
19773
19724
|
function _reflectModuleFromLiteralType(type) {
|
|
19774
|
-
if (!
|
|
19725
|
+
if (!ts67.isIntersectionTypeNode(type)) {
|
|
19775
19726
|
return null;
|
|
19776
19727
|
}
|
|
19777
19728
|
for (const t of type.types) {
|
|
19778
|
-
if (
|
|
19729
|
+
if (ts67.isTypeLiteralNode(t)) {
|
|
19779
19730
|
for (const m of t.members) {
|
|
19780
|
-
const ngModuleType =
|
|
19731
|
+
const ngModuleType = ts67.isPropertySignature(m) && ts67.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
19781
19732
|
let ngModuleExpression = null;
|
|
19782
|
-
if (ngModuleType !== null &&
|
|
19733
|
+
if (ngModuleType !== null && ts67.isTypeQueryNode(ngModuleType)) {
|
|
19783
19734
|
ngModuleExpression = entityNameToValue(ngModuleType.exprName);
|
|
19784
19735
|
} else if (ngModuleType !== null) {
|
|
19785
19736
|
ngModuleExpression = typeNodeToValueExpr(ngModuleType);
|
|
@@ -19957,8 +19908,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
19957
19908
|
if (decorator.args === null || decorator.args.length > 1) {
|
|
19958
19909
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
|
|
19959
19910
|
}
|
|
19960
|
-
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) :
|
|
19961
|
-
if (!
|
|
19911
|
+
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts68.factory.createObjectLiteralExpression([]);
|
|
19912
|
+
if (!ts68.isObjectLiteralExpression(meta)) {
|
|
19962
19913
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
|
|
19963
19914
|
}
|
|
19964
19915
|
const ngModule = reflectObjectLiteral(meta);
|
|
@@ -20045,7 +19996,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
20045
19996
|
id = new WrappedNodeExpr10(idExpr);
|
|
20046
19997
|
} else {
|
|
20047
19998
|
const diag = makeDiagnostic(ErrorCode.WARN_NGMODULE_ID_UNNECESSARY, idExpr, `Using 'module.id' for NgModule.id is a common anti-pattern that is ignored by the Angular compiler.`);
|
|
20048
|
-
diag.category =
|
|
19999
|
+
diag.category = ts68.DiagnosticCategory.Warning;
|
|
20049
20000
|
diagnostics.push(diag);
|
|
20050
20001
|
}
|
|
20051
20002
|
}
|
|
@@ -20105,16 +20056,16 @@ var NgModuleDecoratorHandler = class {
|
|
|
20105
20056
|
}
|
|
20106
20057
|
const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
|
|
20107
20058
|
let wrappedProviders = null;
|
|
20108
|
-
if (rawProviders !== null && (!
|
|
20059
|
+
if (rawProviders !== null && (!ts68.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
|
|
20109
20060
|
wrappedProviders = new WrappedNodeExpr10(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
|
|
20110
20061
|
}
|
|
20111
20062
|
const topLevelImports = [];
|
|
20112
20063
|
if (!allowUnresolvedReferences && ngModule.has("imports")) {
|
|
20113
20064
|
const rawImports2 = unwrapExpression(ngModule.get("imports"));
|
|
20114
20065
|
let topLevelExpressions = [];
|
|
20115
|
-
if (
|
|
20066
|
+
if (ts68.isArrayLiteralExpression(rawImports2)) {
|
|
20116
20067
|
for (const element of rawImports2.elements) {
|
|
20117
|
-
if (
|
|
20068
|
+
if (ts68.isSpreadElement(element)) {
|
|
20118
20069
|
topLevelExpressions.push(element.expression);
|
|
20119
20070
|
continue;
|
|
20120
20071
|
}
|
|
@@ -20154,7 +20105,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
20154
20105
|
if (exp === null) {
|
|
20155
20106
|
continue;
|
|
20156
20107
|
}
|
|
20157
|
-
if (
|
|
20108
|
+
if (ts68.isArrayLiteralExpression(exp)) {
|
|
20158
20109
|
if (exp.elements) {
|
|
20159
20110
|
injectorMetadata.imports.push(...exp.elements.map((n2) => new WrappedNodeExpr10(n2)));
|
|
20160
20111
|
}
|
|
@@ -20384,7 +20335,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
20384
20335
|
const componentType = this.refEmitter.emit(decl, context);
|
|
20385
20336
|
assertSuccessfulReferenceEmit(componentType, node, "component");
|
|
20386
20337
|
const declExpr = componentType.expression;
|
|
20387
|
-
const setComponentScope = new
|
|
20338
|
+
const setComponentScope = new ExternalExpr9(R3Identifiers7.setComponentScope);
|
|
20388
20339
|
const callExpr = new InvokeFunctionExpr(setComponentScope, [
|
|
20389
20340
|
declExpr,
|
|
20390
20341
|
directiveExpr,
|
|
@@ -20485,7 +20436,7 @@ function isNgModule(node, compilation) {
|
|
|
20485
20436
|
return !compilation.dependencies.some((dep) => dep.ref.node === node);
|
|
20486
20437
|
}
|
|
20487
20438
|
function isModuleIdExpression(expr) {
|
|
20488
|
-
return
|
|
20439
|
+
return ts68.isPropertyAccessExpression(expr) && ts68.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
|
|
20489
20440
|
}
|
|
20490
20441
|
function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
|
|
20491
20442
|
const componentClassName = bootstrappedClassRef.node.name.text;
|
|
@@ -20558,7 +20509,7 @@ var ComponentSymbol = class _ComponentSymbol extends DirectiveSymbol {
|
|
|
20558
20509
|
};
|
|
20559
20510
|
|
|
20560
20511
|
// packages/compiler-cli/src/ngtsc/annotations/component/src/util.js
|
|
20561
|
-
import
|
|
20512
|
+
import ts69 from "typescript";
|
|
20562
20513
|
function collectLegacyAnimationNames(value, legacyAnimationTriggerNames) {
|
|
20563
20514
|
if (value instanceof Map) {
|
|
20564
20515
|
const name = value.get("name");
|
|
@@ -20605,7 +20556,7 @@ function validateAndFlattenComponentImports(imports, expr, isDeferred) {
|
|
|
20605
20556
|
for (let i = 0; i < imports.length; i++) {
|
|
20606
20557
|
const ref = imports[i];
|
|
20607
20558
|
let refExpr = expr;
|
|
20608
|
-
if (
|
|
20559
|
+
if (ts69.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts69.isSpreadAssignment)) {
|
|
20609
20560
|
refExpr = expr.elements[i];
|
|
20610
20561
|
}
|
|
20611
20562
|
if (Array.isArray(ref)) {
|
|
@@ -20667,11 +20618,11 @@ import { outputAst as o4 } from "@angular/compiler";
|
|
|
20667
20618
|
|
|
20668
20619
|
// packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.js
|
|
20669
20620
|
import { outputAst as o3 } from "@angular/compiler";
|
|
20670
|
-
import
|
|
20621
|
+
import ts70 from "typescript";
|
|
20671
20622
|
function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator) {
|
|
20672
|
-
const name =
|
|
20623
|
+
const name = ts70.isClassDeclaration(node) && node.name ? node.name.text : null;
|
|
20673
20624
|
const visitor = new PotentialTopLevelReadsVisitor();
|
|
20674
|
-
const sourceFile =
|
|
20625
|
+
const sourceFile = ts70.getOriginalNode(node).getSourceFile();
|
|
20675
20626
|
definition.expression.visitExpression(visitor, null);
|
|
20676
20627
|
definition.statements.forEach((statement) => statement.visitStatement(visitor, null));
|
|
20677
20628
|
factory.initializer?.visitExpression(visitor, null);
|
|
@@ -20732,21 +20683,21 @@ function getRuntimeRepresentation(node, reflection, evaluator) {
|
|
|
20732
20683
|
function getTopLevelDeclarationNames(sourceFile) {
|
|
20733
20684
|
const results = /* @__PURE__ */ new Set();
|
|
20734
20685
|
for (const node of sourceFile.statements) {
|
|
20735
|
-
if (
|
|
20686
|
+
if (ts70.isClassDeclaration(node) || ts70.isFunctionDeclaration(node) || ts70.isEnumDeclaration(node)) {
|
|
20736
20687
|
if (node.name) {
|
|
20737
20688
|
results.add(node.name.text);
|
|
20738
20689
|
}
|
|
20739
20690
|
continue;
|
|
20740
20691
|
}
|
|
20741
|
-
if (
|
|
20692
|
+
if (ts70.isVariableStatement(node)) {
|
|
20742
20693
|
for (const decl of node.declarationList.declarations) {
|
|
20743
20694
|
trackBindingName(decl.name, results);
|
|
20744
20695
|
}
|
|
20745
20696
|
continue;
|
|
20746
20697
|
}
|
|
20747
|
-
if (
|
|
20698
|
+
if (ts70.isImportDeclaration(node) && node.importClause) {
|
|
20748
20699
|
const importClause = node.importClause;
|
|
20749
|
-
if (importClause.phaseModifier ===
|
|
20700
|
+
if (importClause.phaseModifier === ts70.SyntaxKind.TypeKeyword) {
|
|
20750
20701
|
continue;
|
|
20751
20702
|
}
|
|
20752
20703
|
if (importClause.name) {
|
|
@@ -20754,7 +20705,7 @@ function getTopLevelDeclarationNames(sourceFile) {
|
|
|
20754
20705
|
}
|
|
20755
20706
|
if (importClause.namedBindings) {
|
|
20756
20707
|
const namedBindings = importClause.namedBindings;
|
|
20757
|
-
if (
|
|
20708
|
+
if (ts70.isNamespaceImport(namedBindings)) {
|
|
20758
20709
|
results.add(namedBindings.name.text);
|
|
20759
20710
|
} else {
|
|
20760
20711
|
namedBindings.elements.forEach((el) => {
|
|
@@ -20770,11 +20721,11 @@ function getTopLevelDeclarationNames(sourceFile) {
|
|
|
20770
20721
|
return results;
|
|
20771
20722
|
}
|
|
20772
20723
|
function trackBindingName(node, results) {
|
|
20773
|
-
if (
|
|
20724
|
+
if (ts70.isIdentifier(node)) {
|
|
20774
20725
|
results.add(node.text);
|
|
20775
20726
|
} else {
|
|
20776
20727
|
for (const el of node.elements) {
|
|
20777
|
-
if (!
|
|
20728
|
+
if (!ts70.isOmittedExpression(el)) {
|
|
20778
20729
|
trackBindingName(el.name, results);
|
|
20779
20730
|
}
|
|
20780
20731
|
}
|
|
@@ -20804,10 +20755,10 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
|
|
|
20804
20755
|
* @param node Node from which to start the traversal.
|
|
20805
20756
|
*/
|
|
20806
20757
|
addAllTopLevelIdentifiers = (node) => {
|
|
20807
|
-
if (
|
|
20758
|
+
if (ts70.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
|
|
20808
20759
|
this.allReads.add(node);
|
|
20809
20760
|
} else {
|
|
20810
|
-
|
|
20761
|
+
ts70.forEachChild(node, this.addAllTopLevelIdentifiers);
|
|
20811
20762
|
}
|
|
20812
20763
|
};
|
|
20813
20764
|
/**
|
|
@@ -20822,52 +20773,52 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
|
|
|
20822
20773
|
if (!parent) {
|
|
20823
20774
|
return false;
|
|
20824
20775
|
}
|
|
20825
|
-
if (
|
|
20826
|
-
while (parent &&
|
|
20776
|
+
if (ts70.isParenthesizedExpression(parent) && parent.expression === node) {
|
|
20777
|
+
while (parent && ts70.isParenthesizedExpression(parent)) {
|
|
20827
20778
|
node = parent;
|
|
20828
20779
|
parent = parent.parent;
|
|
20829
20780
|
}
|
|
20830
20781
|
}
|
|
20831
|
-
if (
|
|
20782
|
+
if (ts70.isSourceFile(parent)) {
|
|
20832
20783
|
return true;
|
|
20833
20784
|
}
|
|
20834
|
-
if (
|
|
20785
|
+
if (ts70.isCallExpression(parent)) {
|
|
20835
20786
|
return parent.expression === node || parent.arguments.includes(node);
|
|
20836
20787
|
}
|
|
20837
|
-
if (
|
|
20788
|
+
if (ts70.isExpressionStatement(parent) || ts70.isPropertyAccessExpression(parent) || ts70.isComputedPropertyName(parent) || ts70.isTemplateSpan(parent) || ts70.isSpreadAssignment(parent) || ts70.isSpreadElement(parent) || ts70.isAwaitExpression(parent) || ts70.isNonNullExpression(parent) || ts70.isIfStatement(parent) || ts70.isDoStatement(parent) || ts70.isWhileStatement(parent) || ts70.isSwitchStatement(parent) || ts70.isCaseClause(parent) || ts70.isThrowStatement(parent) || ts70.isNewExpression(parent) || ts70.isExpressionWithTypeArguments(parent)) {
|
|
20838
20789
|
return parent.expression === node;
|
|
20839
20790
|
}
|
|
20840
|
-
if (
|
|
20791
|
+
if (ts70.isArrayLiteralExpression(parent)) {
|
|
20841
20792
|
return parent.elements.includes(node);
|
|
20842
20793
|
}
|
|
20843
|
-
if (
|
|
20794
|
+
if (ts70.isPropertyAssignment(parent) || ts70.isParameter(parent) || ts70.isBindingElement(parent) || ts70.isPropertyDeclaration(parent) || ts70.isEnumMember(parent)) {
|
|
20844
20795
|
return parent.initializer === node;
|
|
20845
20796
|
}
|
|
20846
|
-
if (
|
|
20797
|
+
if (ts70.isVariableDeclaration(parent)) {
|
|
20847
20798
|
return parent.name === node || parent.initializer === node;
|
|
20848
20799
|
}
|
|
20849
|
-
if (
|
|
20800
|
+
if (ts70.isClassDeclaration(parent) || ts70.isFunctionDeclaration(parent) || ts70.isShorthandPropertyAssignment(parent)) {
|
|
20850
20801
|
return parent.name === node;
|
|
20851
20802
|
}
|
|
20852
|
-
if (
|
|
20803
|
+
if (ts70.isElementAccessExpression(parent)) {
|
|
20853
20804
|
return parent.expression === node || parent.argumentExpression === node;
|
|
20854
20805
|
}
|
|
20855
|
-
if (
|
|
20806
|
+
if (ts70.isBinaryExpression(parent)) {
|
|
20856
20807
|
return parent.left === node || parent.right === node;
|
|
20857
20808
|
}
|
|
20858
|
-
if (
|
|
20809
|
+
if (ts70.isForInStatement(parent) || ts70.isForOfStatement(parent)) {
|
|
20859
20810
|
return parent.expression === node || parent.initializer === node;
|
|
20860
20811
|
}
|
|
20861
|
-
if (
|
|
20812
|
+
if (ts70.isForStatement(parent)) {
|
|
20862
20813
|
return parent.condition === node || parent.initializer === node || parent.incrementor === node;
|
|
20863
20814
|
}
|
|
20864
|
-
if (
|
|
20815
|
+
if (ts70.isArrowFunction(parent)) {
|
|
20865
20816
|
return parent.body === node;
|
|
20866
20817
|
}
|
|
20867
|
-
if (
|
|
20818
|
+
if (ts70.isImportSpecifier(parent) || ts70.isExportSpecifier(parent)) {
|
|
20868
20819
|
return (parent.propertyName || parent.name) === node;
|
|
20869
20820
|
}
|
|
20870
|
-
if (
|
|
20821
|
+
if (ts70.isConditionalExpression(parent)) {
|
|
20871
20822
|
return parent.condition === node || parent.whenFalse === node || parent.whenTrue === node;
|
|
20872
20823
|
}
|
|
20873
20824
|
return false;
|
|
@@ -20879,20 +20830,20 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
|
|
|
20879
20830
|
};
|
|
20880
20831
|
function isConstEnumReference(node, reflection) {
|
|
20881
20832
|
const parent = node.parent;
|
|
20882
|
-
if (!parent || !
|
|
20833
|
+
if (!parent || !ts70.isPropertyAccessExpression(parent) || parent.expression !== node || !ts70.isIdentifier(parent.name)) {
|
|
20883
20834
|
return false;
|
|
20884
20835
|
}
|
|
20885
20836
|
const declaration = reflection.getDeclarationOfIdentifier(node);
|
|
20886
|
-
return declaration !== null &&
|
|
20837
|
+
return declaration !== null && ts70.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts70.SyntaxKind.ConstKeyword);
|
|
20887
20838
|
}
|
|
20888
20839
|
|
|
20889
20840
|
// packages/compiler-cli/src/ngtsc/hmr/src/metadata.js
|
|
20890
|
-
import
|
|
20841
|
+
import ts71 from "typescript";
|
|
20891
20842
|
function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
|
|
20892
20843
|
if (!reflection.isClass(clazz)) {
|
|
20893
20844
|
return null;
|
|
20894
20845
|
}
|
|
20895
|
-
const sourceFile =
|
|
20846
|
+
const sourceFile = ts71.getOriginalNode(clazz).getSourceFile();
|
|
20896
20847
|
const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
|
|
20897
20848
|
const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
|
|
20898
20849
|
if (dependencies === null) {
|
|
@@ -20910,7 +20861,7 @@ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDi
|
|
|
20910
20861
|
|
|
20911
20862
|
// packages/compiler-cli/src/ngtsc/hmr/src/update_declaration.js
|
|
20912
20863
|
import { compileHmrUpdateCallback } from "@angular/compiler";
|
|
20913
|
-
import
|
|
20864
|
+
import ts72 from "typescript";
|
|
20914
20865
|
function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, declaration) {
|
|
20915
20866
|
const namespaceSpecifiers = meta.namespaceDependencies.reduce((result, current) => {
|
|
20916
20867
|
result.set(current.moduleName, current.assignedName);
|
|
@@ -20922,11 +20873,11 @@ function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, d
|
|
|
20922
20873
|
rewriter: importRewriter
|
|
20923
20874
|
});
|
|
20924
20875
|
const callback = compileHmrUpdateCallback(compilationResults, constantStatements, meta);
|
|
20925
|
-
const sourceFile =
|
|
20876
|
+
const sourceFile = ts72.getOriginalNode(declaration).getSourceFile();
|
|
20926
20877
|
const node = translateStatement(sourceFile, callback, importManager);
|
|
20927
|
-
return
|
|
20928
|
-
|
|
20929
|
-
|
|
20878
|
+
return ts72.factory.updateFunctionDeclaration(node, [
|
|
20879
|
+
ts72.factory.createToken(ts72.SyntaxKind.ExportKeyword),
|
|
20880
|
+
ts72.factory.createToken(ts72.SyntaxKind.DefaultKeyword)
|
|
20930
20881
|
], node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body);
|
|
20931
20882
|
}
|
|
20932
20883
|
var HmrModuleImportRewriter = class {
|
|
@@ -21373,7 +21324,7 @@ var ComponentDecoratorHandler = class {
|
|
|
21373
21324
|
path: absoluteFrom(template.declaration.resolvedTemplateUrl),
|
|
21374
21325
|
node: template.sourceMapping.node
|
|
21375
21326
|
};
|
|
21376
|
-
const relativeTemplatePath = getProjectRelativePath(templateResource.path ??
|
|
21327
|
+
const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts73.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
|
|
21377
21328
|
let selectorlessEnabled = false;
|
|
21378
21329
|
let localReferencedSymbols = null;
|
|
21379
21330
|
if (this.enableSelectorless) {
|
|
@@ -21407,7 +21358,7 @@ var ComponentDecoratorHandler = class {
|
|
|
21407
21358
|
externalStyles.push(resourceUrl);
|
|
21408
21359
|
continue;
|
|
21409
21360
|
}
|
|
21410
|
-
if (styleUrl.source === 2 &&
|
|
21361
|
+
if (styleUrl.source === 2 && ts73.isStringLiteralLike(styleUrl.expression)) {
|
|
21411
21362
|
styleResources.add({
|
|
21412
21363
|
path: absoluteFrom(resourceUrl),
|
|
21413
21364
|
node: styleUrl.expression
|
|
@@ -21615,7 +21566,7 @@ var ComponentDecoratorHandler = class {
|
|
|
21615
21566
|
return null;
|
|
21616
21567
|
}
|
|
21617
21568
|
typeCheck(ctx, node, meta) {
|
|
21618
|
-
if (!
|
|
21569
|
+
if (!ts73.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
|
|
21619
21570
|
return;
|
|
21620
21571
|
}
|
|
21621
21572
|
const ref = new Reference(node);
|
|
@@ -22024,7 +21975,7 @@ var ComponentDecoratorHandler = class {
|
|
|
22024
21975
|
data.declarations = eagerDeclarations;
|
|
22025
21976
|
if (this.compilationMode === CompilationMode.LOCAL && this.localCompilationExtraImportsTracker !== null) {
|
|
22026
21977
|
for (const { type } of eagerDeclarations) {
|
|
22027
|
-
if (type instanceof
|
|
21978
|
+
if (type instanceof ExternalExpr10 && type.value.moduleName) {
|
|
22028
21979
|
this.localCompilationExtraImportsTracker.addImportForFile(context, type.value.moduleName);
|
|
22029
21980
|
}
|
|
22030
21981
|
}
|
|
@@ -22146,12 +22097,12 @@ var ComponentDecoratorHandler = class {
|
|
|
22146
22097
|
*/
|
|
22147
22098
|
collectExplicitlyDeferredSymbols(rawDeferredImports) {
|
|
22148
22099
|
const deferredTypes = /* @__PURE__ */ new Map();
|
|
22149
|
-
if (!
|
|
22100
|
+
if (!ts73.isArrayLiteralExpression(rawDeferredImports)) {
|
|
22150
22101
|
return deferredTypes;
|
|
22151
22102
|
}
|
|
22152
22103
|
for (const element of rawDeferredImports.elements) {
|
|
22153
22104
|
const node = tryUnwrapForwardRef(element, this.reflector) || element;
|
|
22154
|
-
if (!
|
|
22105
|
+
if (!ts73.isIdentifier(node)) {
|
|
22155
22106
|
continue;
|
|
22156
22107
|
}
|
|
22157
22108
|
const imp = this.reflector.getImportOfIdentifier(node);
|
|
@@ -22219,12 +22170,12 @@ var ComponentDecoratorHandler = class {
|
|
|
22219
22170
|
}
|
|
22220
22171
|
}
|
|
22221
22172
|
if (analysisData.meta.isStandalone) {
|
|
22222
|
-
if (analysisData.rawImports !== null &&
|
|
22173
|
+
if (analysisData.rawImports !== null && ts73.isArrayLiteralExpression(analysisData.rawImports)) {
|
|
22223
22174
|
for (const element of analysisData.rawImports.elements) {
|
|
22224
22175
|
this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
|
|
22225
22176
|
}
|
|
22226
22177
|
}
|
|
22227
|
-
if (analysisData.rawDeferredImports !== null &&
|
|
22178
|
+
if (analysisData.rawDeferredImports !== null && ts73.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
|
|
22228
22179
|
for (const element of analysisData.rawDeferredImports.elements) {
|
|
22229
22180
|
this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
|
|
22230
22181
|
}
|
|
@@ -22243,7 +22194,7 @@ var ComponentDecoratorHandler = class {
|
|
|
22243
22194
|
*/
|
|
22244
22195
|
registerDeferrableCandidate(componentClassDecl, element, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
|
|
22245
22196
|
const node = tryUnwrapForwardRef(element, this.reflector) || element;
|
|
22246
|
-
if (!
|
|
22197
|
+
if (!ts73.isIdentifier(node)) {
|
|
22247
22198
|
return;
|
|
22248
22199
|
}
|
|
22249
22200
|
const imp = this.reflector.getImportOfIdentifier(node);
|
|
@@ -22378,7 +22329,7 @@ function isDefaultImport(node) {
|
|
|
22378
22329
|
|
|
22379
22330
|
// packages/compiler-cli/src/ngtsc/annotations/src/injectable.js
|
|
22380
22331
|
import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr11 } from "@angular/compiler";
|
|
22381
|
-
import
|
|
22332
|
+
import ts74 from "typescript";
|
|
22382
22333
|
var InjectableDecoratorHandler = class {
|
|
22383
22334
|
reflector;
|
|
22384
22335
|
evaluator;
|
|
@@ -22513,7 +22464,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
22513
22464
|
};
|
|
22514
22465
|
} else if (decorator.args.length === 1) {
|
|
22515
22466
|
const metaNode = decorator.args[0];
|
|
22516
|
-
if (!
|
|
22467
|
+
if (!ts74.isObjectLiteralExpression(metaNode)) {
|
|
22517
22468
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
|
|
22518
22469
|
}
|
|
22519
22470
|
const meta = reflectObjectLiteral(metaNode);
|
|
@@ -22525,7 +22476,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
22525
22476
|
let deps = void 0;
|
|
22526
22477
|
if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
|
|
22527
22478
|
const depsExpr = meta.get("deps");
|
|
22528
|
-
if (!
|
|
22479
|
+
if (!ts74.isArrayLiteralExpression(depsExpr)) {
|
|
22529
22480
|
throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
|
|
22530
22481
|
}
|
|
22531
22482
|
deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
|
|
@@ -22614,12 +22565,12 @@ function getDep(dep, reflector) {
|
|
|
22614
22565
|
}
|
|
22615
22566
|
return true;
|
|
22616
22567
|
}
|
|
22617
|
-
if (
|
|
22568
|
+
if (ts74.isArrayLiteralExpression(dep)) {
|
|
22618
22569
|
dep.elements.forEach((el) => {
|
|
22619
22570
|
let isDecorator = false;
|
|
22620
|
-
if (
|
|
22571
|
+
if (ts74.isIdentifier(el)) {
|
|
22621
22572
|
isDecorator = maybeUpdateDecorator(el, reflector);
|
|
22622
|
-
} else if (
|
|
22573
|
+
} else if (ts74.isNewExpression(el) && ts74.isIdentifier(el.expression)) {
|
|
22623
22574
|
const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
|
|
22624
22575
|
isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
|
|
22625
22576
|
}
|
|
@@ -22633,7 +22584,7 @@ function getDep(dep, reflector) {
|
|
|
22633
22584
|
|
|
22634
22585
|
// packages/compiler-cli/src/ngtsc/annotations/src/pipe.js
|
|
22635
22586
|
import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
|
|
22636
|
-
import
|
|
22587
|
+
import ts75 from "typescript";
|
|
22637
22588
|
var PipeSymbol = class _PipeSymbol extends SemanticSymbol {
|
|
22638
22589
|
name;
|
|
22639
22590
|
constructor(decl, name) {
|
|
@@ -22703,13 +22654,13 @@ var PipeDecoratorHandler = class {
|
|
|
22703
22654
|
}
|
|
22704
22655
|
const meta = decorator.args.length === 0 || // TODO(crisbeto): temporary for testing until we've changed
|
|
22705
22656
|
// the pipe public API not to require a name.
|
|
22706
|
-
|
|
22657
|
+
ts75.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts75.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
|
|
22707
22658
|
let pipeName = null;
|
|
22708
22659
|
let pipeNameExpr = null;
|
|
22709
22660
|
let pure = true;
|
|
22710
22661
|
let isStandalone = this.implicitStandaloneValue;
|
|
22711
22662
|
if (meta !== null) {
|
|
22712
|
-
if (!
|
|
22663
|
+
if (!ts75.isObjectLiteralExpression(meta)) {
|
|
22713
22664
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
|
|
22714
22665
|
}
|
|
22715
22666
|
const pipe = reflectObjectLiteral(meta);
|
|
@@ -22835,12 +22786,12 @@ var PipeDecoratorHandler = class {
|
|
|
22835
22786
|
};
|
|
22836
22787
|
|
|
22837
22788
|
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform.js
|
|
22838
|
-
import
|
|
22789
|
+
import ts78 from "typescript";
|
|
22839
22790
|
|
|
22840
22791
|
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform_api.js
|
|
22841
|
-
import
|
|
22792
|
+
import ts76 from "typescript";
|
|
22842
22793
|
function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngClassDecorator, sourceFile, decoratorName) {
|
|
22843
|
-
const classDecoratorIdentifier =
|
|
22794
|
+
const classDecoratorIdentifier = ts76.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
|
|
22844
22795
|
return factory.createPropertyAccessExpression(
|
|
22845
22796
|
importManager.addImport({
|
|
22846
22797
|
exportModuleSpecifier: "@angular/core",
|
|
@@ -22850,11 +22801,11 @@ function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngCla
|
|
|
22850
22801
|
// The synthetic identifier may be checked later by the downlevel decorators
|
|
22851
22802
|
// transform to resolve to an Angular import using `getSymbolAtLocation`. We trick
|
|
22852
22803
|
// the transform to think it's not synthetic and comes from Angular core.
|
|
22853
|
-
|
|
22804
|
+
ts76.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
|
|
22854
22805
|
);
|
|
22855
22806
|
}
|
|
22856
22807
|
function castAsAny(factory, expr) {
|
|
22857
|
-
return factory.createAsExpression(expr, factory.createKeywordTypeNode(
|
|
22808
|
+
return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword));
|
|
22858
22809
|
}
|
|
22859
22810
|
|
|
22860
22811
|
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/input_function.js
|
|
@@ -22885,7 +22836,7 @@ var signalInputsTransform = (member, sourceFile, host, factory, importTracker, i
|
|
|
22885
22836
|
};
|
|
22886
22837
|
|
|
22887
22838
|
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/model_function.js
|
|
22888
|
-
import
|
|
22839
|
+
import ts77 from "typescript";
|
|
22889
22840
|
var signalModelTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
|
|
22890
22841
|
if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => {
|
|
22891
22842
|
return isAngularDecorator2(d, "Input", isCore) || isAngularDecorator2(d, "Output", isCore);
|
|
@@ -22906,7 +22857,7 @@ var signalModelTransform = (member, sourceFile, host, factory, importTracker, im
|
|
|
22906
22857
|
// Config is cast to `any` because `isSignal` will be private, and in case this
|
|
22907
22858
|
// transform is used directly as a pre-compilation step, the decorator should
|
|
22908
22859
|
// not fail. It is already validated now due to us parsing the input metadata.
|
|
22909
|
-
factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(
|
|
22860
|
+
factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts77.SyntaxKind.AnyKeyword)),
|
|
22910
22861
|
classDecorator,
|
|
22911
22862
|
factory,
|
|
22912
22863
|
sourceFile,
|
|
@@ -22981,21 +22932,21 @@ function getInitializerApiJitTransform(host, importTracker, isCore, shouldTransf
|
|
|
22981
22932
|
return (ctx) => {
|
|
22982
22933
|
return (sourceFile) => {
|
|
22983
22934
|
const importManager = new ImportManager();
|
|
22984
|
-
sourceFile =
|
|
22935
|
+
sourceFile = ts78.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts78.isSourceFile);
|
|
22985
22936
|
return importManager.transformTsFile(ctx, sourceFile);
|
|
22986
22937
|
};
|
|
22987
22938
|
};
|
|
22988
22939
|
}
|
|
22989
22940
|
function createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass) {
|
|
22990
22941
|
const visitor = (node) => {
|
|
22991
|
-
if (
|
|
22992
|
-
const originalNode =
|
|
22942
|
+
if (ts78.isClassDeclaration(node) && node.name !== void 0) {
|
|
22943
|
+
const originalNode = ts78.getOriginalNode(node, ts78.isClassDeclaration);
|
|
22993
22944
|
const angularDecorator = host.getDecoratorsOfDeclaration(originalNode)?.find((d) => decoratorsWithInputs.some((name) => isAngularDecorator2(d, name, isCore)));
|
|
22994
22945
|
if (angularDecorator !== void 0 && (shouldTransformClass === void 0 || shouldTransformClass(node))) {
|
|
22995
22946
|
let hasChanged = false;
|
|
22996
22947
|
const sourceFile = originalNode.getSourceFile();
|
|
22997
22948
|
const members = node.members.map((memberNode) => {
|
|
22998
|
-
if (!
|
|
22949
|
+
if (!ts78.isPropertyDeclaration(memberNode)) {
|
|
22999
22950
|
return memberNode;
|
|
23000
22951
|
}
|
|
23001
22952
|
const member = reflectClassMember(memberNode);
|
|
@@ -23016,7 +22967,7 @@ function createTransformVisitor(ctx, host, importManager, importTracker, isCore,
|
|
|
23016
22967
|
}
|
|
23017
22968
|
}
|
|
23018
22969
|
}
|
|
23019
|
-
return
|
|
22970
|
+
return ts78.visitEachChild(node, visitor, ctx);
|
|
23020
22971
|
};
|
|
23021
22972
|
return visitor;
|
|
23022
22973
|
}
|
|
@@ -23175,4 +23126,4 @@ export {
|
|
|
23175
23126
|
* Use of this source code is governed by an MIT-style license that can be
|
|
23176
23127
|
* found in the LICENSE file at https://angular.dev/license
|
|
23177
23128
|
*/
|
|
23178
|
-
//# sourceMappingURL=chunk-
|
|
23129
|
+
//# sourceMappingURL=chunk-YF2MWLZG.js.map
|