@angular/compiler-cli 21.2.0-next.3 → 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-REXDVAT6.js → chunk-G6DAEDUS.js} +42 -30
- package/bundles/{chunk-TAXP3SCS.js → chunk-IG22BDVK.js} +57 -19
- package/bundles/{chunk-PT6VYMWK.js → chunk-IO4PSCVA.js} +1 -1
- package/bundles/{chunk-RBFYX33W.js → chunk-J2UUYQZ3.js} +3 -3
- package/bundles/index.js +4 -4
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/testing.js +1 -1
- package/bundles/private/tooling.js +1 -1
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +3 -3
- package/src/ngtsc/preprocessor.d.ts +33 -0
- package/src/ngtsc/transform/src/compilation.d.ts +2 -1
- package/src/ngtsc/transform/src/transform.d.ts +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
- package/src/ngtsc/typecheck/src/ops/signal_forms.d.ts +1 -1
- package/src/ngtsc/typecheck/src/ops/switch_block.d.ts +1 -1
|
@@ -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,
|
|
@@ -709,11 +709,9 @@ var PipeExtractor = class extends ClassExtractor {
|
|
|
709
709
|
};
|
|
710
710
|
var NgModuleExtractor = class extends ClassExtractor {
|
|
711
711
|
reference;
|
|
712
|
-
|
|
713
|
-
constructor(declaration, reference, metadata, typeChecker) {
|
|
712
|
+
constructor(declaration, reference, typeChecker) {
|
|
714
713
|
super(declaration, typeChecker);
|
|
715
714
|
this.reference = reference;
|
|
716
|
-
this.metadata = metadata;
|
|
717
715
|
}
|
|
718
716
|
extract() {
|
|
719
717
|
return {
|
|
@@ -733,7 +731,7 @@ function extractClass(classDeclaration, metadataReader, typeChecker) {
|
|
|
733
731
|
} else if (pipeMetadata) {
|
|
734
732
|
extractor = new PipeExtractor(classDeclaration, ref, pipeMetadata, typeChecker);
|
|
735
733
|
} else if (ngModuleMetadata) {
|
|
736
|
-
extractor = new NgModuleExtractor(classDeclaration, ref,
|
|
734
|
+
extractor = new NgModuleExtractor(classDeclaration, ref, typeChecker);
|
|
737
735
|
} else {
|
|
738
736
|
extractor = new ClassExtractor(classDeclaration, typeChecker);
|
|
739
737
|
}
|
|
@@ -1591,7 +1589,7 @@ function isLocalFile(sf) {
|
|
|
1591
1589
|
return !sf.isDeclarationFile;
|
|
1592
1590
|
}
|
|
1593
1591
|
function isTypeOnlyImportClause(node) {
|
|
1594
|
-
if (node.
|
|
1592
|
+
if (node.phaseModifier === ts15.SyntaxKind.TypeKeyword) {
|
|
1595
1593
|
return true;
|
|
1596
1594
|
}
|
|
1597
1595
|
if (node.namedBindings !== void 0 && ts15.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
@@ -2958,6 +2956,20 @@ var TemplateVisitor2 = class extends CombinedRecursiveAstVisitor2 {
|
|
|
2958
2956
|
}
|
|
2959
2957
|
};
|
|
2960
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
|
+
|
|
2961
2973
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.js
|
|
2962
2974
|
var SIGNAL_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["set", "update", "asReadonly"]);
|
|
2963
2975
|
var FUNCTION_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["name", "length", "prototype"]);
|
|
@@ -3035,7 +3047,7 @@ function buildDiagnosticForSignal(ctx, node, component) {
|
|
|
3035
3047
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
3036
3048
|
if (symbol !== null && symbol.kind === SymbolKind.Expression && isSignalReference(symbol)) {
|
|
3037
3049
|
const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbol.tcbLocation);
|
|
3038
|
-
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}()}`);
|
|
3039
3051
|
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
|
|
3040
3052
|
return [diagnostic];
|
|
3041
3053
|
}
|
|
@@ -3045,7 +3057,7 @@ function buildDiagnosticForSignal(ctx, node, component) {
|
|
|
3045
3057
|
const symbolOfReceiver = ctx.templateTypeChecker.getSymbolOfNode(node.receiver, component);
|
|
3046
3058
|
if (symbolOfReceiver !== null && symbolOfReceiver.kind === SymbolKind.Expression && isSignalReference(symbolOfReceiver)) {
|
|
3047
3059
|
const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbolOfReceiver.tcbLocation);
|
|
3048
|
-
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}()`);
|
|
3049
3061
|
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
|
|
3050
3062
|
return [diagnostic];
|
|
3051
3063
|
}
|
|
@@ -3069,8 +3081,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
3069
3081
|
return [];
|
|
3070
3082
|
const boundSyntax = node.sourceSpan.toString();
|
|
3071
3083
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
3072
|
-
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'
|
|
3073
|
-
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}'`));
|
|
3074
3085
|
return [diagnostic];
|
|
3075
3086
|
}
|
|
3076
3087
|
};
|
|
@@ -3109,7 +3120,7 @@ var MissingControlFlowDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
|
3109
3120
|
}
|
|
3110
3121
|
const sourceSpan = controlFlowAttr.keySpan || controlFlowAttr.sourceSpan;
|
|
3111
3122
|
const directiveAndBuiltIn = KNOWN_CONTROL_FLOW_DIRECTIVES.get(controlFlowAttr.name);
|
|
3112
|
-
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.`);
|
|
3113
3124
|
const diagnostic = ctx.makeTemplateDiagnostic(sourceSpan, errorMessage);
|
|
3114
3125
|
return [diagnostic];
|
|
3115
3126
|
}
|
|
@@ -3141,7 +3152,7 @@ var MissingNgForOfLetCheck = class extends TemplateCheckWithVisitor {
|
|
|
3141
3152
|
if (node.variables.length > 0) {
|
|
3142
3153
|
return [];
|
|
3143
3154
|
}
|
|
3144
|
-
const errorString =
|
|
3155
|
+
const errorString = formatExtendedError(ErrorCode.MISSING_NGFOROF_LET, `Your ngFor is missing a value. Did you forget to add the \`let\` keyword?`);
|
|
3145
3156
|
const diagnostic = ctx.makeTemplateDiagnostic(attr.sourceSpan, errorString);
|
|
3146
3157
|
return [diagnostic];
|
|
3147
3158
|
}
|
|
@@ -3184,7 +3195,7 @@ var MissingStructuralDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
|
3184
3195
|
if (hasStructuralDirective)
|
|
3185
3196
|
return [];
|
|
3186
3197
|
const sourceSpan = customStructuralDirective.keySpan || customStructuralDirective.sourceSpan;
|
|
3187
|
-
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.`);
|
|
3188
3199
|
return [ctx.makeTemplateDiagnostic(sourceSpan, errorMessage)];
|
|
3189
3200
|
}
|
|
3190
3201
|
};
|
|
@@ -3220,7 +3231,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3220
3231
|
if (templateMapping === null) {
|
|
3221
3232
|
return [];
|
|
3222
3233
|
}
|
|
3223
|
-
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.`));
|
|
3224
3235
|
return [diagnostic];
|
|
3225
3236
|
}
|
|
3226
3237
|
};
|
|
@@ -3272,7 +3283,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3272
3283
|
return [];
|
|
3273
3284
|
}
|
|
3274
3285
|
const advice = node instanceof SafePropertyRead ? `the '?.' operator can be replaced with the '.' operator` : `the '?.' operator can be safely removed`;
|
|
3275
|
-
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}`));
|
|
3276
3287
|
return [diagnostic];
|
|
3277
3288
|
}
|
|
3278
3289
|
};
|
|
@@ -3296,7 +3307,7 @@ var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
|
|
|
3296
3307
|
code = ErrorCode.SKIP_HYDRATION_NOT_STATIC;
|
|
3297
3308
|
visitNode(ctx, component, node) {
|
|
3298
3309
|
if (node instanceof TmplAstBoundAttribute2 && node.name === NG_SKIP_HYDRATION_ATTR_NAME) {
|
|
3299
|
-
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`);
|
|
3300
3311
|
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
|
|
3301
3312
|
return [diagnostic];
|
|
3302
3313
|
}
|
|
@@ -3306,7 +3317,7 @@ var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
|
|
|
3306
3317
|
/* empty string */
|
|
3307
3318
|
];
|
|
3308
3319
|
if (node instanceof TmplAstTextAttribute && node.name === NG_SKIP_HYDRATION_ATTR_NAME && !acceptedValues.includes(node.value) && node.value !== void 0) {
|
|
3309
|
-
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'`);
|
|
3310
3321
|
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
|
|
3311
3322
|
return [diagnostic];
|
|
3312
3323
|
}
|
|
@@ -3330,7 +3341,7 @@ var SuffixNotSupportedCheck = class extends TemplateCheckWithVisitor {
|
|
|
3330
3341
|
if (!node.keySpan.toString().startsWith("attr.") || !STYLE_SUFFIXES.some((suffix) => node.name.endsWith(`.${suffix}`))) {
|
|
3331
3342
|
return [];
|
|
3332
3343
|
}
|
|
3333
|
-
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`));
|
|
3334
3345
|
return [diagnostic];
|
|
3335
3346
|
}
|
|
3336
3347
|
};
|
|
@@ -3369,6 +3380,7 @@ var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
|
|
|
3369
3380
|
if (node.value) {
|
|
3370
3381
|
errorString += ` For example, '${expectedKey}="${expectedValue}"'.`;
|
|
3371
3382
|
}
|
|
3383
|
+
errorString = formatExtendedError(ErrorCode.TEXT_ATTRIBUTE_NOT_BINDING, errorString);
|
|
3372
3384
|
}
|
|
3373
3385
|
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
|
|
3374
3386
|
return [diagnostic];
|
|
@@ -3417,7 +3429,7 @@ function assertExpressionInvoked(expression, component, node, expressionText, ct
|
|
|
3417
3429
|
if (symbol !== null && symbol.kind === SymbolKind.Expression) {
|
|
3418
3430
|
if (symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3419
3431
|
const fullExpressionText = generateStringFromExpression(expression, expressionText);
|
|
3420
|
-
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}()`);
|
|
3421
3433
|
return [ctx.makeTemplateDiagnostic(node.sourceSpan, errorString)];
|
|
3422
3434
|
}
|
|
3423
3435
|
}
|
|
@@ -3448,7 +3460,7 @@ var UnparenthesizedNullishCoalescing = class extends TemplateCheckWithVisitor {
|
|
|
3448
3460
|
if (sourceMapping === null) {
|
|
3449
3461
|
return [];
|
|
3450
3462
|
}
|
|
3451
|
-
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 '||'`));
|
|
3452
3464
|
return [diagnostic];
|
|
3453
3465
|
}
|
|
3454
3466
|
}
|
|
@@ -3473,7 +3485,7 @@ var UnusedLetDeclarationCheck = class extends TemplateCheckWithVisitor {
|
|
|
3473
3485
|
const { allLetDeclarations, usedLetDeclarations } = this.getAnalysis(component);
|
|
3474
3486
|
for (const decl of allLetDeclarations) {
|
|
3475
3487
|
if (!usedLetDeclarations.has(decl)) {
|
|
3476
|
-
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.`)));
|
|
3477
3489
|
}
|
|
3478
3490
|
}
|
|
3479
3491
|
this.analysis.clear();
|
|
@@ -3521,7 +3533,7 @@ var UninvokedTrackFunctionCheck = class extends TemplateCheckWithVisitor {
|
|
|
3521
3533
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node.trackBy.ast, component);
|
|
3522
3534
|
if (symbol !== null && symbol.kind === SymbolKind.Expression && symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3523
3535
|
const fullExpressionText = generateStringFromExpression2(node.trackBy.ast, node.trackBy.source || "");
|
|
3524
|
-
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 */)`);
|
|
3525
3537
|
return [ctx.makeTemplateDiagnostic(node.sourceSpan, errorString)];
|
|
3526
3538
|
}
|
|
3527
3539
|
return [];
|
|
@@ -3554,7 +3566,7 @@ function assertExpressionInvoked2(expression, component, ctx) {
|
|
|
3554
3566
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(expression, component);
|
|
3555
3567
|
if (symbol !== null && symbol.kind === SymbolKind.Expression) {
|
|
3556
3568
|
if (symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3557
|
-
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}()`);
|
|
3558
3570
|
const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbol.tcbLocation);
|
|
3559
3571
|
return [ctx.makeTemplateDiagnostic(templateMapping.span, errorString)];
|
|
3560
3572
|
}
|
|
@@ -3583,11 +3595,11 @@ var DeferTriggerMisconfiguration = class extends TemplateCheckWithVisitor {
|
|
|
3583
3595
|
if (hasImmediateMain) {
|
|
3584
3596
|
if (mains.length > 1) {
|
|
3585
3597
|
const msg = `The 'immediate' trigger makes additional triggers redundant.`;
|
|
3586
|
-
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, msg));
|
|
3598
|
+
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3587
3599
|
}
|
|
3588
3600
|
if (prefetches.length > 0) {
|
|
3589
3601
|
const msg = `Prefetch triggers have no effect because 'immediate' executes earlier.`;
|
|
3590
|
-
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, msg));
|
|
3602
|
+
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3591
3603
|
}
|
|
3592
3604
|
}
|
|
3593
3605
|
if (mains.length === 1 && prefetches.length > 0) {
|
|
@@ -3599,7 +3611,7 @@ var DeferTriggerMisconfiguration = class extends TemplateCheckWithVisitor {
|
|
|
3599
3611
|
const preDelay = pre.delay;
|
|
3600
3612
|
if (preDelay >= mainDelay) {
|
|
3601
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.`;
|
|
3602
|
-
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
3614
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3603
3615
|
}
|
|
3604
3616
|
}
|
|
3605
3617
|
const isHoverTrigger = main instanceof TmplAstHoverDeferredTrigger && pre instanceof TmplAstHoverDeferredTrigger;
|
|
@@ -3611,14 +3623,14 @@ var DeferTriggerMisconfiguration = class extends TemplateCheckWithVisitor {
|
|
|
3611
3623
|
if (mainRef && preRef && mainRef === preRef) {
|
|
3612
3624
|
const kindName = main.constructor.name.replace("DeferredTrigger", "").toLowerCase();
|
|
3613
3625
|
const msg = `Prefetch '${kindName}' matches the main trigger and provides no benefit. Remove the prefetch modifier.`;
|
|
3614
|
-
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
3626
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3615
3627
|
}
|
|
3616
3628
|
continue;
|
|
3617
3629
|
}
|
|
3618
3630
|
if (main.constructor === pre.constructor && !(main instanceof TmplAstTimerDeferredTrigger)) {
|
|
3619
3631
|
const kind = main instanceof TmplAstImmediateDeferredTrigger ? "immediate" : main.constructor.name.replace("DeferredTrigger", "").toLowerCase();
|
|
3620
3632
|
const msg = `Prefetch '${kind}' matches the main trigger and provides no benefit. Remove the prefetch modifier.`;
|
|
3621
|
-
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
3633
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, formatExtendedError(ErrorCode.DEFER_TRIGGER_MISCONFIGURATION, msg)));
|
|
3622
3634
|
}
|
|
3623
3635
|
}
|
|
3624
3636
|
}
|
|
@@ -4484,7 +4496,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4484
4496
|
}
|
|
4485
4497
|
const defaultImportTracker = new DefaultImportTracker();
|
|
4486
4498
|
const before = [
|
|
4487
|
-
ivyTransformFactory(compilation.traitCompiler, compilation.reflector, importRewriter, defaultImportTracker, compilation.localCompilationExtraImportsTracker, this.delegatingPerfRecorder, compilation.isCore, this.closureCompilerEnabled, this.emitDeclarationOnly),
|
|
4499
|
+
ivyTransformFactory(compilation.traitCompiler, compilation.reflector, importRewriter, defaultImportTracker, compilation.localCompilationExtraImportsTracker, this.delegatingPerfRecorder, compilation.isCore, this.closureCompilerEnabled, this.emitDeclarationOnly, compilation.refEmitter, !!this.options["_experimentalEmitIntermediateTs"]),
|
|
4488
4500
|
aliasTransformFactory(compilation.traitCompiler.exportStatements),
|
|
4489
4501
|
defaultImportTracker.importPreservingTransformer()
|
|
4490
4502
|
];
|
|
@@ -4922,7 +4934,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4922
4934
|
new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
|
|
4923
4935
|
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, this.options.onlyPublishPublicTypingsForNgModules ?? false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode, localCompilationExtraImportsTracker, jitDeclarationRegistry, this.emitDeclarationOnly)
|
|
4924
4936
|
];
|
|
4925
|
-
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter, this.emitDeclarationOnly);
|
|
4937
|
+
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter, this.emitDeclarationOnly, !!this.options["_experimentalEmitIntermediateTs"]);
|
|
4926
4938
|
const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {
|
|
4927
4939
|
this.incrementalStrategy.setIncrementalState(this.incrementalCompilation.state, program);
|
|
4928
4940
|
this.currentProgram = program;
|
|
@@ -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
|
})();
|
|
@@ -694,7 +694,7 @@ function typeToValue(typeNode, checker, isLocalCompilation) {
|
|
|
694
694
|
const firstDecl = local.declarations && local.declarations[0];
|
|
695
695
|
if (firstDecl !== void 0) {
|
|
696
696
|
if (ts5.isImportClause(firstDecl) && firstDecl.name !== void 0) {
|
|
697
|
-
if (firstDecl.
|
|
697
|
+
if (firstDecl.phaseModifier === ts5.SyntaxKind.TypeKeyword) {
|
|
698
698
|
return typeOnlyImport(typeNode, firstDecl);
|
|
699
699
|
}
|
|
700
700
|
if (!ts5.isImportDeclaration(firstDecl.parent)) {
|
|
@@ -709,7 +709,7 @@ function typeToValue(typeNode, checker, isLocalCompilation) {
|
|
|
709
709
|
if (firstDecl.isTypeOnly) {
|
|
710
710
|
return typeOnlyImport(typeNode, firstDecl);
|
|
711
711
|
}
|
|
712
|
-
if (firstDecl.parent.parent.
|
|
712
|
+
if (firstDecl.parent.parent.phaseModifier === ts5.SyntaxKind.TypeKeyword) {
|
|
713
713
|
return typeOnlyImport(typeNode, firstDecl.parent.parent);
|
|
714
714
|
}
|
|
715
715
|
const importedName = (firstDecl.propertyName || firstDecl.name).text;
|
|
@@ -727,7 +727,7 @@ function typeToValue(typeNode, checker, isLocalCompilation) {
|
|
|
727
727
|
nestedPath
|
|
728
728
|
};
|
|
729
729
|
} else if (ts5.isNamespaceImport(firstDecl)) {
|
|
730
|
-
if (firstDecl.parent.
|
|
730
|
+
if (firstDecl.parent.phaseModifier === ts5.SyntaxKind.TypeKeyword) {
|
|
731
731
|
return typeOnlyImport(typeNode, firstDecl.parent);
|
|
732
732
|
}
|
|
733
733
|
if (symbols.symbolNames.length === 1) {
|
|
@@ -1930,7 +1930,7 @@ var DeferredSymbolTracker = class {
|
|
|
1930
1930
|
if (importDecl.importClause === void 0) {
|
|
1931
1931
|
throw new Error(`Provided import declaration doesn't have any symbols.`);
|
|
1932
1932
|
}
|
|
1933
|
-
if (importDecl.importClause.
|
|
1933
|
+
if (importDecl.importClause.phaseModifier === ts10.SyntaxKind.TypeKeyword) {
|
|
1934
1934
|
return symbolMap;
|
|
1935
1935
|
}
|
|
1936
1936
|
if (importDecl.importClause.namedBindings !== void 0) {
|
|
@@ -4737,7 +4737,7 @@ function createTsTransformForImportManager(manager, extraStatementsForFiles) {
|
|
|
4737
4737
|
if (clause.namedBindings === void 0 || !ts19.isNamedImports(clause.namedBindings) || !updatedImports.has(clause.namedBindings)) {
|
|
4738
4738
|
return node;
|
|
4739
4739
|
}
|
|
4740
|
-
const newClause = ctx.factory.updateImportClause(clause, clause.
|
|
4740
|
+
const newClause = ctx.factory.updateImportClause(clause, clause.phaseModifier, clause.name, updatedImports.get(clause.namedBindings));
|
|
4741
4741
|
const newImport = ctx.factory.updateImportDeclaration(node, node.modifiers, newClause, node.moduleSpecifier, node.attributes);
|
|
4742
4742
|
ts19.setOriginalNode(newImport, {
|
|
4743
4743
|
importClause: newClause,
|
|
@@ -4809,7 +4809,7 @@ function attemptToReuseExistingSourceFileImports(tracker, sourceFile, request) {
|
|
|
4809
4809
|
if (!ts21.isImportDeclaration(statement) || !ts21.isStringLiteral(statement.moduleSpecifier)) {
|
|
4810
4810
|
continue;
|
|
4811
4811
|
}
|
|
4812
|
-
if (!statement.importClause || statement.importClause.
|
|
4812
|
+
if (!statement.importClause || statement.importClause.phaseModifier === ts21.SyntaxKind.TypeKeyword) {
|
|
4813
4813
|
continue;
|
|
4814
4814
|
}
|
|
4815
4815
|
const moduleSpecifier = statement.moduleSpecifier.text;
|
|
@@ -6006,6 +6006,7 @@ var TraitCompiler = class {
|
|
|
6006
6006
|
semanticDepGraphUpdater;
|
|
6007
6007
|
sourceFileTypeIdentifier;
|
|
6008
6008
|
emitDeclarationOnly;
|
|
6009
|
+
emitIntermediateTs;
|
|
6009
6010
|
/**
|
|
6010
6011
|
* Maps class declarations to their `ClassRecord`, which tracks the Ivy traits being applied to
|
|
6011
6012
|
* those classes.
|
|
@@ -6023,7 +6024,7 @@ var TraitCompiler = class {
|
|
|
6023
6024
|
filesWithoutTraits = /* @__PURE__ */ new Set();
|
|
6024
6025
|
reexportMap = /* @__PURE__ */ new Map();
|
|
6025
6026
|
handlersByName = /* @__PURE__ */ new Map();
|
|
6026
|
-
constructor(handlers, reflector, perf, incrementalBuild, compileNonExportedClasses, compilationMode, dtsTransforms, semanticDepGraphUpdater, sourceFileTypeIdentifier, emitDeclarationOnly) {
|
|
6027
|
+
constructor(handlers, reflector, perf, incrementalBuild, compileNonExportedClasses, compilationMode, dtsTransforms, semanticDepGraphUpdater, sourceFileTypeIdentifier, emitDeclarationOnly, emitIntermediateTs) {
|
|
6027
6028
|
this.handlers = handlers;
|
|
6028
6029
|
this.reflector = reflector;
|
|
6029
6030
|
this.perf = perf;
|
|
@@ -6034,6 +6035,7 @@ var TraitCompiler = class {
|
|
|
6034
6035
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
6035
6036
|
this.sourceFileTypeIdentifier = sourceFileTypeIdentifier;
|
|
6036
6037
|
this.emitDeclarationOnly = emitDeclarationOnly;
|
|
6038
|
+
this.emitIntermediateTs = emitIntermediateTs;
|
|
6037
6039
|
for (const handler of handlers) {
|
|
6038
6040
|
this.handlersByName.set(handler.name, handler);
|
|
6039
6041
|
}
|
|
@@ -6708,11 +6710,11 @@ var Visitor = class {
|
|
|
6708
6710
|
// packages/compiler-cli/src/ngtsc/transform/src/transform.js
|
|
6709
6711
|
var NO_DECORATORS = /* @__PURE__ */ new Set();
|
|
6710
6712
|
var CLOSURE_FILE_OVERVIEW_REGEXP = /\s+@fileoverview\s+/i;
|
|
6711
|
-
function ivyTransformFactory(compilation, reflector, importRewriter, defaultImportTracker, localCompilationExtraImportsTracker, perf, isCore, isClosureCompilerEnabled, emitDeclarationOnly) {
|
|
6713
|
+
function ivyTransformFactory(compilation, reflector, importRewriter, defaultImportTracker, localCompilationExtraImportsTracker, perf, isCore, isClosureCompilerEnabled, emitDeclarationOnly, refEmitter, enableTypeReification) {
|
|
6712
6714
|
const recordWrappedNode = createRecorderFn(defaultImportTracker);
|
|
6713
6715
|
return (context) => {
|
|
6714
6716
|
return (file) => {
|
|
6715
|
-
return perf.inPhase(PerfPhase.Compile, () => transformIvySourceFile(compilation, context, reflector, importRewriter, localCompilationExtraImportsTracker, file, isCore, isClosureCompilerEnabled, emitDeclarationOnly, recordWrappedNode));
|
|
6717
|
+
return perf.inPhase(PerfPhase.Compile, () => transformIvySourceFile(compilation, context, reflector, importRewriter, localCompilationExtraImportsTracker, file, isCore, isClosureCompilerEnabled, emitDeclarationOnly, refEmitter, enableTypeReification, recordWrappedNode));
|
|
6716
6718
|
};
|
|
6717
6719
|
};
|
|
6718
6720
|
}
|
|
@@ -6748,7 +6750,9 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
6748
6750
|
isClosureCompilerEnabled;
|
|
6749
6751
|
isCore;
|
|
6750
6752
|
deferrableImports;
|
|
6751
|
-
|
|
6753
|
+
refEmitter;
|
|
6754
|
+
enableTypeReification;
|
|
6755
|
+
constructor(compilation, classCompilationMap, reflector, importManager, recordWrappedNodeExpr, isClosureCompilerEnabled, isCore, deferrableImports, refEmitter, enableTypeReification) {
|
|
6752
6756
|
super();
|
|
6753
6757
|
this.compilation = compilation;
|
|
6754
6758
|
this.classCompilationMap = classCompilationMap;
|
|
@@ -6758,6 +6762,8 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
6758
6762
|
this.isClosureCompilerEnabled = isClosureCompilerEnabled;
|
|
6759
6763
|
this.isCore = isCore;
|
|
6760
6764
|
this.deferrableImports = deferrableImports;
|
|
6765
|
+
this.refEmitter = refEmitter;
|
|
6766
|
+
this.enableTypeReification = enableTypeReification;
|
|
6761
6767
|
}
|
|
6762
6768
|
visitClassDeclaration(node) {
|
|
6763
6769
|
const original = ts31.getOriginalNode(node, ts31.isClassDeclaration);
|
|
@@ -6777,7 +6783,11 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
6777
6783
|
continue;
|
|
6778
6784
|
}
|
|
6779
6785
|
const exprNode = translateExpression(sourceFile, field.initializer, this.importManager, translateOptions);
|
|
6780
|
-
|
|
6786
|
+
let typeNode = void 0;
|
|
6787
|
+
if (this.enableTypeReification && this.refEmitter !== null) {
|
|
6788
|
+
typeNode = translateType(field.type, sourceFile, this.reflector, this.refEmitter, this.importManager);
|
|
6789
|
+
}
|
|
6790
|
+
const property = ts31.factory.createPropertyDeclaration([ts31.factory.createToken(ts31.SyntaxKind.StaticKeyword)], field.name, void 0, typeNode, exprNode);
|
|
6781
6791
|
if (this.isClosureCompilerEnabled) {
|
|
6782
6792
|
ts31.addSyntheticLeadingComment(
|
|
6783
6793
|
property,
|
|
@@ -6876,7 +6886,7 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
6876
6886
|
return node;
|
|
6877
6887
|
}
|
|
6878
6888
|
};
|
|
6879
|
-
function transformIvySourceFile(compilation, context, reflector, importRewriter, localCompilationExtraImportsTracker, file, isCore, isClosureCompilerEnabled, emitDeclarationOnly, recordWrappedNode) {
|
|
6889
|
+
function transformIvySourceFile(compilation, context, reflector, importRewriter, localCompilationExtraImportsTracker, file, isCore, isClosureCompilerEnabled, emitDeclarationOnly, refEmitter, enableTypeReification, recordWrappedNode) {
|
|
6880
6890
|
const constantPool = new ConstantPool(isClosureCompilerEnabled);
|
|
6881
6891
|
const importManager = new ImportManager({
|
|
6882
6892
|
...presetImportManagerForceNamespaceImports,
|
|
@@ -6887,7 +6897,7 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
|
|
|
6887
6897
|
if (emitDeclarationOnly) {
|
|
6888
6898
|
return file;
|
|
6889
6899
|
}
|
|
6890
|
-
const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore, compilationVisitor.deferrableImports);
|
|
6900
|
+
const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore, compilationVisitor.deferrableImports, refEmitter, enableTypeReification);
|
|
6891
6901
|
let sf = visit(file, transformationVisitor, context);
|
|
6892
6902
|
const downlevelTranslatedCode = getLocalizeCompileTarget(context) < ts31.ScriptTarget.ES2015;
|
|
6893
6903
|
const constants = constantPool.statements.map((stmt) => translateStatement(file, stmt, importManager, {
|
|
@@ -10784,7 +10794,7 @@ var SelectorlessComponentScopeReader = class {
|
|
|
10784
10794
|
result.set(stmt.name.text, stmt.name);
|
|
10785
10795
|
continue;
|
|
10786
10796
|
}
|
|
10787
|
-
if (ts46.isImportDeclaration(stmt) && stmt.importClause !== void 0 && !stmt.importClause.
|
|
10797
|
+
if (ts46.isImportDeclaration(stmt) && stmt.importClause !== void 0 && !(stmt.importClause.phaseModifier === ts46.SyntaxKind.TypeKeyword)) {
|
|
10788
10798
|
const clause = stmt.importClause;
|
|
10789
10799
|
if (clause.namedBindings !== void 0 && ts46.isNamedImports(clause.namedBindings)) {
|
|
10790
10800
|
for (const element of clause.namedBindings.elements) {
|
|
@@ -14621,6 +14631,25 @@ var TcbExpressionOp = class extends TcbOp {
|
|
|
14621
14631
|
return null;
|
|
14622
14632
|
}
|
|
14623
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
|
+
};
|
|
14624
14653
|
var TcbExpressionTranslator = class {
|
|
14625
14654
|
tcb;
|
|
14626
14655
|
scope;
|
|
@@ -15105,6 +15134,14 @@ var TcbSwitchOp = class extends TcbOp {
|
|
|
15105
15134
|
return switchCase.expression === null ? ts70.factory.createDefaultClause(statementsForCase) : ts70.factory.createCaseClause(tcbExpression(switchCase.expression, this.tcb, this.scope), statementsForCase);
|
|
15106
15135
|
});
|
|
15107
15136
|
});
|
|
15137
|
+
if (this.block.exhaustiveCheck) {
|
|
15138
|
+
const switchValue = tcbExpression(this.block.expression, this.tcb, this.scope);
|
|
15139
|
+
clauses.push(ts70.factory.createDefaultClause([
|
|
15140
|
+
ts70.factory.createVariableStatement(void 0, ts70.factory.createVariableDeclarationList([
|
|
15141
|
+
ts70.factory.createVariableDeclaration(ts70.factory.createUniqueName("tcbExhaustive"), void 0, ts70.factory.createKeywordTypeNode(ts70.SyntaxKind.NeverKeyword), switchValue)
|
|
15142
|
+
], ts70.NodeFlags.Const))
|
|
15143
|
+
]));
|
|
15144
|
+
}
|
|
15108
15145
|
this.scope.addStatement(ts70.factory.createSwitchStatement(switchExpression, ts70.factory.createCaseBlock(clauses)));
|
|
15109
15146
|
return null;
|
|
15110
15147
|
}
|
|
@@ -15330,7 +15367,8 @@ var TcbNativeFieldOp = class extends TcbOp {
|
|
|
15330
15367
|
case "datetime-local":
|
|
15331
15368
|
return ts73.factory.createUnionTypeNode([
|
|
15332
15369
|
ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
|
|
15333
|
-
ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword)
|
|
15370
|
+
ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
|
|
15371
|
+
ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
|
|
15334
15372
|
]);
|
|
15335
15373
|
case "date":
|
|
15336
15374
|
case "month":
|
|
@@ -16948,7 +16986,7 @@ var Scope = class _Scope {
|
|
|
16948
16986
|
this.appendDeferredTriggers(block, block.triggers);
|
|
16949
16987
|
this.appendDeferredTriggers(block, block.prefetchTriggers);
|
|
16950
16988
|
if (block.hydrateTriggers.when) {
|
|
16951
|
-
this.opQueue.push(new
|
|
16989
|
+
this.opQueue.push(new TcbConditionOp(this.tcb, this, block.hydrateTriggers.when.value));
|
|
16952
16990
|
}
|
|
16953
16991
|
this.appendChildren(block);
|
|
16954
16992
|
if (block.placeholder !== null) {
|
|
@@ -16963,7 +17001,7 @@ var Scope = class _Scope {
|
|
|
16963
17001
|
}
|
|
16964
17002
|
appendDeferredTriggers(block, triggers) {
|
|
16965
17003
|
if (triggers.when !== void 0) {
|
|
16966
|
-
this.opQueue.push(new
|
|
17004
|
+
this.opQueue.push(new TcbConditionOp(this.tcb, this, triggers.when.value));
|
|
16967
17005
|
}
|
|
16968
17006
|
if (triggers.viewport !== void 0 && triggers.viewport.options !== null) {
|
|
16969
17007
|
this.opQueue.push(new TcbIntersectionObserverOp(this.tcb, this, triggers.viewport.options));
|
|
@@ -20742,7 +20780,7 @@ function getTopLevelDeclarationNames(sourceFile) {
|
|
|
20742
20780
|
}
|
|
20743
20781
|
if (ts91.isImportDeclaration(node) && node.importClause) {
|
|
20744
20782
|
const importClause = node.importClause;
|
|
20745
|
-
if (importClause.
|
|
20783
|
+
if (importClause.phaseModifier === ts91.SyntaxKind.TypeKeyword) {
|
|
20746
20784
|
continue;
|
|
20747
20785
|
}
|
|
20748
20786
|
if (importClause.name) {
|
|
@@ -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,
|
|
@@ -149,7 +149,7 @@ function compareVersions(v1, v2) {
|
|
|
149
149
|
|
|
150
150
|
// packages/compiler-cli/src/typescript_support.js
|
|
151
151
|
var MIN_TS_VERSION = "5.9.0";
|
|
152
|
-
var MAX_TS_VERSION = "6.
|
|
152
|
+
var MAX_TS_VERSION = "6.1.0";
|
|
153
153
|
var tsVersion = ts2.version;
|
|
154
154
|
function checkVersion(version, minVersion, maxVersion) {
|
|
155
155
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
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,8 +43,8 @@
|
|
|
43
43
|
"typescript": "5.9.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@angular/compiler": "21.2.0
|
|
47
|
-
"typescript": ">=5.9 <6.
|
|
46
|
+
"@angular/compiler": "21.2.0",
|
|
47
|
+
"typescript": ">=5.9 <6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"typescript": {
|
|
@@ -0,0 +1,33 @@
|
|
|
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 ts from 'typescript';
|
|
9
|
+
import { NgCompiler } from './core';
|
|
10
|
+
import { NgCompilerOptions } from './core/api';
|
|
11
|
+
/**
|
|
12
|
+
* A driver for the Angular Compiler that performs "Source-to-Source" transformation.
|
|
13
|
+
*
|
|
14
|
+
* Unlike `NgtscProgram`, this driver does NOT use `program.emit()`. Instead, it:
|
|
15
|
+
* 1. Analyzes the program using `NgCompiler`.
|
|
16
|
+
* 2. Manually runs `ts.transform` with Angular's Ivy transformers.
|
|
17
|
+
* 3. Prints the transformed AST back to a TypeScript string.
|
|
18
|
+
*
|
|
19
|
+
* This mode is designed for a mode where the Angular Compiler
|
|
20
|
+
* acts as a pre-processor for a downstream TypeScript compiler.
|
|
21
|
+
*/
|
|
22
|
+
export declare class NgtscIsolatedPreprocessor {
|
|
23
|
+
private options;
|
|
24
|
+
readonly compiler: NgCompiler;
|
|
25
|
+
private tsProgram;
|
|
26
|
+
private host;
|
|
27
|
+
private incrementalStrategy;
|
|
28
|
+
constructor(rootNames: ReadonlyArray<string>, options: NgCompilerOptions, delegateHost: ts.CompilerHost, oldProgram?: NgtscIsolatedPreprocessor);
|
|
29
|
+
transformAndPrint(): {
|
|
30
|
+
fileName: string;
|
|
31
|
+
content: string;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
@@ -66,6 +66,7 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
|
|
|
66
66
|
private semanticDepGraphUpdater;
|
|
67
67
|
private sourceFileTypeIdentifier;
|
|
68
68
|
private emitDeclarationOnly;
|
|
69
|
+
private emitIntermediateTs;
|
|
69
70
|
/**
|
|
70
71
|
* Maps class declarations to their `ClassRecord`, which tracks the Ivy traits being applied to
|
|
71
72
|
* those classes.
|
|
@@ -83,7 +84,7 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
|
|
|
83
84
|
private filesWithoutTraits;
|
|
84
85
|
private reexportMap;
|
|
85
86
|
private handlersByName;
|
|
86
|
-
constructor(handlers: DecoratorHandler<unknown, unknown, SemanticSymbol | null, unknown>[], reflector: ReflectionHost, perf: PerfRecorder, incrementalBuild: IncrementalBuild<ClassRecord, unknown>, compileNonExportedClasses: boolean, compilationMode: CompilationMode, dtsTransforms: DtsTransformRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, sourceFileTypeIdentifier: SourceFileTypeIdentifier, emitDeclarationOnly: boolean);
|
|
87
|
+
constructor(handlers: DecoratorHandler<unknown, unknown, SemanticSymbol | null, unknown>[], reflector: ReflectionHost, perf: PerfRecorder, incrementalBuild: IncrementalBuild<ClassRecord, unknown>, compileNonExportedClasses: boolean, compilationMode: CompilationMode, dtsTransforms: DtsTransformRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, sourceFileTypeIdentifier: SourceFileTypeIdentifier, emitDeclarationOnly: boolean, emitIntermediateTs: boolean);
|
|
87
88
|
analyzeSync(sf: ts.SourceFile): void;
|
|
88
89
|
analyzeAsync(sf: ts.SourceFile): Promise<void> | undefined;
|
|
89
90
|
private analyze;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import ts from 'typescript';
|
|
9
|
-
import { DefaultImportTracker, ImportRewriter, LocalCompilationExtraImportsTracker } from '../../imports';
|
|
9
|
+
import { DefaultImportTracker, ImportRewriter, LocalCompilationExtraImportsTracker, ReferenceEmitter } from '../../imports';
|
|
10
10
|
import { PerfRecorder } from '../../perf';
|
|
11
11
|
import { ReflectionHost } from '../../reflection';
|
|
12
12
|
import { TraitCompiler } from './compilation';
|
|
13
|
-
export declare function ivyTransformFactory(compilation: TraitCompiler, reflector: ReflectionHost, importRewriter: ImportRewriter, defaultImportTracker: DefaultImportTracker, localCompilationExtraImportsTracker: LocalCompilationExtraImportsTracker | null, perf: PerfRecorder, isCore: boolean, isClosureCompilerEnabled: boolean, emitDeclarationOnly: boolean): ts.TransformerFactory<ts.SourceFile>;
|
|
13
|
+
export declare function ivyTransformFactory(compilation: TraitCompiler, reflector: ReflectionHost, importRewriter: ImportRewriter, defaultImportTracker: DefaultImportTracker, localCompilationExtraImportsTracker: LocalCompilationExtraImportsTracker | null, perf: PerfRecorder, isCore: boolean, isClosureCompilerEnabled: boolean, emitDeclarationOnly: boolean, refEmitter: ReferenceEmitter | null, enableTypeReification: boolean): ts.TransformerFactory<ts.SourceFile>;
|
|
@@ -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;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { TmplAstSwitchBlock } from '@angular/compiler';
|
|
9
9
|
import { TcbOp } from './base';
|
|
10
|
-
import type { Scope } from './scope';
|
|
11
10
|
import type { Context } from './context';
|
|
11
|
+
import type { Scope } from './scope';
|
|
12
12
|
/**
|
|
13
13
|
* A `TcbOp` which renders a `switch` block as a TypeScript `switch` statement.
|
|
14
14
|
*
|