@angular/compiler-cli 20.0.0-rc.1 → 20.0.0-rc.3
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-WIAPFYJX.js → chunk-3AHGFMNS.js} +29 -137
- package/bundles/chunk-3AHGFMNS.js.map +6 -0
- package/bundles/{chunk-TQ6LMH6Y.js → chunk-4OIPE63R.js} +8 -9
- package/bundles/{chunk-TQ6LMH6Y.js.map → chunk-4OIPE63R.js.map} +1 -1
- package/bundles/{chunk-GTZJJ3FS.js → chunk-5PLBB4J5.js} +2 -2
- package/bundles/{chunk-GU2OJWV5.js → chunk-A7TLTAA4.js} +2 -2
- package/bundles/chunk-M3WWDK6S.js +296 -0
- package/bundles/chunk-M3WWDK6S.js.map +6 -0
- package/bundles/{chunk-BGRGIORD.js → chunk-T36IFLGD.js} +19 -26
- package/bundles/chunk-T36IFLGD.js.map +6 -0
- package/bundles/{chunk-TTRWAZF3.js → chunk-TSBVO2TY.js} +4742 -1973
- package/bundles/chunk-TSBVO2TY.js.map +6 -0
- package/bundles/chunk-U5SKOFKE.js +123 -0
- package/bundles/chunk-U5SKOFKE.js.map +6 -0
- package/bundles/{chunk-UWOD5VHW.js → chunk-YZVRRB6E.js} +128 -190
- package/bundles/chunk-YZVRRB6E.js.map +6 -0
- package/bundles/index.js +15 -13
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +5 -6
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -3
- package/bundles/private/localize.js +6 -2
- package/bundles/private/migrations.js +7 -7
- package/bundles/private/tooling.js +6 -5
- package/bundles/src/bin/ng_xi18n.js +9 -7
- package/bundles/src/bin/ng_xi18n.js.map +1 -1
- package/bundles/src/bin/ngc.js +9 -7
- package/bundles/src/bin/ngc.js.map +1 -1
- package/linker/babel/src/ast/babel_ast_factory.d.ts +1 -1
- package/linker/babel/src/linker_plugin_options.d.ts +1 -1
- package/linker/src/file_linker/file_linker.d.ts +1 -1
- package/linker/src/file_linker/get_source_file.d.ts +1 -1
- package/linker/src/file_linker/linker_environment.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/partial_directive_linker_1.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/partial_linker_selector.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/linker/src/file_linker/translator.d.ts +3 -1
- package/package.json +8 -3
- package/src/ngtsc/file_system/index.d.ts +1 -0
- package/src/ngtsc/typecheck/src/checker.d.ts +2 -1
- package/bundles/chunk-B24NLAZZ.js +0 -3236
- package/bundles/chunk-B24NLAZZ.js.map +0 -6
- package/bundles/chunk-BGRGIORD.js.map +0 -6
- package/bundles/chunk-TTRWAZF3.js.map +0 -6
- package/bundles/chunk-UWOD5VHW.js.map +0 -6
- package/bundles/chunk-WIAPFYJX.js.map +0 -6
- package/bundles_metadata.json +0 -1
- package/src/ngtsc/validation/src/config.d.ts +0 -12
- /package/bundles/{chunk-GTZJJ3FS.js.map → chunk-5PLBB4J5.js.map} +0 -0
- /package/bundles/{chunk-GU2OJWV5.js.map → chunk-A7TLTAA4.js.map} +0 -0
|
@@ -4,36 +4,55 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
angularJitApplicationTransform
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T36IFLGD.js";
|
|
8
8
|
import {
|
|
9
|
+
AbsoluteModuleStrategy,
|
|
10
|
+
AliasStrategy,
|
|
11
|
+
COMPILER_ERRORS_WITH_GUIDES,
|
|
9
12
|
CompilationMode,
|
|
10
13
|
ComponentDecoratorHandler,
|
|
11
14
|
ComponentScopeKind,
|
|
12
15
|
CompoundComponentScopeReader,
|
|
13
16
|
CompoundMetadataReader,
|
|
14
17
|
CompoundMetadataRegistry,
|
|
18
|
+
DefaultImportTracker,
|
|
19
|
+
DeferredSymbolTracker,
|
|
15
20
|
DirectiveDecoratorHandler,
|
|
16
21
|
DtsMetadataReader,
|
|
17
22
|
DtsTransformRegistry,
|
|
23
|
+
ERROR_DETAILS_PAGE_BASE_URL,
|
|
24
|
+
ErrorCode,
|
|
18
25
|
ExportedProviderStatusResolver,
|
|
26
|
+
ExtendedTemplateDiagnosticName,
|
|
19
27
|
HostDirectivesResolver,
|
|
20
28
|
INPUT_INITIALIZER_FN,
|
|
29
|
+
ImportedSymbolsTracker,
|
|
21
30
|
InjectableClassRegistry,
|
|
22
31
|
InjectableDecoratorHandler,
|
|
23
32
|
JitDeclarationRegistry,
|
|
33
|
+
LocalCompilationExtraImportsTracker,
|
|
34
|
+
LocalIdentifierStrategy,
|
|
24
35
|
LocalMetadataRegistry,
|
|
25
36
|
LocalModuleScopeRegistry,
|
|
37
|
+
LogicalProjectStrategy,
|
|
26
38
|
MODEL_INITIALIZER_FN,
|
|
27
39
|
MetaKind,
|
|
28
40
|
MetadataDtsModuleScopeResolver,
|
|
41
|
+
ModuleResolver,
|
|
29
42
|
NgModuleDecoratorHandler,
|
|
30
43
|
NgOriginalFile,
|
|
44
|
+
NoopImportRewriter,
|
|
31
45
|
NoopReferencesRegistry,
|
|
32
46
|
OUTPUT_INITIALIZER_FNS,
|
|
33
47
|
OptimizeFor,
|
|
34
48
|
PartialEvaluator,
|
|
35
49
|
PipeDecoratorHandler,
|
|
50
|
+
PrivateExportAliasingHost,
|
|
36
51
|
QUERY_INITIALIZER_FNS,
|
|
52
|
+
R3SymbolsImportRewriter,
|
|
53
|
+
Reference,
|
|
54
|
+
ReferenceEmitter,
|
|
55
|
+
RelativePathStrategy,
|
|
37
56
|
ResourceRegistry,
|
|
38
57
|
SemanticDepGraphUpdater,
|
|
39
58
|
ShimAdapter,
|
|
@@ -44,50 +63,29 @@ import {
|
|
|
44
63
|
TsCreateProgramDriver,
|
|
45
64
|
TypeCheckScopeRegistry,
|
|
46
65
|
TypeCheckShimGenerator,
|
|
47
|
-
aliasTransformFactory,
|
|
48
|
-
declarationTransformFactory,
|
|
49
|
-
isShim,
|
|
50
|
-
ivyTransformFactory,
|
|
51
|
-
retagAllTsFiles,
|
|
52
|
-
tryParseInitializerApi,
|
|
53
|
-
untagAllTsFiles
|
|
54
|
-
} from "./chunk-TTRWAZF3.js";
|
|
55
|
-
import {
|
|
56
|
-
AbsoluteModuleStrategy,
|
|
57
|
-
AliasStrategy,
|
|
58
|
-
COMPILER_ERRORS_WITH_GUIDES,
|
|
59
|
-
DefaultImportTracker,
|
|
60
|
-
DeferredSymbolTracker,
|
|
61
|
-
ERROR_DETAILS_PAGE_BASE_URL,
|
|
62
|
-
ErrorCode,
|
|
63
|
-
ExtendedTemplateDiagnosticName,
|
|
64
|
-
ImportedSymbolsTracker,
|
|
65
|
-
LocalCompilationExtraImportsTracker,
|
|
66
|
-
LocalIdentifierStrategy,
|
|
67
|
-
LogicalProjectStrategy,
|
|
68
|
-
ModuleResolver,
|
|
69
|
-
NoopImportRewriter,
|
|
70
|
-
PrivateExportAliasingHost,
|
|
71
|
-
R3SymbolsImportRewriter,
|
|
72
|
-
Reference,
|
|
73
|
-
ReferenceEmitter,
|
|
74
|
-
RelativePathStrategy,
|
|
75
66
|
TypeScriptReflectionHost,
|
|
76
67
|
UnifiedModulesAliasingHost,
|
|
77
68
|
UnifiedModulesStrategy,
|
|
69
|
+
aliasTransformFactory,
|
|
70
|
+
declarationTransformFactory,
|
|
78
71
|
getRootDirs,
|
|
79
72
|
getSourceFileOrNull,
|
|
80
73
|
isDtsPath,
|
|
81
74
|
isFatalDiagnosticError,
|
|
82
75
|
isNamedClassDeclaration,
|
|
83
76
|
isNonDeclarationTsPath,
|
|
77
|
+
isShim,
|
|
78
|
+
ivyTransformFactory,
|
|
84
79
|
makeDiagnostic,
|
|
85
80
|
ngErrorCode,
|
|
86
81
|
normalizeSeparators,
|
|
87
82
|
relativePathBetween,
|
|
88
83
|
replaceTsWithNgInErrors,
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
retagAllTsFiles,
|
|
85
|
+
toUnredirectedSourceFile,
|
|
86
|
+
tryParseInitializerApi,
|
|
87
|
+
untagAllTsFiles
|
|
88
|
+
} from "./chunk-TSBVO2TY.js";
|
|
91
89
|
import {
|
|
92
90
|
ActivePerfRecorder,
|
|
93
91
|
DelegatingPerfRecorder,
|
|
@@ -104,7 +102,7 @@ import {
|
|
|
104
102
|
getFileSystem,
|
|
105
103
|
join,
|
|
106
104
|
resolve
|
|
107
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-3AHGFMNS.js";
|
|
108
106
|
|
|
109
107
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
110
108
|
var DEFAULT_ERROR_CODE = 100;
|
|
@@ -189,8 +187,7 @@ import ts6 from "typescript";
|
|
|
189
187
|
|
|
190
188
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/filters.js
|
|
191
189
|
function isAngularPrivateName(name) {
|
|
192
|
-
|
|
193
|
-
const firstChar = (_a = name[0]) != null ? _a : "";
|
|
190
|
+
const firstChar = name[0] ?? "";
|
|
194
191
|
return firstChar === "\u0275" || firstChar === "_";
|
|
195
192
|
}
|
|
196
193
|
|
|
@@ -199,15 +196,11 @@ import ts4 from "typescript";
|
|
|
199
196
|
|
|
200
197
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.js
|
|
201
198
|
function extractGenerics(declaration) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
constraint: (_a2 = typeParam.constraint) == null ? void 0 : _a2.getText(),
|
|
208
|
-
default: (_b2 = typeParam.default) == null ? void 0 : _b2.getText()
|
|
209
|
-
};
|
|
210
|
-
})) != null ? _b : [];
|
|
199
|
+
return declaration.typeParameters?.map((typeParam) => ({
|
|
200
|
+
name: typeParam.name.getText(),
|
|
201
|
+
constraint: typeParam.constraint?.getText(),
|
|
202
|
+
default: typeParam.default?.getText()
|
|
203
|
+
})) ?? [];
|
|
211
204
|
}
|
|
212
205
|
|
|
213
206
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.js
|
|
@@ -216,26 +209,23 @@ var decoratorExpression = /@(?=(Injectable|Component|Directive|Pipe|NgModule|Inp
|
|
|
216
209
|
function extractJsDocTags(node) {
|
|
217
210
|
const escapedNode = getEscapedNode(node);
|
|
218
211
|
return ts2.getJSDocTags(escapedNode).map((t) => {
|
|
219
|
-
var _a;
|
|
220
212
|
return {
|
|
221
213
|
name: t.tagName.getText(),
|
|
222
|
-
comment: unescapeAngularDecorators(
|
|
214
|
+
comment: unescapeAngularDecorators(ts2.getTextOfJSDocComment(t.comment) ?? "")
|
|
223
215
|
};
|
|
224
216
|
});
|
|
225
217
|
}
|
|
226
218
|
function extractJsDocDescription(node) {
|
|
227
|
-
var _a, _b;
|
|
228
219
|
const escapedNode = getEscapedNode(node);
|
|
229
220
|
const commentOrTag = ts2.getJSDocCommentsAndTags(escapedNode).find((d) => {
|
|
230
221
|
return ts2.isJSDoc(d) || ts2.isJSDocParameterTag(d);
|
|
231
222
|
});
|
|
232
|
-
const comment =
|
|
233
|
-
const description = typeof comment === "string" ? comment :
|
|
223
|
+
const comment = commentOrTag?.comment ?? "";
|
|
224
|
+
const description = typeof comment === "string" ? comment : ts2.getTextOfJSDocComment(comment) ?? "";
|
|
234
225
|
return unescapeAngularDecorators(description);
|
|
235
226
|
}
|
|
236
227
|
function extractRawJsDoc(node) {
|
|
237
|
-
|
|
238
|
-
const comment = (_b = (_a = ts2.getJSDocCommentsAndTags(node).find(ts2.isJSDoc)) == null ? void 0 : _a.getFullText()) != null ? _b : "";
|
|
228
|
+
const comment = ts2.getJSDocCommentsAndTags(node).find(ts2.isJSDoc)?.getFullText() ?? "";
|
|
239
229
|
return unescapeAngularDecorators(comment);
|
|
240
230
|
}
|
|
241
231
|
function getEscapedNode(node) {
|
|
@@ -271,10 +261,9 @@ var FunctionExtractor = class {
|
|
|
271
261
|
this.typeChecker = typeChecker;
|
|
272
262
|
}
|
|
273
263
|
extract() {
|
|
274
|
-
var _a, _b;
|
|
275
264
|
const signature = this.typeChecker.getSignatureFromDeclaration(this.exportDeclaration);
|
|
276
265
|
const returnType = signature ? extractReturnType(signature, this.typeChecker) : "unknown";
|
|
277
|
-
const implementation =
|
|
266
|
+
const implementation = findImplementationOfFunction(this.exportDeclaration, this.typeChecker) ?? this.exportDeclaration;
|
|
278
267
|
const type = this.typeChecker.getTypeAtLocation(this.exportDeclaration);
|
|
279
268
|
const overloads = ts4.isConstructorDeclaration(this.exportDeclaration) ? constructorOverloads(this.exportDeclaration, this.typeChecker) : extractCallSignatures(this.name, this.typeChecker, type);
|
|
280
269
|
const jsdocsTags = extractJsDocTags(implementation);
|
|
@@ -286,7 +275,7 @@ var FunctionExtractor = class {
|
|
|
286
275
|
params: extractAllParams(implementation.parameters, this.typeChecker),
|
|
287
276
|
isNewType: ts4.isConstructSignatureDeclaration(implementation),
|
|
288
277
|
returnType,
|
|
289
|
-
returnDescription:
|
|
278
|
+
returnDescription: jsdocsTags.find((tag) => tag.name === "returns")?.comment,
|
|
290
279
|
generics: extractGenerics(implementation),
|
|
291
280
|
name: this.name,
|
|
292
281
|
description,
|
|
@@ -307,11 +296,10 @@ function constructorOverloads(constructorDeclaration, typeChecker) {
|
|
|
307
296
|
return ts4.isConstructorDeclaration(member) && !member.body;
|
|
308
297
|
});
|
|
309
298
|
return constructorNode.map((n) => {
|
|
310
|
-
var _a;
|
|
311
299
|
return {
|
|
312
300
|
name: "constructor",
|
|
313
301
|
params: extractAllParams(n.parameters, typeChecker),
|
|
314
|
-
returnType:
|
|
302
|
+
returnType: typeChecker.getTypeAtLocation(classDeclaration)?.symbol.name,
|
|
315
303
|
description: extractJsDocDescription(n),
|
|
316
304
|
entryType: EntryType.Function,
|
|
317
305
|
jsdocTags: extractJsDocTags(n),
|
|
@@ -354,8 +342,7 @@ function extractCallSignatures(name, typeChecker, type) {
|
|
|
354
342
|
}));
|
|
355
343
|
}
|
|
356
344
|
function extractReturnType(signature, typeChecker) {
|
|
357
|
-
|
|
358
|
-
if (((_a = signature == null ? void 0 : signature.declaration) == null ? void 0 : _a.type) && ts4.isTypePredicateNode(signature.declaration.type)) {
|
|
345
|
+
if (signature?.declaration?.type && ts4.isTypePredicateNode(signature.declaration.type)) {
|
|
359
346
|
return signature.declaration.type.getText();
|
|
360
347
|
}
|
|
361
348
|
return typeChecker.typeToString(
|
|
@@ -365,12 +352,11 @@ function extractReturnType(signature, typeChecker) {
|
|
|
365
352
|
);
|
|
366
353
|
}
|
|
367
354
|
function findImplementationOfFunction(node, typeChecker) {
|
|
368
|
-
var _a;
|
|
369
355
|
if (node.body !== void 0 || node.name === void 0) {
|
|
370
356
|
return node;
|
|
371
357
|
}
|
|
372
358
|
const symbol = typeChecker.getSymbolAtLocation(node.name);
|
|
373
|
-
const implementation =
|
|
359
|
+
const implementation = symbol?.declarations?.find((s) => ts4.isFunctionDeclaration(s) && s.body !== void 0);
|
|
374
360
|
return implementation;
|
|
375
361
|
}
|
|
376
362
|
|
|
@@ -380,9 +366,8 @@ function isInternal(member) {
|
|
|
380
366
|
return extractJsDocTags(member).some((tag) => tag.name === "internal") || hasLeadingInternalComment(member);
|
|
381
367
|
}
|
|
382
368
|
function hasLeadingInternalComment(member) {
|
|
383
|
-
var _a;
|
|
384
369
|
const memberText = member.getSourceFile().text;
|
|
385
|
-
return
|
|
370
|
+
return ts5.reduceEachLeadingCommentRange(
|
|
386
371
|
memberText,
|
|
387
372
|
member.getFullStart(),
|
|
388
373
|
(pos, end, kind, hasTrailingNewLine, containsInternal) => {
|
|
@@ -390,7 +375,7 @@ function hasLeadingInternalComment(member) {
|
|
|
390
375
|
},
|
|
391
376
|
false,
|
|
392
377
|
false
|
|
393
|
-
)
|
|
378
|
+
) ?? false;
|
|
394
379
|
}
|
|
395
380
|
|
|
396
381
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
|
|
@@ -498,13 +483,11 @@ var ClassExtractor = class {
|
|
|
498
483
|
return void 0;
|
|
499
484
|
}
|
|
500
485
|
extractInterfaceConformance(declaration) {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
return (_b = implementClause == null ? void 0 : implementClause.types.map((m) => m.getText())) != null ? _b : [];
|
|
486
|
+
const implementClause = declaration.heritageClauses?.find((clause) => clause.token === ts6.SyntaxKind.ImplementsKeyword);
|
|
487
|
+
return implementClause?.types.map((m) => m.getText()) ?? [];
|
|
504
488
|
}
|
|
505
489
|
getMemberTags(member) {
|
|
506
|
-
|
|
507
|
-
const tags = this.getMemberTagsFromModifiers((_a = member.modifiers) != null ? _a : []);
|
|
490
|
+
const tags = this.getMemberTagsFromModifiers(member.modifiers ?? []);
|
|
508
491
|
if (member.questionToken) {
|
|
509
492
|
tags.push(MemberTags.Optional);
|
|
510
493
|
}
|
|
@@ -526,15 +509,14 @@ var ClassExtractor = class {
|
|
|
526
509
|
return result;
|
|
527
510
|
}
|
|
528
511
|
getMemberDeclarations() {
|
|
529
|
-
var _a, _b, _c;
|
|
530
512
|
const type = this.typeChecker.getTypeAtLocation(this.declaration);
|
|
531
513
|
const members = type.getProperties();
|
|
532
|
-
const constructor =
|
|
514
|
+
const constructor = type.getSymbol()?.members?.get(ts6.InternalSymbolName.Constructor);
|
|
533
515
|
const typeOfConstructor = this.typeChecker.getTypeOfSymbol(type.symbol);
|
|
534
516
|
const staticMembers = typeOfConstructor.getProperties();
|
|
535
517
|
const result = [];
|
|
536
518
|
for (const member of [...constructor ? [constructor] : [], ...members, ...staticMembers]) {
|
|
537
|
-
const memberDeclarations = this.filterMethodOverloads(
|
|
519
|
+
const memberDeclarations = this.filterMethodOverloads(member.getDeclarations() ?? []);
|
|
538
520
|
for (const memberDeclaration of memberDeclarations) {
|
|
539
521
|
if (this.isDocumentableMember(memberDeclaration)) {
|
|
540
522
|
result.push(memberDeclaration);
|
|
@@ -545,10 +527,9 @@ var ClassExtractor = class {
|
|
|
545
527
|
}
|
|
546
528
|
filterMethodOverloads(declarations) {
|
|
547
529
|
return declarations.filter((declaration, index) => {
|
|
548
|
-
var _a;
|
|
549
530
|
if (ts6.isFunctionDeclaration(declaration) || ts6.isMethodDeclaration(declaration) || ts6.isConstructorDeclaration(declaration)) {
|
|
550
531
|
const nextDeclaration = declarations[index + 1];
|
|
551
|
-
const isNextMethodWithSameName = nextDeclaration && (ts6.isMethodDeclaration(nextDeclaration) && nextDeclaration.name.getText() ===
|
|
532
|
+
const isNextMethodWithSameName = nextDeclaration && (ts6.isMethodDeclaration(nextDeclaration) && nextDeclaration.name.getText() === declaration.name?.getText() || ts6.isConstructorDeclaration(nextDeclaration) && ts6.isConstructorDeclaration(declaration));
|
|
552
533
|
return !isNextMethodWithSameName;
|
|
553
534
|
}
|
|
554
535
|
return true;
|
|
@@ -578,11 +559,10 @@ var ClassExtractor = class {
|
|
|
578
559
|
}
|
|
579
560
|
}
|
|
580
561
|
isMemberExcluded(member) {
|
|
581
|
-
var _a;
|
|
582
562
|
if (ts6.isConstructorDeclaration(member)) {
|
|
583
563
|
return false;
|
|
584
564
|
}
|
|
585
|
-
return !member.name || !this.isDocumentableMember(member) || !ts6.isCallSignatureDeclaration(member) &&
|
|
565
|
+
return !member.name || !this.isDocumentableMember(member) || !ts6.isCallSignatureDeclaration(member) && member.modifiers?.some((mod) => mod.kind === ts6.SyntaxKind.PrivateKeyword) || member.name.getText() === "prototype" || isAngularPrivateName(member.name.getText()) || isInternal(member);
|
|
586
566
|
}
|
|
587
567
|
isDocumentableMember(member) {
|
|
588
568
|
return this.isMethod(member) || this.isProperty(member) || ts6.isAccessor(member) || ts6.isConstructorDeclaration(member) || ts6.isCallSignatureDeclaration(member);
|
|
@@ -603,8 +583,7 @@ var ClassExtractor = class {
|
|
|
603
583
|
return ts6.isConstructSignatureDeclaration(signature) || ts6.isCallSignatureDeclaration(signature);
|
|
604
584
|
}
|
|
605
585
|
isAbstract() {
|
|
606
|
-
|
|
607
|
-
const modifiers = (_a = this.declaration.modifiers) != null ? _a : [];
|
|
586
|
+
const modifiers = this.declaration.modifiers ?? [];
|
|
608
587
|
return modifiers.some((mod) => mod.kind === ts6.SyntaxKind.AbstractKeyword);
|
|
609
588
|
}
|
|
610
589
|
hasPrivateComputedProperty(property) {
|
|
@@ -620,12 +599,11 @@ var DirectiveExtractor = class extends ClassExtractor {
|
|
|
620
599
|
this.metadata = metadata;
|
|
621
600
|
}
|
|
622
601
|
extract() {
|
|
623
|
-
var _a, _b;
|
|
624
602
|
return {
|
|
625
603
|
...super.extract(),
|
|
626
604
|
isStandalone: this.metadata.isStandalone,
|
|
627
|
-
selector:
|
|
628
|
-
exportAs:
|
|
605
|
+
selector: this.metadata.selector ?? "",
|
|
606
|
+
exportAs: this.metadata.exportAs ?? [],
|
|
629
607
|
entryType: this.metadata.isComponent ? EntryType.Component : EntryType.Directive
|
|
630
608
|
};
|
|
631
609
|
}
|
|
@@ -645,14 +623,12 @@ var DirectiveExtractor = class extends ClassExtractor {
|
|
|
645
623
|
return entry;
|
|
646
624
|
}
|
|
647
625
|
getInputMetadata(prop) {
|
|
648
|
-
var _a, _b;
|
|
649
626
|
const propName = prop.name.getText();
|
|
650
|
-
return
|
|
627
|
+
return this.metadata.inputs?.getByClassPropertyName(propName) ?? void 0;
|
|
651
628
|
}
|
|
652
629
|
getOutputMetadata(prop) {
|
|
653
|
-
var _a, _b, _c;
|
|
654
630
|
const propName = prop.name.getText();
|
|
655
|
-
return
|
|
631
|
+
return this.metadata?.outputs?.getByClassPropertyName(propName) ?? void 0;
|
|
656
632
|
}
|
|
657
633
|
};
|
|
658
634
|
var PipeExtractor = class extends ClassExtractor {
|
|
@@ -803,8 +779,7 @@ function isDecoratorOptionsInterface(declaration) {
|
|
|
803
779
|
return declaration.getSourceFile().statements.some((s) => ts8.isVariableStatement(s) && s.declarationList.declarations.some((d) => isDecoratorDeclaration(d) && d.name.getText() === declaration.name.getText()));
|
|
804
780
|
}
|
|
805
781
|
function getDecoratorType(declaration) {
|
|
806
|
-
|
|
807
|
-
const initializer = (_b = (_a = declaration.initializer) == null ? void 0 : _a.getFullText()) != null ? _b : "";
|
|
782
|
+
const initializer = declaration.initializer?.getFullText() ?? "";
|
|
808
783
|
if (initializer.includes("makeDecorator"))
|
|
809
784
|
return DecoratorType.Class;
|
|
810
785
|
if (initializer.includes("makePropDecorator"))
|
|
@@ -814,7 +789,6 @@ function getDecoratorType(declaration) {
|
|
|
814
789
|
return void 0;
|
|
815
790
|
}
|
|
816
791
|
function getDecoratorOptions(declaration, typeChecker) {
|
|
817
|
-
var _a, _b;
|
|
818
792
|
const name = declaration.name.getText();
|
|
819
793
|
const optionsDeclaration = declaration.getSourceFile().statements.find((node) => {
|
|
820
794
|
return (ts8.isInterfaceDeclaration(node) || ts8.isTypeAliasDeclaration(node)) && node.name.getText() === name;
|
|
@@ -825,7 +799,7 @@ function getDecoratorOptions(declaration, typeChecker) {
|
|
|
825
799
|
let optionsInterface;
|
|
826
800
|
if (ts8.isTypeAliasDeclaration(optionsDeclaration)) {
|
|
827
801
|
const aliasedType = typeChecker.getTypeAtLocation(optionsDeclaration.type);
|
|
828
|
-
optionsInterface = (
|
|
802
|
+
optionsInterface = (aliasedType.getSymbol()?.getDeclarations() ?? []).find((d) => ts8.isInterfaceDeclaration(d));
|
|
829
803
|
} else {
|
|
830
804
|
optionsInterface = optionsDeclaration;
|
|
831
805
|
}
|
|
@@ -875,11 +849,10 @@ function extractEnumMembers(declaration, checker) {
|
|
|
875
849
|
}));
|
|
876
850
|
}
|
|
877
851
|
function getEnumMemberValue(memberNode) {
|
|
878
|
-
var _a;
|
|
879
852
|
const literal = memberNode.getChildren().find((n) => {
|
|
880
853
|
return ts9.isNumericLiteral(n) || ts9.isStringLiteral(n) || ts9.isPrefixUnaryExpression(n) && n.operator === ts9.SyntaxKind.MinusToken && ts9.isNumericLiteral(n.operand);
|
|
881
854
|
});
|
|
882
|
-
return
|
|
855
|
+
return literal?.getText() ?? "";
|
|
883
856
|
}
|
|
884
857
|
|
|
885
858
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.js
|
|
@@ -903,7 +876,6 @@ function isInitializerApiFunction(node, typeChecker) {
|
|
|
903
876
|
return tags.some((t) => t.tagName.text === initializerApiTag);
|
|
904
877
|
}
|
|
905
878
|
function extractInitializerApiFunction(node, typeChecker) {
|
|
906
|
-
var _a;
|
|
907
879
|
if (node.name === void 0 || !ts10.isIdentifier(node.name)) {
|
|
908
880
|
throw new Error(`Initializer API: Expected literal variable name.`);
|
|
909
881
|
}
|
|
@@ -917,7 +889,7 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
917
889
|
const subFunctions = [];
|
|
918
890
|
for (const property of type.getProperties()) {
|
|
919
891
|
const subName = property.getName();
|
|
920
|
-
const subDecl =
|
|
892
|
+
const subDecl = property.getDeclarations()?.[0];
|
|
921
893
|
if (subDecl === void 0 || !ts10.isPropertySignature(subDecl)) {
|
|
922
894
|
throw new Error(`Initializer API: Could not resolve declaration of sub-property: ${name}.${subName}`);
|
|
923
895
|
}
|
|
@@ -1009,16 +981,15 @@ import ts11 from "typescript";
|
|
|
1009
981
|
function getImportedSymbols(sourceFile) {
|
|
1010
982
|
const importSpecifiers = /* @__PURE__ */ new Map();
|
|
1011
983
|
function visit(node) {
|
|
1012
|
-
var _a;
|
|
1013
984
|
if (ts11.isImportDeclaration(node)) {
|
|
1014
985
|
let moduleSpecifier = node.moduleSpecifier.getText(sourceFile).replace(/['"]/g, "");
|
|
1015
986
|
if (moduleSpecifier.startsWith("@angular/")) {
|
|
1016
|
-
const namedBindings =
|
|
987
|
+
const namedBindings = node.importClause?.namedBindings;
|
|
1017
988
|
if (namedBindings && ts11.isNamedImports(namedBindings)) {
|
|
1018
989
|
namedBindings.elements.forEach((importSpecifier) => {
|
|
1019
990
|
const importName = importSpecifier.name.text;
|
|
1020
991
|
const importAlias = importSpecifier.propertyName ? importSpecifier.propertyName.text : void 0;
|
|
1021
|
-
importSpecifiers.set(importAlias
|
|
992
|
+
importSpecifiers.set(importAlias ?? importName, moduleSpecifier);
|
|
1022
993
|
});
|
|
1023
994
|
}
|
|
1024
995
|
}
|
|
@@ -1094,10 +1065,9 @@ var DocsExtractor = class {
|
|
|
1094
1065
|
return null;
|
|
1095
1066
|
}
|
|
1096
1067
|
getExportedDeclarations(sourceFile) {
|
|
1097
|
-
var _a;
|
|
1098
1068
|
const reflector = new TypeScriptReflectionHost(this.typeChecker, false, true);
|
|
1099
1069
|
const exportedDeclarationMap = reflector.getExportsOfModule(sourceFile);
|
|
1100
|
-
let exportedDeclarations = Array.from(
|
|
1070
|
+
let exportedDeclarations = Array.from(exportedDeclarationMap?.entries() ?? []).map(([exportName, declaration]) => [exportName, declaration.node]);
|
|
1101
1071
|
return exportedDeclarations.sort(([a, declarationA], [b, declarationB]) => declarationA.pos - declarationB.pos);
|
|
1102
1072
|
}
|
|
1103
1073
|
};
|
|
@@ -1679,7 +1649,7 @@ var IncrementalCompilation = class {
|
|
|
1679
1649
|
static incremental(program, newVersions, oldProgram, oldState, modifiedResourceFiles, perf) {
|
|
1680
1650
|
return perf.inPhase(PerfPhase.Reconciliation, () => {
|
|
1681
1651
|
const physicallyChangedTsFiles = /* @__PURE__ */ new Set();
|
|
1682
|
-
const changedResourceFiles = new Set(modifiedResourceFiles
|
|
1652
|
+
const changedResourceFiles = new Set(modifiedResourceFiles ?? []);
|
|
1683
1653
|
let priorAnalysis;
|
|
1684
1654
|
switch (oldState.kind) {
|
|
1685
1655
|
case IncrementalStateKind.Fresh:
|
|
@@ -2071,12 +2041,11 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
2071
2041
|
this.visitAll(block.children);
|
|
2072
2042
|
}
|
|
2073
2043
|
visitForLoopBlock(block) {
|
|
2074
|
-
var _a;
|
|
2075
2044
|
block.item.visit(this);
|
|
2076
2045
|
this.visitAll(block.contextVariables);
|
|
2077
2046
|
this.visitExpression(block.expression);
|
|
2078
2047
|
this.visitAll(block.children);
|
|
2079
|
-
|
|
2048
|
+
block.empty?.visit(this);
|
|
2080
2049
|
}
|
|
2081
2050
|
visitForLoopBlockEmpty(block) {
|
|
2082
2051
|
this.visitAll(block.children);
|
|
@@ -2085,9 +2054,8 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
2085
2054
|
this.visitAll(block.branches);
|
|
2086
2055
|
}
|
|
2087
2056
|
visitIfBlockBranch(block) {
|
|
2088
|
-
var _a;
|
|
2089
2057
|
block.expression && this.visitExpression(block.expression);
|
|
2090
|
-
|
|
2058
|
+
block.expressionAlias?.visit(this);
|
|
2091
2059
|
this.visitAll(block.children);
|
|
2092
2060
|
}
|
|
2093
2061
|
visitLetDeclaration(decl) {
|
|
@@ -2104,7 +2072,6 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
2104
2072
|
throw new Error("TODO");
|
|
2105
2073
|
}
|
|
2106
2074
|
elementOrTemplateToIdentifier(node) {
|
|
2107
|
-
var _a;
|
|
2108
2075
|
if (node instanceof TmplAstComponent || node instanceof TmplAstDirective) {
|
|
2109
2076
|
throw new Error("TODO");
|
|
2110
2077
|
}
|
|
@@ -2114,7 +2081,7 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
2114
2081
|
let name;
|
|
2115
2082
|
let kind;
|
|
2116
2083
|
if (node instanceof TmplAstTemplate) {
|
|
2117
|
-
name =
|
|
2084
|
+
name = node.tagName ?? "ng-template";
|
|
2118
2085
|
kind = IdentifierKind.Template;
|
|
2119
2086
|
} else {
|
|
2120
2087
|
name = node.name;
|
|
@@ -2299,12 +2266,11 @@ var NgModuleIndexImpl = class {
|
|
|
2299
2266
|
this.indexed = true;
|
|
2300
2267
|
}
|
|
2301
2268
|
indexTrait(ref, seenTypesWithReexports) {
|
|
2302
|
-
var _a, _b, _c;
|
|
2303
2269
|
if (seenTypesWithReexports.has(ref.node)) {
|
|
2304
2270
|
return;
|
|
2305
2271
|
}
|
|
2306
2272
|
seenTypesWithReexports.set(ref.node, /* @__PURE__ */ new Set());
|
|
2307
|
-
const meta =
|
|
2273
|
+
const meta = this.metaReader.getDirectiveMetadata(ref) ?? this.metaReader.getNgModuleMetadata(ref);
|
|
2308
2274
|
if (meta === null) {
|
|
2309
2275
|
return;
|
|
2310
2276
|
}
|
|
@@ -2319,7 +2285,7 @@ var NgModuleIndexImpl = class {
|
|
|
2319
2285
|
}
|
|
2320
2286
|
for (const childRef of meta.exports) {
|
|
2321
2287
|
this.indexTrait(childRef, seenTypesWithReexports);
|
|
2322
|
-
const childMeta =
|
|
2288
|
+
const childMeta = this.metaReader.getDirectiveMetadata(childRef) ?? this.metaReader.getPipeMetadata(childRef) ?? this.metaReader.getNgModuleMetadata(childRef);
|
|
2323
2289
|
if (childMeta === null) {
|
|
2324
2290
|
continue;
|
|
2325
2291
|
}
|
|
@@ -2489,7 +2455,6 @@ var AdapterResourceLoader = class {
|
|
|
2489
2455
|
}
|
|
2490
2456
|
};
|
|
2491
2457
|
function createLookupResolutionHost(adapter) {
|
|
2492
|
-
var _a, _b, _c;
|
|
2493
2458
|
return {
|
|
2494
2459
|
directoryExists(directoryName) {
|
|
2495
2460
|
if (directoryName.includes(RESOURCE_MARKER)) {
|
|
@@ -2509,9 +2474,9 @@ function createLookupResolutionHost(adapter) {
|
|
|
2509
2474
|
},
|
|
2510
2475
|
readFile: adapter.readFile.bind(adapter),
|
|
2511
2476
|
getCurrentDirectory: adapter.getCurrentDirectory.bind(adapter),
|
|
2512
|
-
getDirectories:
|
|
2513
|
-
realpath:
|
|
2514
|
-
trace:
|
|
2477
|
+
getDirectories: adapter.getDirectories?.bind(adapter),
|
|
2478
|
+
realpath: adapter.realpath?.bind(adapter),
|
|
2479
|
+
trace: adapter.trace?.bind(adapter),
|
|
2515
2480
|
useCaseSensitiveFileNames: typeof adapter.useCaseSensitiveFileNames === "function" ? adapter.useCaseSensitiveFileNames.bind(adapter) : adapter.useCaseSensitiveFileNames
|
|
2516
2481
|
};
|
|
2517
2482
|
}
|
|
@@ -2528,7 +2493,6 @@ var StandaloneComponentScopeReader = class {
|
|
|
2528
2493
|
this.dtsModuleReader = dtsModuleReader;
|
|
2529
2494
|
}
|
|
2530
2495
|
getScopeForComponent(clazz) {
|
|
2531
|
-
var _a;
|
|
2532
2496
|
if (!this.cache.has(clazz)) {
|
|
2533
2497
|
const clazzRef = new Reference(clazz);
|
|
2534
2498
|
const clazzMeta = this.metaReader.getDirectiveMetadata(clazzRef);
|
|
@@ -2605,7 +2569,7 @@ var StandaloneComponentScopeReader = class {
|
|
|
2605
2569
|
dependencies: Array.from(dependencies),
|
|
2606
2570
|
deferredDependencies: Array.from(deferredDependencies),
|
|
2607
2571
|
isPoisoned,
|
|
2608
|
-
schemas:
|
|
2572
|
+
schemas: clazzMeta.schemas ?? []
|
|
2609
2573
|
});
|
|
2610
2574
|
}
|
|
2611
2575
|
return this.cache.get(clazz);
|
|
@@ -2748,12 +2712,11 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
2748
2712
|
this.visitAllNodes(block.children);
|
|
2749
2713
|
}
|
|
2750
2714
|
visitForLoopBlock(block) {
|
|
2751
|
-
var _a;
|
|
2752
2715
|
block.item.visit(this);
|
|
2753
2716
|
this.visitAllNodes(block.contextVariables);
|
|
2754
2717
|
this.visitAst(block.expression);
|
|
2755
2718
|
this.visitAllNodes(block.children);
|
|
2756
|
-
|
|
2719
|
+
block.empty?.visit(this);
|
|
2757
2720
|
}
|
|
2758
2721
|
visitForLoopBlockEmpty(block) {
|
|
2759
2722
|
this.visitAllNodes(block.children);
|
|
@@ -2762,9 +2725,8 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
2762
2725
|
this.visitAllNodes(block.branches);
|
|
2763
2726
|
}
|
|
2764
2727
|
visitIfBlockBranch(block) {
|
|
2765
|
-
var _a;
|
|
2766
2728
|
block.expression && this.visitAst(block.expression);
|
|
2767
|
-
|
|
2729
|
+
block.expressionAlias?.visit(this);
|
|
2768
2730
|
this.visitAllNodes(block.children);
|
|
2769
2731
|
}
|
|
2770
2732
|
visitLetDeclaration(decl) {
|
|
@@ -2892,7 +2854,7 @@ var MissingControlFlowDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
|
2892
2854
|
}
|
|
2893
2855
|
const sourceSpan = controlFlowAttr.keySpan || controlFlowAttr.sourceSpan;
|
|
2894
2856
|
const directiveAndBuiltIn = KNOWN_CONTROL_FLOW_DIRECTIVES.get(controlFlowAttr.name);
|
|
2895
|
-
const errorMessage = `The \`*${controlFlowAttr.name}\` directive was used in the template, but neither the \`${directiveAndBuiltIn
|
|
2857
|
+
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.`;
|
|
2896
2858
|
const diagnostic = ctx.makeTemplateDiagnostic(sourceSpan, errorMessage);
|
|
2897
2859
|
return [diagnostic];
|
|
2898
2860
|
}
|
|
@@ -2961,7 +2923,7 @@ var MissingStructuralDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
|
2961
2923
|
if (!customStructuralDirective)
|
|
2962
2924
|
return [];
|
|
2963
2925
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
2964
|
-
if (symbol
|
|
2926
|
+
if (symbol?.directives.length) {
|
|
2965
2927
|
return [];
|
|
2966
2928
|
}
|
|
2967
2929
|
const sourceSpan = customStructuralDirective.keySpan || customStructuralDirective.sourceSpan;
|
|
@@ -3168,7 +3130,6 @@ var UninvokedFunctionInEventBindingSpec = class extends TemplateCheckWithVisitor
|
|
|
3168
3130
|
}
|
|
3169
3131
|
};
|
|
3170
3132
|
function assertExpressionInvoked(expression, component, node, expressionText, ctx) {
|
|
3171
|
-
var _a;
|
|
3172
3133
|
if (expression instanceof Call || expression instanceof SafeCall2) {
|
|
3173
3134
|
return [];
|
|
3174
3135
|
}
|
|
@@ -3177,7 +3138,7 @@ function assertExpressionInvoked(expression, component, node, expressionText, ct
|
|
|
3177
3138
|
}
|
|
3178
3139
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(expression, component);
|
|
3179
3140
|
if (symbol !== null && symbol.kind === SymbolKind.Expression) {
|
|
3180
|
-
if (
|
|
3141
|
+
if (symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3181
3142
|
const fullExpressionText = generateStringFromExpression(expression, expressionText);
|
|
3182
3143
|
const errorString = `Function in event binding should be invoked: ${fullExpressionText}()`;
|
|
3183
3144
|
return [ctx.makeTemplateDiagnostic(node.sourceSpan, errorString)];
|
|
@@ -3203,7 +3164,7 @@ var UnparenthesizedNullishCoalescing = class extends TemplateCheckWithVisitor {
|
|
|
3203
3164
|
if (node.operation === "&&" || node.operation === "||") {
|
|
3204
3165
|
if (node.left instanceof Binary2 && node.left.operation === "??" || node.right instanceof Binary2 && node.right.operation === "??") {
|
|
3205
3166
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
3206
|
-
if (
|
|
3167
|
+
if (symbol?.kind !== SymbolKind.Expression) {
|
|
3207
3168
|
return [];
|
|
3208
3169
|
}
|
|
3209
3170
|
const sourceMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbol.tcbLocation);
|
|
@@ -3271,7 +3232,6 @@ import { Call as Call2, PropertyRead as PropertyRead4, SafeCall as SafeCall3, Sa
|
|
|
3271
3232
|
var UninvokedTrackFunctionCheck = class extends TemplateCheckWithVisitor {
|
|
3272
3233
|
code = ErrorCode.UNINVOKED_TRACK_FUNCTION;
|
|
3273
3234
|
visitNode(ctx, component, node) {
|
|
3274
|
-
var _a;
|
|
3275
3235
|
if (!(node instanceof TmplAstForLoopBlock) || !node.trackBy) {
|
|
3276
3236
|
return [];
|
|
3277
3237
|
}
|
|
@@ -3282,7 +3242,7 @@ var UninvokedTrackFunctionCheck = class extends TemplateCheckWithVisitor {
|
|
|
3282
3242
|
return [];
|
|
3283
3243
|
}
|
|
3284
3244
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node.trackBy.ast, component);
|
|
3285
|
-
if (symbol !== null && symbol.kind === SymbolKind.Expression &&
|
|
3245
|
+
if (symbol !== null && symbol.kind === SymbolKind.Expression && symbol.tsType.getCallSignatures()?.length > 0) {
|
|
3286
3246
|
const fullExpressionText = generateStringFromExpression2(node.trackBy.ast, node.trackBy.source || "");
|
|
3287
3247
|
const errorString = `The track function in the @for block should be invoked: ${fullExpressionText}(/* arguments */)`;
|
|
3288
3248
|
return [ctx.makeTemplateDiagnostic(node.sourceSpan, errorString)];
|
|
@@ -3315,11 +3275,10 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
3315
3275
|
partialCtx;
|
|
3316
3276
|
templateChecks;
|
|
3317
3277
|
constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
|
|
3318
|
-
var _a, _b, _c, _d, _e;
|
|
3319
3278
|
this.partialCtx = { templateTypeChecker, typeChecker };
|
|
3320
3279
|
this.templateChecks = /* @__PURE__ */ new Map();
|
|
3321
3280
|
for (const factory15 of templateCheckFactories) {
|
|
3322
|
-
const category = diagnosticLabelToCategory(
|
|
3281
|
+
const category = diagnosticLabelToCategory(options?.extendedDiagnostics?.checks?.[factory15.name] ?? options?.extendedDiagnostics?.defaultCategory ?? DiagnosticCategoryLabel.Warning);
|
|
3323
3282
|
if (category === null) {
|
|
3324
3283
|
continue;
|
|
3325
3284
|
}
|
|
@@ -3527,8 +3486,7 @@ var InitializerApiUsageRule = class {
|
|
|
3527
3486
|
if (closestClass && ts23.isClassDeclaration(closestClass)) {
|
|
3528
3487
|
const decorators = this.reflector.getDecoratorsOfDeclaration(closestClass);
|
|
3529
3488
|
const isComponentOrDirective = decorators !== null && decorators.some((decorator) => {
|
|
3530
|
-
|
|
3531
|
-
return ((_a = decorator.import) == null ? void 0 : _a.from) === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
3489
|
+
return decorator.import?.from === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
3532
3490
|
});
|
|
3533
3491
|
return isComponentOrDirective ? null : makeDiagnostic(ErrorCode.UNSUPPORTED_INITIALIZER_API_USAGE, node, `Unsupported call to the ${functionName} function. This function can only be used as the initializer of a property on a @Component or @Directive class.`);
|
|
3534
3492
|
}
|
|
@@ -3589,30 +3547,29 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3589
3547
|
const dirMeta = this.templateTypeChecker.getDirectiveMetadata(currentNode);
|
|
3590
3548
|
if (dirMeta !== null) {
|
|
3591
3549
|
if (dirMeta.isStandalone && !usedDirectives.has(currentNode) && !this.isPotentialSharedReference(current, rawImports)) {
|
|
3592
|
-
unused
|
|
3550
|
+
unused ??= [];
|
|
3593
3551
|
unused.push(current);
|
|
3594
3552
|
}
|
|
3595
3553
|
continue;
|
|
3596
3554
|
}
|
|
3597
3555
|
const pipeMeta = this.templateTypeChecker.getPipeMetadata(currentNode);
|
|
3598
3556
|
if (pipeMeta !== null && pipeMeta.isStandalone && !usedPipes.has(pipeMeta.name) && !this.isPotentialSharedReference(current, rawImports)) {
|
|
3599
|
-
unused
|
|
3557
|
+
unused ??= [];
|
|
3600
3558
|
unused.push(current);
|
|
3601
3559
|
}
|
|
3602
3560
|
}
|
|
3603
3561
|
return unused;
|
|
3604
3562
|
}
|
|
3605
3563
|
isPotentialSharedReference(reference, rawImports) {
|
|
3606
|
-
var _a, _b;
|
|
3607
3564
|
if (reference.getIdentityInExpression(rawImports) !== null) {
|
|
3608
3565
|
return false;
|
|
3609
3566
|
}
|
|
3610
3567
|
let current = reference.getIdentityIn(rawImports.getSourceFile());
|
|
3611
3568
|
while (current !== null) {
|
|
3612
3569
|
if (ts24.isVariableStatement(current)) {
|
|
3613
|
-
return !!
|
|
3570
|
+
return !!current.modifiers?.some((m) => m.kind === ts24.SyntaxKind.ExportKeyword);
|
|
3614
3571
|
}
|
|
3615
|
-
current =
|
|
3572
|
+
current = current.parent ?? null;
|
|
3616
3573
|
}
|
|
3617
3574
|
return true;
|
|
3618
3575
|
}
|
|
@@ -3629,17 +3586,12 @@ function closestNode(start, predicate) {
|
|
|
3629
3586
|
return null;
|
|
3630
3587
|
}
|
|
3631
3588
|
|
|
3632
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/config.js
|
|
3633
|
-
var UNUSED_STANDALONE_IMPORTS_RULE_ENABLED = true;
|
|
3634
|
-
|
|
3635
3589
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
|
|
3636
3590
|
var SourceFileValidator = class {
|
|
3637
3591
|
rules;
|
|
3638
3592
|
constructor(reflector, importedSymbolsTracker, templateTypeChecker, typeCheckingConfig) {
|
|
3639
3593
|
this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
|
|
3640
|
-
|
|
3641
|
-
this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
|
|
3642
|
-
}
|
|
3594
|
+
this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
|
|
3643
3595
|
}
|
|
3644
3596
|
getDiagnosticsForFile(sourceFile) {
|
|
3645
3597
|
if (sourceFile.isDeclarationFile || sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
|
|
@@ -3648,7 +3600,7 @@ var SourceFileValidator = class {
|
|
|
3648
3600
|
let rulesToRun = null;
|
|
3649
3601
|
for (const rule of this.rules) {
|
|
3650
3602
|
if (rule.shouldCheck(sourceFile)) {
|
|
3651
|
-
rulesToRun
|
|
3603
|
+
rulesToRun ??= [];
|
|
3652
3604
|
rulesToRun.push(rule);
|
|
3653
3605
|
}
|
|
3654
3606
|
}
|
|
@@ -3660,7 +3612,7 @@ var SourceFileValidator = class {
|
|
|
3660
3612
|
for (const rule of rulesToRun) {
|
|
3661
3613
|
const nodeDiagnostics = rule.checkNode(node);
|
|
3662
3614
|
if (nodeDiagnostics !== null) {
|
|
3663
|
-
fileDiagnostics
|
|
3615
|
+
fileDiagnostics ??= [];
|
|
3664
3616
|
if (Array.isArray(nodeDiagnostics)) {
|
|
3665
3617
|
fileDiagnostics.push(...nodeDiagnostics);
|
|
3666
3618
|
} else {
|
|
@@ -3699,7 +3651,7 @@ function freshCompilationTicket(tsProgram, options, incrementalBuildStrategy, pr
|
|
|
3699
3651
|
programDriver,
|
|
3700
3652
|
enableTemplateTypeChecker,
|
|
3701
3653
|
usePoisonedData,
|
|
3702
|
-
perfRecorder: perfRecorder
|
|
3654
|
+
perfRecorder: perfRecorder ?? ActivePerfRecorder.zeroedToNow()
|
|
3703
3655
|
};
|
|
3704
3656
|
}
|
|
3705
3657
|
function incrementalFromCompilerTicket(oldCompiler, newProgram, incrementalBuildStrategy, programDriver, modifiedResourceFiles, perfRecorder) {
|
|
@@ -3782,7 +3734,6 @@ var NgCompiler = class {
|
|
|
3782
3734
|
}
|
|
3783
3735
|
}
|
|
3784
3736
|
constructor(adapter, options, inputProgram, programDriver, incrementalStrategy, incrementalCompilation, enableTemplateTypeChecker, usePoisonedData, livePerfRecorder) {
|
|
3785
|
-
var _a, _b, _c, _d;
|
|
3786
3737
|
this.adapter = adapter;
|
|
3787
3738
|
this.options = options;
|
|
3788
3739
|
this.inputProgram = inputProgram;
|
|
@@ -3791,13 +3742,13 @@ var NgCompiler = class {
|
|
|
3791
3742
|
this.incrementalCompilation = incrementalCompilation;
|
|
3792
3743
|
this.usePoisonedData = usePoisonedData;
|
|
3793
3744
|
this.livePerfRecorder = livePerfRecorder;
|
|
3794
|
-
this.angularCoreVersion =
|
|
3745
|
+
this.angularCoreVersion = options["_angularCoreVersion"] ?? null;
|
|
3795
3746
|
this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
|
|
3796
3747
|
this.usePoisonedData = usePoisonedData || !!options._compilePoisonedComponents;
|
|
3797
3748
|
this.enableTemplateTypeChecker = enableTemplateTypeChecker || !!options._enableTemplateTypeChecker;
|
|
3798
|
-
this.enableBlockSyntax =
|
|
3799
|
-
this.enableLetSyntax =
|
|
3800
|
-
this.enableSelectorless =
|
|
3749
|
+
this.enableBlockSyntax = options["_enableBlockSyntax"] ?? true;
|
|
3750
|
+
this.enableLetSyntax = options["_enableLetSyntax"] ?? true;
|
|
3751
|
+
this.enableSelectorless = options["_enableSelectorless"] ?? false;
|
|
3801
3752
|
this.implicitStandaloneValue = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 19.0.0");
|
|
3802
3753
|
this.enableHmr = !!options["_enableHmr"];
|
|
3803
3754
|
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
|
|
@@ -3948,13 +3899,12 @@ var NgCompiler = class {
|
|
|
3948
3899
|
return { styles, template, hostBindings };
|
|
3949
3900
|
}
|
|
3950
3901
|
getMeta(classDecl) {
|
|
3951
|
-
var _a;
|
|
3952
3902
|
if (!isNamedClassDeclaration(classDecl)) {
|
|
3953
3903
|
return null;
|
|
3954
3904
|
}
|
|
3955
3905
|
const ref = new Reference(classDecl);
|
|
3956
3906
|
const { metaReader } = this.ensureAnalyzed();
|
|
3957
|
-
const meta =
|
|
3907
|
+
const meta = metaReader.getPipeMetadata(ref) ?? metaReader.getDirectiveMetadata(ref);
|
|
3958
3908
|
if (meta === null) {
|
|
3959
3909
|
return null;
|
|
3960
3910
|
}
|
|
@@ -4101,10 +4051,9 @@ var NgCompiler = class {
|
|
|
4101
4051
|
return strictTemplates || !!this.options.fullTemplateTypeCheck;
|
|
4102
4052
|
}
|
|
4103
4053
|
getTypeCheckingConfig() {
|
|
4104
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4105
4054
|
const strictTemplates = !!this.options.strictTemplates;
|
|
4106
4055
|
const useInlineTypeConstructors = this.programDriver.supportsInlineOperations;
|
|
4107
|
-
const checkTwoWayBoundEvents =
|
|
4056
|
+
const checkTwoWayBoundEvents = this.options["_checkTwoWayBoundEvents"] ?? false;
|
|
4108
4057
|
const allowSignalsInTwoWayBindings = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 17.2.0-0");
|
|
4109
4058
|
let typeCheckingConfig;
|
|
4110
4059
|
if (this.fullTemplateTypeCheck) {
|
|
@@ -4131,8 +4080,8 @@ var NgCompiler = class {
|
|
|
4131
4080
|
enableTemplateTypeChecker: this.enableTemplateTypeChecker,
|
|
4132
4081
|
useInlineTypeConstructors,
|
|
4133
4082
|
suggestionsForSuboptimalTypeInference: this.enableTemplateTypeChecker && !strictTemplates,
|
|
4134
|
-
controlFlowPreventingContentProjection:
|
|
4135
|
-
unusedStandaloneImports:
|
|
4083
|
+
controlFlowPreventingContentProjection: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
|
|
4084
|
+
unusedStandaloneImports: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
|
|
4136
4085
|
allowSignalsInTwoWayBindings,
|
|
4137
4086
|
checkTwoWayBoundEvents
|
|
4138
4087
|
};
|
|
@@ -4160,8 +4109,8 @@ var NgCompiler = class {
|
|
|
4160
4109
|
enableTemplateTypeChecker: this.enableTemplateTypeChecker,
|
|
4161
4110
|
useInlineTypeConstructors,
|
|
4162
4111
|
suggestionsForSuboptimalTypeInference: false,
|
|
4163
|
-
controlFlowPreventingContentProjection:
|
|
4164
|
-
unusedStandaloneImports:
|
|
4112
|
+
controlFlowPreventingContentProjection: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
|
|
4113
|
+
unusedStandaloneImports: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
|
|
4165
4114
|
allowSignalsInTwoWayBindings,
|
|
4166
4115
|
checkTwoWayBoundEvents
|
|
4167
4116
|
};
|
|
@@ -4198,10 +4147,10 @@ var NgCompiler = class {
|
|
|
4198
4147
|
if (this.options.strictLiteralTypes !== void 0) {
|
|
4199
4148
|
typeCheckingConfig.strictLiteralTypes = this.options.strictLiteralTypes;
|
|
4200
4149
|
}
|
|
4201
|
-
if (
|
|
4150
|
+
if (this.options.extendedDiagnostics?.checks?.controlFlowPreventingContentProjection !== void 0) {
|
|
4202
4151
|
typeCheckingConfig.controlFlowPreventingContentProjection = this.options.extendedDiagnostics.checks.controlFlowPreventingContentProjection;
|
|
4203
4152
|
}
|
|
4204
|
-
if (
|
|
4153
|
+
if (this.options.extendedDiagnostics?.checks?.unusedStandaloneImports !== void 0) {
|
|
4205
4154
|
typeCheckingConfig.unusedStandaloneImports = this.options.extendedDiagnostics.checks.unusedStandaloneImports;
|
|
4206
4155
|
}
|
|
4207
4156
|
return typeCheckingConfig;
|
|
@@ -4255,22 +4204,19 @@ var NgCompiler = class {
|
|
|
4255
4204
|
}
|
|
4256
4205
|
if (templateSemanticsChecker !== null) {
|
|
4257
4206
|
diagnostics.push(...compilation.traitCompiler.runAdditionalChecks(sf2, (clazz, handler) => {
|
|
4258
|
-
|
|
4259
|
-
return ((_a = handler.templateSemanticsCheck) == null ? void 0 : _a.call(handler, clazz, templateSemanticsChecker)) || null;
|
|
4207
|
+
return handler.templateSemanticsCheck?.(clazz, templateSemanticsChecker) || null;
|
|
4260
4208
|
}));
|
|
4261
4209
|
}
|
|
4262
4210
|
if (this.options.strictTemplates && extendedTemplateChecker !== null) {
|
|
4263
4211
|
diagnostics.push(...compilation.traitCompiler.runAdditionalChecks(sf2, (clazz, handler) => {
|
|
4264
|
-
|
|
4265
|
-
return ((_a = handler.extendedTemplateCheck) == null ? void 0 : _a.call(handler, clazz, extendedTemplateChecker)) || null;
|
|
4212
|
+
return handler.extendedTemplateCheck?.(clazz, extendedTemplateChecker) || null;
|
|
4266
4213
|
}));
|
|
4267
4214
|
}
|
|
4268
4215
|
}
|
|
4269
4216
|
return diagnostics;
|
|
4270
4217
|
}
|
|
4271
4218
|
makeCompilation() {
|
|
4272
|
-
|
|
4273
|
-
const isCore = (_a = this.options._isAngularCoreCompilation) != null ? _a : isAngularCorePackage(this.inputProgram);
|
|
4219
|
+
const isCore = this.options._isAngularCoreCompilation ?? isAngularCorePackage(this.inputProgram);
|
|
4274
4220
|
let compilationMode = CompilationMode.FULL;
|
|
4275
4221
|
if (!isCore) {
|
|
4276
4222
|
switch (this.options.compilationMode) {
|
|
@@ -4344,17 +4290,17 @@ var NgCompiler = class {
|
|
|
4344
4290
|
}
|
|
4345
4291
|
const dtsTransforms = new DtsTransformRegistry();
|
|
4346
4292
|
const resourceRegistry = new ResourceRegistry();
|
|
4347
|
-
const deferredSymbolsTracker = new DeferredSymbolTracker(this.inputProgram.getTypeChecker(),
|
|
4293
|
+
const deferredSymbolsTracker = new DeferredSymbolTracker(this.inputProgram.getTypeChecker(), this.options.onlyExplicitDeferDependencyImports ?? false);
|
|
4348
4294
|
let localCompilationExtraImportsTracker = null;
|
|
4349
4295
|
if (compilationMode === CompilationMode.LOCAL && this.options.generateExtraImportsInLocalMode) {
|
|
4350
4296
|
localCompilationExtraImportsTracker = new LocalCompilationExtraImportsTracker(checker);
|
|
4351
4297
|
}
|
|
4352
4298
|
const cycleHandlingStrategy = compilationMode === CompilationMode.PARTIAL ? 1 : 0;
|
|
4353
4299
|
const strictCtorDeps = this.options.strictInjectionParameters || false;
|
|
4354
|
-
const supportJitMode =
|
|
4355
|
-
const supportTestBed =
|
|
4356
|
-
const externalRuntimeStyles =
|
|
4357
|
-
const typeCheckHostBindings =
|
|
4300
|
+
const supportJitMode = this.options["supportJitMode"] ?? true;
|
|
4301
|
+
const supportTestBed = this.options["supportTestBed"] ?? true;
|
|
4302
|
+
const externalRuntimeStyles = this.options["externalRuntimeStyles"] ?? false;
|
|
4303
|
+
const typeCheckHostBindings = this.options.typeCheckHostBindings ?? false;
|
|
4358
4304
|
if (supportTestBed === false && compilationMode === CompilationMode.PARTIAL) {
|
|
4359
4305
|
throw new Error('TestBed support ("supportTestBed" option) cannot be disabled in partial compilation mode.');
|
|
4360
4306
|
}
|
|
@@ -4366,11 +4312,11 @@ var NgCompiler = class {
|
|
|
4366
4312
|
}
|
|
4367
4313
|
const jitDeclarationRegistry = new JitDeclarationRegistry();
|
|
4368
4314
|
const handlers = [
|
|
4369
|
-
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, this.adapter, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax, this.enableLetSyntax, externalRuntimeStyles, localCompilationExtraImportsTracker, jitDeclarationRegistry,
|
|
4315
|
+
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, this.adapter, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax, this.enableLetSyntax, externalRuntimeStyles, localCompilationExtraImportsTracker, jitDeclarationRegistry, this.options.i18nPreserveWhitespaceForLegacyExtraction ?? true, !!this.options.strictStandalone, this.enableHmr, this.implicitStandaloneValue, typeCheckHostBindings, this.enableSelectorless),
|
|
4370
4316
|
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, importTracker, supportTestBed, typeCheckScopeRegistry, compilationMode, jitDeclarationRegistry, resourceRegistry, !!this.options.strictStandalone, this.implicitStandaloneValue, this.usePoisonedData, typeCheckHostBindings),
|
|
4371
4317
|
new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode, !!this.options.strictStandalone, this.implicitStandaloneValue),
|
|
4372
4318
|
new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
|
|
4373
|
-
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled,
|
|
4319
|
+
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)
|
|
4374
4320
|
];
|
|
4375
4321
|
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
|
|
4376
4322
|
const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {
|
|
@@ -4432,7 +4378,6 @@ function getR3SymbolsFile(program) {
|
|
|
4432
4378
|
return program.getSourceFiles().find((file) => file.fileName.indexOf("r3_symbols.ts") >= 0) || null;
|
|
4433
4379
|
}
|
|
4434
4380
|
function* verifyCompatibleTypeCheckOptions(options) {
|
|
4435
|
-
var _a, _b, _c;
|
|
4436
4381
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
4437
4382
|
yield makeConfigDiagnostic({
|
|
4438
4383
|
category: ts25.DiagnosticCategory.Error,
|
|
@@ -4468,7 +4413,7 @@ One of the following actions is required:
|
|
|
4468
4413
|
});
|
|
4469
4414
|
}
|
|
4470
4415
|
const allowedCategoryLabels = Array.from(Object.values(DiagnosticCategoryLabel));
|
|
4471
|
-
const defaultCategory =
|
|
4416
|
+
const defaultCategory = options.extendedDiagnostics?.defaultCategory;
|
|
4472
4417
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
4473
4418
|
yield makeConfigDiagnostic({
|
|
4474
4419
|
category: ts25.DiagnosticCategory.Error,
|
|
@@ -4481,7 +4426,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
4481
4426
|
`.trim()
|
|
4482
4427
|
});
|
|
4483
4428
|
}
|
|
4484
|
-
for (const [checkName, category] of Object.entries(
|
|
4429
|
+
for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
|
|
4485
4430
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
4486
4431
|
yield makeConfigDiagnostic({
|
|
4487
4432
|
category: ts25.DiagnosticCategory.Error,
|
|
@@ -4540,10 +4485,9 @@ var NotifyingProgramDriverWrapper = class {
|
|
|
4540
4485
|
notifyNewProgram;
|
|
4541
4486
|
getSourceFileVersion;
|
|
4542
4487
|
constructor(delegate, notifyNewProgram) {
|
|
4543
|
-
var _a;
|
|
4544
4488
|
this.delegate = delegate;
|
|
4545
4489
|
this.notifyNewProgram = notifyNewProgram;
|
|
4546
|
-
this.getSourceFileVersion =
|
|
4490
|
+
this.getSourceFileVersion = this.delegate.getSourceFileVersion?.bind(this);
|
|
4547
4491
|
}
|
|
4548
4492
|
get supportsInlineOperations() {
|
|
4549
4493
|
return this.delegate.supportsInlineOperations;
|
|
@@ -4759,8 +4703,8 @@ var NgtscProgram = class {
|
|
|
4759
4703
|
if (options.compilationMode === "experimental-local") {
|
|
4760
4704
|
options.noEmitOnError = false;
|
|
4761
4705
|
}
|
|
4762
|
-
const reuseProgram = oldProgram
|
|
4763
|
-
this.host = NgCompilerHost.wrap(delegateHost, rootNames, options, reuseProgram
|
|
4706
|
+
const reuseProgram = oldProgram?.compiler.getCurrentProgram();
|
|
4707
|
+
this.host = NgCompilerHost.wrap(delegateHost, rootNames, options, reuseProgram ?? null);
|
|
4764
4708
|
if (reuseProgram !== void 0) {
|
|
4765
4709
|
retagAllTsFiles(reuseProgram);
|
|
4766
4710
|
}
|
|
@@ -4876,13 +4820,11 @@ var NgtscProgram = class {
|
|
|
4876
4820
|
return [];
|
|
4877
4821
|
}
|
|
4878
4822
|
emitXi18n() {
|
|
4879
|
-
|
|
4880
|
-
const ctx = new MessageBundle(new HtmlParser(), [], {}, (_a = this.options.i18nOutLocale) != null ? _a : null, this.options.i18nPreserveWhitespaceForLegacyExtraction);
|
|
4823
|
+
const ctx = new MessageBundle(new HtmlParser(), [], {}, this.options.i18nOutLocale ?? null, this.options.i18nPreserveWhitespaceForLegacyExtraction);
|
|
4881
4824
|
this.compiler.xi18n(ctx);
|
|
4882
|
-
i18nExtract(
|
|
4825
|
+
i18nExtract(this.options.i18nOutFormat ?? null, this.options.i18nOutFile ?? null, this.host, this.options, ctx, resolve);
|
|
4883
4826
|
}
|
|
4884
4827
|
emit(opts) {
|
|
4885
|
-
var _a;
|
|
4886
4828
|
if (opts !== void 0 && opts.emitFlags !== void 0 && opts.emitFlags & EmitFlags.I18nBundle) {
|
|
4887
4829
|
this.emitXi18n();
|
|
4888
4830
|
if (!(opts.emitFlags & EmitFlags.JS)) {
|
|
@@ -4893,13 +4835,12 @@ var NgtscProgram = class {
|
|
|
4893
4835
|
};
|
|
4894
4836
|
}
|
|
4895
4837
|
}
|
|
4896
|
-
const forceEmit =
|
|
4838
|
+
const forceEmit = opts?.forceEmit ?? false;
|
|
4897
4839
|
this.compiler.perfRecorder.memory(PerfCheckpoint.PreEmit);
|
|
4898
4840
|
const res = this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptEmit, () => {
|
|
4899
|
-
var _a2;
|
|
4900
4841
|
const { transformers } = this.compiler.prepareEmit();
|
|
4901
4842
|
const ignoreFiles = this.compiler.ignoreForEmit;
|
|
4902
|
-
const emitCallback =
|
|
4843
|
+
const emitCallback = opts?.emitCallback ?? defaultEmitCallback;
|
|
4903
4844
|
const writeFile = (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
|
|
4904
4845
|
if (sourceFiles !== void 0) {
|
|
4905
4846
|
for (const writtenSf of sourceFiles) {
|
|
@@ -5017,17 +4958,15 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
|
5017
4958
|
return { projectFile, basePath };
|
|
5018
4959
|
}
|
|
5019
4960
|
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
5020
|
-
var _a;
|
|
5021
4961
|
try {
|
|
5022
4962
|
const fs = getFileSystem();
|
|
5023
4963
|
const readConfigFile = (configFile) => ts29.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
5024
4964
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
5025
|
-
var _a2, _b;
|
|
5026
4965
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
5027
4966
|
if (error2) {
|
|
5028
4967
|
return parentOptions;
|
|
5029
4968
|
}
|
|
5030
|
-
const angularCompilerOptions =
|
|
4969
|
+
const angularCompilerOptions = config2.angularCompilerOptions ?? config2.bazelOptions?.angularCompilerOptions;
|
|
5031
4970
|
let existingNgCompilerOptions = { ...angularCompilerOptions, ...parentOptions };
|
|
5032
4971
|
if (!config2.extends) {
|
|
5033
4972
|
return existingNgCompilerOptions;
|
|
@@ -5070,7 +5009,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5070
5009
|
const errors = [
|
|
5071
5010
|
{
|
|
5072
5011
|
category: ts29.DiagnosticCategory.Error,
|
|
5073
|
-
messageText:
|
|
5012
|
+
messageText: e.stack ?? e.message,
|
|
5074
5013
|
file: void 0,
|
|
5075
5014
|
start: void 0,
|
|
5076
5015
|
length: void 0,
|
|
@@ -5120,7 +5059,6 @@ function exitCodeFromResult(diags) {
|
|
|
5120
5059
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
5121
5060
|
}
|
|
5122
5061
|
function performCompilation({ rootNames, options, host, oldProgram, emitCallback, mergeEmitResultsCallback, gatherDiagnostics = defaultGatherDiagnostics, customTransformers, emitFlags = EmitFlags.Default, forceEmit = false, modifiedResourceFiles = null }) {
|
|
5123
|
-
var _a;
|
|
5124
5062
|
let program;
|
|
5125
5063
|
let emitResult;
|
|
5126
5064
|
let allDiagnostics = [];
|
|
@@ -5154,7 +5092,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
5154
5092
|
program = void 0;
|
|
5155
5093
|
allDiagnostics.push({
|
|
5156
5094
|
category: ts29.DiagnosticCategory.Error,
|
|
5157
|
-
messageText:
|
|
5095
|
+
messageText: e.stack ?? e.message,
|
|
5158
5096
|
code: UNKNOWN_ERROR_CODE,
|
|
5159
5097
|
file: void 0,
|
|
5160
5098
|
start: void 0,
|
|
@@ -5228,4 +5166,4 @@ export {
|
|
|
5228
5166
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5229
5167
|
* found in the LICENSE file at https://angular.dev/license
|
|
5230
5168
|
*/
|
|
5231
|
-
//# sourceMappingURL=chunk-
|
|
5169
|
+
//# sourceMappingURL=chunk-YZVRRB6E.js.map
|