@angular/compiler-cli 21.2.0-rc.0 → 21.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/chunk-FLWAEX6T.js +1 -1
- package/bundles/{chunk-YMCUV3OT.js → chunk-G6DAEDUS.js} +37 -23
- package/bundles/{chunk-IQF227JC.js → chunk-IG22BDVK.js} +22 -3
- package/bundles/{chunk-OXTYPMKB.js → chunk-IO4PSCVA.js} +1 -1
- package/bundles/{chunk-NO3TCVXN.js → chunk-J2UUYQZ3.js} +2 -2
- package/bundles/index.js +4 -4
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/testing.js +1 -1
- package/bundles/private/tooling.js +1 -1
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- package/src/ngtsc/typecheck/extended/api/format-extended-error.d.ts +17 -0
- package/src/ngtsc/typecheck/extended/api/index.d.ts +1 -0
- package/src/ngtsc/typecheck/src/ops/expression.d.ts +15 -0
|
@@ -455,7 +455,7 @@ import { compileDirectiveFromMetadata, makeBindingParser, ParseLocation, ParseSo
|
|
|
455
455
|
// packages/compiler-cli/linker/src/file_linker/partial_linkers/util.js
|
|
456
456
|
import { createMayBeForwardRefExpression, outputAst as o2 } from "@angular/compiler";
|
|
457
457
|
import semver from "semver";
|
|
458
|
-
var PLACEHOLDER_VERSION = "21.2.0
|
|
458
|
+
var PLACEHOLDER_VERSION = "21.2.0";
|
|
459
459
|
function wrapReference(wrapped) {
|
|
460
460
|
return { value: wrapped, type: wrapped };
|
|
461
461
|
}
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
toUnredirectedSourceFile,
|
|
89
89
|
tryParseInitializerApi,
|
|
90
90
|
untagAllTsFiles
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-IG22BDVK.js";
|
|
92
92
|
import {
|
|
93
93
|
LogicalFileSystem,
|
|
94
94
|
absoluteFromSourceFile,
|
|
@@ -2956,6 +2956,20 @@ var TemplateVisitor2 = class extends CombinedRecursiveAstVisitor2 {
|
|
|
2956
2956
|
}
|
|
2957
2957
|
};
|
|
2958
2958
|
|
|
2959
|
+
// packages/compiler-cli/src/ngtsc/typecheck/extended/api/format-extended-error.js
|
|
2960
|
+
import { VERSION } from "@angular/compiler";
|
|
2961
|
+
var EXTENDED_ERROR_DETAILS_PAGE_BASE_URL = (() => {
|
|
2962
|
+
const versionSubDomain = VERSION.major !== "0" ? `v${VERSION.major}.` : "";
|
|
2963
|
+
return `https://${versionSubDomain}angular.dev/extended-diagnostics`;
|
|
2964
|
+
})();
|
|
2965
|
+
function formatExtendedError(code, message) {
|
|
2966
|
+
const fullCode = `NG${Math.abs(code)}`;
|
|
2967
|
+
const errorMessage = `${fullCode}${message ? ": " + message : ""}`;
|
|
2968
|
+
const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/);
|
|
2969
|
+
const separator = addPeriodSeparator ? "." : "";
|
|
2970
|
+
return `${errorMessage}${separator} Find more at ${EXTENDED_ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2959
2973
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.js
|
|
2960
2974
|
var SIGNAL_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["set", "update", "asReadonly"]);
|
|
2961
2975
|
var FUNCTION_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["name", "length", "prototype"]);
|
|
@@ -3033,7 +3047,7 @@ function buildDiagnosticForSignal(ctx, node, component) {
|
|
|
3033
3047
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
3034
3048
|
if (symbol !== null && symbol.kind === SymbolKind.Expression && isSignalReference(symbol)) {
|
|
3035
3049
|
const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbol.tcbLocation);
|
|
3036
|
-
const errorString = `${node.name} is a function and should be invoked: ${node.name}()
|
|
3050
|
+
const errorString = formatExtendedError(ErrorCode.INTERPOLATED_SIGNAL_NOT_INVOKED, `${node.name} is a function and should be invoked: ${node.name}()}`);
|
|
3037
3051
|
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
|
|
3038
3052
|
return [diagnostic];
|
|
3039
3053
|
}
|
|
@@ -3043,7 +3057,7 @@ function buildDiagnosticForSignal(ctx, node, component) {
|
|
|
3043
3057
|
const symbolOfReceiver = ctx.templateTypeChecker.getSymbolOfNode(node.receiver, component);
|
|
3044
3058
|
if (symbolOfReceiver !== null && symbolOfReceiver.kind === SymbolKind.Expression && isSignalReference(symbolOfReceiver)) {
|
|
3045
3059
|
const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbolOfReceiver.tcbLocation);
|
|
3046
|
-
const errorString = `${node.receiver.name} is a function and should be invoked: ${node.receiver.name}()
|
|
3060
|
+
const errorString = formatExtendedError(ErrorCode.INTERPOLATED_SIGNAL_NOT_INVOKED, `${node.receiver.name} is a function and should be invoked: ${node.receiver.name}()`);
|
|
3047
3061
|
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
|
|
3048
3062
|
return [diagnostic];
|
|
3049
3063
|
}
|
|
@@ -3067,8 +3081,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
3067
3081
|
return [];
|
|
3068
3082
|
const boundSyntax = node.sourceSpan.toString();
|
|
3069
3083
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
3070
|
-
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'
|
|
3071
|
-
Find more at ${DOC_PAGE_BASE_URL}/guide/templates/two-way-binding`);
|
|
3084
|
+
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, formatExtendedError(ErrorCode.INVALID_BANANA_IN_BOX, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'`));
|
|
3072
3085
|
return [diagnostic];
|
|
3073
3086
|
}
|
|
3074
3087
|
};
|
|
@@ -3107,7 +3120,7 @@ var MissingControlFlowDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
|
3107
3120
|
}
|
|
3108
3121
|
const sourceSpan = controlFlowAttr.keySpan || controlFlowAttr.sourceSpan;
|
|
3109
3122
|
const directiveAndBuiltIn = KNOWN_CONTROL_FLOW_DIRECTIVES.get(controlFlowAttr.name);
|
|
3110
|
-
const errorMessage = `The \`*${controlFlowAttr.name}\` directive was used in the template, but neither the \`${directiveAndBuiltIn?.directive}\` directive nor the \`CommonModule\` was imported. Use Angular's built-in control flow ${directiveAndBuiltIn?.builtIn} or make sure that either the \`${directiveAndBuiltIn?.directive}\` directive or the \`CommonModule\` is included in the \`@Component.imports\` array of this component
|
|
3123
|
+
const errorMessage = formatExtendedError(ErrorCode.MISSING_CONTROL_FLOW_DIRECTIVE, `The \`*${controlFlowAttr.name}\` directive was used in the template, but neither the \`${directiveAndBuiltIn?.directive}\` directive nor the \`CommonModule\` was imported. Use Angular's built-in control flow ${directiveAndBuiltIn?.builtIn} or make sure that either the \`${directiveAndBuiltIn?.directive}\` directive or the \`CommonModule\` is included in the \`@Component.imports\` array of this component.`);
|
|
3111
3124
|
const diagnostic = ctx.makeTemplateDiagnostic(sourceSpan, errorMessage);
|
|
3112
3125
|
return [diagnostic];
|
|
3113
3126
|
}
|
|
@@ -3139,7 +3152,7 @@ var MissingNgForOfLetCheck = class extends TemplateCheckWithVisitor {
|
|
|
3139
3152
|
if (node.variables.length > 0) {
|
|
3140
3153
|
return [];
|
|
3141
3154
|
}
|
|
3142
|
-
const errorString =
|
|
3155
|
+
const errorString = formatExtendedError(ErrorCode.MISSING_NGFOROF_LET, `Your ngFor is missing a value. Did you forget to add the \`let\` keyword?`);
|
|
3143
3156
|
const diagnostic = ctx.makeTemplateDiagnostic(attr.sourceSpan, errorString);
|
|
3144
3157
|
return [diagnostic];
|
|
3145
3158
|
}
|
|
@@ -3182,7 +3195,7 @@ var MissingStructuralDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
|
3182
3195
|
if (hasStructuralDirective)
|
|
3183
3196
|
return [];
|
|
3184
3197
|
const sourceSpan = customStructuralDirective.keySpan || customStructuralDirective.sourceSpan;
|
|
3185
|
-
const errorMessage = `A structural directive \`${customStructuralDirective.name}\` was used in the template without a corresponding import in the component. Make sure that the directive is included in the \`@Component.imports\` array of this component
|
|
3198
|
+
const errorMessage = formatExtendedError(ErrorCode.MISSING_STRUCTURAL_DIRECTIVE, `A structural directive \`${customStructuralDirective.name}\` was used in the template without a corresponding import in the component. Make sure that the directive is included in the \`@Component.imports\` array of this component.`);
|
|
3186
3199
|
return [ctx.makeTemplateDiagnostic(sourceSpan, errorMessage)];
|
|
3187
3200
|
}
|
|
3188
3201
|
};
|
|
@@ -3218,7 +3231,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3218
3231
|
if (templateMapping === null) {
|
|
3219
3232
|
return [];
|
|
3220
3233
|
}
|
|
3221
|
-
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, `The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.`);
|
|
3234
|
+
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, formatExtendedError(ErrorCode.NULLISH_COALESCING_NOT_NULLABLE, `The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.`));
|
|
3222
3235
|
return [diagnostic];
|
|
3223
3236
|
}
|
|
3224
3237
|
};
|
|
@@ -3270,7 +3283,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3270
3283
|
return [];
|
|
3271
3284
|
}
|
|
3272
3285
|
const advice = node instanceof SafePropertyRead ? `the '?.' operator can be replaced with the '.' operator` : `the '?.' operator can be safely removed`;
|
|
3273
|
-
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, `The left side of this optional chain operation does not include 'null' or 'undefined' in its type, therefore ${advice}
|
|
3286
|
+
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, formatExtendedError(ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE, `The left side of this optional chain operation does not include 'null' or 'undefined' in its type, therefore ${advice}`));
|
|
3274
3287
|
return [diagnostic];
|
|
3275
3288
|
}
|
|
3276
3289
|
};
|
|
@@ -3294,7 +3307,7 @@ var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
|
|
|
3294
3307
|
code = ErrorCode.SKIP_HYDRATION_NOT_STATIC;
|
|
3295
3308
|
visitNode(ctx, component, node) {
|
|
3296
3309
|
if (node instanceof TmplAstBoundAttribute2 && node.name === NG_SKIP_HYDRATION_ATTR_NAME) {
|
|
3297
|
-
const errorString = `ngSkipHydration should not be used as a binding
|
|
3310
|
+
const errorString = formatExtendedError(ErrorCode.SKIP_HYDRATION_NOT_STATIC, `ngSkipHydration should not be used as a binding`);
|
|
3298
3311
|
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
|
|
3299
3312
|
return [diagnostic];
|
|
3300
3313
|
}
|
|
@@ -3304,7 +3317,7 @@ var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
|
|
|
3304
3317
|
/* empty string */
|
|
3305
3318
|
];
|
|
3306
3319
|
if (node instanceof TmplAstTextAttribute && node.name === NG_SKIP_HYDRATION_ATTR_NAME && !acceptedValues.includes(node.value) && node.value !== void 0) {
|
|
3307
|
-
const errorString = `ngSkipHydration only accepts "true" or "" as value or no value at all. For example 'ngSkipHydration="true"' or 'ngSkipHydration'
|
|
3320
|
+
const errorString = formatExtendedError(ErrorCode.SKIP_HYDRATION_NOT_STATIC, `ngSkipHydration only accepts "true" or "" as value or no value at all. For example 'ngSkipHydration="true"' or 'ngSkipHydration'`);
|
|
3308
3321
|
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
|
|
3309
3322
|
return [diagnostic];
|
|
3310
3323
|
}
|
|
@@ -3328,7 +3341,7 @@ var SuffixNotSupportedCheck = class extends TemplateCheckWithVisitor {
|
|
|
3328
3341
|
if (!node.keySpan.toString().startsWith("attr.") || !STYLE_SUFFIXES.some((suffix) => node.name.endsWith(`.${suffix}`))) {
|
|
3329
3342
|
return [];
|
|
3330
3343
|
}
|
|
3331
|
-
const diagnostic = ctx.makeTemplateDiagnostic(node.keySpan, `The ${STYLE_SUFFIXES.map((suffix) => `'.${suffix}'`).join(", ")} suffixes are only supported on style bindings
|
|
3344
|
+
const diagnostic = ctx.makeTemplateDiagnostic(node.keySpan, formatExtendedError(ErrorCode.SUFFIX_NOT_SUPPORTED, `The ${STYLE_SUFFIXES.map((suffix) => `'.${suffix}'`).join(", ")} suffixes are only supported on style bindings`));
|
|
3332
3345
|
return [diagnostic];
|
|
3333
3346
|
}
|
|
3334
3347
|
};
|
|
@@ -3367,6 +3380,7 @@ var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
|
|
|
3367
3380
|
if (node.value) {
|
|
3368
3381
|
errorString += ` For example, '${expectedKey}="${expectedValue}"'.`;
|
|
3369
3382
|
}
|
|
3383
|
+
errorString = formatExtendedError(ErrorCode.TEXT_ATTRIBUTE_NOT_BINDING, errorString);
|
|
3370
3384
|
}
|
|
3371
3385
|
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
|
|
3372
3386
|
return [diagnostic];
|
|
@@ -3415,7 +3429,7 @@ function assertExpressionInvoked(expression, component, node, expressionText, ct
|
|
|
3415
3429
|
if (symbol !== null && symbol.kind === SymbolKind.Expression) {
|
|
3416
3430
|
if (symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3417
3431
|
const fullExpressionText = generateStringFromExpression(expression, expressionText);
|
|
3418
|
-
const errorString = `Function in event binding should be invoked: ${fullExpressionText}()
|
|
3432
|
+
const errorString = formatExtendedError(ErrorCode.UNINVOKED_FUNCTION_IN_EVENT_BINDING, `Function in event binding should be invoked: ${fullExpressionText}()`);
|
|
3419
3433
|
return [ctx.makeTemplateDiagnostic(node.sourceSpan, errorString)];
|
|
3420
3434
|
}
|
|
3421
3435
|
}
|
|
@@ -3446,7 +3460,7 @@ var UnparenthesizedNullishCoalescing = class extends TemplateCheckWithVisitor {
|
|
|
3446
3460
|
if (sourceMapping === null) {
|
|
3447
3461
|
return [];
|
|
3448
3462
|
}
|
|
3449
|
-
const diagnostic = ctx.makeTemplateDiagnostic(sourceMapping.span, `Parentheses are required to disambiguate precedence when mixing '??' with '&&' and '||'
|
|
3463
|
+
const diagnostic = ctx.makeTemplateDiagnostic(sourceMapping.span, formatExtendedError(ErrorCode.UNPARENTHESIZED_NULLISH_COALESCING, `Parentheses are required to disambiguate precedence when mixing '??' with '&&' and '||'`));
|
|
3450
3464
|
return [diagnostic];
|
|
3451
3465
|
}
|
|
3452
3466
|
}
|
|
@@ -3471,7 +3485,7 @@ var UnusedLetDeclarationCheck = class extends TemplateCheckWithVisitor {
|
|
|
3471
3485
|
const { allLetDeclarations, usedLetDeclarations } = this.getAnalysis(component);
|
|
3472
3486
|
for (const decl of allLetDeclarations) {
|
|
3473
3487
|
if (!usedLetDeclarations.has(decl)) {
|
|
3474
|
-
diagnostics.push(ctx.makeTemplateDiagnostic(decl.sourceSpan, `@let ${decl.name} is declared but its value is never read.`));
|
|
3488
|
+
diagnostics.push(ctx.makeTemplateDiagnostic(decl.sourceSpan, formatExtendedError(ErrorCode.UNUSED_LET_DECLARATION, `@let ${decl.name} is declared but its value is never read.`)));
|
|
3475
3489
|
}
|
|
3476
3490
|
}
|
|
3477
3491
|
this.analysis.clear();
|
|
@@ -3519,7 +3533,7 @@ var UninvokedTrackFunctionCheck = class extends TemplateCheckWithVisitor {
|
|
|
3519
3533
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node.trackBy.ast, component);
|
|
3520
3534
|
if (symbol !== null && symbol.kind === SymbolKind.Expression && symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3521
3535
|
const fullExpressionText = generateStringFromExpression2(node.trackBy.ast, node.trackBy.source || "");
|
|
3522
|
-
const errorString = `The track function in the @for block should be invoked: ${fullExpressionText}(/* arguments */)
|
|
3536
|
+
const errorString = formatExtendedError(ErrorCode.UNINVOKED_TRACK_FUNCTION, `The track function in the @for block should be invoked: ${fullExpressionText}(/* arguments */)`);
|
|
3523
3537
|
return [ctx.makeTemplateDiagnostic(node.sourceSpan, errorString)];
|
|
3524
3538
|
}
|
|
3525
3539
|
return [];
|
|
@@ -3552,7 +3566,7 @@ function assertExpressionInvoked2(expression, component, ctx) {
|
|
|
3552
3566
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(expression, component);
|
|
3553
3567
|
if (symbol !== null && symbol.kind === SymbolKind.Expression) {
|
|
3554
3568
|
if (symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3555
|
-
const errorString = `Function in text interpolation should be invoked: ${expression.name}()
|
|
3569
|
+
const errorString = formatExtendedError(ErrorCode.UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION, `Function in text interpolation should be invoked: ${expression.name}()`);
|
|
3556
3570
|
const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbol.tcbLocation);
|
|
3557
3571
|
return [ctx.makeTemplateDiagnostic(templateMapping.span, errorString)];
|
|
3558
3572
|
}
|
|
@@ -3581,11 +3595,11 @@ var DeferTriggerMisconfiguration = class extends TemplateCheckWithVisitor {
|
|
|
3581
3595
|
if (hasImmediateMain) {
|
|
3582
3596
|
if (mains.length > 1) {
|
|
3583
3597
|
const msg = `The 'immediate' trigger makes additional triggers redundant.`;
|
|
3584
|
-
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, msg));
|
|
3598
|
+
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3585
3599
|
}
|
|
3586
3600
|
if (prefetches.length > 0) {
|
|
3587
3601
|
const msg = `Prefetch triggers have no effect because 'immediate' executes earlier.`;
|
|
3588
|
-
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, msg));
|
|
3602
|
+
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3589
3603
|
}
|
|
3590
3604
|
}
|
|
3591
3605
|
if (mains.length === 1 && prefetches.length > 0) {
|
|
@@ -3597,7 +3611,7 @@ var DeferTriggerMisconfiguration = class extends TemplateCheckWithVisitor {
|
|
|
3597
3611
|
const preDelay = pre.delay;
|
|
3598
3612
|
if (preDelay >= mainDelay) {
|
|
3599
3613
|
const msg = `The Prefetch 'timer(${preDelay}ms)' is not scheduled before the main 'timer(${mainDelay}ms)', so it won\u2019t run prior to rendering. Lower the prefetch delay or remove it.`;
|
|
3600
|
-
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
3614
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3601
3615
|
}
|
|
3602
3616
|
}
|
|
3603
3617
|
const isHoverTrigger = main instanceof TmplAstHoverDeferredTrigger && pre instanceof TmplAstHoverDeferredTrigger;
|
|
@@ -3609,14 +3623,14 @@ var DeferTriggerMisconfiguration = class extends TemplateCheckWithVisitor {
|
|
|
3609
3623
|
if (mainRef && preRef && mainRef === preRef) {
|
|
3610
3624
|
const kindName = main.constructor.name.replace("DeferredTrigger", "").toLowerCase();
|
|
3611
3625
|
const msg = `Prefetch '${kindName}' matches the main trigger and provides no benefit. Remove the prefetch modifier.`;
|
|
3612
|
-
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
3626
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3613
3627
|
}
|
|
3614
3628
|
continue;
|
|
3615
3629
|
}
|
|
3616
3630
|
if (main.constructor === pre.constructor && !(main instanceof TmplAstTimerDeferredTrigger)) {
|
|
3617
3631
|
const kind = main instanceof TmplAstImmediateDeferredTrigger ? "immediate" : main.constructor.name.replace("DeferredTrigger", "").toLowerCase();
|
|
3618
3632
|
const msg = `Prefetch '${kind}' matches the main trigger and provides no benefit. Remove the prefetch modifier.`;
|
|
3619
|
-
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
3633
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3620
3634
|
}
|
|
3621
3635
|
}
|
|
3622
3636
|
}
|
|
@@ -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.0
|
|
232
|
+
const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.0";
|
|
233
233
|
const prefix = isPreRelease ? "next" : `v${VERSION.major}`;
|
|
234
234
|
return `https://${prefix}.angular.dev`;
|
|
235
235
|
})();
|
|
@@ -14631,6 +14631,25 @@ var TcbExpressionOp = class extends TcbOp {
|
|
|
14631
14631
|
return null;
|
|
14632
14632
|
}
|
|
14633
14633
|
};
|
|
14634
|
+
var TcbConditionOp = class extends TcbOp {
|
|
14635
|
+
tcb;
|
|
14636
|
+
scope;
|
|
14637
|
+
expression;
|
|
14638
|
+
constructor(tcb, scope, expression) {
|
|
14639
|
+
super();
|
|
14640
|
+
this.tcb = tcb;
|
|
14641
|
+
this.scope = scope;
|
|
14642
|
+
this.expression = expression;
|
|
14643
|
+
}
|
|
14644
|
+
get optional() {
|
|
14645
|
+
return false;
|
|
14646
|
+
}
|
|
14647
|
+
execute() {
|
|
14648
|
+
const expr = tcbExpression(this.expression, this.tcb, this.scope);
|
|
14649
|
+
this.scope.addStatement(ts64.factory.createIfStatement(expr, ts64.factory.createBlock([])));
|
|
14650
|
+
return null;
|
|
14651
|
+
}
|
|
14652
|
+
};
|
|
14634
14653
|
var TcbExpressionTranslator = class {
|
|
14635
14654
|
tcb;
|
|
14636
14655
|
scope;
|
|
@@ -16967,7 +16986,7 @@ var Scope = class _Scope {
|
|
|
16967
16986
|
this.appendDeferredTriggers(block, block.triggers);
|
|
16968
16987
|
this.appendDeferredTriggers(block, block.prefetchTriggers);
|
|
16969
16988
|
if (block.hydrateTriggers.when) {
|
|
16970
|
-
this.opQueue.push(new
|
|
16989
|
+
this.opQueue.push(new TcbConditionOp(this.tcb, this, block.hydrateTriggers.when.value));
|
|
16971
16990
|
}
|
|
16972
16991
|
this.appendChildren(block);
|
|
16973
16992
|
if (block.placeholder !== null) {
|
|
@@ -16982,7 +17001,7 @@ var Scope = class _Scope {
|
|
|
16982
17001
|
}
|
|
16983
17002
|
appendDeferredTriggers(block, triggers) {
|
|
16984
17003
|
if (triggers.when !== void 0) {
|
|
16985
|
-
this.opQueue.push(new
|
|
17004
|
+
this.opQueue.push(new TcbConditionOp(this.tcb, this, triggers.when.value));
|
|
16986
17005
|
}
|
|
16987
17006
|
if (triggers.viewport !== void 0 && triggers.viewport.options !== null) {
|
|
16988
17007
|
this.opQueue.push(new TcbIntersectionObserverOp(this.tcb, this, triggers.viewport.options));
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TrackedIncrementalBuildStrategy,
|
|
9
9
|
freshCompilationTicket,
|
|
10
10
|
incrementalFromCompilerTicket
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-G6DAEDUS.js";
|
|
12
12
|
import {
|
|
13
13
|
ActivePerfRecorder,
|
|
14
14
|
OptimizeFor,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
TsCreateProgramDriver,
|
|
19
19
|
replaceTsWithNgInErrors,
|
|
20
20
|
retagAllTsFiles
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-IG22BDVK.js";
|
|
22
22
|
import {
|
|
23
23
|
absoluteFrom,
|
|
24
24
|
createFileSystemTsReadDirectoryFn,
|
package/bundles/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isTsDiagnostic,
|
|
18
18
|
performCompilation,
|
|
19
19
|
readConfiguration
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-J2UUYQZ3.js";
|
|
21
21
|
import {
|
|
22
22
|
ConsoleLogger,
|
|
23
23
|
LogLevel
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
freshCompilationTicket,
|
|
35
35
|
incrementalFromStateTicket,
|
|
36
36
|
isDocEntryWithSourceInfo
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-G6DAEDUS.js";
|
|
38
38
|
import {
|
|
39
39
|
ActivePerfRecorder,
|
|
40
40
|
ErrorCode,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
getInitializerApiJitTransform,
|
|
47
47
|
isLocalCompilationDiagnostics,
|
|
48
48
|
ngErrorCode
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-IG22BDVK.js";
|
|
50
50
|
import "./chunk-CSUVPNMK.js";
|
|
51
51
|
import {
|
|
52
52
|
InvalidFileSystem,
|
|
@@ -77,7 +77,7 @@ import "./chunk-G7GFT6BU.js";
|
|
|
77
77
|
|
|
78
78
|
// packages/compiler-cli/src/version.js
|
|
79
79
|
import { Version } from "@angular/compiler";
|
|
80
|
-
var VERSION = new Version("21.2.0
|
|
80
|
+
var VERSION = new Version("21.2.0");
|
|
81
81
|
|
|
82
82
|
// packages/compiler-cli/private/tooling.js
|
|
83
83
|
var GLOBAL_DEFS_FOR_TERSER = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
DiagnosticCategoryLabel,
|
|
7
7
|
NgCompiler
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-G6DAEDUS.js";
|
|
9
9
|
import {
|
|
10
10
|
CompilationMode,
|
|
11
11
|
DtsMetadataReader,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
queryDecoratorNames,
|
|
33
33
|
reflectObjectLiteral,
|
|
34
34
|
unwrapExpression
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-IG22BDVK.js";
|
|
36
36
|
import "../chunk-CSUVPNMK.js";
|
|
37
37
|
import {
|
|
38
38
|
getFileSystem,
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
import {
|
|
7
7
|
main,
|
|
8
8
|
readCommandLineAndConfiguration
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-IO4PSCVA.js";
|
|
10
10
|
import {
|
|
11
11
|
EmitFlags
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-J2UUYQZ3.js";
|
|
13
|
+
import "../../chunk-G6DAEDUS.js";
|
|
14
|
+
import "../../chunk-IG22BDVK.js";
|
|
15
15
|
import "../../chunk-CSUVPNMK.js";
|
|
16
16
|
import {
|
|
17
17
|
setFileSystem
|
package/bundles/src/bin/ngc.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-IO4PSCVA.js";
|
|
9
|
+
import "../../chunk-J2UUYQZ3.js";
|
|
10
|
+
import "../../chunk-G6DAEDUS.js";
|
|
11
|
+
import "../../chunk-IG22BDVK.js";
|
|
12
12
|
import "../../chunk-CSUVPNMK.js";
|
|
13
13
|
import {
|
|
14
14
|
setFileSystem
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
|
|
9
9
|
import { AstObject, AstValue } from '../../ast/ast_value';
|
|
10
|
-
export declare const PLACEHOLDER_VERSION = "21.2.0
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "21.2.0";
|
|
11
11
|
export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
|
|
12
12
|
/**
|
|
13
13
|
* Parses the value of an enum from the AST value's symbol name.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "21.2.0
|
|
3
|
+
"version": "21.2.0",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typescript": "5.9.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@angular/compiler": "21.2.0
|
|
46
|
+
"@angular/compiler": "21.2.0",
|
|
47
47
|
"typescript": ">=5.9 <6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { ErrorCode } from '../../../diagnostics';
|
|
9
|
+
/**
|
|
10
|
+
* Base URL for the extended error details page.
|
|
11
|
+
*
|
|
12
|
+
* Keep the files below in full sync:
|
|
13
|
+
* - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
|
|
14
|
+
* - packages/core/src/error_details_base_url.ts
|
|
15
|
+
*/
|
|
16
|
+
export declare const EXTENDED_ERROR_DETAILS_PAGE_BASE_URL: string;
|
|
17
|
+
export declare function formatExtendedError(code: ErrorCode, message: null | false | string): string;
|
|
@@ -32,6 +32,21 @@ export declare class TcbExpressionOp extends TcbOp {
|
|
|
32
32
|
get optional(): boolean;
|
|
33
33
|
execute(): null;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* A `TcbOp` which renders an Angular expression inside a conditional context.
|
|
37
|
+
* This is used for `@defer` triggers (`when`, `prefetch when`, `hydrate when`)
|
|
38
|
+
* to enable TypeScript's TS2774 diagnostic for uninvoked functions/signals.
|
|
39
|
+
*
|
|
40
|
+
* Executing this operation returns nothing.
|
|
41
|
+
*/
|
|
42
|
+
export declare class TcbConditionOp extends TcbOp {
|
|
43
|
+
private tcb;
|
|
44
|
+
private scope;
|
|
45
|
+
private expression;
|
|
46
|
+
constructor(tcb: Context, scope: Scope, expression: AST);
|
|
47
|
+
get optional(): boolean;
|
|
48
|
+
execute(): null;
|
|
49
|
+
}
|
|
35
50
|
export declare class TcbExpressionTranslator {
|
|
36
51
|
protected tcb: Context;
|
|
37
52
|
protected scope: Scope;
|