@angular/compiler-cli 21.1.0-next.4 → 21.1.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-ML6J2RBK.js → chunk-ATAZXXPH.js} +2 -2
- package/bundles/{chunk-OPZT26MK.js → chunk-C6LLJPQH.js} +1 -1
- package/bundles/{chunk-6VDGFZBQ.js → chunk-EWMF72RR.js} +34 -12
- package/bundles/{chunk-LS5RJ5CS.js → chunk-FROPOOFC.js} +9 -1
- package/bundles/{chunk-PUEBQK4X.js → chunk-TTZRVNVM.js} +178 -91
- package/bundles/{chunk-ZJZNLTWN.js → chunk-WEF4HIPN.js} +2 -2
- package/bundles/index.js +5 -5
- package/bundles/linker/babel/index.js +14 -4
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +3 -3
- package/bundles/private/testing.js +2 -2
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +5 -5
- package/bundles/src/bin/ngc.js +5 -5
- package/linker/babel/src/ast/babel_ast_factory.d.ts +6 -5
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- package/src/ngtsc/diagnostics/index.d.ts +1 -1
- package/src/ngtsc/diagnostics/src/error_code.d.ts +1 -1
- package/src/ngtsc/diagnostics/src/error_details_base_url.d.ts +1 -0
- package/src/ngtsc/translator/src/api/ast_factory.d.ts +19 -2
- package/src/ngtsc/translator/src/translator.d.ts +1 -0
- package/src/ngtsc/translator/src/typescript_ast_factory.d.ts +1 -0
- package/src/ngtsc/typecheck/src/oob.d.ts +2 -2
- package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +3 -3
- package/src/ngtsc/typecheck/src/ops/inputs.d.ts +4 -3
- package/src/ngtsc/typecheck/src/ops/signal_forms.d.ts +14 -7
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TrackedIncrementalBuildStrategy,
|
|
9
9
|
freshCompilationTicket,
|
|
10
10
|
incrementalFromCompilerTicket
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EWMF72RR.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-TTZRVNVM.js";
|
|
22
22
|
import {
|
|
23
23
|
absoluteFrom,
|
|
24
24
|
createFileSystemTsReadDirectoryFn,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
CompoundComponentScopeReader,
|
|
14
14
|
CompoundMetadataReader,
|
|
15
15
|
CompoundMetadataRegistry,
|
|
16
|
+
DOC_PAGE_BASE_URL,
|
|
16
17
|
DefaultImportTracker,
|
|
17
18
|
DeferredSymbolTracker,
|
|
18
19
|
DelegatingPerfRecorder,
|
|
@@ -87,7 +88,7 @@ import {
|
|
|
87
88
|
toUnredirectedSourceFile,
|
|
88
89
|
tryParseInitializerApi,
|
|
89
90
|
untagAllTsFiles
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-TTZRVNVM.js";
|
|
91
92
|
import {
|
|
92
93
|
LogicalFileSystem,
|
|
93
94
|
absoluteFromSourceFile,
|
|
@@ -622,12 +623,15 @@ var DirectiveExtractor = class extends ClassExtractor {
|
|
|
622
623
|
}
|
|
623
624
|
/** Extract docs info for directives and components (including underlying class info). */
|
|
624
625
|
extract() {
|
|
626
|
+
const selector = this.metadata.selector ?? "";
|
|
627
|
+
const aliases = extractAliasesFromSelector(selector);
|
|
625
628
|
return {
|
|
626
629
|
...super.extract(),
|
|
627
630
|
isStandalone: this.metadata.isStandalone,
|
|
628
|
-
selector
|
|
631
|
+
selector,
|
|
629
632
|
exportAs: this.metadata.exportAs ?? [],
|
|
630
|
-
entryType: this.metadata.isComponent ? EntryType.Component : EntryType.Directive
|
|
633
|
+
entryType: this.metadata.isComponent ? EntryType.Component : EntryType.Directive,
|
|
634
|
+
...aliases.length > 0 && { aliases }
|
|
631
635
|
};
|
|
632
636
|
}
|
|
633
637
|
/** Extracts docs info for a directive property, including input/output metadata. */
|
|
@@ -717,6 +721,21 @@ function extractPipeSyntax(metadata, classDeclaration) {
|
|
|
717
721
|
});
|
|
718
722
|
return `{{ value_expression | ${metadata.name}${paramNames.length ? ":" + paramNames.join(":") : ""} }}`;
|
|
719
723
|
}
|
|
724
|
+
function extractAliasesFromSelector(selector) {
|
|
725
|
+
if (!selector) {
|
|
726
|
+
return [];
|
|
727
|
+
}
|
|
728
|
+
const aliases = [];
|
|
729
|
+
const attributeRegex = /\[([^\]=]+)(?:=[^\]]+)?\]/g;
|
|
730
|
+
let match;
|
|
731
|
+
while ((match = attributeRegex.exec(selector)) !== null) {
|
|
732
|
+
const attributeName = match[1].trim();
|
|
733
|
+
if (attributeName) {
|
|
734
|
+
aliases.push(attributeName);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return aliases;
|
|
738
|
+
}
|
|
720
739
|
|
|
721
740
|
// packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.js
|
|
722
741
|
import ts7 from "typescript";
|
|
@@ -1204,7 +1223,7 @@ var DocsExtractor = class {
|
|
|
1204
1223
|
if (isAngularPrivateName(exportName)) {
|
|
1205
1224
|
continue;
|
|
1206
1225
|
}
|
|
1207
|
-
const entry = this.extractDeclarations(
|
|
1226
|
+
const entry = this.extractDeclarations(declarations);
|
|
1208
1227
|
if (entry && !isIgnoredDocEntry(entry)) {
|
|
1209
1228
|
const realSourceFile = declarations[0].getSourceFile();
|
|
1210
1229
|
const importedSymbols = getImportedSymbols(realSourceFile);
|
|
@@ -1233,7 +1252,7 @@ var DocsExtractor = class {
|
|
|
1233
1252
|
* the same name. This is used to combine entries, e.g. for a type and a namespace that are
|
|
1234
1253
|
* exported under the same name.
|
|
1235
1254
|
*/
|
|
1236
|
-
extractDeclarations(
|
|
1255
|
+
extractDeclarations(nodes) {
|
|
1237
1256
|
const entries = nodes.map((node) => this.extractDeclaration(node));
|
|
1238
1257
|
const decorator = entries.find((e) => e?.entryType === EntryType.Decorator);
|
|
1239
1258
|
if (decorator) {
|
|
@@ -2138,7 +2157,7 @@ var IndexingContext = class {
|
|
|
2138
2157
|
import { ParseSourceFile } from "@angular/compiler";
|
|
2139
2158
|
|
|
2140
2159
|
// packages/compiler-cli/src/ngtsc/indexer/src/template.js
|
|
2141
|
-
import { ASTWithSource, CombinedRecursiveAstVisitor, ImplicitReceiver, PropertyRead, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstReference, TmplAstTemplate, TmplAstVariable, tmplAstVisitAll } from "@angular/compiler";
|
|
2160
|
+
import { ASTWithSource, CombinedRecursiveAstVisitor, ImplicitReceiver, PropertyRead, ThisReceiver, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstReference, TmplAstTemplate, TmplAstVariable, tmplAstVisitAll } from "@angular/compiler";
|
|
2142
2161
|
var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
|
|
2143
2162
|
boundTemplate;
|
|
2144
2163
|
// Identifiers of interest found in the template.
|
|
@@ -2368,7 +2387,7 @@ var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
|
|
|
2368
2387
|
if (this.currentAstWithSource === null || this.currentAstWithSource.source === null) {
|
|
2369
2388
|
return;
|
|
2370
2389
|
}
|
|
2371
|
-
if (!(ast.receiver instanceof ImplicitReceiver)) {
|
|
2390
|
+
if (!(ast.receiver instanceof ImplicitReceiver) && !(ast.receiver instanceof ThisReceiver)) {
|
|
2372
2391
|
return;
|
|
2373
2392
|
}
|
|
2374
2393
|
const { absoluteOffset, source: expressionStr } = this.currentAstWithSource;
|
|
@@ -3024,7 +3043,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
3024
3043
|
const boundSyntax = node.sourceSpan.toString();
|
|
3025
3044
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
3026
3045
|
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'.
|
|
3027
|
-
Find more at
|
|
3046
|
+
Find more at ${DOC_PAGE_BASE_URL}/guide/templates/two-way-binding`);
|
|
3028
3047
|
return [diagnostic];
|
|
3029
3048
|
}
|
|
3030
3049
|
};
|
|
@@ -3664,7 +3683,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
3664
3683
|
]);
|
|
3665
3684
|
|
|
3666
3685
|
// packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
|
|
3667
|
-
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead6, Binary as Binary3, RecursiveAstVisitor, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstRecursiveVisitor, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
3686
|
+
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead6, Binary as Binary3, RecursiveAstVisitor, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstRecursiveVisitor, TmplAstVariable as TmplAstVariable2, ThisReceiver as ThisReceiver2 } from "@angular/compiler";
|
|
3668
3687
|
import ts23 from "typescript";
|
|
3669
3688
|
var TemplateSemanticsCheckerImpl = class {
|
|
3670
3689
|
templateTypeChecker;
|
|
@@ -3716,7 +3735,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
|
|
|
3716
3735
|
this.checkForIllegalWriteInTwoWayBinding(ast, context);
|
|
3717
3736
|
}
|
|
3718
3737
|
checkForIllegalWriteInEventBinding(ast, context) {
|
|
3719
|
-
if (!(
|
|
3738
|
+
if (!this.shouldCheckForIllegalWrites(ast, context)) {
|
|
3720
3739
|
return;
|
|
3721
3740
|
}
|
|
3722
3741
|
const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
|
|
@@ -3726,7 +3745,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
|
|
|
3726
3745
|
}
|
|
3727
3746
|
}
|
|
3728
3747
|
checkForIllegalWriteInTwoWayBinding(ast, context) {
|
|
3729
|
-
if (!(context
|
|
3748
|
+
if (!this.shouldCheckForIllegalWrites(ast, context) || context.type !== ParsedEventType2.TwoWay || ast !== unwrapAstWithSource(context.handler)) {
|
|
3730
3749
|
return;
|
|
3731
3750
|
}
|
|
3732
3751
|
const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
|
|
@@ -3757,6 +3776,9 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
|
|
|
3757
3776
|
}
|
|
3758
3777
|
]);
|
|
3759
3778
|
}
|
|
3779
|
+
shouldCheckForIllegalWrites(ast, context) {
|
|
3780
|
+
return context instanceof TmplAstBoundEvent3 && (ast.receiver instanceof ImplicitReceiver2 || ast.receiver instanceof ThisReceiver2);
|
|
3781
|
+
}
|
|
3760
3782
|
};
|
|
3761
3783
|
function unwrapAstWithSource(ast) {
|
|
3762
3784
|
return ast instanceof ASTWithSource5 ? ast.ast : ast;
|
|
@@ -4944,7 +4966,7 @@ One of the following actions is required:
|
|
|
4944
4966
|
2. Remove "strictTemplates" or set it to 'false'.
|
|
4945
4967
|
|
|
4946
4968
|
More information about the template type checking compiler options can be found in the documentation:
|
|
4947
|
-
|
|
4969
|
+
${DOC_PAGE_BASE_URL}/tools/cli/template-typecheck
|
|
4948
4970
|
`.trim()
|
|
4949
4971
|
});
|
|
4950
4972
|
}
|
|
@@ -214,10 +214,14 @@ var ExpressionTranslatorVisitor = class {
|
|
|
214
214
|
}
|
|
215
215
|
visitLiteralMapExpr(ast, context) {
|
|
216
216
|
const properties = ast.entries.map((entry) => {
|
|
217
|
-
return {
|
|
217
|
+
return entry instanceof o.LiteralMapPropertyAssignment ? {
|
|
218
|
+
kind: "property",
|
|
218
219
|
propertyName: entry.key,
|
|
219
220
|
quoted: entry.quoted,
|
|
220
221
|
value: entry.value.visitExpression(this, context)
|
|
222
|
+
} : {
|
|
223
|
+
kind: "spread",
|
|
224
|
+
expression: entry.expression.visitExpression(this, context)
|
|
221
225
|
};
|
|
222
226
|
});
|
|
223
227
|
return this.setSourceMapRange(this.factory.createObjectLiteral(properties), ast.sourceSpan);
|
|
@@ -228,6 +232,10 @@ var ExpressionTranslatorVisitor = class {
|
|
|
228
232
|
visitTemplateLiteralElementExpr(ast, context) {
|
|
229
233
|
throw new Error("Method not implemented");
|
|
230
234
|
}
|
|
235
|
+
visitSpreadElementExpr(ast, context) {
|
|
236
|
+
const expression = ast.expression.visitExpression(this, context);
|
|
237
|
+
return this.setSourceMapRange(this.factory.createSpreadElement(expression), ast.sourceSpan);
|
|
238
|
+
}
|
|
231
239
|
visitWrappedNodeExpr(ast, _context) {
|
|
232
240
|
this.recordWrappedNode(ast);
|
|
233
241
|
return ast.node;
|