@angular/compiler-cli 21.0.0-next.9 → 21.0.0-rc.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-3UF7UI6H.js → chunk-3CWKYDQ7.js} +16729 -16217
- package/bundles/chunk-DT6FD4OE.js +1 -1
- package/bundles/{chunk-IE2YQNTQ.js → chunk-HSIRUBJU.js} +1 -1
- package/bundles/chunk-ZOLVJRLX.js +644 -0
- package/bundles/{chunk-SIOKS4LN.js → chunk-ZOZ6XVF3.js} +183 -796
- package/bundles/index.js +18 -18
- package/bundles/private/migrations.js +49 -5
- package/bundles/private/testing.js +526 -0
- package/bundles/private/tooling.js +1 -2
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/index.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +5 -13
- package/private/migrations.d.ts +11 -5
- package/private/testing.d.ts +11 -0
- package/src/ngtsc/annotations/index.d.ts +3 -2
- package/src/ngtsc/core/index.d.ts +1 -0
- package/src/ngtsc/file_system/testing/index.d.ts +12 -0
- package/src/ngtsc/file_system/testing/src/mock_file_system.d.ts +71 -0
- package/src/ngtsc/file_system/testing/src/mock_file_system_native.d.ts +15 -0
- package/src/ngtsc/file_system/testing/src/mock_file_system_posix.d.ts +12 -0
- package/src/ngtsc/file_system/testing/src/mock_file_system_windows.d.ts +12 -0
- package/src/ngtsc/file_system/testing/src/test_helper.d.ts +16 -0
- package/bundles/chunk-HRLHX4UA.js +0 -548
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import {createRequire as __cjsCompatRequire} from 'module';
|
|
3
3
|
const require = __cjsCompatRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
angularJitApplicationTransform
|
|
7
|
-
} from "./chunk-HRLHX4UA.js";
|
|
8
5
|
import {
|
|
9
6
|
AbsoluteModuleStrategy,
|
|
10
7
|
ActivePerfRecorder,
|
|
@@ -66,13 +63,13 @@ import {
|
|
|
66
63
|
SymbolKind,
|
|
67
64
|
TemplateTypeCheckerImpl,
|
|
68
65
|
TraitCompiler,
|
|
69
|
-
TsCreateProgramDriver,
|
|
70
66
|
TypeCheckScopeRegistry,
|
|
71
67
|
TypeCheckShimGenerator,
|
|
72
68
|
TypeScriptReflectionHost,
|
|
73
69
|
UnifiedModulesAliasingHost,
|
|
74
70
|
UnifiedModulesStrategy,
|
|
75
71
|
aliasTransformFactory,
|
|
72
|
+
angularJitApplicationTransform,
|
|
76
73
|
declarationTransformFactory,
|
|
77
74
|
getRootDirs,
|
|
78
75
|
getSourceFileOrNull,
|
|
@@ -86,52 +83,20 @@ import {
|
|
|
86
83
|
ngErrorCode,
|
|
87
84
|
normalizeSeparators,
|
|
88
85
|
relativePathBetween,
|
|
89
|
-
replaceTsWithNgInErrors,
|
|
90
|
-
retagAllTsFiles,
|
|
91
86
|
signalMetadataTransform,
|
|
92
87
|
toUnredirectedSourceFile,
|
|
93
88
|
tryParseInitializerApi,
|
|
94
89
|
untagAllTsFiles
|
|
95
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-3CWKYDQ7.js";
|
|
96
91
|
import {
|
|
97
92
|
LogicalFileSystem,
|
|
98
|
-
absoluteFrom,
|
|
99
93
|
absoluteFromSourceFile,
|
|
100
|
-
createFileSystemTsReadDirectoryFn,
|
|
101
94
|
dirname,
|
|
102
95
|
getFileSystem,
|
|
103
96
|
join,
|
|
104
97
|
resolve
|
|
105
98
|
} from "./chunk-GWZQLAGK.js";
|
|
106
99
|
|
|
107
|
-
// packages/compiler-cli/src/transformers/api.js
|
|
108
|
-
var DEFAULT_ERROR_CODE = 100;
|
|
109
|
-
var UNKNOWN_ERROR_CODE = 500;
|
|
110
|
-
var SOURCE = "angular";
|
|
111
|
-
function isTsDiagnostic(diagnostic) {
|
|
112
|
-
return diagnostic != null && diagnostic.source !== "angular";
|
|
113
|
-
}
|
|
114
|
-
var EmitFlags;
|
|
115
|
-
(function(EmitFlags2) {
|
|
116
|
-
EmitFlags2[EmitFlags2["DTS"] = 1] = "DTS";
|
|
117
|
-
EmitFlags2[EmitFlags2["JS"] = 2] = "JS";
|
|
118
|
-
EmitFlags2[EmitFlags2["Metadata"] = 4] = "Metadata";
|
|
119
|
-
EmitFlags2[EmitFlags2["I18nBundle"] = 8] = "I18nBundle";
|
|
120
|
-
EmitFlags2[EmitFlags2["Codegen"] = 16] = "Codegen";
|
|
121
|
-
EmitFlags2[EmitFlags2["Default"] = 19] = "Default";
|
|
122
|
-
EmitFlags2[EmitFlags2["All"] = 31] = "All";
|
|
123
|
-
})(EmitFlags || (EmitFlags = {}));
|
|
124
|
-
|
|
125
|
-
// packages/compiler-cli/src/transformers/compiler_host.js
|
|
126
|
-
import ts from "typescript";
|
|
127
|
-
var wrapHostForTest = null;
|
|
128
|
-
function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, true) }) {
|
|
129
|
-
if (wrapHostForTest !== null) {
|
|
130
|
-
tsHost = wrapHostForTest(tsHost);
|
|
131
|
-
}
|
|
132
|
-
return tsHost;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
100
|
// packages/compiler-cli/src/ngtsc/docs/src/entities.js
|
|
136
101
|
var EntryType;
|
|
137
102
|
(function(EntryType2) {
|
|
@@ -180,44 +145,44 @@ function isDocEntryWithSourceInfo(entry) {
|
|
|
180
145
|
}
|
|
181
146
|
|
|
182
147
|
// packages/compiler-cli/src/ngtsc/docs/src/extractor.js
|
|
183
|
-
import
|
|
148
|
+
import ts13 from "typescript";
|
|
184
149
|
|
|
185
150
|
// packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
|
|
186
|
-
import
|
|
151
|
+
import ts6 from "typescript";
|
|
187
152
|
|
|
188
153
|
// packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.js
|
|
189
|
-
import
|
|
154
|
+
import ts from "typescript";
|
|
190
155
|
var decoratorExpression = /@(?=(Injectable|Component|Directive|Pipe|NgModule|Input|Output|HostBinding|HostListener|Inject|Optional|Self|Host|SkipSelf|ViewChild|ViewChildren|ContentChild|ContentChildren))/g;
|
|
191
156
|
function extractJsDocTags(node) {
|
|
192
157
|
const escapedNode = getEscapedNode(node);
|
|
193
|
-
return
|
|
158
|
+
return ts.getJSDocTags(escapedNode).map((t) => {
|
|
194
159
|
return {
|
|
195
160
|
name: t.tagName.getText(),
|
|
196
|
-
comment: unescapeAngularDecorators(
|
|
161
|
+
comment: unescapeAngularDecorators(ts.getTextOfJSDocComment(t.comment) ?? "")
|
|
197
162
|
};
|
|
198
163
|
});
|
|
199
164
|
}
|
|
200
165
|
function extractJsDocDescription(node) {
|
|
201
166
|
const escapedNode = getEscapedNode(node);
|
|
202
|
-
const commentOrTag =
|
|
203
|
-
return
|
|
167
|
+
const commentOrTag = ts.getJSDocCommentsAndTags(escapedNode).find((d) => {
|
|
168
|
+
return ts.isJSDoc(d) || ts.isJSDocParameterTag(d);
|
|
204
169
|
});
|
|
205
170
|
const comment = commentOrTag?.comment ?? "";
|
|
206
|
-
const description = typeof comment === "string" ? comment :
|
|
171
|
+
const description = typeof comment === "string" ? comment : ts.getTextOfJSDocComment(comment) ?? "";
|
|
207
172
|
return unescapeAngularDecorators(description);
|
|
208
173
|
}
|
|
209
174
|
function extractRawJsDoc(node) {
|
|
210
|
-
const comment =
|
|
175
|
+
const comment = ts.getJSDocCommentsAndTags(node).find(ts.isJSDoc)?.getFullText() ?? "";
|
|
211
176
|
return unescapeAngularDecorators(comment);
|
|
212
177
|
}
|
|
213
178
|
function getEscapedNode(node) {
|
|
214
|
-
if (
|
|
179
|
+
if (ts.isParameter(node)) {
|
|
215
180
|
return node;
|
|
216
181
|
}
|
|
217
182
|
const rawComment = extractRawJsDoc(node);
|
|
218
183
|
const escaped = escapeAngularDecorators(rawComment);
|
|
219
|
-
const file =
|
|
220
|
-
return file.statements.find((s) =>
|
|
184
|
+
const file = ts.createSourceFile("x.ts", `${escaped}class X {}`, ts.ScriptTarget.ES2020, true);
|
|
185
|
+
return file.statements.find((s) => ts.isClassDeclaration(s));
|
|
221
186
|
}
|
|
222
187
|
function escapeAngularDecorators(comment) {
|
|
223
188
|
return comment.replace(decoratorExpression, "_NG_AT_");
|
|
@@ -227,7 +192,7 @@ function unescapeAngularDecorators(comment) {
|
|
|
227
192
|
}
|
|
228
193
|
|
|
229
194
|
// packages/compiler-cli/src/ngtsc/docs/src/properties_extractor.js
|
|
230
|
-
import
|
|
195
|
+
import ts5 from "typescript";
|
|
231
196
|
|
|
232
197
|
// packages/compiler-cli/src/ngtsc/docs/src/filters.js
|
|
233
198
|
function isAngularPrivateName(name) {
|
|
@@ -236,7 +201,7 @@ function isAngularPrivateName(name) {
|
|
|
236
201
|
}
|
|
237
202
|
|
|
238
203
|
// packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
|
|
239
|
-
import
|
|
204
|
+
import ts3 from "typescript";
|
|
240
205
|
|
|
241
206
|
// packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.js
|
|
242
207
|
function extractGenerics(declaration) {
|
|
@@ -248,9 +213,9 @@ function extractGenerics(declaration) {
|
|
|
248
213
|
}
|
|
249
214
|
|
|
250
215
|
// packages/compiler-cli/src/ngtsc/docs/src/type_extractor.js
|
|
251
|
-
import
|
|
216
|
+
import ts2 from "typescript";
|
|
252
217
|
function extractResolvedTypeString(node, checker) {
|
|
253
|
-
return checker.typeToString(checker.getTypeAtLocation(node), void 0,
|
|
218
|
+
return checker.typeToString(checker.getTypeAtLocation(node), void 0, ts2.TypeFormatFlags.NoTruncation);
|
|
254
219
|
}
|
|
255
220
|
|
|
256
221
|
// packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
|
|
@@ -268,7 +233,7 @@ var FunctionExtractor = class {
|
|
|
268
233
|
const returnType = signature ? extractReturnType(signature, this.typeChecker) : "unknown";
|
|
269
234
|
const implementation = findImplementationOfFunction(this.exportDeclaration, this.typeChecker) ?? this.exportDeclaration;
|
|
270
235
|
const type = this.typeChecker.getTypeAtLocation(this.exportDeclaration);
|
|
271
|
-
const overloads =
|
|
236
|
+
const overloads = ts3.isConstructorDeclaration(this.exportDeclaration) ? constructorOverloads(this.exportDeclaration, this.typeChecker) : extractCallSignatures(this.name, this.typeChecker, type);
|
|
272
237
|
const jsdocsTags = extractJsDocTags(implementation);
|
|
273
238
|
const description = extractJsDocDescription(implementation);
|
|
274
239
|
return {
|
|
@@ -276,7 +241,7 @@ var FunctionExtractor = class {
|
|
|
276
241
|
signatures: overloads,
|
|
277
242
|
implementation: {
|
|
278
243
|
params: extractAllParams(implementation.parameters, this.typeChecker),
|
|
279
|
-
isNewType:
|
|
244
|
+
isNewType: ts3.isConstructSignatureDeclaration(implementation),
|
|
280
245
|
returnType,
|
|
281
246
|
returnDescription: jsdocsTags.find((tag) => tag.name === "returns")?.comment,
|
|
282
247
|
generics: extractGenerics(implementation),
|
|
@@ -296,7 +261,7 @@ var FunctionExtractor = class {
|
|
|
296
261
|
function constructorOverloads(constructorDeclaration, typeChecker) {
|
|
297
262
|
const classDeclaration = constructorDeclaration.parent;
|
|
298
263
|
const constructorNode = classDeclaration.members.filter((member) => {
|
|
299
|
-
return
|
|
264
|
+
return ts3.isConstructorDeclaration(member) && !member.body;
|
|
300
265
|
});
|
|
301
266
|
return constructorNode.map((n) => {
|
|
302
267
|
return {
|
|
@@ -325,7 +290,7 @@ function filterSignatureDeclarations(signatures) {
|
|
|
325
290
|
const result = [];
|
|
326
291
|
for (const signature of signatures) {
|
|
327
292
|
const decl = signature.getDeclaration();
|
|
328
|
-
if (
|
|
293
|
+
if (ts3.isFunctionDeclaration(decl) || ts3.isCallSignatureDeclaration(decl) || ts3.isMethodDeclaration(decl) || ts3.isConstructSignatureDeclaration(decl)) {
|
|
329
294
|
result.push({ signature, decl });
|
|
330
295
|
}
|
|
331
296
|
}
|
|
@@ -345,14 +310,14 @@ function extractCallSignatures(name, typeChecker, type) {
|
|
|
345
310
|
}));
|
|
346
311
|
}
|
|
347
312
|
function extractReturnType(signature, typeChecker) {
|
|
348
|
-
if (signature?.declaration?.type &&
|
|
313
|
+
if (signature?.declaration?.type && ts3.isTypePredicateNode(signature.declaration.type)) {
|
|
349
314
|
return signature.declaration.type.getText();
|
|
350
315
|
}
|
|
351
316
|
return typeChecker.typeToString(
|
|
352
317
|
typeChecker.getReturnTypeOfSignature(signature),
|
|
353
318
|
void 0,
|
|
354
319
|
// This ensures that e.g. `T | undefined` is not reduced to `T`.
|
|
355
|
-
|
|
320
|
+
ts3.TypeFormatFlags.NoTypeReduction | ts3.TypeFormatFlags.NoTruncation
|
|
356
321
|
);
|
|
357
322
|
}
|
|
358
323
|
function findImplementationOfFunction(node, typeChecker) {
|
|
@@ -360,18 +325,18 @@ function findImplementationOfFunction(node, typeChecker) {
|
|
|
360
325
|
return node;
|
|
361
326
|
}
|
|
362
327
|
const symbol = typeChecker.getSymbolAtLocation(node.name);
|
|
363
|
-
const implementation = symbol?.declarations?.find((s) =>
|
|
328
|
+
const implementation = symbol?.declarations?.find((s) => ts3.isFunctionDeclaration(s) && s.body !== void 0);
|
|
364
329
|
return implementation;
|
|
365
330
|
}
|
|
366
331
|
|
|
367
332
|
// packages/compiler-cli/src/ngtsc/docs/src/internal.js
|
|
368
|
-
import
|
|
333
|
+
import ts4 from "typescript";
|
|
369
334
|
function isInternal(member) {
|
|
370
335
|
return extractJsDocTags(member).some((tag) => tag.name === "internal") || hasLeadingInternalComment(member);
|
|
371
336
|
}
|
|
372
337
|
function hasLeadingInternalComment(member) {
|
|
373
338
|
const memberText = member.getSourceFile().text;
|
|
374
|
-
return
|
|
339
|
+
return ts4.reduceEachLeadingCommentRange(
|
|
375
340
|
memberText,
|
|
376
341
|
member.getFullStart(),
|
|
377
342
|
(pos, end, kind, hasTrailingNewLine, containsInternal) => {
|
|
@@ -418,9 +383,9 @@ var PropertiesExtractor = class {
|
|
|
418
383
|
return this.extractMethod(memberDeclaration);
|
|
419
384
|
} else if (this.isProperty(memberDeclaration) && !this.hasPrivateComputedProperty(memberDeclaration)) {
|
|
420
385
|
return this.extractClassProperty(memberDeclaration);
|
|
421
|
-
} else if (
|
|
386
|
+
} else if (ts5.isAccessor(memberDeclaration)) {
|
|
422
387
|
return this.extractGetterSetter(memberDeclaration);
|
|
423
|
-
} else if (
|
|
388
|
+
} else if (ts5.isConstructorDeclaration(memberDeclaration) && memberDeclaration.parameters.length > 0) {
|
|
424
389
|
return this.extractConstructor(memberDeclaration);
|
|
425
390
|
}
|
|
426
391
|
return void 0;
|
|
@@ -440,7 +405,7 @@ var PropertiesExtractor = class {
|
|
|
440
405
|
}
|
|
441
406
|
/** Extracts docs for a signature element (usually inside an interface). */
|
|
442
407
|
extractSignature(signature) {
|
|
443
|
-
const functionExtractor = new FunctionExtractor(
|
|
408
|
+
const functionExtractor = new FunctionExtractor(ts5.isConstructSignatureDeclaration(signature) ? "new" : "", signature, this.typeChecker);
|
|
444
409
|
return {
|
|
445
410
|
...functionExtractor.extract(),
|
|
446
411
|
memberType: MemberType.Method,
|
|
@@ -462,7 +427,7 @@ var PropertiesExtractor = class {
|
|
|
462
427
|
extractGetterSetter(accessor) {
|
|
463
428
|
return {
|
|
464
429
|
...this.extractClassProperty(accessor),
|
|
465
|
-
memberType:
|
|
430
|
+
memberType: ts5.isGetAccessor(accessor) ? MemberType.Getter : MemberType.Setter
|
|
466
431
|
};
|
|
467
432
|
}
|
|
468
433
|
extractConstructor(constructorDeclaration) {
|
|
@@ -474,7 +439,7 @@ var PropertiesExtractor = class {
|
|
|
474
439
|
};
|
|
475
440
|
}
|
|
476
441
|
extractInterfaceConformance(declaration) {
|
|
477
|
-
const implementClause = declaration.heritageClauses?.find((clause) => clause.token ===
|
|
442
|
+
const implementClause = declaration.heritageClauses?.find((clause) => clause.token === ts5.SyntaxKind.ImplementsKeyword);
|
|
478
443
|
return implementClause?.types.map((m) => m.getText()) ?? [];
|
|
479
444
|
}
|
|
480
445
|
/** Gets the tags for a member (protected, readonly, static, etc.) */
|
|
@@ -505,7 +470,7 @@ var PropertiesExtractor = class {
|
|
|
505
470
|
getMemberDeclarations() {
|
|
506
471
|
const type = this.typeChecker.getTypeAtLocation(this.declaration);
|
|
507
472
|
const members = type.getProperties();
|
|
508
|
-
const constructor = type.getSymbol()?.members?.get(
|
|
473
|
+
const constructor = type.getSymbol()?.members?.get(ts5.InternalSymbolName.Constructor);
|
|
509
474
|
const typeOfConstructor = this.typeChecker.getTypeOfSymbol(type.symbol);
|
|
510
475
|
const staticMembers = typeOfConstructor.getProperties();
|
|
511
476
|
const result = [];
|
|
@@ -522,9 +487,9 @@ var PropertiesExtractor = class {
|
|
|
522
487
|
/** The result only contains properties, method implementations and abstracts */
|
|
523
488
|
filterMethodOverloads(declarations) {
|
|
524
489
|
return declarations.filter((declaration, index) => {
|
|
525
|
-
if (
|
|
490
|
+
if (ts5.isFunctionDeclaration(declaration) || ts5.isMethodDeclaration(declaration) || ts5.isConstructorDeclaration(declaration)) {
|
|
526
491
|
const nextDeclaration = declarations[index + 1];
|
|
527
|
-
const isNextMethodWithSameName = nextDeclaration && (
|
|
492
|
+
const isNextMethodWithSameName = nextDeclaration && (ts5.isMethodDeclaration(nextDeclaration) && nextDeclaration.name.getText() === declaration.name?.getText() || ts5.isConstructorDeclaration(nextDeclaration) && ts5.isConstructorDeclaration(declaration));
|
|
528
493
|
return !isNextMethodWithSameName;
|
|
529
494
|
}
|
|
530
495
|
return true;
|
|
@@ -543,13 +508,13 @@ var PropertiesExtractor = class {
|
|
|
543
508
|
/** Gets the doc tag corresponding to a class member modifier (readonly, protected, etc.). */
|
|
544
509
|
getTagForMemberModifier(mod) {
|
|
545
510
|
switch (mod.kind) {
|
|
546
|
-
case
|
|
511
|
+
case ts5.SyntaxKind.StaticKeyword:
|
|
547
512
|
return MemberTags.Static;
|
|
548
|
-
case
|
|
513
|
+
case ts5.SyntaxKind.ReadonlyKeyword:
|
|
549
514
|
return MemberTags.Readonly;
|
|
550
|
-
case
|
|
515
|
+
case ts5.SyntaxKind.ProtectedKeyword:
|
|
551
516
|
return MemberTags.Protected;
|
|
552
|
-
case
|
|
517
|
+
case ts5.SyntaxKind.AbstractKeyword:
|
|
553
518
|
return MemberTags.Abstract;
|
|
554
519
|
default:
|
|
555
520
|
return void 0;
|
|
@@ -565,34 +530,34 @@ var PropertiesExtractor = class {
|
|
|
565
530
|
* - The member is marked as internal via JSDoc.
|
|
566
531
|
*/
|
|
567
532
|
isMemberExcluded(member) {
|
|
568
|
-
if (
|
|
533
|
+
if (ts5.isConstructorDeclaration(member)) {
|
|
569
534
|
return false;
|
|
570
535
|
}
|
|
571
|
-
return !member.name || !this.isDocumentableMember(member) || !
|
|
536
|
+
return !member.name || !this.isDocumentableMember(member) || !ts5.isCallSignatureDeclaration(member) && member.modifiers?.some((mod) => mod.kind === ts5.SyntaxKind.PrivateKeyword) || member.name.getText() === "prototype" || isAngularPrivateName(member.name.getText()) || isInternal(member);
|
|
572
537
|
}
|
|
573
538
|
/** Gets whether a class member is a method, property, or accessor. */
|
|
574
539
|
isDocumentableMember(member) {
|
|
575
|
-
return this.isMethod(member) || this.isProperty(member) ||
|
|
576
|
-
|
|
540
|
+
return this.isMethod(member) || this.isProperty(member) || ts5.isAccessor(member) || ts5.isConstructorDeclaration(member) || // Signatures are documentable if they are part of an interface.
|
|
541
|
+
ts5.isCallSignatureDeclaration(member);
|
|
577
542
|
}
|
|
578
543
|
/** Check if the parameter is a constructor parameter with a public modifier */
|
|
579
544
|
isPublicConstructorParameterProperty(node) {
|
|
580
|
-
if (
|
|
581
|
-
return node.modifiers.some((modifier) => modifier.kind ===
|
|
545
|
+
if (ts5.isParameterPropertyDeclaration(node, node.parent) && node.modifiers) {
|
|
546
|
+
return node.modifiers.some((modifier) => modifier.kind === ts5.SyntaxKind.PublicKeyword);
|
|
582
547
|
}
|
|
583
548
|
return false;
|
|
584
549
|
}
|
|
585
550
|
/** Gets whether a member is a property. */
|
|
586
551
|
isProperty(member) {
|
|
587
|
-
return
|
|
552
|
+
return ts5.isPropertyDeclaration(member) || ts5.isPropertySignature(member) || this.isPublicConstructorParameterProperty(member);
|
|
588
553
|
}
|
|
589
554
|
/** Gets whether a member is a method. */
|
|
590
555
|
isMethod(member) {
|
|
591
|
-
return
|
|
556
|
+
return ts5.isMethodDeclaration(member) || ts5.isMethodSignature(member);
|
|
592
557
|
}
|
|
593
558
|
/** Gets whether the given signature declaration is documentable. */
|
|
594
559
|
isDocumentableSignature(signature) {
|
|
595
|
-
return
|
|
560
|
+
return ts5.isConstructSignatureDeclaration(signature) || ts5.isCallSignatureDeclaration(signature);
|
|
596
561
|
}
|
|
597
562
|
/**
|
|
598
563
|
* Check wether a member has a private computed property name like [ɵWRITABLE_SIGNAL]
|
|
@@ -600,7 +565,7 @@ var PropertiesExtractor = class {
|
|
|
600
565
|
* This will prevent exposing private computed properties in the docs.
|
|
601
566
|
*/
|
|
602
567
|
hasPrivateComputedProperty(property) {
|
|
603
|
-
return
|
|
568
|
+
return ts5.isComputedPropertyName(property.name) && property.name.expression.getText().startsWith("\u0275");
|
|
604
569
|
}
|
|
605
570
|
};
|
|
606
571
|
|
|
@@ -626,14 +591,14 @@ var ClassExtractor = class extends PropertiesExtractor {
|
|
|
626
591
|
/** Gets whether the declaration for this extractor is abstract. */
|
|
627
592
|
isAbstract() {
|
|
628
593
|
const modifiers = this.declaration.modifiers ?? [];
|
|
629
|
-
return modifiers.some((mod) => mod.kind ===
|
|
594
|
+
return modifiers.some((mod) => mod.kind === ts6.SyntaxKind.AbstractKeyword);
|
|
630
595
|
}
|
|
631
596
|
extractInheritance(declaration) {
|
|
632
597
|
if (!declaration.heritageClauses) {
|
|
633
598
|
return void 0;
|
|
634
599
|
}
|
|
635
600
|
for (const clause of declaration.heritageClauses) {
|
|
636
|
-
if (clause.token ===
|
|
601
|
+
if (clause.token === ts6.SyntaxKind.ExtendsKeyword) {
|
|
637
602
|
const types = clause.types;
|
|
638
603
|
if (types.length > 0) {
|
|
639
604
|
const baseClass = types[0];
|
|
@@ -742,7 +707,7 @@ function extractClass(classDeclaration, metadataReader, typeChecker) {
|
|
|
742
707
|
}
|
|
743
708
|
function extractPipeSyntax(metadata, classDeclaration) {
|
|
744
709
|
const transformParams = classDeclaration.members.find((member) => {
|
|
745
|
-
return
|
|
710
|
+
return ts6.isMethodDeclaration(member) && member.name && ts6.isIdentifier(member.name) && member.name.getText() === "transform";
|
|
746
711
|
});
|
|
747
712
|
let paramNames = transformParams.parameters.slice(1).map((param) => {
|
|
748
713
|
return param.name.getText();
|
|
@@ -751,7 +716,7 @@ function extractPipeSyntax(metadata, classDeclaration) {
|
|
|
751
716
|
}
|
|
752
717
|
|
|
753
718
|
// packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.js
|
|
754
|
-
import
|
|
719
|
+
import ts7 from "typescript";
|
|
755
720
|
var LITERAL_AS_ENUM_TAG = "object-literal-as-enum";
|
|
756
721
|
function extractConstant(declaration, typeChecker) {
|
|
757
722
|
const resolvedType = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(declaration));
|
|
@@ -783,17 +748,17 @@ function isSyntheticAngularConstant(declaration) {
|
|
|
783
748
|
}
|
|
784
749
|
function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
785
750
|
let initializer = declaration.initializer;
|
|
786
|
-
while (initializer && (
|
|
751
|
+
while (initializer && (ts7.isAsExpression(initializer) || ts7.isParenthesizedExpression(initializer))) {
|
|
787
752
|
initializer = initializer.expression;
|
|
788
753
|
}
|
|
789
|
-
if (initializer === void 0 || !
|
|
790
|
-
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ?
|
|
754
|
+
if (initializer === void 0 || !ts7.isObjectLiteralExpression(initializer)) {
|
|
755
|
+
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ? ts7.SyntaxKind[initializer.kind] : "undefined"}`);
|
|
791
756
|
}
|
|
792
757
|
return initializer.properties.map((prop) => {
|
|
793
|
-
if (!
|
|
758
|
+
if (!ts7.isPropertyAssignment(prop) || !ts7.isIdentifier(prop.name)) {
|
|
794
759
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be a property assignment with a static name`);
|
|
795
760
|
}
|
|
796
|
-
if (!
|
|
761
|
+
if (!ts7.isNumericLiteral(prop.initializer) && !ts7.isStringLiteralLike(prop.initializer)) {
|
|
797
762
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to a number or string literal`);
|
|
798
763
|
}
|
|
799
764
|
return {
|
|
@@ -809,10 +774,10 @@ function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
|
809
774
|
}
|
|
810
775
|
|
|
811
776
|
// packages/compiler-cli/src/ngtsc/docs/src/decorator_extractor.js
|
|
812
|
-
import
|
|
777
|
+
import ts9 from "typescript";
|
|
813
778
|
|
|
814
779
|
// packages/compiler-cli/src/ngtsc/docs/src/interface_extractor.js
|
|
815
|
-
import
|
|
780
|
+
import ts8 from "typescript";
|
|
816
781
|
var InterfaceExtractor = class extends PropertiesExtractor {
|
|
817
782
|
constructor(declaration, typeChecker) {
|
|
818
783
|
super(declaration, typeChecker);
|
|
@@ -835,7 +800,7 @@ var InterfaceExtractor = class extends PropertiesExtractor {
|
|
|
835
800
|
return [];
|
|
836
801
|
}
|
|
837
802
|
for (const clause of declaration.heritageClauses) {
|
|
838
|
-
if (clause.token ===
|
|
803
|
+
if (clause.token === ts8.SyntaxKind.ExtendsKeyword) {
|
|
839
804
|
const types = clause.types;
|
|
840
805
|
if (types.length > 0) {
|
|
841
806
|
return types.map((t) => t.getText());
|
|
@@ -861,7 +826,7 @@ function extractorDecorator(declaration, typeChecker) {
|
|
|
861
826
|
let signatures = [];
|
|
862
827
|
if (!members) {
|
|
863
828
|
const decoratorInterface = getDecoratorDeclaration(declaration, typeChecker);
|
|
864
|
-
const callSignatures = decoratorInterface.members.filter(
|
|
829
|
+
const callSignatures = decoratorInterface.members.filter(ts9.isCallSignatureDeclaration);
|
|
865
830
|
signatures = getDecoratorSignatures(callSignatures, typeChecker);
|
|
866
831
|
}
|
|
867
832
|
return {
|
|
@@ -879,7 +844,7 @@ function isDecoratorDeclaration(declaration) {
|
|
|
879
844
|
return !!getDecoratorType(declaration);
|
|
880
845
|
}
|
|
881
846
|
function isDecoratorOptionsInterface(declaration) {
|
|
882
|
-
return declaration.getSourceFile().statements.some((s) =>
|
|
847
|
+
return declaration.getSourceFile().statements.some((s) => ts9.isVariableStatement(s) && s.declarationList.declarations.some((d) => isDecoratorDeclaration(d) && d.name.getText() === declaration.name.getText()));
|
|
883
848
|
}
|
|
884
849
|
function getDecoratorType(declaration) {
|
|
885
850
|
const initializer = declaration.initializer?.getFullText() ?? "";
|
|
@@ -897,7 +862,7 @@ function getDecoratorDeclaration(declaration, typeChecker) {
|
|
|
897
862
|
const decoratorType = typeChecker.getTypeAtLocation(decoratorDeclaration);
|
|
898
863
|
const aliasDeclaration = decoratorType.getSymbol().getDeclarations()[0];
|
|
899
864
|
const decoratorInterface = aliasDeclaration;
|
|
900
|
-
if (!decoratorInterface || !
|
|
865
|
+
if (!decoratorInterface || !ts9.isInterfaceDeclaration(decoratorInterface)) {
|
|
901
866
|
throw new Error(`No decorator interface found for "${decoratorName}".`);
|
|
902
867
|
}
|
|
903
868
|
return decoratorInterface;
|
|
@@ -908,12 +873,12 @@ function getDecoratorProperties(declaration, typeChecker) {
|
|
|
908
873
|
const firstParamType = typeChecker.getTypeAtLocation(decoratorFirstParam);
|
|
909
874
|
let firstParamTypeDecl;
|
|
910
875
|
if (firstParamType.isUnion()) {
|
|
911
|
-
const firstParamTypeUnion = firstParamType.types.find((t) => (t.flags &
|
|
876
|
+
const firstParamTypeUnion = firstParamType.types.find((t) => (t.flags & ts9.TypeFlags.Undefined) === 0);
|
|
912
877
|
firstParamTypeDecl = firstParamTypeUnion?.getSymbol()?.getDeclarations()[0];
|
|
913
878
|
} else {
|
|
914
879
|
firstParamTypeDecl = firstParamType.getSymbol()?.getDeclarations()[0];
|
|
915
880
|
}
|
|
916
|
-
if (!firstParamTypeDecl || !
|
|
881
|
+
if (!firstParamTypeDecl || !ts9.isInterfaceDeclaration(firstParamTypeDecl)) {
|
|
917
882
|
return null;
|
|
918
883
|
}
|
|
919
884
|
const interfaceDeclaration = firstParamTypeDecl;
|
|
@@ -941,7 +906,7 @@ function getDecoratorInterface(declaration, typeChecker) {
|
|
|
941
906
|
const symbol = typeChecker.getSymbolAtLocation(declaration.name);
|
|
942
907
|
const decoratorType = typeChecker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
|
|
943
908
|
const decoratorInterface = decoratorType.getSymbol()?.getDeclarations()[0];
|
|
944
|
-
if (!decoratorInterface || !
|
|
909
|
+
if (!decoratorInterface || !ts9.isInterfaceDeclaration(decoratorInterface)) {
|
|
945
910
|
throw new Error(`No decorator interface found for "${name}".`);
|
|
946
911
|
}
|
|
947
912
|
return decoratorInterface;
|
|
@@ -950,22 +915,22 @@ function getDecoratorJsDocNode(declaration, typeChecker) {
|
|
|
950
915
|
const name = declaration.name.getText();
|
|
951
916
|
const decoratorInterface = getDecoratorInterface(declaration, typeChecker);
|
|
952
917
|
const callSignature = decoratorInterface.members.filter((node) => {
|
|
953
|
-
return
|
|
918
|
+
return ts9.isCallSignatureDeclaration(node) && extractRawJsDoc(node);
|
|
954
919
|
}).at(-1);
|
|
955
|
-
if (!callSignature || !
|
|
920
|
+
if (!callSignature || !ts9.isCallSignatureDeclaration(callSignature)) {
|
|
956
921
|
throw new Error(`No call signature with JsDoc on "${name}Decorator"`);
|
|
957
922
|
}
|
|
958
923
|
return callSignature;
|
|
959
924
|
}
|
|
960
925
|
function getParamTypeString(paramNode, typeChecker) {
|
|
961
926
|
const type = typeChecker.getTypeAtLocation(paramNode);
|
|
962
|
-
const printer =
|
|
927
|
+
const printer = ts9.createPrinter({ removeComments: true });
|
|
963
928
|
const sourceFile = paramNode.getSourceFile();
|
|
964
929
|
const replace = [];
|
|
965
930
|
if (type.isUnion()) {
|
|
966
931
|
for (const subType of type.types) {
|
|
967
932
|
const decl = subType.getSymbol()?.getDeclarations()?.[0];
|
|
968
|
-
if (decl &&
|
|
933
|
+
if (decl && ts9.isInterfaceDeclaration(decl) && decl.name.text !== "Function") {
|
|
969
934
|
replace.push({
|
|
970
935
|
initial: subType.symbol.name,
|
|
971
936
|
replacedWith: expandType(decl, sourceFile, printer)
|
|
@@ -973,19 +938,19 @@ function getParamTypeString(paramNode, typeChecker) {
|
|
|
973
938
|
}
|
|
974
939
|
}
|
|
975
940
|
}
|
|
976
|
-
let result = printer.printNode(
|
|
941
|
+
let result = printer.printNode(ts9.EmitHint.Unspecified, paramNode, sourceFile).replace(new RegExp(`${paramNode.name.getText()}\\??: `), "").replaceAll(/\s+/g, " ");
|
|
977
942
|
for (const { initial, replacedWith } of replace) {
|
|
978
943
|
result = result.replace(initial, replacedWith);
|
|
979
944
|
}
|
|
980
945
|
return result;
|
|
981
946
|
}
|
|
982
947
|
function expandType(decl, sourceFile, printer) {
|
|
983
|
-
const props = decl.members.map((member) => printer.printNode(
|
|
948
|
+
const props = decl.members.map((member) => printer.printNode(ts9.EmitHint.Unspecified, member, sourceFile)).join(" ").replaceAll(/\s+/g, " ");
|
|
984
949
|
return `{${props}}`;
|
|
985
950
|
}
|
|
986
951
|
|
|
987
952
|
// packages/compiler-cli/src/ngtsc/docs/src/enum_extractor.js
|
|
988
|
-
import
|
|
953
|
+
import ts10 from "typescript";
|
|
989
954
|
function extractEnum(declaration, typeChecker) {
|
|
990
955
|
return {
|
|
991
956
|
name: declaration.name.getText(),
|
|
@@ -1009,36 +974,36 @@ function extractEnumMembers(declaration, checker) {
|
|
|
1009
974
|
}
|
|
1010
975
|
function getEnumMemberValue(memberNode) {
|
|
1011
976
|
const literal = memberNode.getChildren().find((n) => {
|
|
1012
|
-
return
|
|
977
|
+
return ts10.isNumericLiteral(n) || ts10.isStringLiteral(n) || ts10.isPrefixUnaryExpression(n) && n.operator === ts10.SyntaxKind.MinusToken && ts10.isNumericLiteral(n.operand);
|
|
1013
978
|
});
|
|
1014
979
|
return literal?.getText() ?? "";
|
|
1015
980
|
}
|
|
1016
981
|
|
|
1017
982
|
// packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.js
|
|
1018
|
-
import
|
|
983
|
+
import ts11 from "typescript";
|
|
1019
984
|
var initializerApiTag = "initializerApiFunction";
|
|
1020
985
|
function isInitializerApiFunction(node, typeChecker) {
|
|
1021
|
-
if (
|
|
986
|
+
if (ts11.isFunctionDeclaration(node) && node.name !== void 0 && node.body === void 0) {
|
|
1022
987
|
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
1023
988
|
if (implementation !== void 0) {
|
|
1024
989
|
node = implementation;
|
|
1025
990
|
}
|
|
1026
991
|
}
|
|
1027
|
-
if (!
|
|
992
|
+
if (!ts11.isFunctionDeclaration(node) && !ts11.isVariableDeclaration(node)) {
|
|
1028
993
|
return false;
|
|
1029
994
|
}
|
|
1030
|
-
let tagContainer =
|
|
995
|
+
let tagContainer = ts11.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
1031
996
|
if (tagContainer === null) {
|
|
1032
997
|
return false;
|
|
1033
998
|
}
|
|
1034
|
-
const tags =
|
|
999
|
+
const tags = ts11.getJSDocTags(tagContainer);
|
|
1035
1000
|
return tags.some((t) => t.tagName.text === initializerApiTag);
|
|
1036
1001
|
}
|
|
1037
1002
|
function extractInitializerApiFunction(node, typeChecker) {
|
|
1038
|
-
if (node.name === void 0 || !
|
|
1003
|
+
if (node.name === void 0 || !ts11.isIdentifier(node.name)) {
|
|
1039
1004
|
throw new Error(`Initializer API: Expected literal variable name.`);
|
|
1040
1005
|
}
|
|
1041
|
-
const container =
|
|
1006
|
+
const container = ts11.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
1042
1007
|
if (container === null) {
|
|
1043
1008
|
throw new Error("Initializer API: Could not find container AST node of variable.");
|
|
1044
1009
|
}
|
|
@@ -1049,7 +1014,7 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1049
1014
|
for (const property of type.getProperties()) {
|
|
1050
1015
|
const subName = property.getName();
|
|
1051
1016
|
const subDecl = property.getDeclarations()?.[0];
|
|
1052
|
-
if (subDecl === void 0 || !
|
|
1017
|
+
if (subDecl === void 0 || !ts11.isPropertySignature(subDecl)) {
|
|
1053
1018
|
throw new Error(`Initializer API: Could not resolve declaration of sub-property: ${name}.${subName}`);
|
|
1054
1019
|
}
|
|
1055
1020
|
const subType = typeChecker.getTypeAtLocation(subDecl);
|
|
@@ -1058,7 +1023,7 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1058
1023
|
let jsdocTags;
|
|
1059
1024
|
let description;
|
|
1060
1025
|
let rawComment;
|
|
1061
|
-
if (
|
|
1026
|
+
if (ts11.isFunctionDeclaration(node)) {
|
|
1062
1027
|
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
1063
1028
|
if (implementation === void 0) {
|
|
1064
1029
|
throw new Error(`Initializer API: Could not find implementation of function: ${name}`);
|
|
@@ -1106,10 +1071,10 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1106
1071
|
};
|
|
1107
1072
|
}
|
|
1108
1073
|
function getContainerVariableStatement(node) {
|
|
1109
|
-
if (!
|
|
1074
|
+
if (!ts11.isVariableDeclarationList(node.parent)) {
|
|
1110
1075
|
return null;
|
|
1111
1076
|
}
|
|
1112
|
-
if (!
|
|
1077
|
+
if (!ts11.isVariableStatement(node.parent.parent)) {
|
|
1113
1078
|
return null;
|
|
1114
1079
|
}
|
|
1115
1080
|
return node.parent.parent;
|
|
@@ -1137,15 +1102,15 @@ function extractTypeAlias(declaration) {
|
|
|
1137
1102
|
}
|
|
1138
1103
|
|
|
1139
1104
|
// packages/compiler-cli/src/ngtsc/docs/src/import_extractor.js
|
|
1140
|
-
import
|
|
1105
|
+
import ts12 from "typescript";
|
|
1141
1106
|
function getImportedSymbols(sourceFile) {
|
|
1142
1107
|
const importSpecifiers = /* @__PURE__ */ new Map();
|
|
1143
1108
|
function visit(node) {
|
|
1144
|
-
if (
|
|
1109
|
+
if (ts12.isImportDeclaration(node)) {
|
|
1145
1110
|
let moduleSpecifier = node.moduleSpecifier.getText(sourceFile).replace(/['"]/g, "");
|
|
1146
1111
|
if (moduleSpecifier.startsWith("@angular/")) {
|
|
1147
1112
|
const namedBindings = node.importClause?.namedBindings;
|
|
1148
|
-
if (namedBindings &&
|
|
1113
|
+
if (namedBindings && ts12.isNamedImports(namedBindings)) {
|
|
1149
1114
|
namedBindings.elements.forEach((importSpecifier) => {
|
|
1150
1115
|
const importName = importSpecifier.name.text;
|
|
1151
1116
|
const importAlias = importSpecifier.propertyName ? importSpecifier.propertyName.text : void 0;
|
|
@@ -1154,7 +1119,7 @@ function getImportedSymbols(sourceFile) {
|
|
|
1154
1119
|
}
|
|
1155
1120
|
}
|
|
1156
1121
|
}
|
|
1157
|
-
|
|
1122
|
+
ts12.forEachChild(node, visit);
|
|
1158
1123
|
}
|
|
1159
1124
|
visit(sourceFile);
|
|
1160
1125
|
return importSpecifiers;
|
|
@@ -1198,8 +1163,8 @@ var DocsExtractor = class {
|
|
|
1198
1163
|
entry.source = {
|
|
1199
1164
|
filePath: getRelativeFilePath(realSourceFile, rootDir),
|
|
1200
1165
|
// Start & End are off by 1
|
|
1201
|
-
startLine:
|
|
1202
|
-
endLine:
|
|
1166
|
+
startLine: ts13.getLineAndCharacterOfPosition(realSourceFile, node.getStart()).line + 1,
|
|
1167
|
+
endLine: ts13.getLineAndCharacterOfPosition(realSourceFile, node.getEnd()).line + 1
|
|
1203
1168
|
};
|
|
1204
1169
|
entries.push({ ...entry, name: exportName });
|
|
1205
1170
|
}
|
|
@@ -1214,20 +1179,20 @@ var DocsExtractor = class {
|
|
|
1214
1179
|
if (isInitializerApiFunction(node, this.typeChecker)) {
|
|
1215
1180
|
return extractInitializerApiFunction(node, this.typeChecker);
|
|
1216
1181
|
}
|
|
1217
|
-
if (
|
|
1182
|
+
if (ts13.isInterfaceDeclaration(node) && !isIgnoredInterface(node)) {
|
|
1218
1183
|
return extractInterface(node, this.typeChecker);
|
|
1219
1184
|
}
|
|
1220
|
-
if (
|
|
1185
|
+
if (ts13.isFunctionDeclaration(node)) {
|
|
1221
1186
|
const functionExtractor = new FunctionExtractor(node.name.getText(), node, this.typeChecker);
|
|
1222
1187
|
return functionExtractor.extract();
|
|
1223
1188
|
}
|
|
1224
|
-
if (
|
|
1189
|
+
if (ts13.isVariableDeclaration(node) && !isSyntheticAngularConstant(node)) {
|
|
1225
1190
|
return isDecoratorDeclaration(node) ? extractorDecorator(node, this.typeChecker) : extractConstant(node, this.typeChecker);
|
|
1226
1191
|
}
|
|
1227
|
-
if (
|
|
1192
|
+
if (ts13.isTypeAliasDeclaration(node)) {
|
|
1228
1193
|
return extractTypeAlias(node);
|
|
1229
1194
|
}
|
|
1230
|
-
if (
|
|
1195
|
+
if (ts13.isEnumDeclaration(node)) {
|
|
1231
1196
|
return extractEnum(node, this.typeChecker);
|
|
1232
1197
|
}
|
|
1233
1198
|
return null;
|
|
@@ -1256,114 +1221,16 @@ function getRelativeFilePath(sourceFile, rootDir) {
|
|
|
1256
1221
|
return relativePath;
|
|
1257
1222
|
}
|
|
1258
1223
|
|
|
1259
|
-
// packages/compiler-cli/src/ngtsc/
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
function i18nGetExtension(formatName) {
|
|
1267
|
-
const format = formatName.toLowerCase();
|
|
1268
|
-
switch (format) {
|
|
1269
|
-
case "xmb":
|
|
1270
|
-
return "xmb";
|
|
1271
|
-
case "xlf":
|
|
1272
|
-
case "xlif":
|
|
1273
|
-
case "xliff":
|
|
1274
|
-
case "xlf2":
|
|
1275
|
-
case "xliff2":
|
|
1276
|
-
return "xlf";
|
|
1277
|
-
}
|
|
1278
|
-
throw new Error(`Unsupported format "${formatName}"`);
|
|
1279
|
-
}
|
|
1280
|
-
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve = path.resolve) {
|
|
1281
|
-
formatName = formatName || "xlf";
|
|
1282
|
-
const ext = i18nGetExtension(formatName);
|
|
1283
|
-
const content = i18nSerialize(bundle, formatName, options);
|
|
1284
|
-
const dstFile = outFile || `messages.${ext}`;
|
|
1285
|
-
const dstPath = pathResolve(options.outDir || options.basePath, dstFile);
|
|
1286
|
-
host.writeFile(dstPath, content, false, void 0, []);
|
|
1287
|
-
return [dstPath];
|
|
1288
|
-
}
|
|
1289
|
-
function i18nSerialize(bundle, formatName, options) {
|
|
1290
|
-
const format = formatName.toLowerCase();
|
|
1291
|
-
let serializer;
|
|
1292
|
-
switch (format) {
|
|
1293
|
-
case "xmb":
|
|
1294
|
-
serializer = new Xmb();
|
|
1295
|
-
break;
|
|
1296
|
-
case "xliff2":
|
|
1297
|
-
case "xlf2":
|
|
1298
|
-
serializer = new Xliff2();
|
|
1299
|
-
break;
|
|
1300
|
-
case "xlf":
|
|
1301
|
-
case "xliff":
|
|
1302
|
-
default:
|
|
1303
|
-
serializer = new Xliff();
|
|
1304
|
-
}
|
|
1305
|
-
return bundle.write(serializer, getPathNormalizer(options.basePath));
|
|
1306
|
-
}
|
|
1307
|
-
function getPathNormalizer(basePath) {
|
|
1308
|
-
return (sourcePath) => {
|
|
1309
|
-
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
|
|
1310
|
-
return sourcePath.split(path.sep).join("/");
|
|
1311
|
-
};
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
// packages/compiler-cli/src/typescript_support.js
|
|
1315
|
-
import ts15 from "typescript";
|
|
1316
|
-
|
|
1317
|
-
// packages/compiler-cli/src/version_helpers.js
|
|
1318
|
-
function toNumbers(value) {
|
|
1319
|
-
const suffixIndex = value.lastIndexOf("-");
|
|
1320
|
-
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
1321
|
-
const parsed = parseInt(segment, 10);
|
|
1322
|
-
if (isNaN(parsed)) {
|
|
1323
|
-
throw Error(`Unable to parse version string ${value}.`);
|
|
1324
|
-
}
|
|
1325
|
-
return parsed;
|
|
1326
|
-
});
|
|
1327
|
-
}
|
|
1328
|
-
function compareNumbers(a, b) {
|
|
1329
|
-
const max = Math.max(a.length, b.length);
|
|
1330
|
-
const min = Math.min(a.length, b.length);
|
|
1331
|
-
for (let i = 0; i < min; i++) {
|
|
1332
|
-
if (a[i] > b[i])
|
|
1333
|
-
return 1;
|
|
1334
|
-
if (a[i] < b[i])
|
|
1335
|
-
return -1;
|
|
1336
|
-
}
|
|
1337
|
-
if (min !== max) {
|
|
1338
|
-
const longestArray = a.length === max ? a : b;
|
|
1339
|
-
const comparisonResult = a.length === max ? 1 : -1;
|
|
1340
|
-
for (let i = min; i < max; i++) {
|
|
1341
|
-
if (longestArray[i] > 0) {
|
|
1342
|
-
return comparisonResult;
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
return 0;
|
|
1347
|
-
}
|
|
1348
|
-
function compareVersions(v1, v2) {
|
|
1349
|
-
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
// packages/compiler-cli/src/typescript_support.js
|
|
1353
|
-
var MIN_TS_VERSION = "5.9.0";
|
|
1354
|
-
var MAX_TS_VERSION = "6.0.0";
|
|
1355
|
-
var tsVersion = ts15.version;
|
|
1356
|
-
function checkVersion(version, minVersion, maxVersion) {
|
|
1357
|
-
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
1358
|
-
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
function verifySupportedTypeScriptVersion() {
|
|
1362
|
-
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
1363
|
-
}
|
|
1224
|
+
// packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
|
|
1225
|
+
var DiagnosticCategoryLabel;
|
|
1226
|
+
(function(DiagnosticCategoryLabel2) {
|
|
1227
|
+
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
1228
|
+
DiagnosticCategoryLabel2["Error"] = "error";
|
|
1229
|
+
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
1230
|
+
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
1364
1231
|
|
|
1365
1232
|
// packages/compiler-cli/src/ngtsc/core/src/compiler.js
|
|
1366
|
-
import
|
|
1233
|
+
import ts26 from "typescript";
|
|
1367
1234
|
|
|
1368
1235
|
// packages/compiler-cli/src/ngtsc/cycles/src/analyzer.js
|
|
1369
1236
|
var CycleAnalyzer = class {
|
|
@@ -1472,7 +1339,7 @@ var Cycle = class {
|
|
|
1472
1339
|
};
|
|
1473
1340
|
|
|
1474
1341
|
// packages/compiler-cli/src/ngtsc/cycles/src/imports.js
|
|
1475
|
-
import
|
|
1342
|
+
import ts14 from "typescript";
|
|
1476
1343
|
var ImportGraph = class {
|
|
1477
1344
|
checker;
|
|
1478
1345
|
perf;
|
|
@@ -1538,10 +1405,10 @@ var ImportGraph = class {
|
|
|
1538
1405
|
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
1539
1406
|
const imports = /* @__PURE__ */ new Set();
|
|
1540
1407
|
for (const stmt of sf.statements) {
|
|
1541
|
-
if (!
|
|
1408
|
+
if (!ts14.isImportDeclaration(stmt) && !ts14.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
1542
1409
|
continue;
|
|
1543
1410
|
}
|
|
1544
|
-
if (
|
|
1411
|
+
if (ts14.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
1545
1412
|
continue;
|
|
1546
1413
|
}
|
|
1547
1414
|
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
@@ -1549,7 +1416,7 @@ var ImportGraph = class {
|
|
|
1549
1416
|
continue;
|
|
1550
1417
|
}
|
|
1551
1418
|
const moduleFile = symbol.valueDeclaration;
|
|
1552
|
-
if (
|
|
1419
|
+
if (ts14.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
1553
1420
|
imports.add(moduleFile);
|
|
1554
1421
|
}
|
|
1555
1422
|
}
|
|
@@ -1564,7 +1431,7 @@ function isTypeOnlyImportClause(node) {
|
|
|
1564
1431
|
if (node.isTypeOnly) {
|
|
1565
1432
|
return true;
|
|
1566
1433
|
}
|
|
1567
|
-
if (node.namedBindings !== void 0 &&
|
|
1434
|
+
if (node.namedBindings !== void 0 && ts14.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
1568
1435
|
return true;
|
|
1569
1436
|
}
|
|
1570
1437
|
return false;
|
|
@@ -1592,7 +1459,7 @@ var Found = class {
|
|
|
1592
1459
|
};
|
|
1593
1460
|
|
|
1594
1461
|
// packages/compiler-cli/src/ngtsc/entry_point/src/generator.js
|
|
1595
|
-
import
|
|
1462
|
+
import ts15 from "typescript";
|
|
1596
1463
|
var FlatIndexGenerator = class {
|
|
1597
1464
|
entryPoint;
|
|
1598
1465
|
moduleName;
|
|
@@ -1611,7 +1478,7 @@ var FlatIndexGenerator = class {
|
|
|
1611
1478
|
|
|
1612
1479
|
export * from '${relativeEntryPoint}';
|
|
1613
1480
|
`;
|
|
1614
|
-
const genFile =
|
|
1481
|
+
const genFile = ts15.createSourceFile(this.flatIndexPath, contents, ts15.ScriptTarget.ES2015, true, ts15.ScriptKind.TS);
|
|
1615
1482
|
if (this.moduleName !== null) {
|
|
1616
1483
|
genFile.moduleName = this.moduleName;
|
|
1617
1484
|
}
|
|
@@ -1636,7 +1503,7 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
1636
1503
|
}
|
|
1637
1504
|
|
|
1638
1505
|
// packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.js
|
|
1639
|
-
import
|
|
1506
|
+
import ts16 from "typescript";
|
|
1640
1507
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
1641
1508
|
const diagnostics = [];
|
|
1642
1509
|
const topLevelExports = /* @__PURE__ */ new Set();
|
|
@@ -1646,7 +1513,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1646
1513
|
}
|
|
1647
1514
|
const exportedSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
1648
1515
|
exportedSymbols.forEach((symbol) => {
|
|
1649
|
-
if (symbol.flags &
|
|
1516
|
+
if (symbol.flags & ts16.SymbolFlags.Alias) {
|
|
1650
1517
|
symbol = checker.getAliasedSymbol(symbol);
|
|
1651
1518
|
}
|
|
1652
1519
|
const decl = symbol.valueDeclaration;
|
|
@@ -1670,7 +1537,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1670
1537
|
visibleVia = transitivePath.map((seg) => getNameOfDeclaration(seg)).join(" -> ");
|
|
1671
1538
|
}
|
|
1672
1539
|
const diagnostic = {
|
|
1673
|
-
category:
|
|
1540
|
+
category: ts16.DiagnosticCategory.Error,
|
|
1674
1541
|
code: ngErrorCode(ErrorCode.SYMBOL_NOT_EXPORTED),
|
|
1675
1542
|
file: transitiveReference.getSourceFile(),
|
|
1676
1543
|
...getPosOfDeclaration(transitiveReference),
|
|
@@ -1690,7 +1557,7 @@ function getPosOfDeclaration(decl) {
|
|
|
1690
1557
|
};
|
|
1691
1558
|
}
|
|
1692
1559
|
function getIdentifierOfDeclaration(decl) {
|
|
1693
|
-
if ((
|
|
1560
|
+
if ((ts16.isClassDeclaration(decl) || ts16.isVariableDeclaration(decl) || ts16.isFunctionDeclaration(decl)) && decl.name !== void 0 && ts16.isIdentifier(decl.name)) {
|
|
1694
1561
|
return decl.name;
|
|
1695
1562
|
} else {
|
|
1696
1563
|
return null;
|
|
@@ -1702,13 +1569,13 @@ function getNameOfDeclaration(decl) {
|
|
|
1702
1569
|
}
|
|
1703
1570
|
function getDescriptorOfDeclaration(decl) {
|
|
1704
1571
|
switch (decl.kind) {
|
|
1705
|
-
case
|
|
1572
|
+
case ts16.SyntaxKind.ClassDeclaration:
|
|
1706
1573
|
return "class";
|
|
1707
|
-
case
|
|
1574
|
+
case ts16.SyntaxKind.FunctionDeclaration:
|
|
1708
1575
|
return "function";
|
|
1709
|
-
case
|
|
1576
|
+
case ts16.SyntaxKind.VariableDeclaration:
|
|
1710
1577
|
return "variable";
|
|
1711
|
-
case
|
|
1578
|
+
case ts16.SyntaxKind.EnumDeclaration:
|
|
1712
1579
|
return "enum";
|
|
1713
1580
|
default:
|
|
1714
1581
|
return "declaration";
|
|
@@ -2548,7 +2415,7 @@ var NgModuleIndexImpl = class {
|
|
|
2548
2415
|
};
|
|
2549
2416
|
|
|
2550
2417
|
// packages/compiler-cli/src/ngtsc/resource/src/loader.js
|
|
2551
|
-
import
|
|
2418
|
+
import ts17 from "typescript";
|
|
2552
2419
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
2553
2420
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
2554
2421
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -2724,7 +2591,7 @@ var AdapterResourceLoader = class {
|
|
|
2724
2591
|
* for the file by setting up a module resolution for it that will fail.
|
|
2725
2592
|
*/
|
|
2726
2593
|
getResolvedCandidateLocations(url, fromFile) {
|
|
2727
|
-
const failedLookup =
|
|
2594
|
+
const failedLookup = ts17.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
2728
2595
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
2729
2596
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
2730
2597
|
}
|
|
@@ -2860,7 +2727,7 @@ var StandaloneComponentScopeReader = class {
|
|
|
2860
2727
|
import { ASTWithSource as ASTWithSource2, BindingType, Interpolation, PrefixNot, PropertyRead as PropertyRead2, TmplAstBoundAttribute, TmplAstElement as TmplAstElement2, TmplAstIfBlock, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
|
|
2861
2728
|
|
|
2862
2729
|
// packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.js
|
|
2863
|
-
import
|
|
2730
|
+
import ts18 from "typescript";
|
|
2864
2731
|
var SIGNAL_FNS = /* @__PURE__ */ new Set([
|
|
2865
2732
|
"WritableSignal",
|
|
2866
2733
|
"Signal",
|
|
@@ -2877,7 +2744,7 @@ function isSignalSymbol(symbol) {
|
|
|
2877
2744
|
const declarations = symbol.getDeclarations();
|
|
2878
2745
|
return declarations !== void 0 && declarations.some((decl) => {
|
|
2879
2746
|
const fileName = decl.getSourceFile().fileName;
|
|
2880
|
-
return (
|
|
2747
|
+
return (ts18.isInterfaceDeclaration(decl) || ts18.isTypeAliasDeclaration(decl)) && SIGNAL_FNS.has(decl.name.text) && (fileName.includes("@angular/core") || fileName.includes("angular2/rc/packages/core") || fileName.includes("bin/packages/core"));
|
|
2881
2748
|
});
|
|
2882
2749
|
}
|
|
2883
2750
|
|
|
@@ -3166,7 +3033,7 @@ var factory5 = {
|
|
|
3166
3033
|
|
|
3167
3034
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
|
|
3168
3035
|
import { Binary } from "@angular/compiler";
|
|
3169
|
-
import
|
|
3036
|
+
import ts19 from "typescript";
|
|
3170
3037
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3171
3038
|
code = ErrorCode.NULLISH_COALESCING_NOT_NULLABLE;
|
|
3172
3039
|
visitNode(ctx, component, node) {
|
|
@@ -3177,7 +3044,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3177
3044
|
return [];
|
|
3178
3045
|
}
|
|
3179
3046
|
const typeLeft = symbolLeft.tsType;
|
|
3180
|
-
if (typeLeft.flags & (
|
|
3047
|
+
if (typeLeft.flags & (ts19.TypeFlags.Any | ts19.TypeFlags.Unknown)) {
|
|
3181
3048
|
return [];
|
|
3182
3049
|
}
|
|
3183
3050
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3208,7 +3075,7 @@ var factory6 = {
|
|
|
3208
3075
|
|
|
3209
3076
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
|
|
3210
3077
|
import { KeyedRead, SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
|
|
3211
|
-
import
|
|
3078
|
+
import ts20 from "typescript";
|
|
3212
3079
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3213
3080
|
noUncheckedIndexedAccess;
|
|
3214
3081
|
code = ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
|
|
@@ -3228,7 +3095,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3228
3095
|
return [];
|
|
3229
3096
|
}
|
|
3230
3097
|
const typeLeft = symbolLeft.tsType;
|
|
3231
|
-
if (typeLeft.flags & (
|
|
3098
|
+
if (typeLeft.flags & (ts20.TypeFlags.Any | ts20.TypeFlags.Unknown)) {
|
|
3232
3099
|
return [];
|
|
3233
3100
|
}
|
|
3234
3101
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3598,17 +3465,7 @@ var factory16 = {
|
|
|
3598
3465
|
};
|
|
3599
3466
|
|
|
3600
3467
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
|
|
3601
|
-
import
|
|
3602
|
-
|
|
3603
|
-
// packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
|
|
3604
|
-
var DiagnosticCategoryLabel;
|
|
3605
|
-
(function(DiagnosticCategoryLabel2) {
|
|
3606
|
-
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
3607
|
-
DiagnosticCategoryLabel2["Error"] = "error";
|
|
3608
|
-
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
3609
|
-
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
3610
|
-
|
|
3611
|
-
// packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
|
|
3468
|
+
import ts21 from "typescript";
|
|
3612
3469
|
var ExtendedTemplateCheckerImpl = class {
|
|
3613
3470
|
partialCtx;
|
|
3614
3471
|
templateChecks;
|
|
@@ -3650,9 +3507,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
3650
3507
|
function diagnosticLabelToCategory(label) {
|
|
3651
3508
|
switch (label) {
|
|
3652
3509
|
case DiagnosticCategoryLabel.Warning:
|
|
3653
|
-
return
|
|
3510
|
+
return ts21.DiagnosticCategory.Warning;
|
|
3654
3511
|
case DiagnosticCategoryLabel.Error:
|
|
3655
|
-
return
|
|
3512
|
+
return ts21.DiagnosticCategory.Error;
|
|
3656
3513
|
case DiagnosticCategoryLabel.Suppress:
|
|
3657
3514
|
return null;
|
|
3658
3515
|
default:
|
|
@@ -3691,7 +3548,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
3691
3548
|
|
|
3692
3549
|
// packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
|
|
3693
3550
|
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";
|
|
3694
|
-
import
|
|
3551
|
+
import ts22 from "typescript";
|
|
3695
3552
|
var TemplateSemanticsCheckerImpl = class {
|
|
3696
3553
|
templateTypeChecker;
|
|
3697
3554
|
constructor(templateTypeChecker) {
|
|
@@ -3774,7 +3631,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
|
|
|
3774
3631
|
}
|
|
3775
3632
|
makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
|
|
3776
3633
|
const span = target instanceof TmplAstVariable2 ? target.valueSpan || target.sourceSpan : target.sourceSpan;
|
|
3777
|
-
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan,
|
|
3634
|
+
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, ts22.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [
|
|
3778
3635
|
{
|
|
3779
3636
|
text: `'${target.name}' is declared here.`,
|
|
3780
3637
|
start: span.start.offset,
|
|
@@ -3789,7 +3646,7 @@ function unwrapAstWithSource(ast) {
|
|
|
3789
3646
|
}
|
|
3790
3647
|
|
|
3791
3648
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
|
|
3792
|
-
import
|
|
3649
|
+
import ts23 from "typescript";
|
|
3793
3650
|
var APIS_TO_CHECK = [
|
|
3794
3651
|
INPUT_INITIALIZER_FN,
|
|
3795
3652
|
MODEL_INITIALIZER_FN,
|
|
@@ -3809,13 +3666,13 @@ var InitializerApiUsageRule = class {
|
|
|
3809
3666
|
});
|
|
3810
3667
|
}
|
|
3811
3668
|
checkNode(node) {
|
|
3812
|
-
if (!
|
|
3669
|
+
if (!ts23.isCallExpression(node)) {
|
|
3813
3670
|
return null;
|
|
3814
3671
|
}
|
|
3815
|
-
while (node.parent && (
|
|
3672
|
+
while (node.parent && (ts23.isParenthesizedExpression(node.parent) || ts23.isAsExpression(node.parent))) {
|
|
3816
3673
|
node = node.parent;
|
|
3817
3674
|
}
|
|
3818
|
-
if (!node.parent || !
|
|
3675
|
+
if (!node.parent || !ts23.isCallExpression(node)) {
|
|
3819
3676
|
return null;
|
|
3820
3677
|
}
|
|
3821
3678
|
const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK, node, this.reflector, this.importedSymbolsTracker);
|
|
@@ -3823,12 +3680,12 @@ var InitializerApiUsageRule = class {
|
|
|
3823
3680
|
return null;
|
|
3824
3681
|
}
|
|
3825
3682
|
const functionName = identifiedInitializer.api.functionName + (identifiedInitializer.isRequired ? ".required" : "");
|
|
3826
|
-
if (
|
|
3683
|
+
if (ts23.isPropertyDeclaration(node.parent) && node.parent.initializer === node) {
|
|
3827
3684
|
let closestClass = node.parent;
|
|
3828
|
-
while (closestClass && !
|
|
3685
|
+
while (closestClass && !ts23.isClassDeclaration(closestClass)) {
|
|
3829
3686
|
closestClass = closestClass.parent;
|
|
3830
3687
|
}
|
|
3831
|
-
if (closestClass &&
|
|
3688
|
+
if (closestClass && ts23.isClassDeclaration(closestClass)) {
|
|
3832
3689
|
const decorators = this.reflector.getDecoratorsOfDeclaration(closestClass);
|
|
3833
3690
|
const isComponentOrDirective = decorators !== null && decorators.some((decorator) => {
|
|
3834
3691
|
return decorator.import?.from === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
@@ -3841,7 +3698,7 @@ var InitializerApiUsageRule = class {
|
|
|
3841
3698
|
};
|
|
3842
3699
|
|
|
3843
3700
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
|
|
3844
|
-
import
|
|
3701
|
+
import ts24 from "typescript";
|
|
3845
3702
|
var UnusedStandaloneImportsRule = class {
|
|
3846
3703
|
templateTypeChecker;
|
|
3847
3704
|
typeCheckingConfig;
|
|
@@ -3855,7 +3712,7 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3855
3712
|
return this.typeCheckingConfig.unusedStandaloneImports !== "suppress" && (this.importedSymbolsTracker.hasNamedImport(sourceFile, "Component", "@angular/core") || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, "@angular/core"));
|
|
3856
3713
|
}
|
|
3857
3714
|
checkNode(node) {
|
|
3858
|
-
if (!
|
|
3715
|
+
if (!ts24.isClassDeclaration(node)) {
|
|
3859
3716
|
return null;
|
|
3860
3717
|
}
|
|
3861
3718
|
const metadata = this.templateTypeChecker.getDirectiveMetadata(node);
|
|
@@ -3871,8 +3728,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3871
3728
|
if (unused === null) {
|
|
3872
3729
|
return null;
|
|
3873
3730
|
}
|
|
3874
|
-
const propertyAssignment = closestNode(metadata.rawImports,
|
|
3875
|
-
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ?
|
|
3731
|
+
const propertyAssignment = closestNode(metadata.rawImports, ts24.isPropertyAssignment);
|
|
3732
|
+
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ? ts24.DiagnosticCategory.Error : ts24.DiagnosticCategory.Warning;
|
|
3876
3733
|
if (unused.length === metadata.imports.length && propertyAssignment !== null) {
|
|
3877
3734
|
return makeDiagnostic(ErrorCode.UNUSED_STANDALONE_IMPORTS, propertyAssignment.name, "All imports are unused", void 0, category);
|
|
3878
3735
|
}
|
|
@@ -3916,8 +3773,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3916
3773
|
}
|
|
3917
3774
|
let current = reference.getIdentityIn(rawImports.getSourceFile());
|
|
3918
3775
|
while (current !== null) {
|
|
3919
|
-
if (
|
|
3920
|
-
return !!current.modifiers?.some((m) => m.kind ===
|
|
3776
|
+
if (ts24.isVariableStatement(current)) {
|
|
3777
|
+
return !!current.modifiers?.some((m) => m.kind === ts24.SyntaxKind.ExportKeyword);
|
|
3921
3778
|
}
|
|
3922
3779
|
current = current.parent ?? null;
|
|
3923
3780
|
}
|
|
@@ -3937,7 +3794,7 @@ function closestNode(start, predicate) {
|
|
|
3937
3794
|
}
|
|
3938
3795
|
|
|
3939
3796
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/forbidden_required_initializer_invocation_rule.js
|
|
3940
|
-
import
|
|
3797
|
+
import ts25 from "typescript";
|
|
3941
3798
|
var APIS_TO_CHECK2 = [
|
|
3942
3799
|
INPUT_INITIALIZER_FN,
|
|
3943
3800
|
MODEL_INITIALIZER_FN,
|
|
@@ -3956,12 +3813,12 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3956
3813
|
});
|
|
3957
3814
|
}
|
|
3958
3815
|
checkNode(node) {
|
|
3959
|
-
if (!
|
|
3816
|
+
if (!ts25.isClassDeclaration(node))
|
|
3960
3817
|
return null;
|
|
3961
|
-
const requiredInitializerDeclarations = node.members.filter((m) =>
|
|
3818
|
+
const requiredInitializerDeclarations = node.members.filter((m) => ts25.isPropertyDeclaration(m) && this.isPropDeclarationARequiredInitializer(m));
|
|
3962
3819
|
const diagnostics = [];
|
|
3963
3820
|
for (let decl of node.members) {
|
|
3964
|
-
if (!
|
|
3821
|
+
if (!ts25.isPropertyDeclaration(decl))
|
|
3965
3822
|
continue;
|
|
3966
3823
|
const initiallizerExpr = decl.initializer;
|
|
3967
3824
|
if (!initiallizerExpr)
|
|
@@ -3969,10 +3826,10 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3969
3826
|
checkForbiddenInvocation(initiallizerExpr);
|
|
3970
3827
|
}
|
|
3971
3828
|
function checkForbiddenInvocation(node2) {
|
|
3972
|
-
if (
|
|
3829
|
+
if (ts25.isArrowFunction(node2) || ts25.isFunctionExpression(node2))
|
|
3973
3830
|
return;
|
|
3974
|
-
if (
|
|
3975
|
-
|
|
3831
|
+
if (ts25.isPropertyAccessExpression(node2) && node2.expression.kind === ts25.SyntaxKind.ThisKeyword && // With the following we make sure we only flag invoked required initializers
|
|
3832
|
+
ts25.isCallExpression(node2.parent) && node2.parent.expression === node2) {
|
|
3976
3833
|
const requiredProp = requiredInitializerDeclarations.find((prop) => prop.name.getText() === node2.name.getText());
|
|
3977
3834
|
if (requiredProp) {
|
|
3978
3835
|
const initializerFn = requiredProp.initializer.expression.expression.getText();
|
|
@@ -3997,7 +3854,7 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3997
3854
|
}
|
|
3998
3855
|
};
|
|
3999
3856
|
function getConstructorFromClass(node) {
|
|
4000
|
-
return node.members.find((m) =>
|
|
3857
|
+
return node.members.find((m) => ts25.isConstructorDeclaration(m) && m.body !== void 0);
|
|
4001
3858
|
}
|
|
4002
3859
|
|
|
4003
3860
|
// packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
|
|
@@ -4206,7 +4063,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4206
4063
|
this.currentProgram = inputProgram;
|
|
4207
4064
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
4208
4065
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
4209
|
-
const moduleResolutionCache =
|
|
4066
|
+
const moduleResolutionCache = ts26.createModuleResolutionCache(
|
|
4210
4067
|
this.adapter.getCurrentDirectory(),
|
|
4211
4068
|
// doen't retain a reference to `this`, if other closures in the constructor here reference
|
|
4212
4069
|
// `this` internally then a closure created here would retain them. This can cause major
|
|
@@ -4254,7 +4111,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4254
4111
|
}
|
|
4255
4112
|
for (const clazz of classesToUpdate) {
|
|
4256
4113
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
4257
|
-
if (!
|
|
4114
|
+
if (!ts26.isClassDeclaration(clazz)) {
|
|
4258
4115
|
continue;
|
|
4259
4116
|
}
|
|
4260
4117
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -4464,12 +4321,12 @@ var NgCompiler = class _NgCompiler {
|
|
|
4464
4321
|
if (compilation.supportJitMode && compilation.jitDeclarationRegistry.jitDeclarations.size > 0) {
|
|
4465
4322
|
const { jitDeclarations } = compilation.jitDeclarationRegistry;
|
|
4466
4323
|
const jitDeclarationsArray = Array.from(jitDeclarations);
|
|
4467
|
-
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) =>
|
|
4324
|
+
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts26.getOriginalNode(d)));
|
|
4468
4325
|
const sourceFilesWithJit = new Set(jitDeclarationsArray.map((d) => d.getSourceFile().fileName));
|
|
4469
4326
|
before.push((ctx) => {
|
|
4470
4327
|
const reflectionHost = new TypeScriptReflectionHost(this.inputProgram.getTypeChecker());
|
|
4471
4328
|
const jitTransform = angularJitApplicationTransform(this.inputProgram, compilation.isCore, (node) => {
|
|
4472
|
-
node =
|
|
4329
|
+
node = ts26.getOriginalNode(node, ts26.isClassDeclaration);
|
|
4473
4330
|
return reflectionHost.isClass(node) && jitDeclarationOriginalNodes.has(node);
|
|
4474
4331
|
})(ctx);
|
|
4475
4332
|
return (sourceFile) => {
|
|
@@ -4548,16 +4405,16 @@ var NgCompiler = class _NgCompiler {
|
|
|
4548
4405
|
return null;
|
|
4549
4406
|
}
|
|
4550
4407
|
const sourceFile = node.getSourceFile();
|
|
4551
|
-
const printer =
|
|
4552
|
-
const nodeText = printer.printNode(
|
|
4553
|
-
return
|
|
4408
|
+
const printer = ts26.createPrinter();
|
|
4409
|
+
const nodeText = printer.printNode(ts26.EmitHint.Unspecified, callback, sourceFile);
|
|
4410
|
+
return ts26.transpileModule(nodeText, {
|
|
4554
4411
|
compilerOptions: {
|
|
4555
4412
|
...this.options,
|
|
4556
4413
|
// Some module types can produce additional code (see #60795) whereas we need the
|
|
4557
4414
|
// HMR update module to use a native `export`. Override the `target` and `module`
|
|
4558
4415
|
// to ensure that it looks as expected.
|
|
4559
|
-
module:
|
|
4560
|
-
target:
|
|
4416
|
+
module: ts26.ModuleKind.ES2022,
|
|
4417
|
+
target: ts26.ScriptTarget.ES2022
|
|
4561
4418
|
},
|
|
4562
4419
|
fileName: sourceFile.fileName,
|
|
4563
4420
|
reportDiagnostics: false
|
|
@@ -4933,18 +4790,18 @@ function isAngularCorePackage(program) {
|
|
|
4933
4790
|
return false;
|
|
4934
4791
|
}
|
|
4935
4792
|
return r3Symbols.statements.some((stmt) => {
|
|
4936
|
-
if (!
|
|
4793
|
+
if (!ts26.isVariableStatement(stmt)) {
|
|
4937
4794
|
return false;
|
|
4938
4795
|
}
|
|
4939
|
-
const modifiers =
|
|
4940
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
4796
|
+
const modifiers = ts26.getModifiers(stmt);
|
|
4797
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts26.SyntaxKind.ExportKeyword)) {
|
|
4941
4798
|
return false;
|
|
4942
4799
|
}
|
|
4943
4800
|
return stmt.declarationList.declarations.some((decl) => {
|
|
4944
|
-
if (!
|
|
4801
|
+
if (!ts26.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
4945
4802
|
return false;
|
|
4946
4803
|
}
|
|
4947
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
4804
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts26.SyntaxKind.TrueKeyword) {
|
|
4948
4805
|
return false;
|
|
4949
4806
|
}
|
|
4950
4807
|
return true;
|
|
@@ -4957,7 +4814,7 @@ function getR3SymbolsFile(program) {
|
|
|
4957
4814
|
function* verifyCompatibleTypeCheckOptions(options) {
|
|
4958
4815
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
4959
4816
|
yield makeConfigDiagnostic({
|
|
4960
|
-
category:
|
|
4817
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4961
4818
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
4962
4819
|
messageText: `
|
|
4963
4820
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -4976,7 +4833,7 @@ https://angular.dev/tools/cli/template-typecheck
|
|
|
4976
4833
|
}
|
|
4977
4834
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
4978
4835
|
yield makeConfigDiagnostic({
|
|
4979
|
-
category:
|
|
4836
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4980
4837
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
4981
4838
|
messageText: `
|
|
4982
4839
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -4993,7 +4850,7 @@ One of the following actions is required:
|
|
|
4993
4850
|
const defaultCategory = options.extendedDiagnostics?.defaultCategory;
|
|
4994
4851
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
4995
4852
|
yield makeConfigDiagnostic({
|
|
4996
|
-
category:
|
|
4853
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4997
4854
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4998
4855
|
messageText: `
|
|
4999
4856
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -5006,7 +4863,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
5006
4863
|
for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
|
|
5007
4864
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
5008
4865
|
yield makeConfigDiagnostic({
|
|
5009
|
-
category:
|
|
4866
|
+
category: ts26.DiagnosticCategory.Error,
|
|
5010
4867
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
5011
4868
|
messageText: `
|
|
5012
4869
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -5018,7 +4875,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
5018
4875
|
}
|
|
5019
4876
|
if (!allowedCategoryLabels.includes(category)) {
|
|
5020
4877
|
yield makeConfigDiagnostic({
|
|
5021
|
-
category:
|
|
4878
|
+
category: ts26.DiagnosticCategory.Error,
|
|
5022
4879
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
5023
4880
|
messageText: `
|
|
5024
4881
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -5036,7 +4893,7 @@ function verifyEmitDeclarationOnly(options) {
|
|
|
5036
4893
|
}
|
|
5037
4894
|
return [
|
|
5038
4895
|
makeConfigDiagnostic({
|
|
5039
|
-
category:
|
|
4896
|
+
category: ts26.DiagnosticCategory.Error,
|
|
5040
4897
|
code: ErrorCode.CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED,
|
|
5041
4898
|
messageText: 'TS compiler option "emitDeclarationOnly" is not supported.'
|
|
5042
4899
|
})
|
|
@@ -5061,7 +4918,7 @@ var ReferenceGraphAdapter = class {
|
|
|
5061
4918
|
for (const { node } of references) {
|
|
5062
4919
|
let sourceFile = node.getSourceFile();
|
|
5063
4920
|
if (sourceFile === void 0) {
|
|
5064
|
-
sourceFile =
|
|
4921
|
+
sourceFile = ts26.getOriginalNode(node).getSourceFile();
|
|
5065
4922
|
}
|
|
5066
4923
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
5067
4924
|
this.graph.add(source, node);
|
|
@@ -5102,7 +4959,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
5102
4959
|
}
|
|
5103
4960
|
|
|
5104
4961
|
// packages/compiler-cli/src/ngtsc/core/src/host.js
|
|
5105
|
-
import
|
|
4962
|
+
import ts27 from "typescript";
|
|
5106
4963
|
var DelegatingCompilerHost = class {
|
|
5107
4964
|
delegate;
|
|
5108
4965
|
createHash;
|
|
@@ -5241,7 +5098,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5241
5098
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
5242
5099
|
if (entryPoint === null) {
|
|
5243
5100
|
diagnostics.push({
|
|
5244
|
-
category:
|
|
5101
|
+
category: ts27.DiagnosticCategory.Error,
|
|
5245
5102
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
5246
5103
|
file: void 0,
|
|
5247
5104
|
start: void 0,
|
|
@@ -5295,501 +5152,31 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5295
5152
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
5296
5153
|
}
|
|
5297
5154
|
createCachedResolveModuleNamesFunction() {
|
|
5298
|
-
const moduleResolutionCache =
|
|
5155
|
+
const moduleResolutionCache = ts27.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
5299
5156
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
5300
5157
|
return moduleNames.map((moduleName) => {
|
|
5301
|
-
const module =
|
|
5158
|
+
const module = ts27.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
5302
5159
|
return module.resolvedModule;
|
|
5303
5160
|
});
|
|
5304
5161
|
};
|
|
5305
5162
|
}
|
|
5306
5163
|
};
|
|
5307
5164
|
|
|
5308
|
-
// packages/compiler-cli/src/ngtsc/program.js
|
|
5309
|
-
var NgtscProgram = class {
|
|
5310
|
-
options;
|
|
5311
|
-
compiler;
|
|
5312
|
-
/**
|
|
5313
|
-
* The primary TypeScript program, which is used for analysis and emit.
|
|
5314
|
-
*/
|
|
5315
|
-
tsProgram;
|
|
5316
|
-
host;
|
|
5317
|
-
incrementalStrategy;
|
|
5318
|
-
constructor(rootNames, options, delegateHost, oldProgram) {
|
|
5319
|
-
this.options = options;
|
|
5320
|
-
const perfRecorder = ActivePerfRecorder.zeroedToNow();
|
|
5321
|
-
perfRecorder.phase(PerfPhase.Setup);
|
|
5322
|
-
if (!options.disableTypeScriptVersionCheck) {
|
|
5323
|
-
verifySupportedTypeScriptVersion();
|
|
5324
|
-
}
|
|
5325
|
-
if (options.compilationMode === "experimental-local") {
|
|
5326
|
-
options.noEmitOnError = false;
|
|
5327
|
-
}
|
|
5328
|
-
const reuseProgram = oldProgram?.compiler.getCurrentProgram();
|
|
5329
|
-
this.host = NgCompilerHost.wrap(delegateHost, rootNames, options, reuseProgram ?? null);
|
|
5330
|
-
if (reuseProgram !== void 0) {
|
|
5331
|
-
retagAllTsFiles(reuseProgram);
|
|
5332
|
-
}
|
|
5333
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts30.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
5334
|
-
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
5335
|
-
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
5336
|
-
this.host.postProgramCreationCleanup();
|
|
5337
|
-
const programDriver = new TsCreateProgramDriver(this.tsProgram, this.host, this.options, this.host.shimExtensionPrefixes);
|
|
5338
|
-
this.incrementalStrategy = oldProgram !== void 0 ? oldProgram.incrementalStrategy.toNextBuildStrategy() : new TrackedIncrementalBuildStrategy();
|
|
5339
|
-
const modifiedResourceFiles = /* @__PURE__ */ new Set();
|
|
5340
|
-
if (this.host.getModifiedResourceFiles !== void 0) {
|
|
5341
|
-
const strings = this.host.getModifiedResourceFiles();
|
|
5342
|
-
if (strings !== void 0) {
|
|
5343
|
-
for (const fileString of strings) {
|
|
5344
|
-
modifiedResourceFiles.add(absoluteFrom(fileString));
|
|
5345
|
-
}
|
|
5346
|
-
}
|
|
5347
|
-
}
|
|
5348
|
-
let ticket;
|
|
5349
|
-
if (oldProgram === void 0) {
|
|
5350
|
-
ticket = freshCompilationTicket(
|
|
5351
|
-
this.tsProgram,
|
|
5352
|
-
options,
|
|
5353
|
-
this.incrementalStrategy,
|
|
5354
|
-
programDriver,
|
|
5355
|
-
perfRecorder,
|
|
5356
|
-
/* enableTemplateTypeChecker */
|
|
5357
|
-
false,
|
|
5358
|
-
/* usePoisonedData */
|
|
5359
|
-
false
|
|
5360
|
-
);
|
|
5361
|
-
} else {
|
|
5362
|
-
ticket = incrementalFromCompilerTicket(oldProgram.compiler, this.tsProgram, this.incrementalStrategy, programDriver, modifiedResourceFiles, perfRecorder);
|
|
5363
|
-
}
|
|
5364
|
-
this.compiler = NgCompiler.fromTicket(ticket, this.host);
|
|
5365
|
-
}
|
|
5366
|
-
getTsProgram() {
|
|
5367
|
-
return this.tsProgram;
|
|
5368
|
-
}
|
|
5369
|
-
getReuseTsProgram() {
|
|
5370
|
-
return this.compiler.getCurrentProgram();
|
|
5371
|
-
}
|
|
5372
|
-
getTsOptionDiagnostics(cancellationToken) {
|
|
5373
|
-
return this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptDiagnostics, () => this.tsProgram.getOptionsDiagnostics(cancellationToken));
|
|
5374
|
-
}
|
|
5375
|
-
getTsSyntacticDiagnostics(sourceFile, cancellationToken) {
|
|
5376
|
-
return this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptDiagnostics, () => {
|
|
5377
|
-
const ignoredFiles = this.compiler.ignoreForDiagnostics;
|
|
5378
|
-
let res;
|
|
5379
|
-
if (sourceFile !== void 0) {
|
|
5380
|
-
if (ignoredFiles.has(sourceFile)) {
|
|
5381
|
-
return [];
|
|
5382
|
-
}
|
|
5383
|
-
res = this.tsProgram.getSyntacticDiagnostics(sourceFile, cancellationToken);
|
|
5384
|
-
} else {
|
|
5385
|
-
const diagnostics = [];
|
|
5386
|
-
for (const sf of this.tsProgram.getSourceFiles()) {
|
|
5387
|
-
if (!ignoredFiles.has(sf)) {
|
|
5388
|
-
diagnostics.push(...this.tsProgram.getSyntacticDiagnostics(sf, cancellationToken));
|
|
5389
|
-
}
|
|
5390
|
-
}
|
|
5391
|
-
res = diagnostics;
|
|
5392
|
-
}
|
|
5393
|
-
return res;
|
|
5394
|
-
});
|
|
5395
|
-
}
|
|
5396
|
-
getTsSemanticDiagnostics(sourceFile, cancellationToken) {
|
|
5397
|
-
if (this.options.compilationMode === "experimental-local") {
|
|
5398
|
-
return [];
|
|
5399
|
-
}
|
|
5400
|
-
return this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptDiagnostics, () => {
|
|
5401
|
-
const ignoredFiles = this.compiler.ignoreForDiagnostics;
|
|
5402
|
-
let res;
|
|
5403
|
-
if (sourceFile !== void 0) {
|
|
5404
|
-
if (ignoredFiles.has(sourceFile)) {
|
|
5405
|
-
return [];
|
|
5406
|
-
}
|
|
5407
|
-
res = this.tsProgram.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
5408
|
-
} else {
|
|
5409
|
-
const diagnostics = [];
|
|
5410
|
-
for (const sf of this.tsProgram.getSourceFiles()) {
|
|
5411
|
-
if (!ignoredFiles.has(sf)) {
|
|
5412
|
-
diagnostics.push(...this.tsProgram.getSemanticDiagnostics(sf, cancellationToken));
|
|
5413
|
-
}
|
|
5414
|
-
}
|
|
5415
|
-
res = diagnostics;
|
|
5416
|
-
}
|
|
5417
|
-
return res;
|
|
5418
|
-
});
|
|
5419
|
-
}
|
|
5420
|
-
getNgOptionDiagnostics(cancellationToken) {
|
|
5421
|
-
return this.compiler.getOptionDiagnostics();
|
|
5422
|
-
}
|
|
5423
|
-
getNgStructuralDiagnostics(cancellationToken) {
|
|
5424
|
-
return [];
|
|
5425
|
-
}
|
|
5426
|
-
getNgSemanticDiagnostics(fileName, cancellationToken) {
|
|
5427
|
-
let sf = void 0;
|
|
5428
|
-
if (fileName !== void 0) {
|
|
5429
|
-
sf = this.tsProgram.getSourceFile(fileName);
|
|
5430
|
-
if (sf === void 0) {
|
|
5431
|
-
return [];
|
|
5432
|
-
}
|
|
5433
|
-
}
|
|
5434
|
-
if (sf === void 0) {
|
|
5435
|
-
return this.compiler.getDiagnostics();
|
|
5436
|
-
} else {
|
|
5437
|
-
return this.compiler.getDiagnosticsForFile(sf, OptimizeFor.WholeProgram);
|
|
5438
|
-
}
|
|
5439
|
-
}
|
|
5440
|
-
/**
|
|
5441
|
-
* Ensure that the `NgCompiler` has properly analyzed the program, and allow for the asynchronous
|
|
5442
|
-
* loading of any resources during the process.
|
|
5443
|
-
*
|
|
5444
|
-
* This is used by the Angular CLI to allow for spawning (async) child compilations for things
|
|
5445
|
-
* like SASS files used in `styleUrls`.
|
|
5446
|
-
*/
|
|
5447
|
-
loadNgStructureAsync() {
|
|
5448
|
-
return this.compiler.analyzeAsync();
|
|
5449
|
-
}
|
|
5450
|
-
listLazyRoutes(entryRoute) {
|
|
5451
|
-
return [];
|
|
5452
|
-
}
|
|
5453
|
-
emitXi18n() {
|
|
5454
|
-
const ctx = new MessageBundle(new HtmlParser(), [], {}, this.options.i18nOutLocale ?? null, this.options.i18nPreserveWhitespaceForLegacyExtraction);
|
|
5455
|
-
this.compiler.xi18n(ctx);
|
|
5456
|
-
i18nExtract(this.options.i18nOutFormat ?? null, this.options.i18nOutFile ?? null, this.host, this.options, ctx, resolve);
|
|
5457
|
-
}
|
|
5458
|
-
emit(opts) {
|
|
5459
|
-
if (opts !== void 0 && opts.emitFlags !== void 0 && opts.emitFlags & EmitFlags.I18nBundle) {
|
|
5460
|
-
this.emitXi18n();
|
|
5461
|
-
if (!(opts.emitFlags & EmitFlags.JS)) {
|
|
5462
|
-
return {
|
|
5463
|
-
diagnostics: [],
|
|
5464
|
-
emitSkipped: true,
|
|
5465
|
-
emittedFiles: []
|
|
5466
|
-
};
|
|
5467
|
-
}
|
|
5468
|
-
}
|
|
5469
|
-
const forceEmit = opts?.forceEmit ?? false;
|
|
5470
|
-
this.compiler.perfRecorder.memory(PerfCheckpoint.PreEmit);
|
|
5471
|
-
const res = this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptEmit, () => {
|
|
5472
|
-
const { transformers } = this.compiler.prepareEmit();
|
|
5473
|
-
const ignoreFiles = this.compiler.ignoreForEmit;
|
|
5474
|
-
const emitCallback = opts?.emitCallback ?? defaultEmitCallback;
|
|
5475
|
-
const writeFile = (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
|
|
5476
|
-
if (sourceFiles !== void 0) {
|
|
5477
|
-
for (const writtenSf of sourceFiles) {
|
|
5478
|
-
if (writtenSf.isDeclarationFile) {
|
|
5479
|
-
continue;
|
|
5480
|
-
}
|
|
5481
|
-
this.compiler.incrementalCompilation.recordSuccessfulEmit(writtenSf);
|
|
5482
|
-
}
|
|
5483
|
-
}
|
|
5484
|
-
this.host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);
|
|
5485
|
-
};
|
|
5486
|
-
const customTransforms = opts && opts.customTransformers;
|
|
5487
|
-
const beforeTransforms = transformers.before || [];
|
|
5488
|
-
const afterDeclarationsTransforms = transformers.afterDeclarations;
|
|
5489
|
-
if (customTransforms !== void 0 && customTransforms.beforeTs !== void 0) {
|
|
5490
|
-
beforeTransforms.push(...customTransforms.beforeTs);
|
|
5491
|
-
}
|
|
5492
|
-
const emitResults = [];
|
|
5493
|
-
for (const targetSourceFile of this.tsProgram.getSourceFiles()) {
|
|
5494
|
-
if (targetSourceFile.isDeclarationFile || ignoreFiles.has(targetSourceFile)) {
|
|
5495
|
-
continue;
|
|
5496
|
-
}
|
|
5497
|
-
if (!forceEmit && this.compiler.incrementalCompilation.safeToSkipEmit(targetSourceFile)) {
|
|
5498
|
-
this.compiler.perfRecorder.eventCount(PerfEvent.EmitSkipSourceFile);
|
|
5499
|
-
continue;
|
|
5500
|
-
}
|
|
5501
|
-
this.compiler.perfRecorder.eventCount(PerfEvent.EmitSourceFile);
|
|
5502
|
-
emitResults.push(emitCallback({
|
|
5503
|
-
targetSourceFile,
|
|
5504
|
-
program: this.tsProgram,
|
|
5505
|
-
host: this.host,
|
|
5506
|
-
options: this.options,
|
|
5507
|
-
emitOnlyDtsFiles: false,
|
|
5508
|
-
writeFile,
|
|
5509
|
-
customTransformers: {
|
|
5510
|
-
before: beforeTransforms,
|
|
5511
|
-
after: customTransforms && customTransforms.afterTs,
|
|
5512
|
-
afterDeclarations: afterDeclarationsTransforms
|
|
5513
|
-
}
|
|
5514
|
-
}));
|
|
5515
|
-
}
|
|
5516
|
-
this.compiler.perfRecorder.memory(PerfCheckpoint.Emit);
|
|
5517
|
-
return (opts && opts.mergeEmitResultsCallback || mergeEmitResults)(emitResults);
|
|
5518
|
-
});
|
|
5519
|
-
if (this.options.tracePerformance !== void 0) {
|
|
5520
|
-
const perf = this.compiler.perfRecorder.finalize();
|
|
5521
|
-
getFileSystem().writeFile(getFileSystem().resolve(this.options.tracePerformance), JSON.stringify(perf, null, 2));
|
|
5522
|
-
}
|
|
5523
|
-
return res;
|
|
5524
|
-
}
|
|
5525
|
-
getIndexedComponents() {
|
|
5526
|
-
return this.compiler.getIndexedComponents();
|
|
5527
|
-
}
|
|
5528
|
-
/**
|
|
5529
|
-
* Gets information for the current program that may be used to generate API
|
|
5530
|
-
* reference documentation. This includes Angular-specific information, such
|
|
5531
|
-
* as component inputs and outputs.
|
|
5532
|
-
*
|
|
5533
|
-
* @param entryPoint Path to the entry point for the package for which API
|
|
5534
|
-
* docs should be extracted.
|
|
5535
|
-
*/
|
|
5536
|
-
getApiDocumentation(entryPoint, privateModules) {
|
|
5537
|
-
return this.compiler.getApiDocumentation(entryPoint, privateModules);
|
|
5538
|
-
}
|
|
5539
|
-
getEmittedSourceFiles() {
|
|
5540
|
-
throw new Error("Method not implemented.");
|
|
5541
|
-
}
|
|
5542
|
-
};
|
|
5543
|
-
var defaultEmitCallback = ({ program, targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers }) => program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
5544
|
-
function mergeEmitResults(emitResults) {
|
|
5545
|
-
const diagnostics = [];
|
|
5546
|
-
let emitSkipped = false;
|
|
5547
|
-
const emittedFiles = [];
|
|
5548
|
-
for (const er of emitResults) {
|
|
5549
|
-
diagnostics.push(...er.diagnostics);
|
|
5550
|
-
emitSkipped = emitSkipped || er.emitSkipped;
|
|
5551
|
-
emittedFiles.push(...er.emittedFiles || []);
|
|
5552
|
-
}
|
|
5553
|
-
return { diagnostics, emitSkipped, emittedFiles };
|
|
5554
|
-
}
|
|
5555
|
-
|
|
5556
|
-
// packages/compiler-cli/src/transformers/program.js
|
|
5557
|
-
function createProgram({ rootNames, options, host, oldProgram }) {
|
|
5558
|
-
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
5559
|
-
}
|
|
5560
|
-
|
|
5561
|
-
// packages/compiler-cli/src/perform_compile.js
|
|
5562
|
-
import ts32 from "typescript";
|
|
5563
|
-
|
|
5564
|
-
// packages/compiler-cli/src/transformers/util.js
|
|
5565
|
-
import ts31 from "typescript";
|
|
5566
|
-
function createMessageDiagnostic(messageText) {
|
|
5567
|
-
return {
|
|
5568
|
-
file: void 0,
|
|
5569
|
-
start: void 0,
|
|
5570
|
-
length: void 0,
|
|
5571
|
-
category: ts31.DiagnosticCategory.Message,
|
|
5572
|
-
messageText,
|
|
5573
|
-
code: DEFAULT_ERROR_CODE,
|
|
5574
|
-
source: SOURCE
|
|
5575
|
-
};
|
|
5576
|
-
}
|
|
5577
|
-
|
|
5578
|
-
// packages/compiler-cli/src/perform_compile.js
|
|
5579
|
-
var defaultFormatHost = {
|
|
5580
|
-
getCurrentDirectory: () => ts32.sys.getCurrentDirectory(),
|
|
5581
|
-
getCanonicalFileName: (fileName) => fileName,
|
|
5582
|
-
getNewLine: () => ts32.sys.newLine
|
|
5583
|
-
};
|
|
5584
|
-
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
5585
|
-
if (diags && diags.length) {
|
|
5586
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts32.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
5587
|
-
} else {
|
|
5588
|
-
return "";
|
|
5589
|
-
}
|
|
5590
|
-
}
|
|
5591
|
-
function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
5592
|
-
const absProject = host.resolve(project);
|
|
5593
|
-
const projectIsDir = host.lstat(absProject).isDirectory();
|
|
5594
|
-
const projectFile = projectIsDir ? host.join(absProject, "tsconfig.json") : absProject;
|
|
5595
|
-
const projectDir = projectIsDir ? absProject : host.dirname(absProject);
|
|
5596
|
-
const basePath = host.resolve(projectDir);
|
|
5597
|
-
return { projectFile, basePath };
|
|
5598
|
-
}
|
|
5599
|
-
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
5600
|
-
try {
|
|
5601
|
-
const fs = getFileSystem();
|
|
5602
|
-
const readConfigFile = (configFile) => ts32.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
5603
|
-
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
5604
|
-
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
5605
|
-
if (error2) {
|
|
5606
|
-
return parentOptions;
|
|
5607
|
-
}
|
|
5608
|
-
const angularCompilerOptions = config2.angularCompilerOptions ?? config2.bazelOptions?.angularCompilerOptions;
|
|
5609
|
-
let existingNgCompilerOptions = { ...angularCompilerOptions, ...parentOptions };
|
|
5610
|
-
if (!config2.extends) {
|
|
5611
|
-
return existingNgCompilerOptions;
|
|
5612
|
-
}
|
|
5613
|
-
const extendsPaths = typeof config2.extends === "string" ? [config2.extends] : config2.extends;
|
|
5614
|
-
return [...extendsPaths].reverse().reduce((prevOptions, extendsPath) => {
|
|
5615
|
-
const extendedConfigPath = getExtendedConfigPath(configFile, extendsPath, host, fs);
|
|
5616
|
-
return extendedConfigPath === null ? prevOptions : readAngularCompilerOptions(extendedConfigPath, prevOptions);
|
|
5617
|
-
}, existingNgCompilerOptions);
|
|
5618
|
-
};
|
|
5619
|
-
const { projectFile, basePath } = calcProjectFileAndBasePath(project, host);
|
|
5620
|
-
const configFileName = host.resolve(host.pwd(), projectFile);
|
|
5621
|
-
const { config, error } = readConfigFile(projectFile);
|
|
5622
|
-
if (error) {
|
|
5623
|
-
return {
|
|
5624
|
-
project,
|
|
5625
|
-
errors: [error],
|
|
5626
|
-
rootNames: [],
|
|
5627
|
-
options: {},
|
|
5628
|
-
emitFlags: EmitFlags.Default
|
|
5629
|
-
};
|
|
5630
|
-
}
|
|
5631
|
-
const existingCompilerOptions = {
|
|
5632
|
-
genDir: basePath,
|
|
5633
|
-
basePath,
|
|
5634
|
-
...readAngularCompilerOptions(configFileName),
|
|
5635
|
-
...existingOptions
|
|
5636
|
-
};
|
|
5637
|
-
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5638
|
-
const { options, errors, fileNames: rootNames, projectReferences } = ts32.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
5639
|
-
let emitFlags = EmitFlags.Default;
|
|
5640
|
-
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
5641
|
-
emitFlags |= EmitFlags.Metadata;
|
|
5642
|
-
}
|
|
5643
|
-
if (options["skipTemplateCodegen"]) {
|
|
5644
|
-
emitFlags = emitFlags & ~EmitFlags.Codegen;
|
|
5645
|
-
}
|
|
5646
|
-
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
5647
|
-
} catch (e) {
|
|
5648
|
-
const errors = [
|
|
5649
|
-
{
|
|
5650
|
-
category: ts32.DiagnosticCategory.Error,
|
|
5651
|
-
messageText: e.stack ?? e.message,
|
|
5652
|
-
file: void 0,
|
|
5653
|
-
start: void 0,
|
|
5654
|
-
length: void 0,
|
|
5655
|
-
source: "angular",
|
|
5656
|
-
code: UNKNOWN_ERROR_CODE
|
|
5657
|
-
}
|
|
5658
|
-
];
|
|
5659
|
-
return { project: "", errors, rootNames: [], options: {}, emitFlags: EmitFlags.Default };
|
|
5660
|
-
}
|
|
5661
|
-
}
|
|
5662
|
-
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
5663
|
-
return {
|
|
5664
|
-
fileExists: host.exists.bind(host),
|
|
5665
|
-
readDirectory: createFileSystemTsReadDirectoryFn(fs),
|
|
5666
|
-
readFile: host.readFile.bind(host),
|
|
5667
|
-
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
5668
|
-
};
|
|
5669
|
-
}
|
|
5670
|
-
function getExtendedConfigPath(configFile, extendsValue, host, fs) {
|
|
5671
|
-
const result = getExtendedConfigPathWorker(configFile, extendsValue, host, fs);
|
|
5672
|
-
if (result !== null) {
|
|
5673
|
-
return result;
|
|
5674
|
-
}
|
|
5675
|
-
return getExtendedConfigPathWorker(configFile, `${extendsValue}.json`, host, fs);
|
|
5676
|
-
}
|
|
5677
|
-
function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
5678
|
-
if (extendsValue.startsWith(".") || fs.isRooted(extendsValue)) {
|
|
5679
|
-
const extendedConfigPath = host.resolve(host.dirname(configFile), extendsValue);
|
|
5680
|
-
if (host.exists(extendedConfigPath)) {
|
|
5681
|
-
return extendedConfigPath;
|
|
5682
|
-
}
|
|
5683
|
-
} else {
|
|
5684
|
-
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5685
|
-
const { resolvedModule } = ts32.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts32.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
|
|
5686
|
-
if (resolvedModule) {
|
|
5687
|
-
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
5688
|
-
}
|
|
5689
|
-
}
|
|
5690
|
-
return null;
|
|
5691
|
-
}
|
|
5692
|
-
function exitCodeFromResult(diags) {
|
|
5693
|
-
if (!diags)
|
|
5694
|
-
return 0;
|
|
5695
|
-
if (diags.every((diag) => diag.category !== ts32.DiagnosticCategory.Error)) {
|
|
5696
|
-
return 0;
|
|
5697
|
-
}
|
|
5698
|
-
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
5699
|
-
}
|
|
5700
|
-
function performCompilation({ rootNames, options, host, oldProgram, emitCallback, mergeEmitResultsCallback, gatherDiagnostics = defaultGatherDiagnostics, customTransformers, emitFlags = EmitFlags.Default, forceEmit = false, modifiedResourceFiles = null }) {
|
|
5701
|
-
let program;
|
|
5702
|
-
let emitResult;
|
|
5703
|
-
let allDiagnostics = [];
|
|
5704
|
-
try {
|
|
5705
|
-
if (!host) {
|
|
5706
|
-
host = createCompilerHost({ options });
|
|
5707
|
-
}
|
|
5708
|
-
if (modifiedResourceFiles) {
|
|
5709
|
-
host.getModifiedResourceFiles = () => modifiedResourceFiles;
|
|
5710
|
-
}
|
|
5711
|
-
program = createProgram({ rootNames, host, options, oldProgram });
|
|
5712
|
-
const beforeDiags = Date.now();
|
|
5713
|
-
allDiagnostics.push(...gatherDiagnostics(program));
|
|
5714
|
-
if (options.diagnostics) {
|
|
5715
|
-
const afterDiags = Date.now();
|
|
5716
|
-
allDiagnostics.push(createMessageDiagnostic(`Time for diagnostics: ${afterDiags - beforeDiags}ms.`));
|
|
5717
|
-
}
|
|
5718
|
-
if (!hasErrors(allDiagnostics)) {
|
|
5719
|
-
emitResult = program.emit({
|
|
5720
|
-
emitCallback,
|
|
5721
|
-
mergeEmitResultsCallback,
|
|
5722
|
-
customTransformers,
|
|
5723
|
-
emitFlags,
|
|
5724
|
-
forceEmit
|
|
5725
|
-
});
|
|
5726
|
-
allDiagnostics.push(...emitResult.diagnostics);
|
|
5727
|
-
return { diagnostics: allDiagnostics, program, emitResult };
|
|
5728
|
-
}
|
|
5729
|
-
return { diagnostics: allDiagnostics, program };
|
|
5730
|
-
} catch (e) {
|
|
5731
|
-
program = void 0;
|
|
5732
|
-
allDiagnostics.push({
|
|
5733
|
-
category: ts32.DiagnosticCategory.Error,
|
|
5734
|
-
messageText: e.stack ?? e.message,
|
|
5735
|
-
code: UNKNOWN_ERROR_CODE,
|
|
5736
|
-
file: void 0,
|
|
5737
|
-
start: void 0,
|
|
5738
|
-
length: void 0
|
|
5739
|
-
});
|
|
5740
|
-
return { diagnostics: allDiagnostics, program };
|
|
5741
|
-
}
|
|
5742
|
-
}
|
|
5743
|
-
function defaultGatherDiagnostics(program) {
|
|
5744
|
-
const allDiagnostics = [];
|
|
5745
|
-
function checkDiagnostics(diags) {
|
|
5746
|
-
if (diags) {
|
|
5747
|
-
allDiagnostics.push(...diags);
|
|
5748
|
-
return !hasErrors(diags);
|
|
5749
|
-
}
|
|
5750
|
-
return true;
|
|
5751
|
-
}
|
|
5752
|
-
let checkOtherDiagnostics = true;
|
|
5753
|
-
checkOtherDiagnostics = checkOtherDiagnostics && checkDiagnostics([...program.getTsOptionDiagnostics(), ...program.getNgOptionDiagnostics()]);
|
|
5754
|
-
checkOtherDiagnostics = checkOtherDiagnostics && checkDiagnostics(program.getTsSyntacticDiagnostics());
|
|
5755
|
-
checkOtherDiagnostics = checkOtherDiagnostics && checkDiagnostics([
|
|
5756
|
-
...program.getTsSemanticDiagnostics(),
|
|
5757
|
-
...program.getNgStructuralDiagnostics()
|
|
5758
|
-
]);
|
|
5759
|
-
checkOtherDiagnostics = checkOtherDiagnostics && checkDiagnostics(program.getNgSemanticDiagnostics());
|
|
5760
|
-
return allDiagnostics;
|
|
5761
|
-
}
|
|
5762
|
-
function hasErrors(diags) {
|
|
5763
|
-
return diags.some((d) => d.category === ts32.DiagnosticCategory.Error);
|
|
5764
|
-
}
|
|
5765
|
-
|
|
5766
5165
|
export {
|
|
5767
|
-
DEFAULT_ERROR_CODE,
|
|
5768
|
-
UNKNOWN_ERROR_CODE,
|
|
5769
|
-
SOURCE,
|
|
5770
|
-
isTsDiagnostic,
|
|
5771
|
-
EmitFlags,
|
|
5772
|
-
createCompilerHost,
|
|
5773
5166
|
EntryType,
|
|
5774
5167
|
MemberType,
|
|
5775
5168
|
DecoratorType,
|
|
5776
5169
|
MemberTags,
|
|
5777
5170
|
isDocEntryWithSourceInfo,
|
|
5778
5171
|
DocsExtractor,
|
|
5172
|
+
TrackedIncrementalBuildStrategy,
|
|
5779
5173
|
PatchedProgramIncrementalBuildStrategy,
|
|
5174
|
+
DiagnosticCategoryLabel,
|
|
5780
5175
|
freshCompilationTicket,
|
|
5176
|
+
incrementalFromCompilerTicket,
|
|
5781
5177
|
incrementalFromStateTicket,
|
|
5782
5178
|
NgCompiler,
|
|
5783
|
-
NgCompilerHost
|
|
5784
|
-
NgtscProgram,
|
|
5785
|
-
createProgram,
|
|
5786
|
-
createMessageDiagnostic,
|
|
5787
|
-
formatDiagnostics,
|
|
5788
|
-
calcProjectFileAndBasePath,
|
|
5789
|
-
readConfiguration,
|
|
5790
|
-
exitCodeFromResult,
|
|
5791
|
-
performCompilation,
|
|
5792
|
-
defaultGatherDiagnostics
|
|
5179
|
+
NgCompilerHost
|
|
5793
5180
|
};
|
|
5794
5181
|
/**
|
|
5795
5182
|
* @license
|