@angular/compiler-cli 22.0.0-next.3 → 22.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-EAE5KCUR.js → chunk-33PKOB6H.js} +4 -4
- package/bundles/{chunk-NPMPTFII.js → chunk-6IEU2J75.js} +37 -7
- package/bundles/{chunk-NPMPTFII.js.map → chunk-6IEU2J75.js.map} +1 -1
- package/bundles/{chunk-HFKTR5QY.js → chunk-AI2LKYE3.js} +3 -3
- package/bundles/chunk-AI2LKYE3.js.map +6 -0
- package/bundles/{chunk-XSRMZ57L.js → chunk-ARNGIZEA.js} +47 -50
- package/bundles/chunk-ARNGIZEA.js.map +6 -0
- package/bundles/{chunk-5EGV6MZF.js → chunk-BCQGTZBZ.js} +127 -92
- package/bundles/chunk-BCQGTZBZ.js.map +6 -0
- package/bundles/{chunk-I6T4FEIP.js → chunk-L35AQF75.js} +84 -37
- package/bundles/chunk-L35AQF75.js.map +6 -0
- package/bundles/{chunk-UUQRZWDP.js → chunk-TXJNNYJ4.js} +2 -2
- package/bundles/index.js +6 -6
- 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/hybrid_analysis.js +2 -2
- package/bundles/private/migrations.js +4 -4
- package/bundles/private/testing.js +38 -11
- package/bundles/private/testing.js.map +2 -2
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +6 -6
- package/bundles/src/bin/ngc.js +6 -6
- package/linker/babel/src/ast/babel_ast_factory.d.ts +15 -8
- package/linker/src/file_linker/emit_scopes/emit_scope.d.ts +3 -3
- package/linker/src/file_linker/emit_scopes/local_emit_scope.d.ts +1 -1
- package/linker/src/file_linker/file_linker.d.ts +2 -2
- package/linker/src/file_linker/linker_environment.d.ts +4 -4
- package/linker/src/file_linker/partial_linkers/partial_linker_selector.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/linker/src/file_linker/translator.d.ts +2 -2
- package/linker/src/linker_import_generator.d.ts +2 -2
- package/package.json +2 -2
- package/src/ngtsc/file_system/testing/index.d.ts +1 -1
- package/src/ngtsc/file_system/testing/src/test_helper.d.ts +1 -0
- package/src/ngtsc/translator/src/api/ast_factory.d.ts +38 -6
- package/src/ngtsc/translator/src/translator.d.ts +8 -2
- package/src/ngtsc/translator/src/typescript_ast_factory.d.ts +12 -6
- package/src/ngtsc/typecheck/api/api.d.ts +2 -1
- package/src/ngtsc/typecheck/src/tcb_adapter.d.ts +2 -1
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +1 -2
- package/bundles/chunk-5EGV6MZF.js.map +0 -6
- package/bundles/chunk-HFKTR5QY.js.map +0 -6
- package/bundles/chunk-I6T4FEIP.js.map +0 -6
- package/bundles/chunk-XSRMZ57L.js.map +0 -6
- /package/bundles/{chunk-EAE5KCUR.js.map → chunk-33PKOB6H.js.map} +0 -0
- /package/bundles/{chunk-UUQRZWDP.js.map → chunk-TXJNNYJ4.js.map} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
Context,
|
|
7
7
|
ExpressionTranslatorVisitor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-L35AQF75.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 === "22.0.0-next.
|
|
232
|
+
const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "22.0.0-next.4";
|
|
233
233
|
const prefix = isPreRelease ? "next" : `v${VERSION.major}`;
|
|
234
234
|
return `https://${prefix}.angular.dev`;
|
|
235
235
|
})();
|
|
@@ -5239,19 +5239,22 @@ var TypeScriptAstFactory = class {
|
|
|
5239
5239
|
if (!ts25.isBlock(body)) {
|
|
5240
5240
|
throw new Error(`Invalid syntax, expected a block, but got ${ts25.SyntaxKind[body.kind]}.`);
|
|
5241
5241
|
}
|
|
5242
|
-
return ts25.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) =>
|
|
5242
|
+
return ts25.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => this.createParameter(param)), void 0, body);
|
|
5243
5243
|
}
|
|
5244
5244
|
createFunctionExpression(functionName, parameters, body) {
|
|
5245
5245
|
if (!ts25.isBlock(body)) {
|
|
5246
5246
|
throw new Error(`Invalid syntax, expected a block, but got ${ts25.SyntaxKind[body.kind]}.`);
|
|
5247
5247
|
}
|
|
5248
|
-
return ts25.factory.createFunctionExpression(void 0, void 0, functionName ?? void 0, void 0, parameters.map((param) =>
|
|
5248
|
+
return ts25.factory.createFunctionExpression(void 0, void 0, functionName ?? void 0, void 0, parameters.map((param) => this.createParameter(param)), void 0, body);
|
|
5249
5249
|
}
|
|
5250
5250
|
createArrowFunctionExpression(parameters, body) {
|
|
5251
5251
|
if (ts25.isStatement(body) && !ts25.isBlock(body)) {
|
|
5252
5252
|
throw new Error(`Invalid syntax, expected a block, but got ${ts25.SyntaxKind[body.kind]}.`);
|
|
5253
5253
|
}
|
|
5254
|
-
return ts25.factory.createArrowFunction(void 0, void 0, parameters.map((param) =>
|
|
5254
|
+
return ts25.factory.createArrowFunction(void 0, void 0, parameters.map((param) => this.createParameter(param)), void 0, void 0, body);
|
|
5255
|
+
}
|
|
5256
|
+
createParameter(param) {
|
|
5257
|
+
return ts25.factory.createParameterDeclaration(void 0, void 0, param.name, void 0, param.type ?? void 0);
|
|
5255
5258
|
}
|
|
5256
5259
|
createIdentifier = ts25.factory.createIdentifier;
|
|
5257
5260
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
@@ -5326,10 +5329,10 @@ var TypeScriptAstFactory = class {
|
|
|
5326
5329
|
createUnaryExpression(operator, operand) {
|
|
5327
5330
|
return ts25.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
5328
5331
|
}
|
|
5329
|
-
createVariableDeclaration(variableName, initializer, type) {
|
|
5332
|
+
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
5330
5333
|
return ts25.factory.createVariableStatement(void 0, ts25.factory.createVariableDeclarationList([
|
|
5331
|
-
ts25.factory.createVariableDeclaration(variableName, void 0, void 0, initializer ?? void 0)
|
|
5332
|
-
], this.VAR_TYPES[
|
|
5334
|
+
ts25.factory.createVariableDeclaration(variableName, void 0, type ?? void 0, initializer ?? void 0)
|
|
5335
|
+
], this.VAR_TYPES[variableType]));
|
|
5333
5336
|
}
|
|
5334
5337
|
createRegularExpressionLiteral(body, flags) {
|
|
5335
5338
|
return ts25.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
@@ -5350,6 +5353,44 @@ var TypeScriptAstFactory = class {
|
|
|
5350
5353
|
});
|
|
5351
5354
|
return node;
|
|
5352
5355
|
}
|
|
5356
|
+
createBuiltInType(type) {
|
|
5357
|
+
switch (type) {
|
|
5358
|
+
case "any":
|
|
5359
|
+
return ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword);
|
|
5360
|
+
case "boolean":
|
|
5361
|
+
return ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.BooleanKeyword);
|
|
5362
|
+
case "number":
|
|
5363
|
+
return ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.NumberKeyword);
|
|
5364
|
+
case "string":
|
|
5365
|
+
return ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.StringKeyword);
|
|
5366
|
+
case "function":
|
|
5367
|
+
return ts25.factory.createTypeReferenceNode(ts25.factory.createIdentifier("Function"));
|
|
5368
|
+
case "never":
|
|
5369
|
+
return ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.NeverKeyword);
|
|
5370
|
+
case "unknown":
|
|
5371
|
+
return ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.UnknownKeyword);
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
createExpressionType(expression, typeParams) {
|
|
5375
|
+
const typeName = getEntityTypeFromExpression(expression);
|
|
5376
|
+
return ts25.factory.createTypeReferenceNode(typeName, typeParams ?? void 0);
|
|
5377
|
+
}
|
|
5378
|
+
createArrayType(elementType) {
|
|
5379
|
+
return ts25.factory.createArrayTypeNode(elementType);
|
|
5380
|
+
}
|
|
5381
|
+
createMapType(valueType) {
|
|
5382
|
+
return ts25.factory.createTypeLiteralNode([
|
|
5383
|
+
ts25.factory.createIndexSignature(void 0, [
|
|
5384
|
+
ts25.factory.createParameterDeclaration(void 0, void 0, "key", void 0, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.StringKeyword))
|
|
5385
|
+
], valueType)
|
|
5386
|
+
]);
|
|
5387
|
+
}
|
|
5388
|
+
transplantType(type) {
|
|
5389
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts25.isTypeNode(type)) {
|
|
5390
|
+
return type;
|
|
5391
|
+
}
|
|
5392
|
+
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
5393
|
+
}
|
|
5353
5394
|
};
|
|
5354
5395
|
function createTemplateMiddle(cooked, raw) {
|
|
5355
5396
|
const node = ts25.factory.createTemplateHead(cooked, raw);
|
|
@@ -5373,6 +5414,19 @@ function attachComments(statement, leadingComments) {
|
|
|
5373
5414
|
}
|
|
5374
5415
|
}
|
|
5375
5416
|
}
|
|
5417
|
+
function getEntityTypeFromExpression(expression) {
|
|
5418
|
+
if (ts25.isIdentifier(expression)) {
|
|
5419
|
+
return expression;
|
|
5420
|
+
}
|
|
5421
|
+
if (ts25.isPropertyAccessExpression(expression)) {
|
|
5422
|
+
const left = getEntityTypeFromExpression(expression.expression);
|
|
5423
|
+
if (!ts25.isIdentifier(expression.name)) {
|
|
5424
|
+
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
5425
|
+
}
|
|
5426
|
+
return ts25.factory.createQualifiedName(left, expression.name);
|
|
5427
|
+
}
|
|
5428
|
+
throw new Error(`Unsupported expression for type reference: ${ts25.SyntaxKind[expression.kind]}`);
|
|
5429
|
+
}
|
|
5376
5430
|
|
|
5377
5431
|
// packages/compiler-cli/src/ngtsc/translator/src/typescript_translator.js
|
|
5378
5432
|
function translateExpression(contextFile, expression, imports, options = {}) {
|
|
@@ -6569,7 +6623,7 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
6569
6623
|
} else if (ts30.isMethodDeclaration(node)) {
|
|
6570
6624
|
node = ts30.factory.updateMethodDeclaration(node, combinedModifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
|
|
6571
6625
|
} else if (ts30.isPropertyDeclaration(node)) {
|
|
6572
|
-
node = ts30.factory.updatePropertyDeclaration(node, combinedModifiers, node.name, node.questionToken, node.type, node.initializer);
|
|
6626
|
+
node = ts30.factory.updatePropertyDeclaration(node, combinedModifiers, node.name, node.questionToken || node.exclamationToken, node.type, node.initializer);
|
|
6573
6627
|
} else if (ts30.isGetAccessor(node)) {
|
|
6574
6628
|
node = ts30.factory.updateGetAccessorDeclaration(node, combinedModifiers, node.name, node.parameters, node.type, node.body);
|
|
6575
6629
|
} else if (ts30.isSetAccessor(node)) {
|
|
@@ -6700,10 +6754,9 @@ function insertDebugNameIntoCallExpression(node, debugName) {
|
|
|
6700
6754
|
spreadArgs.push(ts31.factory.createIdentifier("undefined"));
|
|
6701
6755
|
}
|
|
6702
6756
|
spreadArgs.push(ts31.factory.createObjectLiteralExpression([debugNameProperty]));
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
];
|
|
6757
|
+
const spread = ts31.factory.createSpreadElement(createNgDevModeConditional(ts31.factory.createArrayLiteralExpression(spreadArgs), ts31.factory.createArrayLiteralExpression()));
|
|
6758
|
+
ts31.addSyntheticLeadingComment(spread, ts31.SyntaxKind.MultiLineCommentTrivia, " @ts-ignore ", true);
|
|
6759
|
+
newArgs = [...node.arguments, spread];
|
|
6707
6760
|
}
|
|
6708
6761
|
return ts31.factory.updateCallExpression(node, node.expression, node.typeArguments, newArgs);
|
|
6709
6762
|
}
|
|
@@ -6889,6 +6942,52 @@ function signalMetadataTransform(program) {
|
|
|
6889
6942
|
};
|
|
6890
6943
|
}
|
|
6891
6944
|
|
|
6945
|
+
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
|
|
6946
|
+
var TcbGenericContextBehavior;
|
|
6947
|
+
(function(TcbGenericContextBehavior2) {
|
|
6948
|
+
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
6949
|
+
TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
|
|
6950
|
+
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
6951
|
+
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
6952
|
+
var Context2 = class {
|
|
6953
|
+
env;
|
|
6954
|
+
domSchemaChecker;
|
|
6955
|
+
oobRecorder;
|
|
6956
|
+
id;
|
|
6957
|
+
boundTarget;
|
|
6958
|
+
pipes;
|
|
6959
|
+
schemas;
|
|
6960
|
+
hostIsStandalone;
|
|
6961
|
+
hostPreserveWhitespaces;
|
|
6962
|
+
nextId = 1;
|
|
6963
|
+
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
|
|
6964
|
+
this.env = env;
|
|
6965
|
+
this.domSchemaChecker = domSchemaChecker;
|
|
6966
|
+
this.oobRecorder = oobRecorder;
|
|
6967
|
+
this.id = id;
|
|
6968
|
+
this.boundTarget = boundTarget;
|
|
6969
|
+
this.pipes = pipes;
|
|
6970
|
+
this.schemas = schemas;
|
|
6971
|
+
this.hostIsStandalone = hostIsStandalone;
|
|
6972
|
+
this.hostPreserveWhitespaces = hostPreserveWhitespaces;
|
|
6973
|
+
}
|
|
6974
|
+
/**
|
|
6975
|
+
* Allocate a new variable name for use within the `Context`.
|
|
6976
|
+
*
|
|
6977
|
+
* Currently this uses a monotonically increasing counter, but in the future the variable name
|
|
6978
|
+
* might change depending on the type of data being stored.
|
|
6979
|
+
*/
|
|
6980
|
+
allocateId() {
|
|
6981
|
+
return `_t${this.nextId++}`;
|
|
6982
|
+
}
|
|
6983
|
+
getPipeByName(name) {
|
|
6984
|
+
if (this.pipes === null || !this.pipes.has(name)) {
|
|
6985
|
+
return null;
|
|
6986
|
+
}
|
|
6987
|
+
return this.pipes.get(name);
|
|
6988
|
+
}
|
|
6989
|
+
};
|
|
6990
|
+
|
|
6892
6991
|
// packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
|
|
6893
6992
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
6894
6993
|
import ts33 from "typescript";
|
|
@@ -8595,7 +8694,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
8595
8694
|
if (this.typeCtors.has(key)) {
|
|
8596
8695
|
return new TcbExpr(this.typeCtors.get(key));
|
|
8597
8696
|
}
|
|
8598
|
-
if (dir.
|
|
8697
|
+
if (dir.requiresInlineTypeCtor) {
|
|
8599
8698
|
const typeCtorExpr = `${this.referenceTcbValue(dir.ref).print()}.ngTypeCtor`;
|
|
8600
8699
|
this.typeCtors.set(key, typeCtorExpr);
|
|
8601
8700
|
return new TcbExpr(typeCtorExpr);
|
|
@@ -8946,52 +9045,6 @@ function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
|
|
|
8946
9045
|
};
|
|
8947
9046
|
}
|
|
8948
9047
|
|
|
8949
|
-
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
|
|
8950
|
-
var TcbGenericContextBehavior;
|
|
8951
|
-
(function(TcbGenericContextBehavior2) {
|
|
8952
|
-
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
8953
|
-
TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
|
|
8954
|
-
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
8955
|
-
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
8956
|
-
var Context2 = class {
|
|
8957
|
-
env;
|
|
8958
|
-
domSchemaChecker;
|
|
8959
|
-
oobRecorder;
|
|
8960
|
-
id;
|
|
8961
|
-
boundTarget;
|
|
8962
|
-
pipes;
|
|
8963
|
-
schemas;
|
|
8964
|
-
hostIsStandalone;
|
|
8965
|
-
hostPreserveWhitespaces;
|
|
8966
|
-
nextId = 1;
|
|
8967
|
-
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
|
|
8968
|
-
this.env = env;
|
|
8969
|
-
this.domSchemaChecker = domSchemaChecker;
|
|
8970
|
-
this.oobRecorder = oobRecorder;
|
|
8971
|
-
this.id = id;
|
|
8972
|
-
this.boundTarget = boundTarget;
|
|
8973
|
-
this.pipes = pipes;
|
|
8974
|
-
this.schemas = schemas;
|
|
8975
|
-
this.hostIsStandalone = hostIsStandalone;
|
|
8976
|
-
this.hostPreserveWhitespaces = hostPreserveWhitespaces;
|
|
8977
|
-
}
|
|
8978
|
-
/**
|
|
8979
|
-
* Allocate a new variable name for use within the `Context`.
|
|
8980
|
-
*
|
|
8981
|
-
* Currently this uses a monotonically increasing counter, but in the future the variable name
|
|
8982
|
-
* might change depending on the type of data being stored.
|
|
8983
|
-
*/
|
|
8984
|
-
allocateId() {
|
|
8985
|
-
return `_t${this.nextId++}`;
|
|
8986
|
-
}
|
|
8987
|
-
getPipeByName(name) {
|
|
8988
|
-
if (this.pipes === null || !this.pipes.has(name)) {
|
|
8989
|
-
return null;
|
|
8990
|
-
}
|
|
8991
|
-
return this.pipes.get(name);
|
|
8992
|
-
}
|
|
8993
|
-
};
|
|
8994
|
-
|
|
8995
9048
|
// packages/compiler-cli/src/ngtsc/typecheck/src/ops/scope.js
|
|
8996
9049
|
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 TmplAstLetDeclaration2, TmplAstReference, TmplAstSwitchBlock as TmplAstSwitchBlock2, TmplAstTemplate as TmplAstTemplate5, TmplAstText as TmplAstText2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
8997
9050
|
|
|
@@ -9227,16 +9280,16 @@ var TcbExprTranslator = class {
|
|
|
9227
9280
|
const head = ast.elements[0];
|
|
9228
9281
|
let result;
|
|
9229
9282
|
if (length === 1) {
|
|
9230
|
-
result = `\`${head.text}\``;
|
|
9283
|
+
result = `\`${this.escapeTemplateLiteral(head.text)}\``;
|
|
9231
9284
|
} else {
|
|
9232
|
-
let parts = [`\`${head.text}`];
|
|
9285
|
+
let parts = [`\`${this.escapeTemplateLiteral(head.text)}`];
|
|
9233
9286
|
const tailIndex = length - 1;
|
|
9234
9287
|
for (let i = 1; i < tailIndex; i++) {
|
|
9235
9288
|
const expr = this.translate(ast.expressions[i - 1]);
|
|
9236
|
-
parts.push(`\${${expr.print()}}${ast.elements[i].text}`);
|
|
9289
|
+
parts.push(`\${${expr.print()}}${this.escapeTemplateLiteral(ast.elements[i].text)}`);
|
|
9237
9290
|
}
|
|
9238
9291
|
const resolvedExpression = this.translate(ast.expressions[tailIndex - 1]);
|
|
9239
|
-
parts.push(`\${${resolvedExpression.print()}}${ast.elements[tailIndex].text}\``);
|
|
9292
|
+
parts.push(`\${${resolvedExpression.print()}}${this.escapeTemplateLiteral(ast.elements[tailIndex].text)}\``);
|
|
9240
9293
|
result = parts.join("");
|
|
9241
9294
|
}
|
|
9242
9295
|
return new TcbExpr(result);
|
|
@@ -9292,6 +9345,9 @@ var TcbExprTranslator = class {
|
|
|
9292
9345
|
}
|
|
9293
9346
|
return new TcbExpr(`(${expr}!(${args}) as any)`);
|
|
9294
9347
|
}
|
|
9348
|
+
escapeTemplateLiteral(value) {
|
|
9349
|
+
return value.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\${/g, "$\\{");
|
|
9350
|
+
}
|
|
9295
9351
|
};
|
|
9296
9352
|
var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
|
|
9297
9353
|
static SINGLETON = new _VeSafeLhsInferenceBugDetector();
|
|
@@ -11556,7 +11612,7 @@ var Scope = class _Scope {
|
|
|
11556
11612
|
getDirectiveOp(dir, node, customFieldType) {
|
|
11557
11613
|
if (!dir.isGeneric) {
|
|
11558
11614
|
return new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir);
|
|
11559
|
-
} else if (!dir.
|
|
11615
|
+
} else if (!dir.requiresInlineTypeCtor || this.tcb.env.config.useInlineTypeConstructors) {
|
|
11560
11616
|
return new TcbDirectiveCtorOp(this.tcb, this, node, dir, customFieldType);
|
|
11561
11617
|
}
|
|
11562
11618
|
return new TcbGenericDirectiveTypeWithAnyParamsOp(this.tcb, this, node, dir);
|
|
@@ -11733,33 +11789,12 @@ var Scope = class _Scope {
|
|
|
11733
11789
|
};
|
|
11734
11790
|
|
|
11735
11791
|
// packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
|
|
11736
|
-
function generateTypeCheckBlock(env, component, name, meta, domSchemaChecker, oobRecorder
|
|
11792
|
+
function generateTypeCheckBlock(env, component, name, meta, domSchemaChecker, oobRecorder) {
|
|
11737
11793
|
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
|
|
11738
11794
|
const ctxRawType = env.referenceTcbValue(component.ref);
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
if (!env.config.useContextGenericType) {
|
|
11743
|
-
genericContextBehavior = TcbGenericContextBehavior.FallbackToAny;
|
|
11744
|
-
}
|
|
11745
|
-
switch (genericContextBehavior) {
|
|
11746
|
-
case TcbGenericContextBehavior.UseEmitter:
|
|
11747
|
-
const emittedParams = component.typeParameters || [];
|
|
11748
|
-
typeParameters = emittedParams;
|
|
11749
|
-
typeArguments = typeParameters.map((param) => param.name);
|
|
11750
|
-
break;
|
|
11751
|
-
case TcbGenericContextBehavior.CopyClassNodes:
|
|
11752
|
-
const copiedParams = component.typeParameters ? [...component.typeParameters] : [];
|
|
11753
|
-
typeParameters = copiedParams;
|
|
11754
|
-
typeArguments = typeParameters.map((param) => param.name);
|
|
11755
|
-
break;
|
|
11756
|
-
case TcbGenericContextBehavior.FallbackToAny:
|
|
11757
|
-
typeArguments = Array.from({ length: component.typeParameters?.length ?? 0 }).map(() => "any");
|
|
11758
|
-
break;
|
|
11759
|
-
}
|
|
11760
|
-
}
|
|
11761
|
-
const typeParamsStr = typeParameters === void 0 || typeParameters.length === 0 ? "" : `<${typeParameters.map((p) => p.representation).join(", ")}>`;
|
|
11762
|
-
const typeArgsStr = typeArguments === void 0 || typeArguments.length === 0 ? "" : `<${typeArguments.join(", ")}>`;
|
|
11795
|
+
const { typeParameters, typeArguments } = component;
|
|
11796
|
+
const typeParamsStr = !env.config.useContextGenericType || typeParameters === null || typeParameters.length === 0 ? "" : `<${typeParameters.map((p) => p.representation).join(", ")}>`;
|
|
11797
|
+
const typeArgsStr = typeArguments === null || typeArguments.length === 0 ? "" : `<${typeArguments.join(", ")}>`;
|
|
11763
11798
|
const thisParamStr = `this: ${ctxRawType.print()}${typeArgsStr}`;
|
|
11764
11799
|
const statements = [];
|
|
11765
11800
|
if (tcb.boundTarget.target.template !== void 0) {
|
|
@@ -11951,11 +11986,11 @@ export {
|
|
|
11951
11986
|
generateTcbTypeParameters,
|
|
11952
11987
|
generateInlineTypeCtor,
|
|
11953
11988
|
requiresInlineTypeCtor,
|
|
11989
|
+
TcbGenericContextBehavior,
|
|
11954
11990
|
RegistryDomSchemaChecker,
|
|
11955
11991
|
ReferenceEmitEnvironment,
|
|
11956
11992
|
Environment,
|
|
11957
11993
|
OutOfBandDiagnosticRecorderImpl,
|
|
11958
|
-
TcbGenericContextBehavior,
|
|
11959
11994
|
generateTypeCheckBlock
|
|
11960
11995
|
};
|
|
11961
11996
|
/**
|
|
@@ -11979,4 +12014,4 @@ export {
|
|
|
11979
12014
|
* Use of this source code is governed by an MIT-style license that can be
|
|
11980
12015
|
* found in the LICENSE file at https://angular.dev/license
|
|
11981
12016
|
*/
|
|
11982
|
-
//# sourceMappingURL=chunk-
|
|
12017
|
+
//# sourceMappingURL=chunk-BCQGTZBZ.js.map
|