@angular/compiler-cli 18.0.0-next.1 → 18.0.0-next.2
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-C4L7A7U3.js → chunk-32GYU5L6.js} +47 -8
- package/bundles/chunk-32GYU5L6.js.map +6 -0
- package/bundles/{chunk-AWB4ZG2D.js → chunk-4CJL5R2P.js} +42 -40
- package/bundles/chunk-4CJL5R2P.js.map +6 -0
- package/bundles/{chunk-OHOBDHII.js → chunk-MTZKBEZU.js} +105 -31
- package/bundles/chunk-MTZKBEZU.js.map +6 -0
- package/bundles/{chunk-GGJA4IFT.js → chunk-NPXXJQN4.js} +129 -49
- package/bundles/chunk-NPXXJQN4.js.map +6 -0
- package/bundles/{chunk-B454JZVO.js → chunk-VFVLP7AO.js} +2 -2
- package/bundles/{chunk-ALDR4XSX.js → chunk-YMLYBTFV.js} +1085 -814
- package/bundles/chunk-YMLYBTFV.js.map +6 -0
- package/bundles/index.js +7 -5
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +10 -3
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/index.d.ts +1 -0
- package/linker/babel/src/ast/babel_ast_host.d.ts +2 -1
- package/linker/src/ast/ast_host.d.ts +4 -0
- package/linker/src/ast/ast_value.d.ts +5 -0
- package/linker/src/ast/typescript/typescript_ast_host.d.ts +1 -0
- package/linker/src/file_linker/partial_linkers/partial_class_metadata_async_linker_1.d.ts +16 -0
- package/linker/src/file_linker/partial_linkers/partial_linker_selector.d.ts +1 -0
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +3 -3
- package/src/ngtsc/annotations/component/src/handler.d.ts +1 -1
- package/src/ngtsc/annotations/directive/index.d.ts +1 -0
- package/src/ngtsc/annotations/directive/src/initializer_function_access.d.ts +17 -0
- package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +10 -6
- package/src/ngtsc/annotations/directive/src/input_function.d.ts +4 -1
- package/src/ngtsc/annotations/directive/src/model_function.d.ts +4 -1
- package/src/ngtsc/annotations/directive/src/output_function.d.ts +4 -1
- package/src/ngtsc/annotations/directive/src/query_functions.d.ts +8 -2
- package/src/ngtsc/annotations/index.d.ts +1 -1
- package/src/ngtsc/diagnostics/src/error_code.d.ts +19 -0
- package/src/ngtsc/docs/src/entities.d.ts +36 -1
- package/src/ngtsc/docs/src/function_extractor.d.ts +3 -2
- package/src/ngtsc/docs/src/initializer_api_function_extractor.d.ts +24 -0
- package/src/ngtsc/docs/src/internal.d.ts +8 -0
- package/src/ngtsc/imports/src/imported_symbols_tracker.d.ts +13 -0
- package/src/ngtsc/reflection/src/host.d.ts +13 -3
- package/src/ngtsc/reflection/src/typescript.d.ts +8 -1
- package/src/ngtsc/reflection/src/util.d.ts +6 -1
- package/src/ngtsc/typecheck/src/oob.d.ts +3 -3
- package/src/ngtsc/validation/index.d.ts +8 -0
- package/src/ngtsc/validation/src/rules/api.d.ts +24 -0
- package/src/ngtsc/validation/src/rules/initializer_api_usage_rule.d.ts +21 -0
- package/src/ngtsc/validation/src/source_file_validator.d.ts +22 -0
- package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +3 -3
- package/bundles/chunk-ALDR4XSX.js.map +0 -6
- package/bundles/chunk-AWB4ZG2D.js.map +0 -6
- package/bundles/chunk-C4L7A7U3.js.map +0 -6
- package/bundles/chunk-GGJA4IFT.js.map +0 -6
- package/bundles/chunk-OHOBDHII.js.map +0 -6
- /package/bundles/{chunk-B454JZVO.js.map → chunk-VFVLP7AO.js.map} +0 -0
|
@@ -21,16 +21,20 @@ import {
|
|
|
21
21
|
DtsTransformRegistry,
|
|
22
22
|
ExportedProviderStatusResolver,
|
|
23
23
|
HostDirectivesResolver,
|
|
24
|
+
INPUT_INITIALIZER_FN,
|
|
24
25
|
InjectableClassRegistry,
|
|
25
26
|
InjectableDecoratorHandler,
|
|
26
27
|
LocalMetadataRegistry,
|
|
27
28
|
LocalModuleScopeRegistry,
|
|
29
|
+
MODEL_INITIALIZER_FN,
|
|
28
30
|
MetaKind,
|
|
29
31
|
MetadataDtsModuleScopeResolver,
|
|
30
32
|
NgModuleDecoratorHandler,
|
|
31
33
|
NoopReferencesRegistry,
|
|
34
|
+
OUTPUT_INITIALIZER_FNS,
|
|
32
35
|
PartialEvaluator,
|
|
33
36
|
PipeDecoratorHandler,
|
|
37
|
+
QUERY_INITIALIZER_FNS,
|
|
34
38
|
ResourceRegistry,
|
|
35
39
|
SemanticDepGraphUpdater,
|
|
36
40
|
TraitCompiler,
|
|
@@ -38,8 +42,9 @@ import {
|
|
|
38
42
|
aliasTransformFactory,
|
|
39
43
|
declarationTransformFactory,
|
|
40
44
|
isHostDirectiveMetaForGlobalMode,
|
|
41
|
-
ivyTransformFactory
|
|
42
|
-
|
|
45
|
+
ivyTransformFactory,
|
|
46
|
+
tryParseInitializerApi
|
|
47
|
+
} from "./chunk-MTZKBEZU.js";
|
|
43
48
|
import {
|
|
44
49
|
AbsoluteModuleStrategy,
|
|
45
50
|
AliasStrategy,
|
|
@@ -89,7 +94,7 @@ import {
|
|
|
89
94
|
toUnredirectedSourceFile,
|
|
90
95
|
translateExpression,
|
|
91
96
|
translateType
|
|
92
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-NPXXJQN4.js";
|
|
93
98
|
import {
|
|
94
99
|
ActivePerfRecorder,
|
|
95
100
|
DelegatingPerfRecorder,
|
|
@@ -152,6 +157,7 @@ var EntryType;
|
|
|
152
157
|
EntryType2["Pipe"] = "pipe";
|
|
153
158
|
EntryType2["TypeAlias"] = "type_alias";
|
|
154
159
|
EntryType2["UndecoratedClass"] = "undecorated_class";
|
|
160
|
+
EntryType2["InitializerApiFunction"] = "initializer_api_function";
|
|
155
161
|
})(EntryType || (EntryType = {}));
|
|
156
162
|
var MemberType;
|
|
157
163
|
(function(MemberType2) {
|
|
@@ -179,284 +185,11 @@ var MemberTags;
|
|
|
179
185
|
MemberTags2["Inherited"] = "override";
|
|
180
186
|
})(MemberTags || (MemberTags = {}));
|
|
181
187
|
|
|
182
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
183
|
-
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
184
|
-
import ts40 from "typescript";
|
|
185
|
-
|
|
186
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
187
|
-
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
188
|
-
import * as path from "path";
|
|
189
|
-
function i18nGetExtension(formatName) {
|
|
190
|
-
const format = formatName.toLowerCase();
|
|
191
|
-
switch (format) {
|
|
192
|
-
case "xmb":
|
|
193
|
-
return "xmb";
|
|
194
|
-
case "xlf":
|
|
195
|
-
case "xlif":
|
|
196
|
-
case "xliff":
|
|
197
|
-
case "xlf2":
|
|
198
|
-
case "xliff2":
|
|
199
|
-
return "xlf";
|
|
200
|
-
}
|
|
201
|
-
throw new Error(`Unsupported format "${formatName}"`);
|
|
202
|
-
}
|
|
203
|
-
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve = path.resolve) {
|
|
204
|
-
formatName = formatName || "xlf";
|
|
205
|
-
const ext = i18nGetExtension(formatName);
|
|
206
|
-
const content = i18nSerialize(bundle, formatName, options);
|
|
207
|
-
const dstFile = outFile || `messages.${ext}`;
|
|
208
|
-
const dstPath = pathResolve(options.outDir || options.basePath, dstFile);
|
|
209
|
-
host.writeFile(dstPath, content, false, void 0, []);
|
|
210
|
-
return [dstPath];
|
|
211
|
-
}
|
|
212
|
-
function i18nSerialize(bundle, formatName, options) {
|
|
213
|
-
const format = formatName.toLowerCase();
|
|
214
|
-
let serializer;
|
|
215
|
-
switch (format) {
|
|
216
|
-
case "xmb":
|
|
217
|
-
serializer = new Xmb();
|
|
218
|
-
break;
|
|
219
|
-
case "xliff2":
|
|
220
|
-
case "xlf2":
|
|
221
|
-
serializer = new Xliff2();
|
|
222
|
-
break;
|
|
223
|
-
case "xlf":
|
|
224
|
-
case "xliff":
|
|
225
|
-
default:
|
|
226
|
-
serializer = new Xliff();
|
|
227
|
-
}
|
|
228
|
-
return bundle.write(serializer, getPathNormalizer(options.basePath));
|
|
229
|
-
}
|
|
230
|
-
function getPathNormalizer(basePath) {
|
|
231
|
-
return (sourcePath) => {
|
|
232
|
-
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
|
|
233
|
-
return sourcePath.split(path.sep).join("/");
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
238
|
-
import ts2 from "typescript";
|
|
239
|
-
|
|
240
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
241
|
-
function toNumbers(value) {
|
|
242
|
-
const suffixIndex = value.lastIndexOf("-");
|
|
243
|
-
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
244
|
-
const parsed = parseInt(segment, 10);
|
|
245
|
-
if (isNaN(parsed)) {
|
|
246
|
-
throw Error(`Unable to parse version string ${value}.`);
|
|
247
|
-
}
|
|
248
|
-
return parsed;
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
function compareNumbers(a, b) {
|
|
252
|
-
const max = Math.max(a.length, b.length);
|
|
253
|
-
const min = Math.min(a.length, b.length);
|
|
254
|
-
for (let i = 0; i < min; i++) {
|
|
255
|
-
if (a[i] > b[i])
|
|
256
|
-
return 1;
|
|
257
|
-
if (a[i] < b[i])
|
|
258
|
-
return -1;
|
|
259
|
-
}
|
|
260
|
-
if (min !== max) {
|
|
261
|
-
const longestArray = a.length === max ? a : b;
|
|
262
|
-
const comparisonResult = a.length === max ? 1 : -1;
|
|
263
|
-
for (let i = min; i < max; i++) {
|
|
264
|
-
if (longestArray[i] > 0) {
|
|
265
|
-
return comparisonResult;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return 0;
|
|
270
|
-
}
|
|
271
|
-
function compareVersions(v1, v2) {
|
|
272
|
-
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
276
|
-
var MIN_TS_VERSION = "5.2.0";
|
|
277
|
-
var MAX_TS_VERSION = "5.5.0";
|
|
278
|
-
var tsVersion = ts2.version;
|
|
279
|
-
function checkVersion(version, minVersion, maxVersion) {
|
|
280
|
-
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
281
|
-
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
function verifySupportedTypeScriptVersion() {
|
|
285
|
-
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
289
|
-
import { R3Identifiers as R3Identifiers5 } from "@angular/compiler";
|
|
290
|
-
import ts38 from "typescript";
|
|
291
|
-
|
|
292
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
293
|
-
var CycleAnalyzer = class {
|
|
294
|
-
constructor(importGraph) {
|
|
295
|
-
this.importGraph = importGraph;
|
|
296
|
-
this.cachedResults = null;
|
|
297
|
-
}
|
|
298
|
-
wouldCreateCycle(from, to) {
|
|
299
|
-
if (this.cachedResults === null || this.cachedResults.from !== from) {
|
|
300
|
-
this.cachedResults = new CycleResults(from, this.importGraph);
|
|
301
|
-
}
|
|
302
|
-
return this.cachedResults.wouldBeCyclic(to) ? new Cycle(this.importGraph, from, to) : null;
|
|
303
|
-
}
|
|
304
|
-
recordSyntheticImport(from, to) {
|
|
305
|
-
this.cachedResults = null;
|
|
306
|
-
this.importGraph.addSyntheticImport(from, to);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
var NgCyclicResult = Symbol("NgCyclicResult");
|
|
310
|
-
var CycleResults = class {
|
|
311
|
-
constructor(from, importGraph) {
|
|
312
|
-
this.from = from;
|
|
313
|
-
this.importGraph = importGraph;
|
|
314
|
-
this.cyclic = {};
|
|
315
|
-
this.acyclic = {};
|
|
316
|
-
}
|
|
317
|
-
wouldBeCyclic(sf) {
|
|
318
|
-
const cached = this.getCachedResult(sf);
|
|
319
|
-
if (cached !== null) {
|
|
320
|
-
return cached;
|
|
321
|
-
}
|
|
322
|
-
if (sf === this.from) {
|
|
323
|
-
return true;
|
|
324
|
-
}
|
|
325
|
-
this.markAcyclic(sf);
|
|
326
|
-
const imports = this.importGraph.importsOf(sf);
|
|
327
|
-
for (const imported of imports) {
|
|
328
|
-
if (this.wouldBeCyclic(imported)) {
|
|
329
|
-
this.markCyclic(sf);
|
|
330
|
-
return true;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
getCachedResult(sf) {
|
|
336
|
-
const result = sf[NgCyclicResult];
|
|
337
|
-
if (result === this.cyclic) {
|
|
338
|
-
return true;
|
|
339
|
-
} else if (result === this.acyclic) {
|
|
340
|
-
return false;
|
|
341
|
-
} else {
|
|
342
|
-
return null;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
markCyclic(sf) {
|
|
346
|
-
sf[NgCyclicResult] = this.cyclic;
|
|
347
|
-
}
|
|
348
|
-
markAcyclic(sf) {
|
|
349
|
-
sf[NgCyclicResult] = this.acyclic;
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
var Cycle = class {
|
|
353
|
-
constructor(importGraph, from, to) {
|
|
354
|
-
this.importGraph = importGraph;
|
|
355
|
-
this.from = from;
|
|
356
|
-
this.to = to;
|
|
357
|
-
}
|
|
358
|
-
getPath() {
|
|
359
|
-
return [this.from, ...this.importGraph.findPath(this.to, this.from)];
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
364
|
-
import ts3 from "typescript";
|
|
365
|
-
var ImportGraph = class {
|
|
366
|
-
constructor(checker, perf) {
|
|
367
|
-
this.checker = checker;
|
|
368
|
-
this.perf = perf;
|
|
369
|
-
this.imports = /* @__PURE__ */ new Map();
|
|
370
|
-
}
|
|
371
|
-
importsOf(sf) {
|
|
372
|
-
if (!this.imports.has(sf)) {
|
|
373
|
-
this.imports.set(sf, this.scanImports(sf));
|
|
374
|
-
}
|
|
375
|
-
return this.imports.get(sf);
|
|
376
|
-
}
|
|
377
|
-
findPath(start, end) {
|
|
378
|
-
if (start === end) {
|
|
379
|
-
return [start];
|
|
380
|
-
}
|
|
381
|
-
const found = /* @__PURE__ */ new Set([start]);
|
|
382
|
-
const queue = [new Found(start, null)];
|
|
383
|
-
while (queue.length > 0) {
|
|
384
|
-
const current = queue.shift();
|
|
385
|
-
const imports = this.importsOf(current.sourceFile);
|
|
386
|
-
for (const importedFile of imports) {
|
|
387
|
-
if (!found.has(importedFile)) {
|
|
388
|
-
const next = new Found(importedFile, current);
|
|
389
|
-
if (next.sourceFile === end) {
|
|
390
|
-
return next.toPath();
|
|
391
|
-
}
|
|
392
|
-
found.add(importedFile);
|
|
393
|
-
queue.push(next);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
return null;
|
|
398
|
-
}
|
|
399
|
-
addSyntheticImport(sf, imported) {
|
|
400
|
-
if (isLocalFile(imported)) {
|
|
401
|
-
this.importsOf(sf).add(imported);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
scanImports(sf) {
|
|
405
|
-
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
406
|
-
const imports = /* @__PURE__ */ new Set();
|
|
407
|
-
for (const stmt of sf.statements) {
|
|
408
|
-
if (!ts3.isImportDeclaration(stmt) && !ts3.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
409
|
-
continue;
|
|
410
|
-
}
|
|
411
|
-
if (ts3.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
412
|
-
continue;
|
|
413
|
-
}
|
|
414
|
-
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
415
|
-
if (symbol === void 0 || symbol.valueDeclaration === void 0) {
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
418
|
-
const moduleFile = symbol.valueDeclaration;
|
|
419
|
-
if (ts3.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
420
|
-
imports.add(moduleFile);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return imports;
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
function isLocalFile(sf) {
|
|
428
|
-
return !sf.isDeclarationFile;
|
|
429
|
-
}
|
|
430
|
-
function isTypeOnlyImportClause(node) {
|
|
431
|
-
if (node.isTypeOnly) {
|
|
432
|
-
return true;
|
|
433
|
-
}
|
|
434
|
-
if (node.namedBindings !== void 0 && ts3.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
435
|
-
return true;
|
|
436
|
-
}
|
|
437
|
-
return false;
|
|
438
|
-
}
|
|
439
|
-
var Found = class {
|
|
440
|
-
constructor(sourceFile, parent) {
|
|
441
|
-
this.sourceFile = sourceFile;
|
|
442
|
-
this.parent = parent;
|
|
443
|
-
}
|
|
444
|
-
toPath() {
|
|
445
|
-
const array = [];
|
|
446
|
-
let current = this;
|
|
447
|
-
while (current !== null) {
|
|
448
|
-
array.push(current.sourceFile);
|
|
449
|
-
current = current.parent;
|
|
450
|
-
}
|
|
451
|
-
return array.reverse();
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
|
|
455
188
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.mjs
|
|
456
189
|
import ts10 from "typescript";
|
|
457
190
|
|
|
458
191
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.mjs
|
|
459
|
-
import
|
|
192
|
+
import ts5 from "typescript";
|
|
460
193
|
|
|
461
194
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/filters.mjs
|
|
462
195
|
function isAngularPrivateName(name) {
|
|
@@ -466,7 +199,7 @@ function isAngularPrivateName(name) {
|
|
|
466
199
|
}
|
|
467
200
|
|
|
468
201
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/function_extractor.mjs
|
|
469
|
-
import
|
|
202
|
+
import ts3 from "typescript";
|
|
470
203
|
|
|
471
204
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.mjs
|
|
472
205
|
function extractGenerics(declaration) {
|
|
@@ -482,41 +215,41 @@ function extractGenerics(declaration) {
|
|
|
482
215
|
}
|
|
483
216
|
|
|
484
217
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.mjs
|
|
485
|
-
import
|
|
218
|
+
import ts2 from "typescript";
|
|
486
219
|
var decoratorExpression = /@(?=(Injectable|Component|Directive|Pipe|NgModule|Input|Output|HostBinding|HostListener|Inject|Optional|Self|Host|SkipSelf))/g;
|
|
487
220
|
function extractJsDocTags(node) {
|
|
488
221
|
const escapedNode = getEscapedNode(node);
|
|
489
|
-
return
|
|
222
|
+
return ts2.getJSDocTags(escapedNode).map((t) => {
|
|
490
223
|
var _a;
|
|
491
224
|
return {
|
|
492
225
|
name: t.tagName.getText(),
|
|
493
|
-
comment: unescapeAngularDecorators((_a =
|
|
226
|
+
comment: unescapeAngularDecorators((_a = ts2.getTextOfJSDocComment(t.comment)) != null ? _a : "")
|
|
494
227
|
};
|
|
495
228
|
});
|
|
496
229
|
}
|
|
497
230
|
function extractJsDocDescription(node) {
|
|
498
231
|
var _a, _b;
|
|
499
232
|
const escapedNode = getEscapedNode(node);
|
|
500
|
-
const commentOrTag =
|
|
501
|
-
return
|
|
233
|
+
const commentOrTag = ts2.getJSDocCommentsAndTags(escapedNode).find((d) => {
|
|
234
|
+
return ts2.isJSDoc(d) || ts2.isJSDocParameterTag(d);
|
|
502
235
|
});
|
|
503
236
|
const comment = (_a = commentOrTag == null ? void 0 : commentOrTag.comment) != null ? _a : "";
|
|
504
|
-
const description = typeof comment === "string" ? comment : (_b =
|
|
237
|
+
const description = typeof comment === "string" ? comment : (_b = ts2.getTextOfJSDocComment(comment)) != null ? _b : "";
|
|
505
238
|
return unescapeAngularDecorators(description);
|
|
506
239
|
}
|
|
507
240
|
function extractRawJsDoc(node) {
|
|
508
241
|
var _a, _b;
|
|
509
|
-
const comment = (_b = (_a =
|
|
242
|
+
const comment = (_b = (_a = ts2.getJSDocCommentsAndTags(node).find(ts2.isJSDoc)) == null ? void 0 : _a.getFullText()) != null ? _b : "";
|
|
510
243
|
return unescapeAngularDecorators(comment);
|
|
511
244
|
}
|
|
512
245
|
function getEscapedNode(node) {
|
|
513
|
-
if (
|
|
246
|
+
if (ts2.isParameter(node)) {
|
|
514
247
|
return node;
|
|
515
248
|
}
|
|
516
249
|
const rawComment = extractRawJsDoc(node);
|
|
517
250
|
const escaped = escapeAngularDecorators(rawComment);
|
|
518
|
-
const file =
|
|
519
|
-
return file.statements.find((s) =>
|
|
251
|
+
const file = ts2.createSourceFile("x.ts", `${escaped}class X {}`, ts2.ScriptTarget.ES2020, true);
|
|
252
|
+
return file.statements.find((s) => ts2.isClassDeclaration(s));
|
|
520
253
|
}
|
|
521
254
|
function escapeAngularDecorators(comment) {
|
|
522
255
|
return comment.replace(decoratorExpression, "_NG_AT_");
|
|
@@ -541,9 +274,9 @@ var FunctionExtractor = class {
|
|
|
541
274
|
const signature = this.typeChecker.getSignatureFromDeclaration(this.declaration);
|
|
542
275
|
const returnType = signature ? this.typeChecker.typeToString(this.typeChecker.getReturnTypeOfSignature(signature)) : "unknown";
|
|
543
276
|
return {
|
|
544
|
-
params:
|
|
277
|
+
params: extractAllParams(this.declaration.parameters, this.typeChecker),
|
|
545
278
|
name: this.name,
|
|
546
|
-
isNewType:
|
|
279
|
+
isNewType: ts3.isConstructSignatureDeclaration(this.declaration),
|
|
547
280
|
returnType,
|
|
548
281
|
entryType: EntryType.Function,
|
|
549
282
|
generics: extractGenerics(this.declaration),
|
|
@@ -552,15 +285,6 @@ var FunctionExtractor = class {
|
|
|
552
285
|
rawComment: extractRawJsDoc(this.declaration)
|
|
553
286
|
};
|
|
554
287
|
}
|
|
555
|
-
extractAllParams(params) {
|
|
556
|
-
return params.map((param) => ({
|
|
557
|
-
name: param.name.getText(),
|
|
558
|
-
description: extractJsDocDescription(param),
|
|
559
|
-
type: extractResolvedTypeString(param, this.typeChecker),
|
|
560
|
-
isOptional: !!(param.questionToken || param.initializer),
|
|
561
|
-
isRestParam: !!param.dotDotDotToken
|
|
562
|
-
}));
|
|
563
|
-
}
|
|
564
288
|
getOverloads() {
|
|
565
289
|
var _a, _b, _c, _d;
|
|
566
290
|
const overloads = [];
|
|
@@ -571,7 +295,7 @@ var FunctionExtractor = class {
|
|
|
571
295
|
const overloadDeclaration = (_c = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _c[i];
|
|
572
296
|
if ((overloadDeclaration == null ? void 0 : overloadDeclaration.pos) === this.declaration.pos)
|
|
573
297
|
continue;
|
|
574
|
-
if (overloadDeclaration &&
|
|
298
|
+
if (overloadDeclaration && ts3.isFunctionDeclaration(overloadDeclaration) && ((_d = overloadDeclaration.modifiers) == null ? void 0 : _d.some((mod) => mod.kind === ts3.SyntaxKind.ExportKeyword))) {
|
|
575
299
|
overloads.push(overloadDeclaration);
|
|
576
300
|
}
|
|
577
301
|
}
|
|
@@ -579,12 +303,40 @@ var FunctionExtractor = class {
|
|
|
579
303
|
return overloads;
|
|
580
304
|
}
|
|
581
305
|
getSymbol() {
|
|
582
|
-
return this.typeChecker.getSymbolsInScope(this.declaration,
|
|
306
|
+
return this.typeChecker.getSymbolsInScope(this.declaration, ts3.SymbolFlags.Function).find((s) => {
|
|
583
307
|
var _a;
|
|
584
308
|
return s.name === ((_a = this.declaration.name) == null ? void 0 : _a.getText());
|
|
585
309
|
});
|
|
586
310
|
}
|
|
587
311
|
};
|
|
312
|
+
function extractAllParams(params, typeChecker) {
|
|
313
|
+
return params.map((param) => ({
|
|
314
|
+
name: param.name.getText(),
|
|
315
|
+
description: extractJsDocDescription(param),
|
|
316
|
+
type: extractResolvedTypeString(param, typeChecker),
|
|
317
|
+
isOptional: !!(param.questionToken || param.initializer),
|
|
318
|
+
isRestParam: !!param.dotDotDotToken
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/internal.mjs
|
|
323
|
+
import ts4 from "typescript";
|
|
324
|
+
function isInternal(member) {
|
|
325
|
+
return extractJsDocTags(member).some((tag) => tag.name === "internal") || hasLeadingInternalComment(member);
|
|
326
|
+
}
|
|
327
|
+
function hasLeadingInternalComment(member) {
|
|
328
|
+
var _a;
|
|
329
|
+
const memberText = member.getSourceFile().text;
|
|
330
|
+
return (_a = ts4.reduceEachLeadingCommentRange(
|
|
331
|
+
memberText,
|
|
332
|
+
member.getFullStart(),
|
|
333
|
+
(pos, end, kind, hasTrailingNewLine, containsInternal) => {
|
|
334
|
+
return containsInternal || memberText.slice(pos, end).includes("@internal");
|
|
335
|
+
},
|
|
336
|
+
false,
|
|
337
|
+
false
|
|
338
|
+
)) != null ? _a : false;
|
|
339
|
+
}
|
|
588
340
|
|
|
589
341
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.mjs
|
|
590
342
|
var ClassExtractor = class {
|
|
@@ -596,7 +348,7 @@ var ClassExtractor = class {
|
|
|
596
348
|
return {
|
|
597
349
|
name: this.declaration.name.text,
|
|
598
350
|
isAbstract: this.isAbstract(),
|
|
599
|
-
entryType:
|
|
351
|
+
entryType: ts5.isInterfaceDeclaration(this.declaration) ? EntryType.Interface : EntryType.UndecoratedClass,
|
|
600
352
|
members: this.extractSignatures().concat(this.extractAllClassMembers()),
|
|
601
353
|
generics: extractGenerics(this.declaration),
|
|
602
354
|
description: extractJsDocDescription(this.declaration),
|
|
@@ -621,7 +373,7 @@ var ClassExtractor = class {
|
|
|
621
373
|
return this.extractMethod(memberDeclaration);
|
|
622
374
|
} else if (this.isProperty(memberDeclaration)) {
|
|
623
375
|
return this.extractClassProperty(memberDeclaration);
|
|
624
|
-
} else if (
|
|
376
|
+
} else if (ts5.isAccessor(memberDeclaration)) {
|
|
625
377
|
return this.extractGetterSetter(memberDeclaration);
|
|
626
378
|
}
|
|
627
379
|
return void 0;
|
|
@@ -638,7 +390,7 @@ var ClassExtractor = class {
|
|
|
638
390
|
};
|
|
639
391
|
}
|
|
640
392
|
extractSignature(signature) {
|
|
641
|
-
const functionExtractor = new FunctionExtractor(
|
|
393
|
+
const functionExtractor = new FunctionExtractor(ts5.isConstructSignatureDeclaration(signature) ? "new" : "", signature, this.typeChecker);
|
|
642
394
|
return {
|
|
643
395
|
...functionExtractor.extract(),
|
|
644
396
|
memberType: MemberType.Method,
|
|
@@ -658,7 +410,7 @@ var ClassExtractor = class {
|
|
|
658
410
|
extractGetterSetter(accessor) {
|
|
659
411
|
return {
|
|
660
412
|
...this.extractClassProperty(accessor),
|
|
661
|
-
memberType:
|
|
413
|
+
memberType: ts5.isGetAccessor(accessor) ? MemberType.Getter : MemberType.Setter
|
|
662
414
|
};
|
|
663
415
|
}
|
|
664
416
|
getMemberTags(member) {
|
|
@@ -674,10 +426,7 @@ var ClassExtractor = class {
|
|
|
674
426
|
}
|
|
675
427
|
computeAllSignatureDeclarations() {
|
|
676
428
|
const type = this.typeChecker.getTypeAtLocation(this.declaration);
|
|
677
|
-
const signatures = [
|
|
678
|
-
...type.getCallSignatures(),
|
|
679
|
-
...type.getConstructSignatures()
|
|
680
|
-
];
|
|
429
|
+
const signatures = [...type.getCallSignatures(), ...type.getConstructSignatures()];
|
|
681
430
|
const result = [];
|
|
682
431
|
for (const signature of signatures) {
|
|
683
432
|
const decl = signature.getDeclaration();
|
|
@@ -715,13 +464,13 @@ var ClassExtractor = class {
|
|
|
715
464
|
}
|
|
716
465
|
getTagForMemberModifier(mod) {
|
|
717
466
|
switch (mod.kind) {
|
|
718
|
-
case
|
|
467
|
+
case ts5.SyntaxKind.StaticKeyword:
|
|
719
468
|
return MemberTags.Static;
|
|
720
|
-
case
|
|
469
|
+
case ts5.SyntaxKind.ReadonlyKeyword:
|
|
721
470
|
return MemberTags.Readonly;
|
|
722
|
-
case
|
|
471
|
+
case ts5.SyntaxKind.ProtectedKeyword:
|
|
723
472
|
return MemberTags.Protected;
|
|
724
|
-
case
|
|
473
|
+
case ts5.SyntaxKind.AbstractKeyword:
|
|
725
474
|
return MemberTags.Abstract;
|
|
726
475
|
default:
|
|
727
476
|
return void 0;
|
|
@@ -729,27 +478,27 @@ var ClassExtractor = class {
|
|
|
729
478
|
}
|
|
730
479
|
isMemberExcluded(member) {
|
|
731
480
|
var _a;
|
|
732
|
-
return !member.name || !this.isDocumentableMember(member) || !!((_a = member.modifiers) == null ? void 0 : _a.some((mod) => mod.kind ===
|
|
481
|
+
return !member.name || !this.isDocumentableMember(member) || !!((_a = member.modifiers) == null ? void 0 : _a.some((mod) => mod.kind === ts5.SyntaxKind.PrivateKeyword)) || member.name.getText() === "prototype" || isAngularPrivateName(member.name.getText()) || isInternal(member);
|
|
733
482
|
}
|
|
734
483
|
isDocumentableMember(member) {
|
|
735
|
-
return this.isMethod(member) || this.isProperty(member) ||
|
|
484
|
+
return this.isMethod(member) || this.isProperty(member) || ts5.isAccessor(member);
|
|
736
485
|
}
|
|
737
486
|
isProperty(member) {
|
|
738
|
-
return
|
|
487
|
+
return ts5.isPropertyDeclaration(member) || ts5.isPropertySignature(member);
|
|
739
488
|
}
|
|
740
489
|
isMethod(member) {
|
|
741
|
-
return
|
|
490
|
+
return ts5.isMethodDeclaration(member) || ts5.isMethodSignature(member);
|
|
742
491
|
}
|
|
743
492
|
isDocumentableSignature(signature) {
|
|
744
|
-
return
|
|
493
|
+
return ts5.isConstructSignatureDeclaration(signature) || ts5.isCallSignatureDeclaration(signature);
|
|
745
494
|
}
|
|
746
495
|
isAbstract() {
|
|
747
496
|
var _a;
|
|
748
497
|
const modifiers = (_a = this.declaration.modifiers) != null ? _a : [];
|
|
749
|
-
return modifiers.some((mod) => mod.kind ===
|
|
498
|
+
return modifiers.some((mod) => mod.kind === ts5.SyntaxKind.AbstractKeyword);
|
|
750
499
|
}
|
|
751
500
|
isImplementationForOverload(method) {
|
|
752
|
-
if (method.kind ===
|
|
501
|
+
if (method.kind === ts5.SyntaxKind.MethodSignature)
|
|
753
502
|
return false;
|
|
754
503
|
const signature = this.typeChecker.getSignatureFromDeclaration(method);
|
|
755
504
|
return signature && this.typeChecker.isImplementationOfOverload(signature.declaration);
|
|
@@ -848,7 +597,7 @@ function extractInterface(declaration, typeChecker) {
|
|
|
848
597
|
}
|
|
849
598
|
|
|
850
599
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.mjs
|
|
851
|
-
import
|
|
600
|
+
import ts6 from "typescript";
|
|
852
601
|
var LITERAL_AS_ENUM_TAG = "object-literal-as-enum";
|
|
853
602
|
function extractConstant(declaration, typeChecker) {
|
|
854
603
|
const resolvedType = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(declaration));
|
|
@@ -880,17 +629,17 @@ function isSyntheticAngularConstant(declaration) {
|
|
|
880
629
|
}
|
|
881
630
|
function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
882
631
|
let initializer = declaration.initializer;
|
|
883
|
-
while (initializer && (
|
|
632
|
+
while (initializer && (ts6.isAsExpression(initializer) || ts6.isParenthesizedExpression(initializer))) {
|
|
884
633
|
initializer = initializer.expression;
|
|
885
634
|
}
|
|
886
|
-
if (initializer === void 0 || !
|
|
887
|
-
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ?
|
|
635
|
+
if (initializer === void 0 || !ts6.isObjectLiteralExpression(initializer)) {
|
|
636
|
+
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ? ts6.SyntaxKind[initializer.kind] : "undefined"}`);
|
|
888
637
|
}
|
|
889
638
|
return initializer.properties.map((prop) => {
|
|
890
|
-
if (!
|
|
639
|
+
if (!ts6.isPropertyAssignment(prop) || !ts6.isIdentifier(prop.name)) {
|
|
891
640
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be a property assignment with a static name`);
|
|
892
641
|
}
|
|
893
|
-
if (!
|
|
642
|
+
if (!ts6.isNumericLiteral(prop.initializer) && !ts6.isStringLiteralLike(prop.initializer)) {
|
|
894
643
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to a number or string literal`);
|
|
895
644
|
}
|
|
896
645
|
return {
|
|
@@ -906,7 +655,7 @@ function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
|
906
655
|
}
|
|
907
656
|
|
|
908
657
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/decorator_extractor.mjs
|
|
909
|
-
import
|
|
658
|
+
import ts7 from "typescript";
|
|
910
659
|
function extractorDecorator(declaration, typeChecker) {
|
|
911
660
|
const documentedNode = getDecoratorJsDocNode(declaration);
|
|
912
661
|
const decoratorType = getDecoratorType(declaration);
|
|
@@ -927,7 +676,7 @@ function isDecoratorDeclaration(declaration) {
|
|
|
927
676
|
return !!getDecoratorType(declaration);
|
|
928
677
|
}
|
|
929
678
|
function isDecoratorOptionsInterface(declaration) {
|
|
930
|
-
return declaration.getSourceFile().statements.some((s) =>
|
|
679
|
+
return declaration.getSourceFile().statements.some((s) => ts7.isVariableStatement(s) && s.declarationList.declarations.some((d) => isDecoratorDeclaration(d) && d.name.getText() === declaration.name.getText()));
|
|
931
680
|
}
|
|
932
681
|
function getDecoratorType(declaration) {
|
|
933
682
|
var _a, _b;
|
|
@@ -944,19 +693,19 @@ function getDecoratorOptions(declaration, typeChecker) {
|
|
|
944
693
|
var _a, _b;
|
|
945
694
|
const name = declaration.name.getText();
|
|
946
695
|
const optionsDeclaration = declaration.getSourceFile().statements.find((node) => {
|
|
947
|
-
return (
|
|
696
|
+
return (ts7.isInterfaceDeclaration(node) || ts7.isTypeAliasDeclaration(node)) && node.name.getText() === name;
|
|
948
697
|
});
|
|
949
698
|
if (!optionsDeclaration) {
|
|
950
699
|
throw new Error(`Decorator "${name}" has no corresponding options interface.`);
|
|
951
700
|
}
|
|
952
701
|
let optionsInterface;
|
|
953
|
-
if (
|
|
702
|
+
if (ts7.isTypeAliasDeclaration(optionsDeclaration)) {
|
|
954
703
|
const aliasedType = typeChecker.getTypeAtLocation(optionsDeclaration.type);
|
|
955
|
-
optionsInterface = ((_b = (_a = aliasedType.getSymbol()) == null ? void 0 : _a.getDeclarations()) != null ? _b : []).find((d) =>
|
|
704
|
+
optionsInterface = ((_b = (_a = aliasedType.getSymbol()) == null ? void 0 : _a.getDeclarations()) != null ? _b : []).find((d) => ts7.isInterfaceDeclaration(d));
|
|
956
705
|
} else {
|
|
957
706
|
optionsInterface = optionsDeclaration;
|
|
958
707
|
}
|
|
959
|
-
if (!optionsInterface || !
|
|
708
|
+
if (!optionsInterface || !ts7.isInterfaceDeclaration(optionsInterface)) {
|
|
960
709
|
throw new Error(`Options for decorator "${name}" is not an interface.`);
|
|
961
710
|
}
|
|
962
711
|
return extractInterface(optionsInterface, typeChecker).members;
|
|
@@ -964,22 +713,22 @@ function getDecoratorOptions(declaration, typeChecker) {
|
|
|
964
713
|
function getDecoratorJsDocNode(declaration) {
|
|
965
714
|
const name = declaration.name.getText();
|
|
966
715
|
const decoratorInterface = declaration.getSourceFile().statements.find((s) => {
|
|
967
|
-
return
|
|
716
|
+
return ts7.isInterfaceDeclaration(s) && s.name.getText() === `${name}Decorator`;
|
|
968
717
|
});
|
|
969
|
-
if (!decoratorInterface || !
|
|
718
|
+
if (!decoratorInterface || !ts7.isInterfaceDeclaration(decoratorInterface)) {
|
|
970
719
|
throw new Error(`No interface "${name}Decorator" found.`);
|
|
971
720
|
}
|
|
972
721
|
const callSignature = decoratorInterface.members.find((node) => {
|
|
973
|
-
return
|
|
722
|
+
return ts7.isCallSignatureDeclaration(node) && extractRawJsDoc(node);
|
|
974
723
|
});
|
|
975
|
-
if (!callSignature || !
|
|
724
|
+
if (!callSignature || !ts7.isCallSignatureDeclaration(callSignature)) {
|
|
976
725
|
throw new Error(`No call signature with JsDoc on "${name}Decorator"`);
|
|
977
726
|
}
|
|
978
727
|
return callSignature;
|
|
979
728
|
}
|
|
980
729
|
|
|
981
730
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/enum_extractor.mjs
|
|
982
|
-
import
|
|
731
|
+
import ts8 from "typescript";
|
|
983
732
|
function extractEnum(declaration, typeChecker) {
|
|
984
733
|
return {
|
|
985
734
|
name: declaration.name.getText(),
|
|
@@ -1004,11 +753,148 @@ function extractEnumMembers(declaration, checker) {
|
|
|
1004
753
|
function getEnumMemberValue(memberNode) {
|
|
1005
754
|
var _a;
|
|
1006
755
|
const literal = memberNode.getChildren().find((n2) => {
|
|
1007
|
-
return
|
|
756
|
+
return ts8.isNumericLiteral(n2) || ts8.isStringLiteral(n2) || ts8.isPrefixUnaryExpression(n2) && n2.operator === ts8.SyntaxKind.MinusToken && ts8.isNumericLiteral(n2.operand);
|
|
1008
757
|
});
|
|
1009
758
|
return (_a = literal == null ? void 0 : literal.getText()) != null ? _a : "";
|
|
1010
759
|
}
|
|
1011
760
|
|
|
761
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.mjs
|
|
762
|
+
import ts9 from "typescript";
|
|
763
|
+
var initializerApiTag = "initializerApiFunction";
|
|
764
|
+
function isInitializerApiFunction(node, typeChecker) {
|
|
765
|
+
if (ts9.isFunctionDeclaration(node) && node.name !== void 0 && node.body === void 0) {
|
|
766
|
+
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
767
|
+
if (implementation !== void 0) {
|
|
768
|
+
node = implementation;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
if (!ts9.isFunctionDeclaration(node) && !ts9.isVariableDeclaration(node)) {
|
|
772
|
+
return false;
|
|
773
|
+
}
|
|
774
|
+
let tagContainer = ts9.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
775
|
+
if (tagContainer === null) {
|
|
776
|
+
return false;
|
|
777
|
+
}
|
|
778
|
+
const tags = ts9.getJSDocTags(tagContainer);
|
|
779
|
+
return tags.some((t) => t.tagName.text === initializerApiTag);
|
|
780
|
+
}
|
|
781
|
+
function extractInitializerApiFunction(node, typeChecker) {
|
|
782
|
+
var _a;
|
|
783
|
+
if (node.name === void 0 || !ts9.isIdentifier(node.name)) {
|
|
784
|
+
throw new Error(`Initializer API: Expected literal variable name.`);
|
|
785
|
+
}
|
|
786
|
+
const container = ts9.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
787
|
+
if (container === null) {
|
|
788
|
+
throw new Error("Initializer API: Could not find container AST node of variable.");
|
|
789
|
+
}
|
|
790
|
+
const name = node.name.text;
|
|
791
|
+
const type = typeChecker.getTypeAtLocation(node);
|
|
792
|
+
const callFunction = extractFunctionWithOverloads(name, type.getCallSignatures(), typeChecker);
|
|
793
|
+
const subFunctions = [];
|
|
794
|
+
for (const property of type.getProperties()) {
|
|
795
|
+
const subName = property.getName();
|
|
796
|
+
const subDecl = (_a = property.getDeclarations()) == null ? void 0 : _a[0];
|
|
797
|
+
if (subDecl === void 0 || !ts9.isPropertySignature(subDecl)) {
|
|
798
|
+
throw new Error(`Initializer API: Could not resolve declaration of sub-property: ${name}.${subName}`);
|
|
799
|
+
}
|
|
800
|
+
const subType = typeChecker.getTypeAtLocation(subDecl);
|
|
801
|
+
subFunctions.push(extractFunctionWithOverloads(subName, subType.getCallSignatures(), typeChecker));
|
|
802
|
+
}
|
|
803
|
+
let jsdocTags;
|
|
804
|
+
let description;
|
|
805
|
+
let rawComment;
|
|
806
|
+
if (ts9.isFunctionDeclaration(node)) {
|
|
807
|
+
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
808
|
+
if (implementation === void 0) {
|
|
809
|
+
throw new Error(`Initializer API: Could not find implementation of function: ${name}`);
|
|
810
|
+
}
|
|
811
|
+
callFunction.implementation = {
|
|
812
|
+
name,
|
|
813
|
+
entryType: EntryType.Function,
|
|
814
|
+
isNewType: false,
|
|
815
|
+
description: extractJsDocDescription(implementation),
|
|
816
|
+
generics: extractGenerics(implementation),
|
|
817
|
+
jsdocTags: extractJsDocTags(implementation),
|
|
818
|
+
params: extractAllParams(implementation.parameters, typeChecker),
|
|
819
|
+
rawComment: extractRawJsDoc(implementation),
|
|
820
|
+
returnType: typeChecker.typeToString(typeChecker.getReturnTypeOfSignature(typeChecker.getSignatureFromDeclaration(implementation)))
|
|
821
|
+
};
|
|
822
|
+
jsdocTags = callFunction.implementation.jsdocTags;
|
|
823
|
+
description = callFunction.implementation.description;
|
|
824
|
+
rawComment = callFunction.implementation.description;
|
|
825
|
+
} else {
|
|
826
|
+
jsdocTags = extractJsDocTags(container);
|
|
827
|
+
description = extractJsDocDescription(container);
|
|
828
|
+
rawComment = extractRawJsDoc(container);
|
|
829
|
+
}
|
|
830
|
+
const metadataTag = jsdocTags.find((t) => t.name === initializerApiTag);
|
|
831
|
+
if (metadataTag === void 0) {
|
|
832
|
+
throw new Error(`Initializer API: Detected initializer API function does not have "@initializerApiFunction" tag: ${name}`);
|
|
833
|
+
}
|
|
834
|
+
let parsedMetadata = void 0;
|
|
835
|
+
if (metadataTag.comment.trim() !== "") {
|
|
836
|
+
try {
|
|
837
|
+
parsedMetadata = JSON.parse(metadataTag.comment);
|
|
838
|
+
} catch (e) {
|
|
839
|
+
throw new Error(`Could not parse initializer API function metadata: ${e}`);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return {
|
|
843
|
+
entryType: EntryType.InitializerApiFunction,
|
|
844
|
+
name,
|
|
845
|
+
description,
|
|
846
|
+
jsdocTags,
|
|
847
|
+
rawComment,
|
|
848
|
+
callFunction,
|
|
849
|
+
subFunctions,
|
|
850
|
+
__docsMetadata__: parsedMetadata
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
function getContainerVariableStatement(node) {
|
|
854
|
+
if (!ts9.isVariableDeclarationList(node.parent)) {
|
|
855
|
+
return null;
|
|
856
|
+
}
|
|
857
|
+
if (!ts9.isVariableStatement(node.parent.parent)) {
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
return node.parent.parent;
|
|
861
|
+
}
|
|
862
|
+
function filterSignatureDeclarations(signatures) {
|
|
863
|
+
const result = [];
|
|
864
|
+
for (const signature of signatures) {
|
|
865
|
+
const decl = signature.getDeclaration();
|
|
866
|
+
if (ts9.isFunctionDeclaration(decl) || ts9.isCallSignatureDeclaration(decl)) {
|
|
867
|
+
result.push(decl);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return result;
|
|
871
|
+
}
|
|
872
|
+
function extractFunctionWithOverloads(name, signatures, typeChecker) {
|
|
873
|
+
return {
|
|
874
|
+
name,
|
|
875
|
+
signatures: filterSignatureDeclarations(signatures).map((s) => ({
|
|
876
|
+
name,
|
|
877
|
+
entryType: EntryType.Function,
|
|
878
|
+
description: extractJsDocDescription(s),
|
|
879
|
+
generics: extractGenerics(s),
|
|
880
|
+
isNewType: false,
|
|
881
|
+
jsdocTags: extractJsDocTags(s),
|
|
882
|
+
params: extractAllParams(s.parameters, typeChecker),
|
|
883
|
+
rawComment: extractRawJsDoc(s),
|
|
884
|
+
returnType: typeChecker.typeToString(typeChecker.getReturnTypeOfSignature(typeChecker.getSignatureFromDeclaration(s)))
|
|
885
|
+
})),
|
|
886
|
+
implementation: null
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
function findImplementationOfFunction(node, typeChecker) {
|
|
890
|
+
var _a;
|
|
891
|
+
if (node.body !== void 0 || node.name === void 0) {
|
|
892
|
+
return node;
|
|
893
|
+
}
|
|
894
|
+
const symbol = typeChecker.getSymbolAtLocation(node.name);
|
|
895
|
+
return (_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a.find((s) => ts9.isFunctionDeclaration(s) && s.body !== void 0);
|
|
896
|
+
}
|
|
897
|
+
|
|
1012
898
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/type_alias_extractor.mjs
|
|
1013
899
|
function extractTypeAlias(declaration) {
|
|
1014
900
|
return {
|
|
@@ -1031,60 +917,344 @@ var DocsExtractor = class {
|
|
|
1031
917
|
const entries = [];
|
|
1032
918
|
const exportedDeclarations = this.getExportedDeclarations(sourceFile);
|
|
1033
919
|
for (const [exportName, node] of exportedDeclarations) {
|
|
1034
|
-
if (isAngularPrivateName(exportName))
|
|
920
|
+
if (isAngularPrivateName(exportName)) {
|
|
1035
921
|
continue;
|
|
922
|
+
}
|
|
1036
923
|
const entry = this.extractDeclaration(node);
|
|
1037
|
-
if (entry) {
|
|
924
|
+
if (entry && !isIgnoredDocEntry(entry)) {
|
|
1038
925
|
entries.push({ ...entry, name: exportName });
|
|
1039
926
|
}
|
|
1040
927
|
}
|
|
1041
|
-
return entries;
|
|
928
|
+
return entries;
|
|
929
|
+
}
|
|
930
|
+
extractDeclaration(node) {
|
|
931
|
+
if (isNamedClassDeclaration(node)) {
|
|
932
|
+
return extractClass(node, this.metadataReader, this.typeChecker);
|
|
933
|
+
}
|
|
934
|
+
if (isInitializerApiFunction(node, this.typeChecker)) {
|
|
935
|
+
return extractInitializerApiFunction(node, this.typeChecker);
|
|
936
|
+
}
|
|
937
|
+
if (ts10.isInterfaceDeclaration(node) && !isIgnoredInterface(node)) {
|
|
938
|
+
return extractInterface(node, this.typeChecker);
|
|
939
|
+
}
|
|
940
|
+
if (ts10.isFunctionDeclaration(node)) {
|
|
941
|
+
const functionExtractor = new FunctionExtractor(node.name.getText(), node, this.typeChecker);
|
|
942
|
+
return functionExtractor.extract();
|
|
943
|
+
}
|
|
944
|
+
if (ts10.isVariableDeclaration(node) && !isSyntheticAngularConstant(node)) {
|
|
945
|
+
return isDecoratorDeclaration(node) ? extractorDecorator(node, this.typeChecker) : extractConstant(node, this.typeChecker);
|
|
946
|
+
}
|
|
947
|
+
if (ts10.isTypeAliasDeclaration(node)) {
|
|
948
|
+
return extractTypeAlias(node);
|
|
949
|
+
}
|
|
950
|
+
if (ts10.isEnumDeclaration(node)) {
|
|
951
|
+
return extractEnum(node, this.typeChecker);
|
|
952
|
+
}
|
|
953
|
+
return null;
|
|
954
|
+
}
|
|
955
|
+
getExportedDeclarations(sourceFile) {
|
|
956
|
+
var _a;
|
|
957
|
+
const reflector = new TypeScriptReflectionHost(this.typeChecker);
|
|
958
|
+
const exportedDeclarationMap = reflector.getExportsOfModule(sourceFile);
|
|
959
|
+
let exportedDeclarations = Array.from((_a = exportedDeclarationMap == null ? void 0 : exportedDeclarationMap.entries()) != null ? _a : []).map(([exportName, declaration]) => [exportName, declaration.node]);
|
|
960
|
+
const declarationCount = exportedDeclarations.length;
|
|
961
|
+
for (let i = 0; i < declarationCount; i++) {
|
|
962
|
+
const [exportName, declaration] = exportedDeclarations[i];
|
|
963
|
+
if (ts10.isFunctionDeclaration(declaration)) {
|
|
964
|
+
const extractor = new FunctionExtractor(exportName, declaration, this.typeChecker);
|
|
965
|
+
const overloads = extractor.getOverloads().map((overload) => [exportName, overload]);
|
|
966
|
+
exportedDeclarations.push(...overloads);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
return exportedDeclarations.sort(([a, declarationA], [b, declarationB]) => declarationA.pos - declarationB.pos);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
function isIgnoredInterface(node) {
|
|
973
|
+
return node.name.getText().endsWith("Decorator") || isDecoratorOptionsInterface(node);
|
|
974
|
+
}
|
|
975
|
+
function isIgnoredDocEntry(entry) {
|
|
976
|
+
const isDocsPrivate = entry.jsdocTags.find((e) => e.name === "docsPrivate");
|
|
977
|
+
if (isDocsPrivate !== void 0 && isDocsPrivate.comment === "") {
|
|
978
|
+
throw new Error(`Docs extraction: Entry "${entry.name}" is marked as "@docsPrivate" but without reasoning.`);
|
|
979
|
+
}
|
|
980
|
+
return isDocsPrivate !== void 0;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
984
|
+
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
985
|
+
import ts43 from "typescript";
|
|
986
|
+
|
|
987
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
988
|
+
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
989
|
+
import * as path from "path";
|
|
990
|
+
function i18nGetExtension(formatName) {
|
|
991
|
+
const format = formatName.toLowerCase();
|
|
992
|
+
switch (format) {
|
|
993
|
+
case "xmb":
|
|
994
|
+
return "xmb";
|
|
995
|
+
case "xlf":
|
|
996
|
+
case "xlif":
|
|
997
|
+
case "xliff":
|
|
998
|
+
case "xlf2":
|
|
999
|
+
case "xliff2":
|
|
1000
|
+
return "xlf";
|
|
1001
|
+
}
|
|
1002
|
+
throw new Error(`Unsupported format "${formatName}"`);
|
|
1003
|
+
}
|
|
1004
|
+
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve = path.resolve) {
|
|
1005
|
+
formatName = formatName || "xlf";
|
|
1006
|
+
const ext = i18nGetExtension(formatName);
|
|
1007
|
+
const content = i18nSerialize(bundle, formatName, options);
|
|
1008
|
+
const dstFile = outFile || `messages.${ext}`;
|
|
1009
|
+
const dstPath = pathResolve(options.outDir || options.basePath, dstFile);
|
|
1010
|
+
host.writeFile(dstPath, content, false, void 0, []);
|
|
1011
|
+
return [dstPath];
|
|
1012
|
+
}
|
|
1013
|
+
function i18nSerialize(bundle, formatName, options) {
|
|
1014
|
+
const format = formatName.toLowerCase();
|
|
1015
|
+
let serializer;
|
|
1016
|
+
switch (format) {
|
|
1017
|
+
case "xmb":
|
|
1018
|
+
serializer = new Xmb();
|
|
1019
|
+
break;
|
|
1020
|
+
case "xliff2":
|
|
1021
|
+
case "xlf2":
|
|
1022
|
+
serializer = new Xliff2();
|
|
1023
|
+
break;
|
|
1024
|
+
case "xlf":
|
|
1025
|
+
case "xliff":
|
|
1026
|
+
default:
|
|
1027
|
+
serializer = new Xliff();
|
|
1028
|
+
}
|
|
1029
|
+
return bundle.write(serializer, getPathNormalizer(options.basePath));
|
|
1030
|
+
}
|
|
1031
|
+
function getPathNormalizer(basePath) {
|
|
1032
|
+
return (sourcePath) => {
|
|
1033
|
+
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
|
|
1034
|
+
return sourcePath.split(path.sep).join("/");
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
1039
|
+
import ts11 from "typescript";
|
|
1040
|
+
|
|
1041
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
1042
|
+
function toNumbers(value) {
|
|
1043
|
+
const suffixIndex = value.lastIndexOf("-");
|
|
1044
|
+
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
1045
|
+
const parsed = parseInt(segment, 10);
|
|
1046
|
+
if (isNaN(parsed)) {
|
|
1047
|
+
throw Error(`Unable to parse version string ${value}.`);
|
|
1048
|
+
}
|
|
1049
|
+
return parsed;
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function compareNumbers(a, b) {
|
|
1053
|
+
const max = Math.max(a.length, b.length);
|
|
1054
|
+
const min = Math.min(a.length, b.length);
|
|
1055
|
+
for (let i = 0; i < min; i++) {
|
|
1056
|
+
if (a[i] > b[i])
|
|
1057
|
+
return 1;
|
|
1058
|
+
if (a[i] < b[i])
|
|
1059
|
+
return -1;
|
|
1060
|
+
}
|
|
1061
|
+
if (min !== max) {
|
|
1062
|
+
const longestArray = a.length === max ? a : b;
|
|
1063
|
+
const comparisonResult = a.length === max ? 1 : -1;
|
|
1064
|
+
for (let i = min; i < max; i++) {
|
|
1065
|
+
if (longestArray[i] > 0) {
|
|
1066
|
+
return comparisonResult;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
return 0;
|
|
1071
|
+
}
|
|
1072
|
+
function compareVersions(v1, v2) {
|
|
1073
|
+
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
1077
|
+
var MIN_TS_VERSION = "5.4.0";
|
|
1078
|
+
var MAX_TS_VERSION = "5.5.0";
|
|
1079
|
+
var tsVersion = ts11.version;
|
|
1080
|
+
function checkVersion(version, minVersion, maxVersion) {
|
|
1081
|
+
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
1082
|
+
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
function verifySupportedTypeScriptVersion() {
|
|
1086
|
+
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
1090
|
+
import { R3Identifiers as R3Identifiers5 } from "@angular/compiler";
|
|
1091
|
+
import ts41 from "typescript";
|
|
1092
|
+
|
|
1093
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
1094
|
+
var CycleAnalyzer = class {
|
|
1095
|
+
constructor(importGraph) {
|
|
1096
|
+
this.importGraph = importGraph;
|
|
1097
|
+
this.cachedResults = null;
|
|
1098
|
+
}
|
|
1099
|
+
wouldCreateCycle(from, to) {
|
|
1100
|
+
if (this.cachedResults === null || this.cachedResults.from !== from) {
|
|
1101
|
+
this.cachedResults = new CycleResults(from, this.importGraph);
|
|
1102
|
+
}
|
|
1103
|
+
return this.cachedResults.wouldBeCyclic(to) ? new Cycle(this.importGraph, from, to) : null;
|
|
1104
|
+
}
|
|
1105
|
+
recordSyntheticImport(from, to) {
|
|
1106
|
+
this.cachedResults = null;
|
|
1107
|
+
this.importGraph.addSyntheticImport(from, to);
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
var NgCyclicResult = Symbol("NgCyclicResult");
|
|
1111
|
+
var CycleResults = class {
|
|
1112
|
+
constructor(from, importGraph) {
|
|
1113
|
+
this.from = from;
|
|
1114
|
+
this.importGraph = importGraph;
|
|
1115
|
+
this.cyclic = {};
|
|
1116
|
+
this.acyclic = {};
|
|
1117
|
+
}
|
|
1118
|
+
wouldBeCyclic(sf) {
|
|
1119
|
+
const cached = this.getCachedResult(sf);
|
|
1120
|
+
if (cached !== null) {
|
|
1121
|
+
return cached;
|
|
1122
|
+
}
|
|
1123
|
+
if (sf === this.from) {
|
|
1124
|
+
return true;
|
|
1125
|
+
}
|
|
1126
|
+
this.markAcyclic(sf);
|
|
1127
|
+
const imports = this.importGraph.importsOf(sf);
|
|
1128
|
+
for (const imported of imports) {
|
|
1129
|
+
if (this.wouldBeCyclic(imported)) {
|
|
1130
|
+
this.markCyclic(sf);
|
|
1131
|
+
return true;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
return false;
|
|
1042
1135
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
if (
|
|
1048
|
-
return
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
const functionExtractor = new FunctionExtractor(node.name.getText(), node, this.typeChecker);
|
|
1052
|
-
return functionExtractor.extract();
|
|
1136
|
+
getCachedResult(sf) {
|
|
1137
|
+
const result = sf[NgCyclicResult];
|
|
1138
|
+
if (result === this.cyclic) {
|
|
1139
|
+
return true;
|
|
1140
|
+
} else if (result === this.acyclic) {
|
|
1141
|
+
return false;
|
|
1142
|
+
} else {
|
|
1143
|
+
return null;
|
|
1053
1144
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1145
|
+
}
|
|
1146
|
+
markCyclic(sf) {
|
|
1147
|
+
sf[NgCyclicResult] = this.cyclic;
|
|
1148
|
+
}
|
|
1149
|
+
markAcyclic(sf) {
|
|
1150
|
+
sf[NgCyclicResult] = this.acyclic;
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
var Cycle = class {
|
|
1154
|
+
constructor(importGraph, from, to) {
|
|
1155
|
+
this.importGraph = importGraph;
|
|
1156
|
+
this.from = from;
|
|
1157
|
+
this.to = to;
|
|
1158
|
+
}
|
|
1159
|
+
getPath() {
|
|
1160
|
+
return [this.from, ...this.importGraph.findPath(this.to, this.from)];
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
1165
|
+
import ts12 from "typescript";
|
|
1166
|
+
var ImportGraph = class {
|
|
1167
|
+
constructor(checker, perf) {
|
|
1168
|
+
this.checker = checker;
|
|
1169
|
+
this.perf = perf;
|
|
1170
|
+
this.imports = /* @__PURE__ */ new Map();
|
|
1171
|
+
}
|
|
1172
|
+
importsOf(sf) {
|
|
1173
|
+
if (!this.imports.has(sf)) {
|
|
1174
|
+
this.imports.set(sf, this.scanImports(sf));
|
|
1056
1175
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1176
|
+
return this.imports.get(sf);
|
|
1177
|
+
}
|
|
1178
|
+
findPath(start, end) {
|
|
1179
|
+
if (start === end) {
|
|
1180
|
+
return [start];
|
|
1059
1181
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1182
|
+
const found = /* @__PURE__ */ new Set([start]);
|
|
1183
|
+
const queue = [new Found(start, null)];
|
|
1184
|
+
while (queue.length > 0) {
|
|
1185
|
+
const current = queue.shift();
|
|
1186
|
+
const imports = this.importsOf(current.sourceFile);
|
|
1187
|
+
for (const importedFile of imports) {
|
|
1188
|
+
if (!found.has(importedFile)) {
|
|
1189
|
+
const next = new Found(importedFile, current);
|
|
1190
|
+
if (next.sourceFile === end) {
|
|
1191
|
+
return next.toPath();
|
|
1192
|
+
}
|
|
1193
|
+
found.add(importedFile);
|
|
1194
|
+
queue.push(next);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1062
1197
|
}
|
|
1063
1198
|
return null;
|
|
1064
1199
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
const exportedDeclarationMap = reflector.getExportsOfModule(sourceFile);
|
|
1069
|
-
let exportedDeclarations = Array.from((_a = exportedDeclarationMap == null ? void 0 : exportedDeclarationMap.entries()) != null ? _a : []).map(([exportName, declaration]) => [exportName, declaration.node]);
|
|
1070
|
-
const declarationCount = exportedDeclarations.length;
|
|
1071
|
-
for (let i = 0; i < declarationCount; i++) {
|
|
1072
|
-
const [exportName, declaration] = exportedDeclarations[i];
|
|
1073
|
-
if (ts10.isFunctionDeclaration(declaration)) {
|
|
1074
|
-
const extractor = new FunctionExtractor(exportName, declaration, this.typeChecker);
|
|
1075
|
-
const overloads = extractor.getOverloads().map((overload) => [exportName, overload]);
|
|
1076
|
-
exportedDeclarations.push(...overloads);
|
|
1077
|
-
}
|
|
1200
|
+
addSyntheticImport(sf, imported) {
|
|
1201
|
+
if (isLocalFile(imported)) {
|
|
1202
|
+
this.importsOf(sf).add(imported);
|
|
1078
1203
|
}
|
|
1079
|
-
|
|
1204
|
+
}
|
|
1205
|
+
scanImports(sf) {
|
|
1206
|
+
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
1207
|
+
const imports = /* @__PURE__ */ new Set();
|
|
1208
|
+
for (const stmt of sf.statements) {
|
|
1209
|
+
if (!ts12.isImportDeclaration(stmt) && !ts12.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1212
|
+
if (ts12.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
1216
|
+
if (symbol === void 0 || symbol.valueDeclaration === void 0) {
|
|
1217
|
+
continue;
|
|
1218
|
+
}
|
|
1219
|
+
const moduleFile = symbol.valueDeclaration;
|
|
1220
|
+
if (ts12.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
1221
|
+
imports.add(moduleFile);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
return imports;
|
|
1225
|
+
});
|
|
1080
1226
|
}
|
|
1081
1227
|
};
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1228
|
+
function isLocalFile(sf) {
|
|
1229
|
+
return !sf.isDeclarationFile;
|
|
1230
|
+
}
|
|
1231
|
+
function isTypeOnlyImportClause(node) {
|
|
1232
|
+
if (node.isTypeOnly) {
|
|
1233
|
+
return true;
|
|
1234
|
+
}
|
|
1235
|
+
if (node.namedBindings !== void 0 && ts12.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
1236
|
+
return true;
|
|
1237
|
+
}
|
|
1238
|
+
return false;
|
|
1084
1239
|
}
|
|
1240
|
+
var Found = class {
|
|
1241
|
+
constructor(sourceFile, parent) {
|
|
1242
|
+
this.sourceFile = sourceFile;
|
|
1243
|
+
this.parent = parent;
|
|
1244
|
+
}
|
|
1245
|
+
toPath() {
|
|
1246
|
+
const array = [];
|
|
1247
|
+
let current = this;
|
|
1248
|
+
while (current !== null) {
|
|
1249
|
+
array.push(current.sourceFile);
|
|
1250
|
+
current = current.parent;
|
|
1251
|
+
}
|
|
1252
|
+
return array.reverse();
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1085
1255
|
|
|
1086
1256
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
1087
|
-
import
|
|
1257
|
+
import ts13 from "typescript";
|
|
1088
1258
|
var FlatIndexGenerator = class {
|
|
1089
1259
|
constructor(entryPoint, relativeFlatIndexPath, moduleName) {
|
|
1090
1260
|
this.entryPoint = entryPoint;
|
|
@@ -1100,7 +1270,7 @@ var FlatIndexGenerator = class {
|
|
|
1100
1270
|
|
|
1101
1271
|
export * from '${relativeEntryPoint}';
|
|
1102
1272
|
`;
|
|
1103
|
-
const genFile =
|
|
1273
|
+
const genFile = ts13.createSourceFile(this.flatIndexPath, contents, ts13.ScriptTarget.ES2015, true, ts13.ScriptKind.TS);
|
|
1104
1274
|
if (this.moduleName !== null) {
|
|
1105
1275
|
genFile.moduleName = this.moduleName;
|
|
1106
1276
|
}
|
|
@@ -1125,7 +1295,7 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
1125
1295
|
}
|
|
1126
1296
|
|
|
1127
1297
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
1128
|
-
import
|
|
1298
|
+
import ts14 from "typescript";
|
|
1129
1299
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
1130
1300
|
const diagnostics = [];
|
|
1131
1301
|
const topLevelExports = /* @__PURE__ */ new Set();
|
|
@@ -1135,7 +1305,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1135
1305
|
}
|
|
1136
1306
|
const exportedSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
1137
1307
|
exportedSymbols.forEach((symbol) => {
|
|
1138
|
-
if (symbol.flags &
|
|
1308
|
+
if (symbol.flags & ts14.SymbolFlags.Alias) {
|
|
1139
1309
|
symbol = checker.getAliasedSymbol(symbol);
|
|
1140
1310
|
}
|
|
1141
1311
|
const decl = symbol.valueDeclaration;
|
|
@@ -1159,7 +1329,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1159
1329
|
visibleVia = transitivePath.map((seg) => getNameOfDeclaration(seg)).join(" -> ");
|
|
1160
1330
|
}
|
|
1161
1331
|
const diagnostic = {
|
|
1162
|
-
category:
|
|
1332
|
+
category: ts14.DiagnosticCategory.Error,
|
|
1163
1333
|
code: ngErrorCode(ErrorCode.SYMBOL_NOT_EXPORTED),
|
|
1164
1334
|
file: transitiveReference.getSourceFile(),
|
|
1165
1335
|
...getPosOfDeclaration(transitiveReference),
|
|
@@ -1179,7 +1349,7 @@ function getPosOfDeclaration(decl) {
|
|
|
1179
1349
|
};
|
|
1180
1350
|
}
|
|
1181
1351
|
function getIdentifierOfDeclaration(decl) {
|
|
1182
|
-
if ((
|
|
1352
|
+
if ((ts14.isClassDeclaration(decl) || ts14.isVariableDeclaration(decl) || ts14.isFunctionDeclaration(decl)) && decl.name !== void 0 && ts14.isIdentifier(decl.name)) {
|
|
1183
1353
|
return decl.name;
|
|
1184
1354
|
} else {
|
|
1185
1355
|
return null;
|
|
@@ -1191,13 +1361,13 @@ function getNameOfDeclaration(decl) {
|
|
|
1191
1361
|
}
|
|
1192
1362
|
function getDescriptorOfDeclaration(decl) {
|
|
1193
1363
|
switch (decl.kind) {
|
|
1194
|
-
case
|
|
1364
|
+
case ts14.SyntaxKind.ClassDeclaration:
|
|
1195
1365
|
return "class";
|
|
1196
|
-
case
|
|
1366
|
+
case ts14.SyntaxKind.FunctionDeclaration:
|
|
1197
1367
|
return "function";
|
|
1198
|
-
case
|
|
1368
|
+
case ts14.SyntaxKind.VariableDeclaration:
|
|
1199
1369
|
return "variable";
|
|
1200
|
-
case
|
|
1370
|
+
case ts14.SyntaxKind.EnumDeclaration:
|
|
1201
1371
|
return "enum";
|
|
1202
1372
|
default:
|
|
1203
1373
|
return "declaration";
|
|
@@ -1267,10 +1437,10 @@ var UpdateMode;
|
|
|
1267
1437
|
})(UpdateMode || (UpdateMode = {}));
|
|
1268
1438
|
|
|
1269
1439
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
1270
|
-
import
|
|
1440
|
+
import ts16 from "typescript";
|
|
1271
1441
|
|
|
1272
1442
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
1273
|
-
import
|
|
1443
|
+
import ts15 from "typescript";
|
|
1274
1444
|
|
|
1275
1445
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
1276
1446
|
var NgExtension = Symbol("NgExtension");
|
|
@@ -1401,10 +1571,10 @@ var ShimAdapter = class {
|
|
|
1401
1571
|
}
|
|
1402
1572
|
const prefix = match[1];
|
|
1403
1573
|
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
1404
|
-
let inputFile = this.delegate.getSourceFile(baseFileName,
|
|
1574
|
+
let inputFile = this.delegate.getSourceFile(baseFileName, ts15.ScriptTarget.Latest);
|
|
1405
1575
|
if (inputFile === void 0) {
|
|
1406
1576
|
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
1407
|
-
inputFile = this.delegate.getSourceFile(baseFileName,
|
|
1577
|
+
inputFile = this.delegate.getSourceFile(baseFileName, ts15.ScriptTarget.Latest);
|
|
1408
1578
|
}
|
|
1409
1579
|
if (inputFile === void 0 || isShim(inputFile)) {
|
|
1410
1580
|
return void 0;
|
|
@@ -1565,7 +1735,7 @@ var TsCreateProgramDriver = class {
|
|
|
1565
1735
|
this.sfMap.clear();
|
|
1566
1736
|
}
|
|
1567
1737
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
1568
|
-
const sf =
|
|
1738
|
+
const sf = ts16.createSourceFile(filePath, newText, ts16.ScriptTarget.Latest, true);
|
|
1569
1739
|
if (originalFile !== null) {
|
|
1570
1740
|
sf[NgOriginalFile] = originalFile;
|
|
1571
1741
|
}
|
|
@@ -1574,7 +1744,7 @@ var TsCreateProgramDriver = class {
|
|
|
1574
1744
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
1575
1745
|
const oldProgram = this.program;
|
|
1576
1746
|
retagAllTsFiles(oldProgram);
|
|
1577
|
-
this.program =
|
|
1747
|
+
this.program = ts16.createProgram({
|
|
1578
1748
|
host,
|
|
1579
1749
|
rootNames: this.program.getRootFileNames(),
|
|
1580
1750
|
options: this.options,
|
|
@@ -2075,7 +2245,7 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
2075
2245
|
visitForLoopBlock(block) {
|
|
2076
2246
|
var _a;
|
|
2077
2247
|
block.item.visit(this);
|
|
2078
|
-
this.visitAll(
|
|
2248
|
+
this.visitAll(block.contextVariables);
|
|
2079
2249
|
this.visitExpression(block.expression);
|
|
2080
2250
|
this.visitAll(block.children);
|
|
2081
2251
|
(_a = block.empty) == null ? void 0 : _a.visit(this);
|
|
@@ -2337,7 +2507,7 @@ var NgModuleIndexImpl = class {
|
|
|
2337
2507
|
};
|
|
2338
2508
|
|
|
2339
2509
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
2340
|
-
import
|
|
2510
|
+
import ts17 from "typescript";
|
|
2341
2511
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
2342
2512
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
2343
2513
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -2447,7 +2617,7 @@ var AdapterResourceLoader = class {
|
|
|
2447
2617
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
2448
2618
|
}
|
|
2449
2619
|
getResolvedCandidateLocations(url, fromFile) {
|
|
2450
|
-
const failedLookup =
|
|
2620
|
+
const failedLookup = ts17.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
2451
2621
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
2452
2622
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
2453
2623
|
}
|
|
@@ -2582,7 +2752,7 @@ var StandaloneComponentScopeReader = class {
|
|
|
2582
2752
|
import { CssSelector as CssSelector2, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr2, WrappedNodeExpr as WrappedNodeExpr2 } from "@angular/compiler";
|
|
2583
2753
|
|
|
2584
2754
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
2585
|
-
import
|
|
2755
|
+
import ts18 from "typescript";
|
|
2586
2756
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
2587
2757
|
var _a;
|
|
2588
2758
|
if (mapping.type === "direct") {
|
|
@@ -2591,7 +2761,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2591
2761
|
relatedInformation = [];
|
|
2592
2762
|
for (const relatedMessage of relatedMessages) {
|
|
2593
2763
|
relatedInformation.push({
|
|
2594
|
-
category:
|
|
2764
|
+
category: ts18.DiagnosticCategory.Message,
|
|
2595
2765
|
code: 0,
|
|
2596
2766
|
file: relatedMessage.sourceFile,
|
|
2597
2767
|
start: relatedMessage.start,
|
|
@@ -2620,7 +2790,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2620
2790
|
if (relatedMessages !== void 0) {
|
|
2621
2791
|
for (const relatedMessage of relatedMessages) {
|
|
2622
2792
|
relatedInformation.push({
|
|
2623
|
-
category:
|
|
2793
|
+
category: ts18.DiagnosticCategory.Message,
|
|
2624
2794
|
code: 0,
|
|
2625
2795
|
file: relatedMessage.sourceFile,
|
|
2626
2796
|
start: relatedMessage.start,
|
|
@@ -2650,7 +2820,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2650
2820
|
};
|
|
2651
2821
|
}
|
|
2652
2822
|
relatedInformation.push({
|
|
2653
|
-
category:
|
|
2823
|
+
category: ts18.DiagnosticCategory.Message,
|
|
2654
2824
|
code: 0,
|
|
2655
2825
|
file: componentSf,
|
|
2656
2826
|
start: mapping.node.getStart(),
|
|
@@ -2685,7 +2855,7 @@ function parseTemplateAsSourceFile(fileName, template) {
|
|
|
2685
2855
|
if (parseTemplateAsSourceFileForTest !== null) {
|
|
2686
2856
|
return parseTemplateAsSourceFileForTest(fileName, template);
|
|
2687
2857
|
}
|
|
2688
|
-
return
|
|
2858
|
+
return ts18.createSourceFile(fileName, template, ts18.ScriptTarget.Latest, false, ts18.ScriptKind.JSX);
|
|
2689
2859
|
}
|
|
2690
2860
|
|
|
2691
2861
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
@@ -2707,15 +2877,15 @@ function allocateTemplateId(sf) {
|
|
|
2707
2877
|
|
|
2708
2878
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2709
2879
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2710
|
-
import
|
|
2880
|
+
import ts20 from "typescript";
|
|
2711
2881
|
|
|
2712
2882
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2713
2883
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2714
|
-
import
|
|
2884
|
+
import ts19 from "typescript";
|
|
2715
2885
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2716
2886
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2717
|
-
return
|
|
2718
|
-
if (kind !==
|
|
2887
|
+
return ts19.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2888
|
+
if (kind !== ts19.SyntaxKind.MultiLineCommentTrivia) {
|
|
2719
2889
|
return null;
|
|
2720
2890
|
}
|
|
2721
2891
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2739,25 +2909,25 @@ var ExpressionIdentifier;
|
|
|
2739
2909
|
ExpressionIdentifier2["VARIABLE_AS_EXPRESSION"] = "VAE";
|
|
2740
2910
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2741
2911
|
function addExpressionIdentifier(node, identifier) {
|
|
2742
|
-
|
|
2912
|
+
ts19.addSyntheticTrailingComment(
|
|
2743
2913
|
node,
|
|
2744
|
-
|
|
2914
|
+
ts19.SyntaxKind.MultiLineCommentTrivia,
|
|
2745
2915
|
`${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
|
|
2746
2916
|
false
|
|
2747
2917
|
);
|
|
2748
2918
|
}
|
|
2749
2919
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2750
2920
|
function markIgnoreDiagnostics(node) {
|
|
2751
|
-
|
|
2921
|
+
ts19.addSyntheticTrailingComment(
|
|
2752
2922
|
node,
|
|
2753
|
-
|
|
2923
|
+
ts19.SyntaxKind.MultiLineCommentTrivia,
|
|
2754
2924
|
IGNORE_FOR_DIAGNOSTICS_MARKER,
|
|
2755
2925
|
false
|
|
2756
2926
|
);
|
|
2757
2927
|
}
|
|
2758
2928
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2759
|
-
return
|
|
2760
|
-
if (kind !==
|
|
2929
|
+
return ts19.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2930
|
+
if (kind !== ts19.SyntaxKind.MultiLineCommentTrivia) {
|
|
2761
2931
|
return null;
|
|
2762
2932
|
}
|
|
2763
2933
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2831,8 +3001,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2831
3001
|
return results;
|
|
2832
3002
|
}
|
|
2833
3003
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2834
|
-
return
|
|
2835
|
-
if (kind !==
|
|
3004
|
+
return ts19.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
3005
|
+
if (kind !== ts19.SyntaxKind.MultiLineCommentTrivia) {
|
|
2836
3006
|
return false;
|
|
2837
3007
|
}
|
|
2838
3008
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2850,7 +3020,7 @@ var CompletionEngine = class {
|
|
|
2850
3020
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2851
3021
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2852
3022
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2853
|
-
filter:
|
|
3023
|
+
filter: ts20.isPropertyAccessExpression,
|
|
2854
3024
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2855
3025
|
});
|
|
2856
3026
|
if (globalRead !== null) {
|
|
@@ -2874,7 +3044,7 @@ var CompletionEngine = class {
|
|
|
2874
3044
|
let nodeContext = null;
|
|
2875
3045
|
if (node instanceof EmptyExpr) {
|
|
2876
3046
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2877
|
-
filter:
|
|
3047
|
+
filter: ts20.isIdentifier,
|
|
2878
3048
|
withSpan: node.sourceSpan
|
|
2879
3049
|
});
|
|
2880
3050
|
if (nodeLocation !== null) {
|
|
@@ -2887,7 +3057,7 @@ var CompletionEngine = class {
|
|
|
2887
3057
|
}
|
|
2888
3058
|
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2889
3059
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2890
|
-
filter:
|
|
3060
|
+
filter: ts20.isPropertyAccessExpression,
|
|
2891
3061
|
withSpan: node.sourceSpan
|
|
2892
3062
|
});
|
|
2893
3063
|
if (nodeLocation) {
|
|
@@ -2911,21 +3081,21 @@ var CompletionEngine = class {
|
|
|
2911
3081
|
let tsExpr = null;
|
|
2912
3082
|
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2913
3083
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2914
|
-
filter:
|
|
3084
|
+
filter: ts20.isPropertyAccessExpression,
|
|
2915
3085
|
withSpan: expr.nameSpan
|
|
2916
3086
|
});
|
|
2917
3087
|
} else if (expr instanceof SafePropertyRead) {
|
|
2918
3088
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2919
|
-
filter:
|
|
3089
|
+
filter: ts20.isParenthesizedExpression,
|
|
2920
3090
|
withSpan: expr.sourceSpan
|
|
2921
3091
|
});
|
|
2922
|
-
if (ternaryExpr === null || !
|
|
3092
|
+
if (ternaryExpr === null || !ts20.isConditionalExpression(ternaryExpr.expression)) {
|
|
2923
3093
|
return null;
|
|
2924
3094
|
}
|
|
2925
3095
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2926
|
-
if (
|
|
3096
|
+
if (ts20.isPropertyAccessExpression(whenTrue)) {
|
|
2927
3097
|
tsExpr = whenTrue;
|
|
2928
|
-
} else if (
|
|
3098
|
+
} else if (ts20.isCallExpression(whenTrue) && ts20.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2929
3099
|
tsExpr = whenTrue.expression;
|
|
2930
3100
|
}
|
|
2931
3101
|
}
|
|
@@ -2947,15 +3117,15 @@ var CompletionEngine = class {
|
|
|
2947
3117
|
let tsExpr = null;
|
|
2948
3118
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2949
3119
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2950
|
-
filter:
|
|
3120
|
+
filter: ts20.isParenthesizedExpression,
|
|
2951
3121
|
withSpan: expr.sourceSpan
|
|
2952
3122
|
});
|
|
2953
|
-
if (strNode !== null &&
|
|
3123
|
+
if (strNode !== null && ts20.isStringLiteral(strNode.expression)) {
|
|
2954
3124
|
tsExpr = strNode.expression;
|
|
2955
3125
|
}
|
|
2956
3126
|
} else {
|
|
2957
3127
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2958
|
-
filter: (n2) =>
|
|
3128
|
+
filter: (n2) => ts20.isStringLiteral(n2) || ts20.isNumericLiteral(n2),
|
|
2959
3129
|
withSpan: expr.sourceSpan
|
|
2960
3130
|
});
|
|
2961
3131
|
}
|
|
@@ -2963,7 +3133,7 @@ var CompletionEngine = class {
|
|
|
2963
3133
|
return null;
|
|
2964
3134
|
}
|
|
2965
3135
|
let positionInShimFile = tsExpr.getEnd();
|
|
2966
|
-
if (
|
|
3136
|
+
if (ts20.isStringLiteral(tsExpr)) {
|
|
2967
3137
|
positionInShimFile -= 1;
|
|
2968
3138
|
}
|
|
2969
3139
|
const res = {
|
|
@@ -4008,11 +4178,11 @@ var MagicString = class {
|
|
|
4008
4178
|
};
|
|
4009
4179
|
|
|
4010
4180
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
4011
|
-
import
|
|
4181
|
+
import ts33 from "typescript";
|
|
4012
4182
|
|
|
4013
4183
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
4014
4184
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
4015
|
-
import
|
|
4185
|
+
import ts21 from "typescript";
|
|
4016
4186
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
4017
4187
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
4018
4188
|
var RegistryDomSchemaChecker = class {
|
|
@@ -4037,7 +4207,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
4037
4207
|
} else {
|
|
4038
4208
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
4039
4209
|
}
|
|
4040
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
4210
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
4041
4211
|
this._diagnostics.push(diag);
|
|
4042
4212
|
}
|
|
4043
4213
|
}
|
|
@@ -4057,14 +4227,14 @@ var RegistryDomSchemaChecker = class {
|
|
|
4057
4227
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
|
|
4058
4228
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
4059
4229
|
}
|
|
4060
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
4230
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
4061
4231
|
this._diagnostics.push(diag);
|
|
4062
4232
|
}
|
|
4063
4233
|
}
|
|
4064
4234
|
};
|
|
4065
4235
|
|
|
4066
4236
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
4067
|
-
import
|
|
4237
|
+
import ts26 from "typescript";
|
|
4068
4238
|
|
|
4069
4239
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.mjs
|
|
4070
4240
|
import { ExpressionType, ExternalExpr, TypeModifier } from "@angular/compiler";
|
|
@@ -4098,98 +4268,98 @@ var ReferenceEmitEnvironment = class {
|
|
|
4098
4268
|
};
|
|
4099
4269
|
|
|
4100
4270
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
4101
|
-
import
|
|
4271
|
+
import ts22 from "typescript";
|
|
4102
4272
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4273
|
+
ts22.SyntaxKind.ParenthesizedExpression,
|
|
4274
|
+
ts22.SyntaxKind.Identifier,
|
|
4275
|
+
ts22.SyntaxKind.CallExpression,
|
|
4276
|
+
ts22.SyntaxKind.NonNullExpression,
|
|
4277
|
+
ts22.SyntaxKind.ElementAccessExpression,
|
|
4278
|
+
ts22.SyntaxKind.PropertyAccessExpression,
|
|
4279
|
+
ts22.SyntaxKind.ArrayLiteralExpression,
|
|
4280
|
+
ts22.SyntaxKind.ObjectLiteralExpression,
|
|
4281
|
+
ts22.SyntaxKind.StringLiteral,
|
|
4282
|
+
ts22.SyntaxKind.NumericLiteral,
|
|
4283
|
+
ts22.SyntaxKind.TrueKeyword,
|
|
4284
|
+
ts22.SyntaxKind.FalseKeyword,
|
|
4285
|
+
ts22.SyntaxKind.NullKeyword,
|
|
4286
|
+
ts22.SyntaxKind.UndefinedKeyword
|
|
4117
4287
|
]);
|
|
4118
4288
|
function tsCastToAny(expr) {
|
|
4119
4289
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
4120
|
-
expr =
|
|
4290
|
+
expr = ts22.factory.createParenthesizedExpression(expr);
|
|
4121
4291
|
}
|
|
4122
|
-
return
|
|
4292
|
+
return ts22.factory.createParenthesizedExpression(ts22.factory.createAsExpression(expr, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword)));
|
|
4123
4293
|
}
|
|
4124
4294
|
function tsCreateElement(tagName) {
|
|
4125
|
-
const createElement =
|
|
4126
|
-
|
|
4295
|
+
const createElement = ts22.factory.createPropertyAccessExpression(
|
|
4296
|
+
ts22.factory.createIdentifier("document"),
|
|
4127
4297
|
"createElement"
|
|
4128
4298
|
);
|
|
4129
|
-
return
|
|
4299
|
+
return ts22.factory.createCallExpression(
|
|
4130
4300
|
createElement,
|
|
4131
4301
|
void 0,
|
|
4132
|
-
[
|
|
4302
|
+
[ts22.factory.createStringLiteral(tagName)]
|
|
4133
4303
|
);
|
|
4134
4304
|
}
|
|
4135
4305
|
function tsDeclareVariable(id, type) {
|
|
4136
4306
|
addExpressionIdentifier(type, ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
|
|
4137
|
-
const initializer =
|
|
4138
|
-
const decl =
|
|
4307
|
+
const initializer = ts22.factory.createAsExpression(ts22.factory.createNonNullExpression(ts22.factory.createNull()), type);
|
|
4308
|
+
const decl = ts22.factory.createVariableDeclaration(
|
|
4139
4309
|
id,
|
|
4140
4310
|
void 0,
|
|
4141
4311
|
void 0,
|
|
4142
4312
|
initializer
|
|
4143
4313
|
);
|
|
4144
|
-
return
|
|
4314
|
+
return ts22.factory.createVariableStatement(
|
|
4145
4315
|
void 0,
|
|
4146
4316
|
[decl]
|
|
4147
4317
|
);
|
|
4148
4318
|
}
|
|
4149
4319
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
4150
|
-
return
|
|
4320
|
+
return ts22.factory.createTypeQueryNode(ts22.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
4151
4321
|
}
|
|
4152
4322
|
function tsCreateVariable(id, initializer) {
|
|
4153
|
-
const decl =
|
|
4323
|
+
const decl = ts22.factory.createVariableDeclaration(
|
|
4154
4324
|
id,
|
|
4155
4325
|
void 0,
|
|
4156
4326
|
void 0,
|
|
4157
4327
|
initializer
|
|
4158
4328
|
);
|
|
4159
|
-
return
|
|
4329
|
+
return ts22.factory.createVariableStatement(
|
|
4160
4330
|
void 0,
|
|
4161
4331
|
[decl]
|
|
4162
4332
|
);
|
|
4163
4333
|
}
|
|
4164
4334
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
4165
|
-
const methodAccess =
|
|
4166
|
-
return
|
|
4335
|
+
const methodAccess = ts22.factory.createPropertyAccessExpression(receiver, methodName);
|
|
4336
|
+
return ts22.factory.createCallExpression(
|
|
4167
4337
|
methodAccess,
|
|
4168
4338
|
void 0,
|
|
4169
4339
|
args
|
|
4170
4340
|
);
|
|
4171
4341
|
}
|
|
4172
4342
|
function isAccessExpression(node) {
|
|
4173
|
-
return
|
|
4343
|
+
return ts22.isPropertyAccessExpression(node) || ts22.isElementAccessExpression(node);
|
|
4174
4344
|
}
|
|
4175
4345
|
function tsNumericExpression(value) {
|
|
4176
4346
|
if (value < 0) {
|
|
4177
|
-
const operand =
|
|
4178
|
-
return
|
|
4347
|
+
const operand = ts22.factory.createNumericLiteral(Math.abs(value));
|
|
4348
|
+
return ts22.factory.createPrefixUnaryExpression(ts22.SyntaxKind.MinusToken, operand);
|
|
4179
4349
|
}
|
|
4180
|
-
return
|
|
4350
|
+
return ts22.factory.createNumericLiteral(value);
|
|
4181
4351
|
}
|
|
4182
4352
|
|
|
4183
4353
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
4184
4354
|
import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers2, WrappedNodeExpr } from "@angular/compiler";
|
|
4185
|
-
import
|
|
4355
|
+
import ts25 from "typescript";
|
|
4186
4356
|
|
|
4187
4357
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
4188
4358
|
import { R3Identifiers } from "@angular/compiler";
|
|
4189
|
-
import
|
|
4359
|
+
import ts24 from "typescript";
|
|
4190
4360
|
|
|
4191
4361
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
4192
|
-
import
|
|
4362
|
+
import ts23 from "typescript";
|
|
4193
4363
|
var TypeParameterEmitter = class {
|
|
4194
4364
|
constructor(typeParameters, reflector) {
|
|
4195
4365
|
this.typeParameters = typeParameters;
|
|
@@ -4226,11 +4396,11 @@ var TypeParameterEmitter = class {
|
|
|
4226
4396
|
return this.typeParameters.map((typeParam) => {
|
|
4227
4397
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
4228
4398
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
4229
|
-
return
|
|
4399
|
+
return ts23.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
|
|
4230
4400
|
});
|
|
4231
4401
|
}
|
|
4232
4402
|
resolveTypeReference(type) {
|
|
4233
|
-
const target =
|
|
4403
|
+
const target = ts23.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
4234
4404
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
4235
4405
|
if (declaration === null || declaration.node === null) {
|
|
4236
4406
|
return null;
|
|
@@ -4256,8 +4426,8 @@ var TypeParameterEmitter = class {
|
|
|
4256
4426
|
if (typeNode === null) {
|
|
4257
4427
|
return null;
|
|
4258
4428
|
}
|
|
4259
|
-
if (!
|
|
4260
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
4429
|
+
if (!ts23.isTypeReferenceNode(typeNode)) {
|
|
4430
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts23.SyntaxKind[typeNode.kind]}.`);
|
|
4261
4431
|
}
|
|
4262
4432
|
return typeNode;
|
|
4263
4433
|
}
|
|
@@ -4302,14 +4472,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
4302
4472
|
}
|
|
4303
4473
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
4304
4474
|
for (const stmt of file.statements) {
|
|
4305
|
-
if (
|
|
4475
|
+
if (ts24.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
4306
4476
|
return stmt;
|
|
4307
4477
|
}
|
|
4308
4478
|
}
|
|
4309
4479
|
return null;
|
|
4310
4480
|
}
|
|
4311
4481
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
4312
|
-
while (node !== void 0 && !
|
|
4482
|
+
while (node !== void 0 && !ts24.isFunctionDeclaration(node)) {
|
|
4313
4483
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
4314
4484
|
return null;
|
|
4315
4485
|
}
|
|
@@ -4326,7 +4496,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
4326
4496
|
return null;
|
|
4327
4497
|
}
|
|
4328
4498
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
4329
|
-
while (!
|
|
4499
|
+
while (!ts24.isFunctionDeclaration(node)) {
|
|
4330
4500
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
4331
4501
|
return null;
|
|
4332
4502
|
}
|
|
@@ -4336,8 +4506,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
4336
4506
|
}
|
|
4337
4507
|
}
|
|
4338
4508
|
const start = node.getFullStart();
|
|
4339
|
-
return
|
|
4340
|
-
if (kind !==
|
|
4509
|
+
return ts24.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
4510
|
+
if (kind !== ts24.SyntaxKind.MultiLineCommentTrivia) {
|
|
4341
4511
|
return null;
|
|
4342
4512
|
}
|
|
4343
4513
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -4361,29 +4531,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
4361
4531
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
4362
4532
|
function generateTypeCtorDeclarationFn(env, meta, nodeTypeRef, typeParams) {
|
|
4363
4533
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
4364
|
-
const rawType =
|
|
4534
|
+
const rawType = ts25.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
4365
4535
|
const initParam = constructTypeCtorParameter(env, meta, rawType);
|
|
4366
4536
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
4367
4537
|
if (meta.body) {
|
|
4368
|
-
const fnType =
|
|
4538
|
+
const fnType = ts25.factory.createFunctionTypeNode(
|
|
4369
4539
|
typeParameters,
|
|
4370
4540
|
[initParam],
|
|
4371
4541
|
rawType
|
|
4372
4542
|
);
|
|
4373
|
-
const decl =
|
|
4543
|
+
const decl = ts25.factory.createVariableDeclaration(
|
|
4374
4544
|
meta.fnName,
|
|
4375
4545
|
void 0,
|
|
4376
4546
|
fnType,
|
|
4377
|
-
|
|
4547
|
+
ts25.factory.createNonNullExpression(ts25.factory.createNull())
|
|
4378
4548
|
);
|
|
4379
|
-
const declList =
|
|
4380
|
-
return
|
|
4549
|
+
const declList = ts25.factory.createVariableDeclarationList([decl], ts25.NodeFlags.Const);
|
|
4550
|
+
return ts25.factory.createVariableStatement(
|
|
4381
4551
|
void 0,
|
|
4382
4552
|
declList
|
|
4383
4553
|
);
|
|
4384
4554
|
} else {
|
|
4385
|
-
return
|
|
4386
|
-
[
|
|
4555
|
+
return ts25.factory.createFunctionDeclaration(
|
|
4556
|
+
[ts25.factory.createModifier(ts25.SyntaxKind.DeclareKeyword)],
|
|
4387
4557
|
void 0,
|
|
4388
4558
|
meta.fnName,
|
|
4389
4559
|
typeParameters,
|
|
@@ -4395,16 +4565,16 @@ function generateTypeCtorDeclarationFn(env, meta, nodeTypeRef, typeParams) {
|
|
|
4395
4565
|
}
|
|
4396
4566
|
function generateInlineTypeCtor(env, node, meta) {
|
|
4397
4567
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
4398
|
-
const rawType =
|
|
4568
|
+
const rawType = ts25.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
4399
4569
|
const initParam = constructTypeCtorParameter(env, meta, rawType);
|
|
4400
4570
|
let body = void 0;
|
|
4401
4571
|
if (meta.body) {
|
|
4402
|
-
body =
|
|
4403
|
-
|
|
4572
|
+
body = ts25.factory.createBlock([
|
|
4573
|
+
ts25.factory.createReturnStatement(ts25.factory.createNonNullExpression(ts25.factory.createNull()))
|
|
4404
4574
|
]);
|
|
4405
4575
|
}
|
|
4406
|
-
return
|
|
4407
|
-
[
|
|
4576
|
+
return ts25.factory.createMethodDeclaration(
|
|
4577
|
+
[ts25.factory.createModifier(ts25.SyntaxKind.StaticKeyword)],
|
|
4408
4578
|
void 0,
|
|
4409
4579
|
meta.fnName,
|
|
4410
4580
|
void 0,
|
|
@@ -4421,12 +4591,12 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
4421
4591
|
const signalInputKeys = [];
|
|
4422
4592
|
for (const { classPropertyName, transform, isSignal } of meta.fields.inputs) {
|
|
4423
4593
|
if (isSignal) {
|
|
4424
|
-
signalInputKeys.push(
|
|
4594
|
+
signalInputKeys.push(ts25.factory.createLiteralTypeNode(ts25.factory.createStringLiteral(classPropertyName)));
|
|
4425
4595
|
} else if (!meta.coercedInputFields.has(classPropertyName)) {
|
|
4426
|
-
plainKeys.push(
|
|
4596
|
+
plainKeys.push(ts25.factory.createLiteralTypeNode(ts25.factory.createStringLiteral(classPropertyName)));
|
|
4427
4597
|
} else {
|
|
4428
4598
|
const coercionType = transform != null ? transform.type.node : tsCreateTypeQueryForCoercedInput(rawType.typeName, classPropertyName);
|
|
4429
|
-
coercedKeys.push(
|
|
4599
|
+
coercedKeys.push(ts25.factory.createPropertySignature(
|
|
4430
4600
|
void 0,
|
|
4431
4601
|
classPropertyName,
|
|
4432
4602
|
void 0,
|
|
@@ -4435,25 +4605,25 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
4435
4605
|
}
|
|
4436
4606
|
}
|
|
4437
4607
|
if (plainKeys.length > 0) {
|
|
4438
|
-
const keyTypeUnion =
|
|
4439
|
-
initType =
|
|
4608
|
+
const keyTypeUnion = ts25.factory.createUnionTypeNode(plainKeys);
|
|
4609
|
+
initType = ts25.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
4440
4610
|
}
|
|
4441
4611
|
if (coercedKeys.length > 0) {
|
|
4442
|
-
const coercedLiteral =
|
|
4443
|
-
initType = initType !== null ?
|
|
4612
|
+
const coercedLiteral = ts25.factory.createTypeLiteralNode(coercedKeys);
|
|
4613
|
+
initType = initType !== null ? ts25.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
4444
4614
|
}
|
|
4445
4615
|
if (signalInputKeys.length > 0) {
|
|
4446
|
-
const keyTypeUnion =
|
|
4616
|
+
const keyTypeUnion = ts25.factory.createUnionTypeNode(signalInputKeys);
|
|
4447
4617
|
const unwrapDirectiveSignalInputsExpr = env.referenceExternalType(R3Identifiers2.UnwrapDirectiveSignalInputs.moduleName, R3Identifiers2.UnwrapDirectiveSignalInputs.name, [
|
|
4448
4618
|
new ExpressionType2(new WrappedNodeExpr(rawType)),
|
|
4449
4619
|
new ExpressionType2(new WrappedNodeExpr(keyTypeUnion))
|
|
4450
4620
|
]);
|
|
4451
|
-
initType = initType !== null ?
|
|
4621
|
+
initType = initType !== null ? ts25.factory.createIntersectionTypeNode([initType, unwrapDirectiveSignalInputsExpr]) : unwrapDirectiveSignalInputsExpr;
|
|
4452
4622
|
}
|
|
4453
4623
|
if (initType === null) {
|
|
4454
|
-
initType =
|
|
4624
|
+
initType = ts25.factory.createTypeLiteralNode([]);
|
|
4455
4625
|
}
|
|
4456
|
-
return
|
|
4626
|
+
return ts25.factory.createParameterDeclaration(
|
|
4457
4627
|
void 0,
|
|
4458
4628
|
void 0,
|
|
4459
4629
|
"init",
|
|
@@ -4463,7 +4633,7 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
4463
4633
|
);
|
|
4464
4634
|
}
|
|
4465
4635
|
function generateGenericArgs(params) {
|
|
4466
|
-
return params.map((param) =>
|
|
4636
|
+
return params.map((param) => ts25.factory.createTypeReferenceNode(param.name, void 0));
|
|
4467
4637
|
}
|
|
4468
4638
|
function requiresInlineTypeCtor(node, host, env) {
|
|
4469
4639
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -4474,7 +4644,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
4474
4644
|
}
|
|
4475
4645
|
return params.map((param) => {
|
|
4476
4646
|
if (param.default === void 0) {
|
|
4477
|
-
return
|
|
4647
|
+
return ts25.factory.updateTypeParameterDeclaration(param, param.modifiers, param.name, param.constraint, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
4478
4648
|
} else {
|
|
4479
4649
|
return param;
|
|
4480
4650
|
}
|
|
@@ -4503,13 +4673,13 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4503
4673
|
}
|
|
4504
4674
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
4505
4675
|
const ref = this.reference(dirRef);
|
|
4506
|
-
const typeCtorExpr =
|
|
4676
|
+
const typeCtorExpr = ts26.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
4507
4677
|
this.typeCtors.set(node, typeCtorExpr);
|
|
4508
4678
|
return typeCtorExpr;
|
|
4509
4679
|
} else {
|
|
4510
4680
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
4511
4681
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
4512
|
-
if (!
|
|
4682
|
+
if (!ts26.isTypeReferenceNode(nodeTypeRef)) {
|
|
4513
4683
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
4514
4684
|
}
|
|
4515
4685
|
const meta = {
|
|
@@ -4524,7 +4694,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4524
4694
|
const typeParams = this.emitTypeParameters(node);
|
|
4525
4695
|
const typeCtor = generateTypeCtorDeclarationFn(this, meta, nodeTypeRef.typeName, typeParams);
|
|
4526
4696
|
this.typeCtorStatements.push(typeCtor);
|
|
4527
|
-
const fnId =
|
|
4697
|
+
const fnId = ts26.factory.createIdentifier(fnName);
|
|
4528
4698
|
this.typeCtors.set(node, fnId);
|
|
4529
4699
|
return fnId;
|
|
4530
4700
|
}
|
|
@@ -4534,7 +4704,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4534
4704
|
return this.pipeInsts.get(ref.node);
|
|
4535
4705
|
}
|
|
4536
4706
|
const pipeType = this.referenceType(ref);
|
|
4537
|
-
const pipeInstId =
|
|
4707
|
+
const pipeInstId = ts26.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
4538
4708
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
4539
4709
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
4540
4710
|
return pipeInstId;
|
|
@@ -4557,8 +4727,8 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4557
4727
|
};
|
|
4558
4728
|
|
|
4559
4729
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
4560
|
-
import { AbsoluteSourceSpan as AbsoluteSourceSpan3, TmplAstElement as TmplAstElement2
|
|
4561
|
-
import
|
|
4730
|
+
import { AbsoluteSourceSpan as AbsoluteSourceSpan3, TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
4731
|
+
import ts27 from "typescript";
|
|
4562
4732
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
4563
4733
|
constructor(resolver) {
|
|
4564
4734
|
this.resolver = resolver;
|
|
@@ -4572,7 +4742,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4572
4742
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
4573
4743
|
const value = ref.value.trim();
|
|
4574
4744
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
4575
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
4745
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
4576
4746
|
}
|
|
4577
4747
|
missingPipe(templateId, ast) {
|
|
4578
4748
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -4584,7 +4754,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4584
4754
|
if (sourceSpan === null) {
|
|
4585
4755
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
4586
4756
|
}
|
|
4587
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
4757
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
4588
4758
|
this.recordedPipes.add(ast);
|
|
4589
4759
|
}
|
|
4590
4760
|
deferredPipeUsedEagerly(templateId, ast) {
|
|
@@ -4597,7 +4767,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4597
4767
|
if (sourceSpan === null) {
|
|
4598
4768
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
4599
4769
|
}
|
|
4600
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
4770
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
|
|
4601
4771
|
this.recordedPipes.add(ast);
|
|
4602
4772
|
}
|
|
4603
4773
|
deferredComponentUsedEagerly(templateId, element) {
|
|
@@ -4609,12 +4779,12 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4609
4779
|
if (sourceSpan === null) {
|
|
4610
4780
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element.name}'.`);
|
|
4611
4781
|
}
|
|
4612
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
4782
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
|
|
4613
4783
|
}
|
|
4614
4784
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
4615
4785
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
4616
4786
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
4617
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
4787
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
4618
4788
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
4619
4789
|
start: firstDecl.sourceSpan.start.offset,
|
|
4620
4790
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -4653,7 +4823,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4653
4823
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
4654
4824
|
|
|
4655
4825
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
4656
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
4826
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts27.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
4657
4827
|
}
|
|
4658
4828
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
4659
4829
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -4687,19 +4857,20 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
4687
4857
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
4688
4858
|
});
|
|
4689
4859
|
}
|
|
4690
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
4860
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
4691
4861
|
}
|
|
4692
4862
|
missingRequiredInputs(templateId, element, directiveName, isComponent, inputAliases) {
|
|
4693
4863
|
const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
|
|
4694
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan,
|
|
4864
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
|
|
4695
4865
|
}
|
|
4696
4866
|
illegalForLoopTrackAccess(templateId, block, access) {
|
|
4697
4867
|
const sourceSpan = this.resolver.toParseSourceSpan(templateId, access.sourceSpan);
|
|
4698
4868
|
if (sourceSpan === null) {
|
|
4699
4869
|
throw new Error(`Assertion failure: no SourceLocation found for property read.`);
|
|
4700
4870
|
}
|
|
4701
|
-
const
|
|
4702
|
-
|
|
4871
|
+
const messageVars = [block.item, ...block.contextVariables.filter((v) => v.value === "$index")].map((v) => `'${v.name}'`).join(", ");
|
|
4872
|
+
const message = `Cannot access '${access.name}' inside of a track expression. Only ${messageVars} and properties on the containing component are available to this expression.`;
|
|
4873
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
|
|
4703
4874
|
}
|
|
4704
4875
|
inaccessibleDeferredTriggerElement(templateId, trigger) {
|
|
4705
4876
|
let message;
|
|
@@ -4710,17 +4881,10 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
4710
4881
|
Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
|
|
4711
4882
|
Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
|
|
4712
4883
|
}
|
|
4713
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan,
|
|
4884
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
|
|
4714
4885
|
}
|
|
4715
4886
|
controlFlowPreventingContentProjection(templateId, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
|
|
4716
|
-
|
|
4717
|
-
if (controlFlowNode instanceof TmplAstForLoopBlockEmpty) {
|
|
4718
|
-
blockName = "@empty";
|
|
4719
|
-
} else if (controlFlowNode instanceof TmplAstForLoopBlock) {
|
|
4720
|
-
blockName = "@for";
|
|
4721
|
-
} else {
|
|
4722
|
-
blockName = "@if";
|
|
4723
|
-
}
|
|
4887
|
+
const blockName = controlFlowNode.nameSpan.toString().trim();
|
|
4724
4888
|
const lines = [
|
|
4725
4889
|
`Node matches the "${slotSelector}" slot of the "${componentName}" component, but will not be projected into the specific slot because the surrounding ${blockName} has more than one node at its root. To project the node in the right slot, you can:
|
|
4726
4890
|
`,
|
|
@@ -4744,7 +4908,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
4744
4908
|
}
|
|
4745
4909
|
|
|
4746
4910
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
4747
|
-
import
|
|
4911
|
+
import ts28 from "typescript";
|
|
4748
4912
|
var TypeCheckShimGenerator = class {
|
|
4749
4913
|
constructor() {
|
|
4750
4914
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -4754,7 +4918,7 @@ var TypeCheckShimGenerator = class {
|
|
|
4754
4918
|
if (priorShimSf !== null) {
|
|
4755
4919
|
return priorShimSf;
|
|
4756
4920
|
}
|
|
4757
|
-
return
|
|
4921
|
+
return ts28.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts28.ScriptTarget.Latest, true, ts28.ScriptKind.TS);
|
|
4758
4922
|
}
|
|
4759
4923
|
static shimFor(fileName) {
|
|
4760
4924
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -4762,17 +4926,17 @@ var TypeCheckShimGenerator = class {
|
|
|
4762
4926
|
};
|
|
4763
4927
|
|
|
4764
4928
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
4765
|
-
import { BindingPipe, BindingType, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock
|
|
4766
|
-
import
|
|
4929
|
+
import { BindingPipe, BindingType, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TransplantedType } from "@angular/compiler";
|
|
4930
|
+
import ts31 from "typescript";
|
|
4767
4931
|
|
|
4768
4932
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
4769
4933
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan4 } from "@angular/compiler";
|
|
4770
|
-
import
|
|
4934
|
+
import ts29 from "typescript";
|
|
4771
4935
|
function wrapForDiagnostics(expr) {
|
|
4772
|
-
return
|
|
4936
|
+
return ts29.factory.createParenthesizedExpression(expr);
|
|
4773
4937
|
}
|
|
4774
4938
|
function wrapForTypeChecker(expr) {
|
|
4775
|
-
return
|
|
4939
|
+
return ts29.factory.createParenthesizedExpression(expr);
|
|
4776
4940
|
}
|
|
4777
4941
|
function addParseSpanInfo(node, span) {
|
|
4778
4942
|
let commentText;
|
|
@@ -4781,10 +4945,10 @@ function addParseSpanInfo(node, span) {
|
|
|
4781
4945
|
} else {
|
|
4782
4946
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
4783
4947
|
}
|
|
4784
|
-
|
|
4948
|
+
ts29.addSyntheticTrailingComment(node, ts29.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
4785
4949
|
}
|
|
4786
4950
|
function addTemplateId(tcb, id) {
|
|
4787
|
-
|
|
4951
|
+
ts29.addSyntheticLeadingComment(tcb, ts29.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
4788
4952
|
}
|
|
4789
4953
|
function shouldReportDiagnostic(diagnostic) {
|
|
4790
4954
|
const { code } = diagnostic;
|
|
@@ -4813,32 +4977,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
4813
4977
|
|
|
4814
4978
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
4815
4979
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
4816
|
-
import
|
|
4817
|
-
var NULL_AS_ANY =
|
|
4818
|
-
var UNDEFINED =
|
|
4980
|
+
import ts30 from "typescript";
|
|
4981
|
+
var NULL_AS_ANY = ts30.factory.createAsExpression(ts30.factory.createNull(), ts30.factory.createKeywordTypeNode(ts30.SyntaxKind.AnyKeyword));
|
|
4982
|
+
var UNDEFINED = ts30.factory.createIdentifier("undefined");
|
|
4819
4983
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
4820
|
-
["+",
|
|
4821
|
-
["-",
|
|
4984
|
+
["+", ts30.SyntaxKind.PlusToken],
|
|
4985
|
+
["-", ts30.SyntaxKind.MinusToken]
|
|
4822
4986
|
]);
|
|
4823
4987
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
4824
|
-
["+",
|
|
4825
|
-
["-",
|
|
4826
|
-
["<",
|
|
4827
|
-
[">",
|
|
4828
|
-
["<=",
|
|
4829
|
-
[">=",
|
|
4830
|
-
["==",
|
|
4831
|
-
["===",
|
|
4832
|
-
["*",
|
|
4833
|
-
["/",
|
|
4834
|
-
["%",
|
|
4835
|
-
["!=",
|
|
4836
|
-
["!==",
|
|
4837
|
-
["||",
|
|
4838
|
-
["&&",
|
|
4839
|
-
["&",
|
|
4840
|
-
["|",
|
|
4841
|
-
["??",
|
|
4988
|
+
["+", ts30.SyntaxKind.PlusToken],
|
|
4989
|
+
["-", ts30.SyntaxKind.MinusToken],
|
|
4990
|
+
["<", ts30.SyntaxKind.LessThanToken],
|
|
4991
|
+
[">", ts30.SyntaxKind.GreaterThanToken],
|
|
4992
|
+
["<=", ts30.SyntaxKind.LessThanEqualsToken],
|
|
4993
|
+
[">=", ts30.SyntaxKind.GreaterThanEqualsToken],
|
|
4994
|
+
["==", ts30.SyntaxKind.EqualsEqualsToken],
|
|
4995
|
+
["===", ts30.SyntaxKind.EqualsEqualsEqualsToken],
|
|
4996
|
+
["*", ts30.SyntaxKind.AsteriskToken],
|
|
4997
|
+
["/", ts30.SyntaxKind.SlashToken],
|
|
4998
|
+
["%", ts30.SyntaxKind.PercentToken],
|
|
4999
|
+
["!=", ts30.SyntaxKind.ExclamationEqualsToken],
|
|
5000
|
+
["!==", ts30.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
5001
|
+
["||", ts30.SyntaxKind.BarBarToken],
|
|
5002
|
+
["&&", ts30.SyntaxKind.AmpersandAmpersandToken],
|
|
5003
|
+
["&", ts30.SyntaxKind.AmpersandToken],
|
|
5004
|
+
["|", ts30.SyntaxKind.BarToken],
|
|
5005
|
+
["??", ts30.SyntaxKind.QuestionQuestionToken]
|
|
4842
5006
|
]);
|
|
4843
5007
|
function astToTypescript(ast, maybeResolve, config) {
|
|
4844
5008
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -4854,7 +5018,7 @@ var AstTranslator = class {
|
|
|
4854
5018
|
ast = ast.ast;
|
|
4855
5019
|
}
|
|
4856
5020
|
if (ast instanceof EmptyExpr2) {
|
|
4857
|
-
const res =
|
|
5021
|
+
const res = ts30.factory.createIdentifier("undefined");
|
|
4858
5022
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
4859
5023
|
return res;
|
|
4860
5024
|
}
|
|
@@ -4870,7 +5034,7 @@ var AstTranslator = class {
|
|
|
4870
5034
|
if (op === void 0) {
|
|
4871
5035
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
4872
5036
|
}
|
|
4873
|
-
const node = wrapForDiagnostics(
|
|
5037
|
+
const node = wrapForDiagnostics(ts30.factory.createPrefixUnaryExpression(op, expr));
|
|
4874
5038
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4875
5039
|
return node;
|
|
4876
5040
|
}
|
|
@@ -4881,13 +5045,13 @@ var AstTranslator = class {
|
|
|
4881
5045
|
if (op === void 0) {
|
|
4882
5046
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
4883
5047
|
}
|
|
4884
|
-
const node =
|
|
5048
|
+
const node = ts30.factory.createBinaryExpression(lhs, op, rhs);
|
|
4885
5049
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4886
5050
|
return node;
|
|
4887
5051
|
}
|
|
4888
5052
|
visitChain(ast) {
|
|
4889
5053
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
4890
|
-
const node = wrapForDiagnostics(
|
|
5054
|
+
const node = wrapForDiagnostics(ts30.factory.createCommaListExpression(elements));
|
|
4891
5055
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4892
5056
|
return node;
|
|
4893
5057
|
}
|
|
@@ -4895,7 +5059,7 @@ var AstTranslator = class {
|
|
|
4895
5059
|
const condExpr = this.translate(ast.condition);
|
|
4896
5060
|
const trueExpr = this.translate(ast.trueExp);
|
|
4897
5061
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
4898
|
-
const node =
|
|
5062
|
+
const node = ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
4899
5063
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4900
5064
|
return node;
|
|
4901
5065
|
}
|
|
@@ -4906,26 +5070,26 @@ var AstTranslator = class {
|
|
|
4906
5070
|
throw new Error("Method not implemented.");
|
|
4907
5071
|
}
|
|
4908
5072
|
visitInterpolation(ast) {
|
|
4909
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
5073
|
+
return ast.expressions.reduce((lhs, ast2) => ts30.factory.createBinaryExpression(lhs, ts30.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts30.factory.createStringLiteral(""));
|
|
4910
5074
|
}
|
|
4911
5075
|
visitKeyedRead(ast) {
|
|
4912
5076
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4913
5077
|
const key = this.translate(ast.key);
|
|
4914
|
-
const node =
|
|
5078
|
+
const node = ts30.factory.createElementAccessExpression(receiver, key);
|
|
4915
5079
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4916
5080
|
return node;
|
|
4917
5081
|
}
|
|
4918
5082
|
visitKeyedWrite(ast) {
|
|
4919
5083
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4920
|
-
const left =
|
|
5084
|
+
const left = ts30.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
4921
5085
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
4922
|
-
const node = wrapForDiagnostics(
|
|
5086
|
+
const node = wrapForDiagnostics(ts30.factory.createBinaryExpression(left, ts30.SyntaxKind.EqualsToken, right));
|
|
4923
5087
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4924
5088
|
return node;
|
|
4925
5089
|
}
|
|
4926
5090
|
visitLiteralArray(ast) {
|
|
4927
5091
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
4928
|
-
const literal =
|
|
5092
|
+
const literal = ts30.factory.createArrayLiteralExpression(elements);
|
|
4929
5093
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
4930
5094
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4931
5095
|
return node;
|
|
@@ -4933,9 +5097,9 @@ var AstTranslator = class {
|
|
|
4933
5097
|
visitLiteralMap(ast) {
|
|
4934
5098
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
4935
5099
|
const value = this.translate(ast.values[idx]);
|
|
4936
|
-
return
|
|
5100
|
+
return ts30.factory.createPropertyAssignment(ts30.factory.createStringLiteral(key), value);
|
|
4937
5101
|
});
|
|
4938
|
-
const literal =
|
|
5102
|
+
const literal = ts30.factory.createObjectLiteralExpression(properties, true);
|
|
4939
5103
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
4940
5104
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4941
5105
|
return node;
|
|
@@ -4943,15 +5107,15 @@ var AstTranslator = class {
|
|
|
4943
5107
|
visitLiteralPrimitive(ast) {
|
|
4944
5108
|
let node;
|
|
4945
5109
|
if (ast.value === void 0) {
|
|
4946
|
-
node =
|
|
5110
|
+
node = ts30.factory.createIdentifier("undefined");
|
|
4947
5111
|
} else if (ast.value === null) {
|
|
4948
|
-
node =
|
|
5112
|
+
node = ts30.factory.createNull();
|
|
4949
5113
|
} else if (typeof ast.value === "string") {
|
|
4950
|
-
node =
|
|
5114
|
+
node = ts30.factory.createStringLiteral(ast.value);
|
|
4951
5115
|
} else if (typeof ast.value === "number") {
|
|
4952
5116
|
node = tsNumericExpression(ast.value);
|
|
4953
5117
|
} else if (typeof ast.value === "boolean") {
|
|
4954
|
-
node = ast.value ?
|
|
5118
|
+
node = ast.value ? ts30.factory.createTrue() : ts30.factory.createFalse();
|
|
4955
5119
|
} else {
|
|
4956
5120
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
4957
5121
|
}
|
|
@@ -4960,7 +5124,7 @@ var AstTranslator = class {
|
|
|
4960
5124
|
}
|
|
4961
5125
|
visitNonNullAssert(ast) {
|
|
4962
5126
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
4963
|
-
const node =
|
|
5127
|
+
const node = ts30.factory.createNonNullExpression(expr);
|
|
4964
5128
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4965
5129
|
return node;
|
|
4966
5130
|
}
|
|
@@ -4969,13 +5133,13 @@ var AstTranslator = class {
|
|
|
4969
5133
|
}
|
|
4970
5134
|
visitPrefixNot(ast) {
|
|
4971
5135
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
4972
|
-
const node =
|
|
5136
|
+
const node = ts30.factory.createLogicalNot(expression);
|
|
4973
5137
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4974
5138
|
return node;
|
|
4975
5139
|
}
|
|
4976
5140
|
visitPropertyRead(ast) {
|
|
4977
5141
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4978
|
-
const name =
|
|
5142
|
+
const name = ts30.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
4979
5143
|
addParseSpanInfo(name, ast.nameSpan);
|
|
4980
5144
|
const node = wrapForDiagnostics(name);
|
|
4981
5145
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -4983,12 +5147,12 @@ var AstTranslator = class {
|
|
|
4983
5147
|
}
|
|
4984
5148
|
visitPropertyWrite(ast) {
|
|
4985
5149
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4986
|
-
const left =
|
|
5150
|
+
const left = ts30.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
4987
5151
|
addParseSpanInfo(left, ast.nameSpan);
|
|
4988
5152
|
const leftWithPath = wrapForDiagnostics(left);
|
|
4989
5153
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
4990
5154
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
4991
|
-
const node = wrapForDiagnostics(
|
|
5155
|
+
const node = wrapForDiagnostics(ts30.factory.createBinaryExpression(leftWithPath, ts30.SyntaxKind.EqualsToken, right));
|
|
4992
5156
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4993
5157
|
return node;
|
|
4994
5158
|
}
|
|
@@ -4996,13 +5160,13 @@ var AstTranslator = class {
|
|
|
4996
5160
|
let node;
|
|
4997
5161
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4998
5162
|
if (this.config.strictSafeNavigationTypes) {
|
|
4999
|
-
const expr =
|
|
5163
|
+
const expr = ts30.factory.createPropertyAccessExpression(ts30.factory.createNonNullExpression(receiver), ast.name);
|
|
5000
5164
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
5001
|
-
node =
|
|
5165
|
+
node = ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
5002
5166
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
5003
|
-
node =
|
|
5167
|
+
node = ts30.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
5004
5168
|
} else {
|
|
5005
|
-
const expr =
|
|
5169
|
+
const expr = ts30.factory.createPropertyAccessExpression(ts30.factory.createNonNullExpression(receiver), ast.name);
|
|
5006
5170
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
5007
5171
|
node = tsCastToAny(expr);
|
|
5008
5172
|
}
|
|
@@ -5014,13 +5178,13 @@ var AstTranslator = class {
|
|
|
5014
5178
|
const key = this.translate(ast.key);
|
|
5015
5179
|
let node;
|
|
5016
5180
|
if (this.config.strictSafeNavigationTypes) {
|
|
5017
|
-
const expr =
|
|
5181
|
+
const expr = ts30.factory.createElementAccessExpression(ts30.factory.createNonNullExpression(receiver), key);
|
|
5018
5182
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
5019
|
-
node =
|
|
5183
|
+
node = ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
5020
5184
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
5021
|
-
node =
|
|
5185
|
+
node = ts30.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
5022
5186
|
} else {
|
|
5023
|
-
const expr =
|
|
5187
|
+
const expr = ts30.factory.createElementAccessExpression(ts30.factory.createNonNullExpression(receiver), key);
|
|
5024
5188
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
5025
5189
|
node = tsCastToAny(expr);
|
|
5026
5190
|
}
|
|
@@ -5037,7 +5201,7 @@ var AstTranslator = class {
|
|
|
5037
5201
|
expr = resolved;
|
|
5038
5202
|
} else {
|
|
5039
5203
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
5040
|
-
expr =
|
|
5204
|
+
expr = ts30.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
5041
5205
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
5042
5206
|
}
|
|
5043
5207
|
} else {
|
|
@@ -5047,7 +5211,7 @@ var AstTranslator = class {
|
|
|
5047
5211
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
5048
5212
|
node = this.convertToSafeCall(ast, expr, args);
|
|
5049
5213
|
} else {
|
|
5050
|
-
node =
|
|
5214
|
+
node = ts30.factory.createCallExpression(expr, void 0, args);
|
|
5051
5215
|
}
|
|
5052
5216
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
5053
5217
|
return node;
|
|
@@ -5061,13 +5225,13 @@ var AstTranslator = class {
|
|
|
5061
5225
|
}
|
|
5062
5226
|
convertToSafeCall(ast, expr, args) {
|
|
5063
5227
|
if (this.config.strictSafeNavigationTypes) {
|
|
5064
|
-
const call =
|
|
5065
|
-
return
|
|
5228
|
+
const call = ts30.factory.createCallExpression(ts30.factory.createNonNullExpression(expr), void 0, args);
|
|
5229
|
+
return ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
5066
5230
|
}
|
|
5067
5231
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
5068
|
-
return
|
|
5232
|
+
return ts30.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
5069
5233
|
}
|
|
5070
|
-
return tsCastToAny(
|
|
5234
|
+
return tsCastToAny(ts30.factory.createCallExpression(ts30.factory.createNonNullExpression(expr), void 0, args));
|
|
5071
5235
|
}
|
|
5072
5236
|
};
|
|
5073
5237
|
var _VeSafeLhsInferenceBugDetector = class {
|
|
@@ -5155,7 +5319,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
5155
5319
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
|
|
5156
5320
|
const scope = Scope.forNodes(tcb, null, null, tcb.boundTarget.target.template, null);
|
|
5157
5321
|
const ctxRawType = env.referenceType(ref);
|
|
5158
|
-
if (!
|
|
5322
|
+
if (!ts31.isTypeReferenceNode(ctxRawType)) {
|
|
5159
5323
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
5160
5324
|
}
|
|
5161
5325
|
let typeParameters = void 0;
|
|
@@ -5167,25 +5331,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
5167
5331
|
switch (genericContextBehavior) {
|
|
5168
5332
|
case TcbGenericContextBehavior.UseEmitter:
|
|
5169
5333
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
5170
|
-
typeArguments = typeParameters.map((param) =>
|
|
5334
|
+
typeArguments = typeParameters.map((param) => ts31.factory.createTypeReferenceNode(param.name));
|
|
5171
5335
|
break;
|
|
5172
5336
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
5173
5337
|
typeParameters = [...ref.node.typeParameters];
|
|
5174
|
-
typeArguments = typeParameters.map((param) =>
|
|
5338
|
+
typeArguments = typeParameters.map((param) => ts31.factory.createTypeReferenceNode(param.name));
|
|
5175
5339
|
break;
|
|
5176
5340
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
5177
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
5341
|
+
typeArguments = ref.node.typeParameters.map(() => ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5178
5342
|
break;
|
|
5179
5343
|
}
|
|
5180
5344
|
}
|
|
5181
5345
|
const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
|
|
5182
5346
|
const scopeStatements = scope.render();
|
|
5183
|
-
const innerBody =
|
|
5347
|
+
const innerBody = ts31.factory.createBlock([
|
|
5184
5348
|
...env.getPreludeStatements(),
|
|
5185
5349
|
...scopeStatements
|
|
5186
5350
|
]);
|
|
5187
|
-
const body =
|
|
5188
|
-
const fnDecl =
|
|
5351
|
+
const body = ts31.factory.createBlock([ts31.factory.createIfStatement(ts31.factory.createTrue(), innerBody, void 0)]);
|
|
5352
|
+
const fnDecl = ts31.factory.createFunctionDeclaration(
|
|
5189
5353
|
void 0,
|
|
5190
5354
|
void 0,
|
|
5191
5355
|
name,
|
|
@@ -5234,7 +5398,7 @@ var TcbTemplateVariableOp = class extends TcbOp {
|
|
|
5234
5398
|
execute() {
|
|
5235
5399
|
const ctx = this.scope.resolve(this.template);
|
|
5236
5400
|
const id = this.tcb.allocateId();
|
|
5237
|
-
const initializer =
|
|
5401
|
+
const initializer = ts31.factory.createPropertyAccessExpression(
|
|
5238
5402
|
ctx,
|
|
5239
5403
|
this.variable.value || "$implicit"
|
|
5240
5404
|
);
|
|
@@ -5260,7 +5424,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
5260
5424
|
}
|
|
5261
5425
|
execute() {
|
|
5262
5426
|
const ctx = this.tcb.allocateId();
|
|
5263
|
-
const type =
|
|
5427
|
+
const type = ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword);
|
|
5264
5428
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
5265
5429
|
return ctx;
|
|
5266
5430
|
}
|
|
@@ -5313,16 +5477,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
5313
5477
|
}
|
|
5314
5478
|
let guard = null;
|
|
5315
5479
|
if (directiveGuards.length > 0) {
|
|
5316
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
5480
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts31.factory.createBinaryExpression(expr, ts31.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
5317
5481
|
}
|
|
5318
5482
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, this.template.children, guard);
|
|
5319
5483
|
const statements = tmplScope.render();
|
|
5320
5484
|
if (statements.length === 0) {
|
|
5321
5485
|
return null;
|
|
5322
5486
|
}
|
|
5323
|
-
let tmplBlock =
|
|
5487
|
+
let tmplBlock = ts31.factory.createBlock(statements);
|
|
5324
5488
|
if (guard !== null) {
|
|
5325
|
-
tmplBlock =
|
|
5489
|
+
tmplBlock = ts31.factory.createIfStatement(guard, tmplBlock);
|
|
5326
5490
|
}
|
|
5327
5491
|
this.scope.addStatement(tmplBlock);
|
|
5328
5492
|
return null;
|
|
@@ -5340,7 +5504,7 @@ var TcbExpressionOp = class extends TcbOp {
|
|
|
5340
5504
|
}
|
|
5341
5505
|
execute() {
|
|
5342
5506
|
const expr = tcbExpression(this.expression, this.tcb, this.scope);
|
|
5343
|
-
this.scope.addStatement(
|
|
5507
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(expr));
|
|
5344
5508
|
return null;
|
|
5345
5509
|
}
|
|
5346
5510
|
};
|
|
@@ -5362,11 +5526,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
5362
5526
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
5363
5527
|
type = rawType;
|
|
5364
5528
|
} else {
|
|
5365
|
-
if (!
|
|
5529
|
+
if (!ts31.isTypeReferenceNode(rawType)) {
|
|
5366
5530
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
5367
5531
|
}
|
|
5368
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
5369
|
-
type =
|
|
5532
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5533
|
+
type = ts31.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
5370
5534
|
}
|
|
5371
5535
|
const id = this.tcb.allocateId();
|
|
5372
5536
|
addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -5407,11 +5571,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
5407
5571
|
const id = this.tcb.allocateId();
|
|
5408
5572
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
5409
5573
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
5410
|
-
initializer =
|
|
5574
|
+
initializer = ts31.factory.createAsExpression(initializer, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5411
5575
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
5412
|
-
initializer =
|
|
5413
|
-
initializer =
|
|
5414
|
-
initializer =
|
|
5576
|
+
initializer = ts31.factory.createAsExpression(initializer, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5577
|
+
initializer = ts31.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
5578
|
+
initializer = ts31.factory.createParenthesizedExpression(initializer);
|
|
5415
5579
|
}
|
|
5416
5580
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
5417
5581
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -5510,7 +5674,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5510
5674
|
type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
|
|
5511
5675
|
} else {
|
|
5512
5676
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
5513
|
-
if (!
|
|
5677
|
+
if (!ts31.isTypeReferenceNode(dirTypeRef)) {
|
|
5514
5678
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
5515
5679
|
}
|
|
5516
5680
|
type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
|
|
@@ -5526,10 +5690,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5526
5690
|
}
|
|
5527
5691
|
const id = this.tcb.allocateId();
|
|
5528
5692
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
5529
|
-
if (!
|
|
5693
|
+
if (!ts31.isTypeReferenceNode(dirTypeRef)) {
|
|
5530
5694
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
5531
5695
|
}
|
|
5532
|
-
const type =
|
|
5696
|
+
const type = ts31.factory.createIndexedAccessTypeNode(ts31.factory.createTypeQueryNode(dirId), ts31.factory.createLiteralTypeNode(ts31.factory.createStringLiteral(fieldName)));
|
|
5533
5697
|
const temp = tsDeclareVariable(id, type);
|
|
5534
5698
|
this.scope.addStatement(temp);
|
|
5535
5699
|
target = id;
|
|
@@ -5537,14 +5701,14 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5537
5701
|
if (dirId === null) {
|
|
5538
5702
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
5539
5703
|
}
|
|
5540
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
5704
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts31.factory.createElementAccessExpression(dirId, ts31.factory.createStringLiteral(fieldName)) : ts31.factory.createPropertyAccessExpression(dirId, ts31.factory.createIdentifier(fieldName));
|
|
5541
5705
|
}
|
|
5542
5706
|
if (isSignal) {
|
|
5543
5707
|
const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(R3Identifiers3.InputSignalBrandWriteType.moduleName, R3Identifiers3.InputSignalBrandWriteType.name);
|
|
5544
|
-
if (!
|
|
5708
|
+
if (!ts31.isIdentifier(inputSignalBrandWriteSymbol) && !ts31.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
|
|
5545
5709
|
throw new Error(`Expected identifier or property access for reference to ${R3Identifiers3.InputSignalBrandWriteType.name}`);
|
|
5546
5710
|
}
|
|
5547
|
-
target =
|
|
5711
|
+
target = ts31.factory.createElementAccessExpression(target, inputSignalBrandWriteSymbol);
|
|
5548
5712
|
}
|
|
5549
5713
|
if (attr.attribute.keySpan !== void 0) {
|
|
5550
5714
|
addParseSpanInfo(target, attr.attribute.keySpan);
|
|
@@ -5552,13 +5716,13 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5552
5716
|
if (isTwoWayBinding && this.tcb.env.config.allowSignalsInTwoWayBindings) {
|
|
5553
5717
|
assignment = unwrapWritableSignal(assignment, this.tcb);
|
|
5554
5718
|
}
|
|
5555
|
-
assignment =
|
|
5719
|
+
assignment = ts31.factory.createBinaryExpression(target, ts31.SyntaxKind.EqualsToken, assignment);
|
|
5556
5720
|
}
|
|
5557
5721
|
addParseSpanInfo(assignment, attr.attribute.sourceSpan);
|
|
5558
5722
|
if (!this.tcb.env.config.checkTypeOfAttributes && attr.attribute instanceof TmplAstTextAttribute2) {
|
|
5559
5723
|
markIgnoreDiagnostics(assignment);
|
|
5560
5724
|
}
|
|
5561
|
-
this.scope.addStatement(
|
|
5725
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(assignment));
|
|
5562
5726
|
}
|
|
5563
5727
|
this.checkRequiredInputs(seenRequiredInputs);
|
|
5564
5728
|
return null;
|
|
@@ -5589,7 +5753,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
5589
5753
|
execute() {
|
|
5590
5754
|
const id = this.tcb.allocateId();
|
|
5591
5755
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
5592
|
-
const circularPlaceholder =
|
|
5756
|
+
const circularPlaceholder = ts31.factory.createCallExpression(typeCtor, void 0, [ts31.factory.createNonNullExpression(ts31.factory.createNull())]);
|
|
5593
5757
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
5594
5758
|
return id;
|
|
5595
5759
|
}
|
|
@@ -5631,7 +5795,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5631
5795
|
this.ngContentSelectors = ngContentSelectors;
|
|
5632
5796
|
this.componentName = componentName;
|
|
5633
5797
|
this.optional = false;
|
|
5634
|
-
this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ?
|
|
5798
|
+
this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts31.DiagnosticCategory.Error : ts31.DiagnosticCategory.Warning;
|
|
5635
5799
|
}
|
|
5636
5800
|
execute() {
|
|
5637
5801
|
const controlFlowToCheck = this.findPotentialControlFlowNodes();
|
|
@@ -5657,8 +5821,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5657
5821
|
findPotentialControlFlowNodes() {
|
|
5658
5822
|
const result = [];
|
|
5659
5823
|
for (const child of this.element.children) {
|
|
5660
|
-
|
|
5661
|
-
if (child instanceof TmplAstForLoopBlock2) {
|
|
5824
|
+
if (child instanceof TmplAstForLoopBlock) {
|
|
5662
5825
|
if (this.shouldCheck(child)) {
|
|
5663
5826
|
result.push(child);
|
|
5664
5827
|
}
|
|
@@ -5666,19 +5829,17 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5666
5829
|
result.push(child.empty);
|
|
5667
5830
|
}
|
|
5668
5831
|
} else if (child instanceof TmplAstIfBlock) {
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5832
|
+
for (const branch of child.branches) {
|
|
5833
|
+
if (this.shouldCheck(branch)) {
|
|
5834
|
+
result.push(branch);
|
|
5835
|
+
}
|
|
5836
|
+
}
|
|
5837
|
+
} else if (child instanceof TmplAstSwitchBlock) {
|
|
5838
|
+
for (const current of child.cases) {
|
|
5839
|
+
if (this.shouldCheck(current)) {
|
|
5840
|
+
result.push(current);
|
|
5841
|
+
}
|
|
5677
5842
|
}
|
|
5678
|
-
return count;
|
|
5679
|
-
}, 0);
|
|
5680
|
-
if (rootNodeCount > 1) {
|
|
5681
|
-
result.push(eligibleNode);
|
|
5682
5843
|
}
|
|
5683
5844
|
}
|
|
5684
5845
|
return result;
|
|
@@ -5687,13 +5848,16 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5687
5848
|
if (node.children.length < 2) {
|
|
5688
5849
|
return false;
|
|
5689
5850
|
}
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5851
|
+
let hasSeenRootNode = false;
|
|
5852
|
+
for (const child of node.children) {
|
|
5853
|
+
if (!(child instanceof TmplAstText) || this.tcb.hostPreserveWhitespaces || child.value.trim().length > 0) {
|
|
5854
|
+
if (hasSeenRootNode) {
|
|
5855
|
+
return true;
|
|
5856
|
+
}
|
|
5857
|
+
hasSeenRootNode = true;
|
|
5693
5858
|
}
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
return rootNodeCount > 1;
|
|
5859
|
+
}
|
|
5860
|
+
return false;
|
|
5697
5861
|
}
|
|
5698
5862
|
};
|
|
5699
5863
|
var ATTR_TO_PROP = new Map(Object.entries({
|
|
@@ -5730,15 +5894,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
5730
5894
|
elId = this.scope.resolve(this.element);
|
|
5731
5895
|
}
|
|
5732
5896
|
const propertyName = (_a = ATTR_TO_PROP.get(binding.name)) != null ? _a : binding.name;
|
|
5733
|
-
const prop =
|
|
5734
|
-
const stmt =
|
|
5897
|
+
const prop = ts31.factory.createElementAccessExpression(elId, ts31.factory.createStringLiteral(propertyName));
|
|
5898
|
+
const stmt = ts31.factory.createBinaryExpression(prop, ts31.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
5735
5899
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
5736
|
-
this.scope.addStatement(
|
|
5900
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(stmt));
|
|
5737
5901
|
} else {
|
|
5738
|
-
this.scope.addStatement(
|
|
5902
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(expr));
|
|
5739
5903
|
}
|
|
5740
5904
|
} else {
|
|
5741
|
-
this.scope.addStatement(
|
|
5905
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(expr));
|
|
5742
5906
|
}
|
|
5743
5907
|
}
|
|
5744
5908
|
return null;
|
|
@@ -5770,18 +5934,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
5770
5934
|
if (dirId === null) {
|
|
5771
5935
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
5772
5936
|
}
|
|
5773
|
-
const outputField =
|
|
5937
|
+
const outputField = ts31.factory.createElementAccessExpression(dirId, ts31.factory.createStringLiteral(field));
|
|
5774
5938
|
addParseSpanInfo(outputField, output.keySpan);
|
|
5775
5939
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
5776
5940
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
5777
|
-
const subscribeFn =
|
|
5778
|
-
const call =
|
|
5941
|
+
const subscribeFn = ts31.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
5942
|
+
const call = ts31.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
5779
5943
|
addParseSpanInfo(call, output.sourceSpan);
|
|
5780
|
-
this.scope.addStatement(
|
|
5944
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(call));
|
|
5781
5945
|
} else {
|
|
5782
|
-
this.scope.addStatement(
|
|
5946
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(outputField));
|
|
5783
5947
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
5784
|
-
this.scope.addStatement(
|
|
5948
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(handler));
|
|
5785
5949
|
}
|
|
5786
5950
|
}
|
|
5787
5951
|
return null;
|
|
@@ -5813,24 +5977,24 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
5813
5977
|
if (output.type === ParsedEventType.Animation) {
|
|
5814
5978
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
5815
5979
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
5816
|
-
this.scope.addStatement(
|
|
5980
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(handler));
|
|
5817
5981
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
5818
5982
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
5819
5983
|
if (elId === null) {
|
|
5820
5984
|
elId = this.scope.resolve(this.element);
|
|
5821
5985
|
}
|
|
5822
|
-
const propertyAccess =
|
|
5986
|
+
const propertyAccess = ts31.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
5823
5987
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
5824
|
-
const call =
|
|
5988
|
+
const call = ts31.factory.createCallExpression(
|
|
5825
5989
|
propertyAccess,
|
|
5826
5990
|
void 0,
|
|
5827
|
-
[
|
|
5991
|
+
[ts31.factory.createStringLiteral(output.name), handler]
|
|
5828
5992
|
);
|
|
5829
5993
|
addParseSpanInfo(call, output.sourceSpan);
|
|
5830
|
-
this.scope.addStatement(
|
|
5994
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(call));
|
|
5831
5995
|
} else {
|
|
5832
5996
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
5833
|
-
this.scope.addStatement(
|
|
5997
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(handler));
|
|
5834
5998
|
}
|
|
5835
5999
|
}
|
|
5836
6000
|
return null;
|
|
@@ -5843,11 +6007,11 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
5843
6007
|
this.optional = false;
|
|
5844
6008
|
}
|
|
5845
6009
|
execute() {
|
|
5846
|
-
const ctx =
|
|
5847
|
-
const ctxDot =
|
|
6010
|
+
const ctx = ts31.factory.createThis();
|
|
6011
|
+
const ctxDot = ts31.factory.createPropertyAccessExpression(ctx, "");
|
|
5848
6012
|
markIgnoreDiagnostics(ctxDot);
|
|
5849
6013
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
5850
|
-
this.scope.addStatement(
|
|
6014
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(ctxDot));
|
|
5851
6015
|
return null;
|
|
5852
6016
|
}
|
|
5853
6017
|
};
|
|
@@ -5912,14 +6076,14 @@ var TcbIfOp = class extends TcbOp {
|
|
|
5912
6076
|
}
|
|
5913
6077
|
if (branch.expression === null) {
|
|
5914
6078
|
const branchScope = Scope.forNodes(this.tcb, this.scope, null, branch.children, this.generateBranchGuard(index));
|
|
5915
|
-
return
|
|
6079
|
+
return ts31.factory.createBlock(branchScope.render());
|
|
5916
6080
|
}
|
|
5917
6081
|
const expressionScope = Scope.forNodes(this.tcb, this.scope, branch, [], null);
|
|
5918
6082
|
expressionScope.render().forEach((stmt) => this.scope.addStatement(stmt));
|
|
5919
6083
|
this.expressionScopes.set(branch, expressionScope);
|
|
5920
6084
|
const expression = branch.expressionAlias === null ? tcbExpression(branch.expression, this.tcb, expressionScope) : expressionScope.resolve(branch.expressionAlias);
|
|
5921
6085
|
const bodyScope = Scope.forNodes(this.tcb, expressionScope, null, branch.children, this.generateBranchGuard(index));
|
|
5922
|
-
return
|
|
6086
|
+
return ts31.factory.createIfStatement(expression, ts31.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
|
|
5923
6087
|
}
|
|
5924
6088
|
generateBranchGuard(index) {
|
|
5925
6089
|
let guard = null;
|
|
@@ -5939,8 +6103,8 @@ var TcbIfOp = class extends TcbOp {
|
|
|
5939
6103
|
} else {
|
|
5940
6104
|
expression = expressionScope.resolve(branch.expressionAlias);
|
|
5941
6105
|
}
|
|
5942
|
-
const comparisonExpression = i === index ? expression :
|
|
5943
|
-
guard = guard === null ? comparisonExpression :
|
|
6106
|
+
const comparisonExpression = i === index ? expression : ts31.factory.createPrefixUnaryExpression(ts31.SyntaxKind.ExclamationToken, ts31.factory.createParenthesizedExpression(expression));
|
|
6107
|
+
guard = guard === null ? comparisonExpression : ts31.factory.createBinaryExpression(guard, ts31.SyntaxKind.AmpersandAmpersandToken, comparisonExpression);
|
|
5944
6108
|
}
|
|
5945
6109
|
return guard;
|
|
5946
6110
|
}
|
|
@@ -5958,7 +6122,7 @@ var TcbSwitchOp = class extends TcbOp {
|
|
|
5958
6122
|
execute() {
|
|
5959
6123
|
const comparisonExpression = tcbExpression(this.block.expression, this.tcb, this.scope);
|
|
5960
6124
|
markIgnoreDiagnostics(comparisonExpression);
|
|
5961
|
-
const expression =
|
|
6125
|
+
const expression = ts31.factory.createParenthesizedExpression(comparisonExpression);
|
|
5962
6126
|
const root = this.generateCase(0, expression, null);
|
|
5963
6127
|
if (root !== void 0) {
|
|
5964
6128
|
this.scope.addStatement(root);
|
|
@@ -5969,7 +6133,7 @@ var TcbSwitchOp = class extends TcbOp {
|
|
|
5969
6133
|
if (index >= this.block.cases.length) {
|
|
5970
6134
|
if (defaultCase !== null) {
|
|
5971
6135
|
const defaultScope = Scope.forNodes(this.tcb, this.scope, null, defaultCase.children, this.generateGuard(defaultCase, switchValue));
|
|
5972
|
-
return
|
|
6136
|
+
return ts31.factory.createBlock(defaultScope.render());
|
|
5973
6137
|
}
|
|
5974
6138
|
return void 0;
|
|
5975
6139
|
}
|
|
@@ -5979,13 +6143,13 @@ var TcbSwitchOp = class extends TcbOp {
|
|
|
5979
6143
|
}
|
|
5980
6144
|
const caseScope = Scope.forNodes(this.tcb, this.scope, null, current.children, this.generateGuard(current, switchValue));
|
|
5981
6145
|
const caseValue = tcbExpression(current.expression, this.tcb, caseScope);
|
|
5982
|
-
return
|
|
6146
|
+
return ts31.factory.createIfStatement(ts31.factory.createBinaryExpression(switchValue, ts31.SyntaxKind.EqualsEqualsEqualsToken, caseValue), ts31.factory.createBlock(caseScope.render()), this.generateCase(index + 1, switchValue, defaultCase));
|
|
5983
6147
|
}
|
|
5984
6148
|
generateGuard(node, switchValue) {
|
|
5985
6149
|
if (node.expression !== null) {
|
|
5986
6150
|
const expression = tcbExpression(node.expression, this.tcb, this.scope);
|
|
5987
6151
|
markIgnoreDiagnostics(expression);
|
|
5988
|
-
return
|
|
6152
|
+
return ts31.factory.createBinaryExpression(switchValue, ts31.SyntaxKind.EqualsEqualsEqualsToken, expression);
|
|
5989
6153
|
}
|
|
5990
6154
|
let guard = null;
|
|
5991
6155
|
for (const current of this.block.cases) {
|
|
@@ -5994,11 +6158,11 @@ var TcbSwitchOp = class extends TcbOp {
|
|
|
5994
6158
|
}
|
|
5995
6159
|
const expression = tcbExpression(current.expression, this.tcb, this.scope);
|
|
5996
6160
|
markIgnoreDiagnostics(expression);
|
|
5997
|
-
const comparison =
|
|
6161
|
+
const comparison = ts31.factory.createBinaryExpression(switchValue, ts31.SyntaxKind.ExclamationEqualsEqualsToken, expression);
|
|
5998
6162
|
if (guard === null) {
|
|
5999
6163
|
guard = comparison;
|
|
6000
6164
|
} else {
|
|
6001
|
-
guard =
|
|
6165
|
+
guard = ts31.factory.createBinaryExpression(guard, ts31.SyntaxKind.AmpersandAmpersandToken, comparison);
|
|
6002
6166
|
}
|
|
6003
6167
|
}
|
|
6004
6168
|
return guard;
|
|
@@ -6017,23 +6181,23 @@ var TcbForOfOp = class extends TcbOp {
|
|
|
6017
6181
|
execute() {
|
|
6018
6182
|
const loopScope = Scope.forNodes(this.tcb, this.scope, this.block, this.block.children, null);
|
|
6019
6183
|
const initializerId = loopScope.resolve(this.block.item);
|
|
6020
|
-
if (!
|
|
6184
|
+
if (!ts31.isIdentifier(initializerId)) {
|
|
6021
6185
|
throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
|
|
6022
6186
|
}
|
|
6023
|
-
const initializer =
|
|
6187
|
+
const initializer = ts31.factory.createVariableDeclarationList([ts31.factory.createVariableDeclaration(initializerId)], ts31.NodeFlags.Const);
|
|
6024
6188
|
addParseSpanInfo(initializer, this.block.item.keySpan);
|
|
6025
|
-
const expression =
|
|
6189
|
+
const expression = ts31.factory.createNonNullExpression(tcbExpression(this.block.expression, this.tcb, loopScope));
|
|
6026
6190
|
const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
|
|
6027
6191
|
const trackExpression = trackTranslator.translate(this.block.trackBy);
|
|
6028
6192
|
const statements = [
|
|
6029
6193
|
...loopScope.render(),
|
|
6030
|
-
|
|
6194
|
+
ts31.factory.createExpressionStatement(trackExpression)
|
|
6031
6195
|
];
|
|
6032
|
-
this.scope.addStatement(
|
|
6196
|
+
this.scope.addStatement(ts31.factory.createForOfStatement(void 0, initializer, expression, ts31.factory.createBlock(statements)));
|
|
6033
6197
|
return null;
|
|
6034
6198
|
}
|
|
6035
6199
|
};
|
|
6036
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
6200
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts31.factory.createNonNullExpression(ts31.factory.createNull());
|
|
6037
6201
|
var Context = class {
|
|
6038
6202
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
|
|
6039
6203
|
this.env = env;
|
|
@@ -6048,7 +6212,7 @@ var Context = class {
|
|
|
6048
6212
|
this.nextId = 1;
|
|
6049
6213
|
}
|
|
6050
6214
|
allocateId() {
|
|
6051
|
-
return
|
|
6215
|
+
return ts31.factory.createIdentifier(`_t${this.nextId++}`);
|
|
6052
6216
|
}
|
|
6053
6217
|
getPipeByName(name) {
|
|
6054
6218
|
if (!this.pipes.has(name)) {
|
|
@@ -6091,15 +6255,15 @@ var _Scope = class {
|
|
|
6091
6255
|
if (expression !== null && expressionAlias !== null) {
|
|
6092
6256
|
this.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
|
|
6093
6257
|
}
|
|
6094
|
-
} else if (scopedNode instanceof
|
|
6258
|
+
} else if (scopedNode instanceof TmplAstForLoopBlock) {
|
|
6095
6259
|
const loopInitializer = tcb.allocateId();
|
|
6096
6260
|
addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
|
|
6097
6261
|
scope.varMap.set(scopedNode.item, loopInitializer);
|
|
6098
|
-
for (const
|
|
6099
|
-
if (!this.forLoopContextVariableTypes.has(
|
|
6100
|
-
throw new Error(`Unrecognized for loop context variable ${name}`);
|
|
6262
|
+
for (const variable of scopedNode.contextVariables) {
|
|
6263
|
+
if (!this.forLoopContextVariableTypes.has(variable.value)) {
|
|
6264
|
+
throw new Error(`Unrecognized for loop context variable ${variable.name}`);
|
|
6101
6265
|
}
|
|
6102
|
-
const type =
|
|
6266
|
+
const type = ts31.factory.createKeywordTypeNode(this.forLoopContextVariableTypes.get(variable.value));
|
|
6103
6267
|
this.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
|
|
6104
6268
|
}
|
|
6105
6269
|
}
|
|
@@ -6116,16 +6280,16 @@ var _Scope = class {
|
|
|
6116
6280
|
const res = this.resolveLocal(node, directive);
|
|
6117
6281
|
if (res !== null) {
|
|
6118
6282
|
let clone;
|
|
6119
|
-
if (
|
|
6120
|
-
clone =
|
|
6121
|
-
} else if (
|
|
6122
|
-
clone =
|
|
6283
|
+
if (ts31.isIdentifier(res)) {
|
|
6284
|
+
clone = ts31.factory.createIdentifier(res.text);
|
|
6285
|
+
} else if (ts31.isNonNullExpression(res)) {
|
|
6286
|
+
clone = ts31.factory.createNonNullExpression(res.expression);
|
|
6123
6287
|
} else {
|
|
6124
6288
|
throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
|
|
6125
6289
|
}
|
|
6126
|
-
|
|
6290
|
+
ts31.setOriginalNode(clone, res);
|
|
6127
6291
|
clone.parent = clone.parent;
|
|
6128
|
-
return
|
|
6292
|
+
return ts31.setSyntheticTrailingComments(clone, []);
|
|
6129
6293
|
} else if (this.parent !== null) {
|
|
6130
6294
|
return this.parent.resolve(node, directive);
|
|
6131
6295
|
} else {
|
|
@@ -6152,7 +6316,7 @@ var _Scope = class {
|
|
|
6152
6316
|
} else if (parentGuards === null) {
|
|
6153
6317
|
return this.guard;
|
|
6154
6318
|
} else {
|
|
6155
|
-
return
|
|
6319
|
+
return ts31.factory.createBinaryExpression(parentGuards, ts31.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
6156
6320
|
}
|
|
6157
6321
|
}
|
|
6158
6322
|
resolveLocal(ref, directive) {
|
|
@@ -6224,13 +6388,15 @@ var _Scope = class {
|
|
|
6224
6388
|
this.opQueue.push(new TcbIfOp(this.tcb, this, node));
|
|
6225
6389
|
} else if (node instanceof TmplAstSwitchBlock) {
|
|
6226
6390
|
this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.expression), new TcbSwitchOp(this.tcb, this, node));
|
|
6227
|
-
} else if (node instanceof
|
|
6391
|
+
} else if (node instanceof TmplAstForLoopBlock) {
|
|
6228
6392
|
this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
|
|
6229
6393
|
node.empty && this.appendChildren(node.empty);
|
|
6230
6394
|
} else if (node instanceof TmplAstBoundText) {
|
|
6231
6395
|
this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.value));
|
|
6232
6396
|
} else if (node instanceof TmplAstIcu) {
|
|
6233
6397
|
this.appendIcuExpressions(node);
|
|
6398
|
+
} else if (node instanceof TmplAstContent) {
|
|
6399
|
+
this.appendChildren(node);
|
|
6234
6400
|
}
|
|
6235
6401
|
}
|
|
6236
6402
|
appendChildren(node) {
|
|
@@ -6400,21 +6566,21 @@ var _Scope = class {
|
|
|
6400
6566
|
var Scope = _Scope;
|
|
6401
6567
|
(() => {
|
|
6402
6568
|
_Scope.forLoopContextVariableTypes = /* @__PURE__ */ new Map([
|
|
6403
|
-
["$first",
|
|
6404
|
-
["$last",
|
|
6405
|
-
["$even",
|
|
6406
|
-
["$odd",
|
|
6407
|
-
["$index",
|
|
6408
|
-
["$count",
|
|
6569
|
+
["$first", ts31.SyntaxKind.BooleanKeyword],
|
|
6570
|
+
["$last", ts31.SyntaxKind.BooleanKeyword],
|
|
6571
|
+
["$even", ts31.SyntaxKind.BooleanKeyword],
|
|
6572
|
+
["$odd", ts31.SyntaxKind.BooleanKeyword],
|
|
6573
|
+
["$index", ts31.SyntaxKind.NumberKeyword],
|
|
6574
|
+
["$count", ts31.SyntaxKind.NumberKeyword]
|
|
6409
6575
|
]);
|
|
6410
6576
|
})();
|
|
6411
6577
|
function tcbThisParam(name, typeArguments) {
|
|
6412
|
-
return
|
|
6578
|
+
return ts31.factory.createParameterDeclaration(
|
|
6413
6579
|
void 0,
|
|
6414
6580
|
void 0,
|
|
6415
6581
|
"this",
|
|
6416
6582
|
void 0,
|
|
6417
|
-
|
|
6583
|
+
ts31.factory.createTypeReferenceNode(name, typeArguments),
|
|
6418
6584
|
void 0
|
|
6419
6585
|
);
|
|
6420
6586
|
}
|
|
@@ -6439,11 +6605,11 @@ var TcbExpressionTranslator = class {
|
|
|
6439
6605
|
return null;
|
|
6440
6606
|
}
|
|
6441
6607
|
const expr = this.translate(ast.value);
|
|
6442
|
-
const result =
|
|
6608
|
+
const result = ts31.factory.createParenthesizedExpression(ts31.factory.createBinaryExpression(target, ts31.SyntaxKind.EqualsToken, expr));
|
|
6443
6609
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
6444
6610
|
return result;
|
|
6445
6611
|
} else if (ast instanceof ImplicitReceiver3) {
|
|
6446
|
-
return
|
|
6612
|
+
return ts31.factory.createThis();
|
|
6447
6613
|
} else if (ast instanceof BindingPipe) {
|
|
6448
6614
|
const expr = this.translate(ast.exp);
|
|
6449
6615
|
const pipeMeta = this.tcb.getPipeByName(ast.name);
|
|
@@ -6458,12 +6624,12 @@ var TcbExpressionTranslator = class {
|
|
|
6458
6624
|
pipe = this.tcb.env.pipeInst(pipeMeta.ref);
|
|
6459
6625
|
}
|
|
6460
6626
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
6461
|
-
let methodAccess =
|
|
6627
|
+
let methodAccess = ts31.factory.createPropertyAccessExpression(pipe, "transform");
|
|
6462
6628
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
6463
6629
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
6464
|
-
methodAccess =
|
|
6630
|
+
methodAccess = ts31.factory.createAsExpression(methodAccess, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
6465
6631
|
}
|
|
6466
|
-
const result =
|
|
6632
|
+
const result = ts31.factory.createCallExpression(
|
|
6467
6633
|
methodAccess,
|
|
6468
6634
|
void 0,
|
|
6469
6635
|
[expr, ...args]
|
|
@@ -6473,8 +6639,8 @@ var TcbExpressionTranslator = class {
|
|
|
6473
6639
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
6474
6640
|
if (ast.receiver.receiver instanceof ImplicitReceiver3 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
6475
6641
|
const expr = this.translate(ast.args[0]);
|
|
6476
|
-
const exprAsAny =
|
|
6477
|
-
const result =
|
|
6642
|
+
const exprAsAny = ts31.factory.createAsExpression(expr, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
6643
|
+
const result = ts31.factory.createParenthesizedExpression(exprAsAny);
|
|
6478
6644
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
6479
6645
|
return result;
|
|
6480
6646
|
}
|
|
@@ -6485,7 +6651,7 @@ var TcbExpressionTranslator = class {
|
|
|
6485
6651
|
const method = wrapForDiagnostics(receiver);
|
|
6486
6652
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
6487
6653
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
6488
|
-
const node =
|
|
6654
|
+
const node = ts31.factory.createCallExpression(method, void 0, args);
|
|
6489
6655
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
6490
6656
|
return node;
|
|
6491
6657
|
} else {
|
|
@@ -6505,23 +6671,23 @@ var TcbExpressionTranslator = class {
|
|
|
6505
6671
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
6506
6672
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
6507
6673
|
const members = inputs.map((input) => {
|
|
6508
|
-
const propertyName =
|
|
6674
|
+
const propertyName = ts31.factory.createStringLiteral(input.field);
|
|
6509
6675
|
if (input.type === "binding") {
|
|
6510
6676
|
let expr = widenBinding(input.expression, tcb);
|
|
6511
6677
|
if (input.isTwoWayBinding && tcb.env.config.allowSignalsInTwoWayBindings) {
|
|
6512
6678
|
expr = unwrapWritableSignal(expr, tcb);
|
|
6513
6679
|
}
|
|
6514
|
-
const assignment =
|
|
6680
|
+
const assignment = ts31.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
6515
6681
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
6516
6682
|
return assignment;
|
|
6517
6683
|
} else {
|
|
6518
|
-
return
|
|
6684
|
+
return ts31.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
6519
6685
|
}
|
|
6520
6686
|
});
|
|
6521
|
-
return
|
|
6687
|
+
return ts31.factory.createCallExpression(
|
|
6522
6688
|
typeCtor,
|
|
6523
6689
|
void 0,
|
|
6524
|
-
[
|
|
6690
|
+
[ts31.factory.createObjectLiteralExpression(members)]
|
|
6525
6691
|
);
|
|
6526
6692
|
}
|
|
6527
6693
|
function getBoundAttributes(directive, node) {
|
|
@@ -6558,17 +6724,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
6558
6724
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
6559
6725
|
return tcbExpression(attr.value, tcb, scope);
|
|
6560
6726
|
} else {
|
|
6561
|
-
return
|
|
6727
|
+
return ts31.factory.createStringLiteral(attr.value);
|
|
6562
6728
|
}
|
|
6563
6729
|
}
|
|
6564
6730
|
function widenBinding(expr, tcb) {
|
|
6565
6731
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
6566
6732
|
return tsCastToAny(expr);
|
|
6567
6733
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
6568
|
-
if (
|
|
6734
|
+
if (ts31.isObjectLiteralExpression(expr) || ts31.isArrayLiteralExpression(expr)) {
|
|
6569
6735
|
return expr;
|
|
6570
6736
|
} else {
|
|
6571
|
-
return
|
|
6737
|
+
return ts31.factory.createNonNullExpression(expr);
|
|
6572
6738
|
}
|
|
6573
6739
|
} else {
|
|
6574
6740
|
return expr;
|
|
@@ -6576,7 +6742,7 @@ function widenBinding(expr, tcb) {
|
|
|
6576
6742
|
}
|
|
6577
6743
|
function unwrapWritableSignal(expression, tcb) {
|
|
6578
6744
|
const unwrapRef = tcb.env.referenceExternalSymbol(R3Identifiers3.unwrapWritableSignal.moduleName, R3Identifiers3.unwrapWritableSignal.name);
|
|
6579
|
-
return
|
|
6745
|
+
return ts31.factory.createCallExpression(unwrapRef, void 0, [expression]);
|
|
6580
6746
|
}
|
|
6581
6747
|
var EVENT_PARAMETER = "$event";
|
|
6582
6748
|
function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
@@ -6585,16 +6751,16 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
6585
6751
|
if (eventType === 0) {
|
|
6586
6752
|
eventParamType = void 0;
|
|
6587
6753
|
} else if (eventType === 1) {
|
|
6588
|
-
eventParamType =
|
|
6754
|
+
eventParamType = ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword);
|
|
6589
6755
|
} else {
|
|
6590
6756
|
eventParamType = eventType;
|
|
6591
6757
|
}
|
|
6592
6758
|
const guards = scope.guards();
|
|
6593
|
-
let body =
|
|
6759
|
+
let body = ts31.factory.createExpressionStatement(handler);
|
|
6594
6760
|
if (guards !== null) {
|
|
6595
|
-
body =
|
|
6761
|
+
body = ts31.factory.createIfStatement(guards, body);
|
|
6596
6762
|
}
|
|
6597
|
-
const eventParam =
|
|
6763
|
+
const eventParam = ts31.factory.createParameterDeclaration(
|
|
6598
6764
|
void 0,
|
|
6599
6765
|
void 0,
|
|
6600
6766
|
EVENT_PARAMETER,
|
|
@@ -6602,13 +6768,13 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
6602
6768
|
eventParamType
|
|
6603
6769
|
);
|
|
6604
6770
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
6605
|
-
return
|
|
6771
|
+
return ts31.factory.createArrowFunction(
|
|
6606
6772
|
void 0,
|
|
6607
6773
|
void 0,
|
|
6608
6774
|
[eventParam],
|
|
6609
|
-
|
|
6775
|
+
ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword),
|
|
6610
6776
|
void 0,
|
|
6611
|
-
|
|
6777
|
+
ts31.factory.createBlock([body])
|
|
6612
6778
|
);
|
|
6613
6779
|
}
|
|
6614
6780
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
@@ -6637,7 +6803,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
6637
6803
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
6638
6804
|
resolve(ast) {
|
|
6639
6805
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
6640
|
-
const event =
|
|
6806
|
+
const event = ts31.factory.createIdentifier(EVENT_PARAMETER);
|
|
6641
6807
|
addParseSpanInfo(event, ast.nameSpan);
|
|
6642
6808
|
return event;
|
|
6643
6809
|
}
|
|
@@ -6648,11 +6814,17 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
|
6648
6814
|
constructor(tcb, scope, block) {
|
|
6649
6815
|
super(tcb, scope);
|
|
6650
6816
|
this.block = block;
|
|
6817
|
+
this.allowedVariables = /* @__PURE__ */ new Set([block.item]);
|
|
6818
|
+
for (const variable of block.contextVariables) {
|
|
6819
|
+
if (variable.value === "$index") {
|
|
6820
|
+
this.allowedVariables.add(variable);
|
|
6821
|
+
}
|
|
6822
|
+
}
|
|
6651
6823
|
}
|
|
6652
6824
|
resolve(ast) {
|
|
6653
6825
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3) {
|
|
6654
6826
|
const target = this.tcb.boundTarget.getExpressionTarget(ast);
|
|
6655
|
-
if (target !== null &&
|
|
6827
|
+
if (target !== null && !this.allowedVariables.has(target)) {
|
|
6656
6828
|
this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
|
|
6657
6829
|
}
|
|
6658
6830
|
}
|
|
@@ -6661,19 +6833,19 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
|
6661
6833
|
};
|
|
6662
6834
|
|
|
6663
6835
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
6664
|
-
import
|
|
6836
|
+
import ts32 from "typescript";
|
|
6665
6837
|
var TypeCheckFile = class extends Environment {
|
|
6666
6838
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
6667
6839
|
super(config, new ImportManager({
|
|
6668
6840
|
forceGenerateNamespacesForNewImports: true,
|
|
6669
6841
|
shouldUseSingleQuotes: () => true
|
|
6670
|
-
}), refEmitter, reflector,
|
|
6842
|
+
}), refEmitter, reflector, ts32.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts32.ScriptTarget.Latest, true));
|
|
6671
6843
|
this.fileName = fileName;
|
|
6672
6844
|
this.nextTcbId = 1;
|
|
6673
6845
|
this.tcbStatements = [];
|
|
6674
6846
|
}
|
|
6675
6847
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
6676
|
-
const fnId =
|
|
6848
|
+
const fnId = ts32.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
6677
6849
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
6678
6850
|
this.tcbStatements.push(fn);
|
|
6679
6851
|
}
|
|
@@ -6683,22 +6855,22 @@ var TypeCheckFile = class extends Environment {
|
|
|
6683
6855
|
if (importChanges.updatedImports.size > 0) {
|
|
6684
6856
|
throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
|
|
6685
6857
|
}
|
|
6686
|
-
const printer =
|
|
6858
|
+
const printer = ts32.createPrinter({ removeComments });
|
|
6687
6859
|
let source = "";
|
|
6688
6860
|
const newImports = importChanges.newImports.get(this.contextFile.fileName);
|
|
6689
6861
|
if (newImports !== void 0) {
|
|
6690
|
-
source += newImports.map((i) => printer.printNode(
|
|
6862
|
+
source += newImports.map((i) => printer.printNode(ts32.EmitHint.Unspecified, i, this.contextFile)).join("\n");
|
|
6691
6863
|
}
|
|
6692
6864
|
source += "\n";
|
|
6693
6865
|
for (const stmt of this.pipeInstStatements) {
|
|
6694
|
-
source += printer.printNode(
|
|
6866
|
+
source += printer.printNode(ts32.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
6695
6867
|
}
|
|
6696
6868
|
for (const stmt of this.typeCtorStatements) {
|
|
6697
|
-
source += printer.printNode(
|
|
6869
|
+
source += printer.printNode(ts32.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
6698
6870
|
}
|
|
6699
6871
|
source += "\n";
|
|
6700
6872
|
for (const stmt of this.tcbStatements) {
|
|
6701
|
-
source += printer.printNode(
|
|
6873
|
+
source += printer.printNode(ts32.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
6702
6874
|
}
|
|
6703
6875
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
6704
6876
|
return source;
|
|
@@ -6811,7 +6983,7 @@ var TypeCheckContextImpl = class {
|
|
|
6811
6983
|
if (!this.opMap.has(sf)) {
|
|
6812
6984
|
return null;
|
|
6813
6985
|
}
|
|
6814
|
-
const printer =
|
|
6986
|
+
const printer = ts33.createPrinter({ omitTrailingSemicolon: true });
|
|
6815
6987
|
const importManager = new ImportManager({
|
|
6816
6988
|
forceGenerateNamespacesForNewImports: true,
|
|
6817
6989
|
shouldUseSingleQuotes: () => true
|
|
@@ -6827,7 +6999,7 @@ var TypeCheckContextImpl = class {
|
|
|
6827
6999
|
newImports.get(sf.fileName).forEach((newImport) => {
|
|
6828
7000
|
updates.push({
|
|
6829
7001
|
pos: 0,
|
|
6830
|
-
text: printer.printNode(
|
|
7002
|
+
text: printer.printNode(ts33.EmitHint.Unspecified, newImport, sf)
|
|
6831
7003
|
});
|
|
6832
7004
|
});
|
|
6833
7005
|
}
|
|
@@ -6838,7 +7010,7 @@ var TypeCheckContextImpl = class {
|
|
|
6838
7010
|
updates.push({
|
|
6839
7011
|
pos: oldBindings.getStart(),
|
|
6840
7012
|
deletePos: oldBindings.getEnd(),
|
|
6841
|
-
text: printer.printNode(
|
|
7013
|
+
text: printer.printNode(ts33.EmitHint.Unspecified, newBindings, sf)
|
|
6842
7014
|
});
|
|
6843
7015
|
}
|
|
6844
7016
|
const result = new MagicString(sf.text, { filename: sf.fileName });
|
|
@@ -6921,7 +7093,7 @@ var TypeCheckContextImpl = class {
|
|
|
6921
7093
|
if (span.start.offset === span.end.offset) {
|
|
6922
7094
|
span.end.offset++;
|
|
6923
7095
|
}
|
|
6924
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
7096
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts33.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
6925
7097
|
});
|
|
6926
7098
|
}
|
|
6927
7099
|
};
|
|
@@ -6939,9 +7111,9 @@ var InlineTcbOp = class {
|
|
|
6939
7111
|
}
|
|
6940
7112
|
execute(im, sf, refEmitter, printer) {
|
|
6941
7113
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
6942
|
-
const fnName =
|
|
7114
|
+
const fnName = ts33.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
6943
7115
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
6944
|
-
return printer.printNode(
|
|
7116
|
+
return printer.printNode(ts33.EmitHint.Unspecified, fn, sf);
|
|
6945
7117
|
}
|
|
6946
7118
|
};
|
|
6947
7119
|
var TypeCtorOp = class {
|
|
@@ -6956,7 +7128,7 @@ var TypeCtorOp = class {
|
|
|
6956
7128
|
execute(im, sf, refEmitter, printer) {
|
|
6957
7129
|
const emitEnv = new ReferenceEmitEnvironment(im, refEmitter, this.reflector, sf);
|
|
6958
7130
|
const tcb = generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
|
|
6959
|
-
return printer.printNode(
|
|
7131
|
+
return printer.printNode(ts33.EmitHint.Unspecified, tcb, sf);
|
|
6960
7132
|
}
|
|
6961
7133
|
};
|
|
6962
7134
|
|
|
@@ -7057,7 +7229,7 @@ var TemplateSourceManager = class {
|
|
|
7057
7229
|
|
|
7058
7230
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
7059
7231
|
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, PropertyWrite as PropertyWrite4, R3Identifiers as R3Identifiers4, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
7060
|
-
import
|
|
7232
|
+
import ts34 from "typescript";
|
|
7061
7233
|
var SymbolBuilder = class {
|
|
7062
7234
|
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
7063
7235
|
this.tcbPath = tcbPath;
|
|
@@ -7101,7 +7273,7 @@ var SymbolBuilder = class {
|
|
|
7101
7273
|
getSymbolOfElement(element) {
|
|
7102
7274
|
var _a;
|
|
7103
7275
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
7104
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
7276
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts34.isVariableDeclaration });
|
|
7105
7277
|
if (node === null) {
|
|
7106
7278
|
return null;
|
|
7107
7279
|
}
|
|
@@ -7121,12 +7293,12 @@ var SymbolBuilder = class {
|
|
|
7121
7293
|
var _a;
|
|
7122
7294
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
7123
7295
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
7124
|
-
const isDirectiveDeclaration = (node) => (
|
|
7296
|
+
const isDirectiveDeclaration = (node) => (ts34.isTypeNode(node) || ts34.isIdentifier(node)) && ts34.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
7125
7297
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
7126
7298
|
const symbols = [];
|
|
7127
7299
|
for (const node of nodes) {
|
|
7128
7300
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
7129
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
7301
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts34.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
7130
7302
|
continue;
|
|
7131
7303
|
}
|
|
7132
7304
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -7157,7 +7329,7 @@ var SymbolBuilder = class {
|
|
|
7157
7329
|
if (!isHostDirectiveMetaForGlobalMode(current)) {
|
|
7158
7330
|
throw new Error("Impossible state: typecheck code path in local compilation mode.");
|
|
7159
7331
|
}
|
|
7160
|
-
if (!
|
|
7332
|
+
if (!ts34.isClassDeclaration(current.directive.node)) {
|
|
7161
7333
|
continue;
|
|
7162
7334
|
}
|
|
7163
7335
|
const symbol = this.getSymbolOfTsNode(current.directive.node);
|
|
@@ -7230,17 +7402,17 @@ var SymbolBuilder = class {
|
|
|
7230
7402
|
if (!isAccessExpression(n2)) {
|
|
7231
7403
|
return false;
|
|
7232
7404
|
}
|
|
7233
|
-
if (
|
|
7405
|
+
if (ts34.isPropertyAccessExpression(n2)) {
|
|
7234
7406
|
return n2.name.getText() === expectedAccess;
|
|
7235
7407
|
} else {
|
|
7236
|
-
return
|
|
7408
|
+
return ts34.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
|
|
7237
7409
|
}
|
|
7238
7410
|
}
|
|
7239
7411
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
7240
7412
|
const bindings = [];
|
|
7241
7413
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
7242
7414
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
7243
|
-
if (!
|
|
7415
|
+
if (!ts34.isPropertyAccessExpression(outputFieldAccess)) {
|
|
7244
7416
|
continue;
|
|
7245
7417
|
}
|
|
7246
7418
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -7263,7 +7435,7 @@ var SymbolBuilder = class {
|
|
|
7263
7435
|
}
|
|
7264
7436
|
});
|
|
7265
7437
|
} else {
|
|
7266
|
-
if (!
|
|
7438
|
+
if (!ts34.isElementAccessExpression(outputFieldAccess)) {
|
|
7267
7439
|
continue;
|
|
7268
7440
|
}
|
|
7269
7441
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -7349,7 +7521,7 @@ var SymbolBuilder = class {
|
|
|
7349
7521
|
return null;
|
|
7350
7522
|
}
|
|
7351
7523
|
const [declaration] = tsSymbol.declarations;
|
|
7352
|
-
if (!
|
|
7524
|
+
if (!ts34.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
|
|
7353
7525
|
declaration.getSourceFile(),
|
|
7354
7526
|
(_a = declaration.type) != null ? _a : declaration.name,
|
|
7355
7527
|
ExpressionIdentifier.DIRECTIVE
|
|
@@ -7357,7 +7529,7 @@ var SymbolBuilder = class {
|
|
|
7357
7529
|
return null;
|
|
7358
7530
|
}
|
|
7359
7531
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
7360
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
7532
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts34.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
7361
7533
|
return null;
|
|
7362
7534
|
}
|
|
7363
7535
|
const ref = new Reference(symbol.tsSymbol.valueDeclaration);
|
|
@@ -7377,12 +7549,12 @@ var SymbolBuilder = class {
|
|
|
7377
7549
|
};
|
|
7378
7550
|
}
|
|
7379
7551
|
getSymbolOfVariable(variable) {
|
|
7380
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
7552
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts34.isVariableDeclaration });
|
|
7381
7553
|
if (node === null) {
|
|
7382
7554
|
return null;
|
|
7383
7555
|
}
|
|
7384
7556
|
let nodeValueSymbol = null;
|
|
7385
|
-
if (
|
|
7557
|
+
if (ts34.isForOfStatement(node.parent.parent)) {
|
|
7386
7558
|
nodeValueSymbol = this.getSymbolOfTsNode(node);
|
|
7387
7559
|
} else if (node.initializer !== void 0) {
|
|
7388
7560
|
nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
|
|
@@ -7405,11 +7577,11 @@ var SymbolBuilder = class {
|
|
|
7405
7577
|
}
|
|
7406
7578
|
getSymbolOfReference(ref) {
|
|
7407
7579
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
7408
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
7580
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts34.isVariableDeclaration });
|
|
7409
7581
|
if (node === null || target === null || node.initializer === void 0) {
|
|
7410
7582
|
return null;
|
|
7411
7583
|
}
|
|
7412
|
-
const originalDeclaration =
|
|
7584
|
+
const originalDeclaration = ts34.isParenthesizedExpression(node.initializer) && ts34.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
7413
7585
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
7414
7586
|
return null;
|
|
7415
7587
|
}
|
|
@@ -7433,7 +7605,7 @@ var SymbolBuilder = class {
|
|
|
7433
7605
|
referenceVarLocation: referenceVarTcbLocation
|
|
7434
7606
|
};
|
|
7435
7607
|
} else {
|
|
7436
|
-
if (!
|
|
7608
|
+
if (!ts34.isClassDeclaration(target.directive.ref.node)) {
|
|
7437
7609
|
return null;
|
|
7438
7610
|
}
|
|
7439
7611
|
return {
|
|
@@ -7448,7 +7620,7 @@ var SymbolBuilder = class {
|
|
|
7448
7620
|
}
|
|
7449
7621
|
}
|
|
7450
7622
|
getSymbolOfPipe(expression) {
|
|
7451
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
7623
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts34.isPropertyAccessExpression });
|
|
7452
7624
|
if (methodAccess === null) {
|
|
7453
7625
|
return null;
|
|
7454
7626
|
}
|
|
@@ -7488,7 +7660,7 @@ var SymbolBuilder = class {
|
|
|
7488
7660
|
}
|
|
7489
7661
|
let node = null;
|
|
7490
7662
|
if (expression instanceof PropertyRead5) {
|
|
7491
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
7663
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts34.isPropertyAccessExpression });
|
|
7492
7664
|
}
|
|
7493
7665
|
if (node === null) {
|
|
7494
7666
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -7496,10 +7668,10 @@ var SymbolBuilder = class {
|
|
|
7496
7668
|
if (node === null) {
|
|
7497
7669
|
return null;
|
|
7498
7670
|
}
|
|
7499
|
-
while (
|
|
7671
|
+
while (ts34.isParenthesizedExpression(node)) {
|
|
7500
7672
|
node = node.expression;
|
|
7501
7673
|
}
|
|
7502
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
7674
|
+
if (expression instanceof SafePropertyRead4 && ts34.isConditionalExpression(node)) {
|
|
7503
7675
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
7504
7676
|
if (whenTrueSymbol === null) {
|
|
7505
7677
|
return null;
|
|
@@ -7516,11 +7688,11 @@ var SymbolBuilder = class {
|
|
|
7516
7688
|
}
|
|
7517
7689
|
getSymbolOfTsNode(node) {
|
|
7518
7690
|
var _a;
|
|
7519
|
-
while (
|
|
7691
|
+
while (ts34.isParenthesizedExpression(node)) {
|
|
7520
7692
|
node = node.expression;
|
|
7521
7693
|
}
|
|
7522
7694
|
let tsSymbol;
|
|
7523
|
-
if (
|
|
7695
|
+
if (ts34.isPropertyAccessExpression(node)) {
|
|
7524
7696
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
7525
7697
|
} else {
|
|
7526
7698
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -7538,13 +7710,13 @@ var SymbolBuilder = class {
|
|
|
7538
7710
|
};
|
|
7539
7711
|
}
|
|
7540
7712
|
getTcbPositionForNode(node) {
|
|
7541
|
-
if (
|
|
7713
|
+
if (ts34.isTypeReferenceNode(node)) {
|
|
7542
7714
|
return this.getTcbPositionForNode(node.typeName);
|
|
7543
|
-
} else if (
|
|
7715
|
+
} else if (ts34.isQualifiedName(node)) {
|
|
7544
7716
|
return node.right.getStart();
|
|
7545
|
-
} else if (
|
|
7717
|
+
} else if (ts34.isPropertyAccessExpression(node)) {
|
|
7546
7718
|
return node.name.getStart();
|
|
7547
|
-
} else if (
|
|
7719
|
+
} else if (ts34.isElementAccessExpression(node)) {
|
|
7548
7720
|
return node.argumentExpression.getStart();
|
|
7549
7721
|
} else {
|
|
7550
7722
|
return node.getStart();
|
|
@@ -7558,13 +7730,13 @@ function sourceSpanEqual(a, b) {
|
|
|
7558
7730
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
7559
7731
|
}
|
|
7560
7732
|
function unwrapSignalInputWriteTAccessor(expr) {
|
|
7561
|
-
if (!
|
|
7733
|
+
if (!ts34.isElementAccessExpression(expr) || !ts34.isPropertyAccessExpression(expr.argumentExpression)) {
|
|
7562
7734
|
return null;
|
|
7563
7735
|
}
|
|
7564
|
-
if (!
|
|
7736
|
+
if (!ts34.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers4.InputSignalBrandWriteType.name) {
|
|
7565
7737
|
return null;
|
|
7566
7738
|
}
|
|
7567
|
-
if (!
|
|
7739
|
+
if (!ts34.isPropertyAccessExpression(expr.expression) && !ts34.isElementAccessExpression(expr.expression)) {
|
|
7568
7740
|
throw new Error("Unexpected expression for signal input write type.");
|
|
7569
7741
|
}
|
|
7570
7742
|
return {
|
|
@@ -8278,7 +8450,7 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
8278
8450
|
import { Interpolation, PropertyRead as PropertyRead6 } from "@angular/compiler";
|
|
8279
8451
|
|
|
8280
8452
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.mjs
|
|
8281
|
-
import
|
|
8453
|
+
import ts35 from "typescript";
|
|
8282
8454
|
var SIGNAL_FNS = /* @__PURE__ */ new Set([
|
|
8283
8455
|
"WritableSignal",
|
|
8284
8456
|
"Signal",
|
|
@@ -8293,7 +8465,7 @@ function isSignalSymbol(symbol) {
|
|
|
8293
8465
|
const declarations = symbol.getDeclarations();
|
|
8294
8466
|
return declarations !== void 0 && declarations.some((decl) => {
|
|
8295
8467
|
const fileName = decl.getSourceFile().fileName;
|
|
8296
|
-
return (
|
|
8468
|
+
return (ts35.isInterfaceDeclaration(decl) || ts35.isTypeAliasDeclaration(decl)) && SIGNAL_FNS.has(decl.name.text) && (fileName.includes("@angular/core") || fileName.includes("angular2/rc/packages/core"));
|
|
8297
8469
|
});
|
|
8298
8470
|
}
|
|
8299
8471
|
|
|
@@ -8347,6 +8519,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
8347
8519
|
this.visitAllNodes(template.children);
|
|
8348
8520
|
}
|
|
8349
8521
|
visitContent(content) {
|
|
8522
|
+
this.visitAllNodes(content.children);
|
|
8350
8523
|
}
|
|
8351
8524
|
visitVariable(variable) {
|
|
8352
8525
|
}
|
|
@@ -8397,7 +8570,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
8397
8570
|
visitForLoopBlock(block) {
|
|
8398
8571
|
var _a;
|
|
8399
8572
|
block.item.visit(this);
|
|
8400
|
-
this.visitAllNodes(
|
|
8573
|
+
this.visitAllNodes(block.contextVariables);
|
|
8401
8574
|
this.visitAst(block.expression);
|
|
8402
8575
|
this.visitAllNodes(block.children);
|
|
8403
8576
|
(_a = block.empty) == null ? void 0 : _a.visit(this);
|
|
@@ -8571,7 +8744,7 @@ var factory4 = {
|
|
|
8571
8744
|
|
|
8572
8745
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
8573
8746
|
import { Binary } from "@angular/compiler";
|
|
8574
|
-
import
|
|
8747
|
+
import ts36 from "typescript";
|
|
8575
8748
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
8576
8749
|
constructor() {
|
|
8577
8750
|
super(...arguments);
|
|
@@ -8585,7 +8758,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
8585
8758
|
return [];
|
|
8586
8759
|
}
|
|
8587
8760
|
const typeLeft = symbolLeft.tsType;
|
|
8588
|
-
if (typeLeft.flags & (
|
|
8761
|
+
if (typeLeft.flags & (ts36.TypeFlags.Any | ts36.TypeFlags.Unknown)) {
|
|
8589
8762
|
return [];
|
|
8590
8763
|
}
|
|
8591
8764
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -8616,7 +8789,7 @@ var factory5 = {
|
|
|
8616
8789
|
|
|
8617
8790
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.mjs
|
|
8618
8791
|
import { SafeCall as SafeCall2, SafeKeyedRead as SafeKeyedRead2, SafePropertyRead as SafePropertyRead5 } from "@angular/compiler";
|
|
8619
|
-
import
|
|
8792
|
+
import ts37 from "typescript";
|
|
8620
8793
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
8621
8794
|
constructor() {
|
|
8622
8795
|
super(...arguments);
|
|
@@ -8630,7 +8803,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
8630
8803
|
return [];
|
|
8631
8804
|
}
|
|
8632
8805
|
const typeLeft = symbolLeft.tsType;
|
|
8633
|
-
if (typeLeft.flags & (
|
|
8806
|
+
if (typeLeft.flags & (ts37.TypeFlags.Any | ts37.TypeFlags.Unknown)) {
|
|
8634
8807
|
return [];
|
|
8635
8808
|
}
|
|
8636
8809
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -8724,7 +8897,7 @@ var factory8 = {
|
|
|
8724
8897
|
};
|
|
8725
8898
|
|
|
8726
8899
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
8727
|
-
import
|
|
8900
|
+
import ts38 from "typescript";
|
|
8728
8901
|
|
|
8729
8902
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
8730
8903
|
var DiagnosticCategoryLabel;
|
|
@@ -8773,9 +8946,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
8773
8946
|
function diagnosticLabelToCategory(label) {
|
|
8774
8947
|
switch (label) {
|
|
8775
8948
|
case DiagnosticCategoryLabel.Warning:
|
|
8776
|
-
return
|
|
8949
|
+
return ts38.DiagnosticCategory.Warning;
|
|
8777
8950
|
case DiagnosticCategoryLabel.Error:
|
|
8778
|
-
return
|
|
8951
|
+
return ts38.DiagnosticCategory.Error;
|
|
8779
8952
|
case DiagnosticCategoryLabel.Suppress:
|
|
8780
8953
|
return null;
|
|
8781
8954
|
default:
|
|
@@ -8805,7 +8978,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
8805
8978
|
|
|
8806
8979
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.mjs
|
|
8807
8980
|
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver4, ParsedEventType as ParsedEventType2, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
8808
|
-
import
|
|
8981
|
+
import ts39 from "typescript";
|
|
8809
8982
|
var TemplateSemanticsCheckerImpl = class {
|
|
8810
8983
|
constructor(templateTypeChecker) {
|
|
8811
8984
|
this.templateTypeChecker = templateTypeChecker;
|
|
@@ -8873,7 +9046,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor3 {
|
|
|
8873
9046
|
}
|
|
8874
9047
|
makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
|
|
8875
9048
|
var _a, _b;
|
|
8876
|
-
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan,
|
|
9049
|
+
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, ts39.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [{
|
|
8877
9050
|
text: `The variable ${target.name} is declared here.`,
|
|
8878
9051
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
8879
9052
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -8885,6 +9058,95 @@ function unwrapAstWithSource(ast) {
|
|
|
8885
9058
|
return ast instanceof ASTWithSource5 ? ast.ast : ast;
|
|
8886
9059
|
}
|
|
8887
9060
|
|
|
9061
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.mjs
|
|
9062
|
+
import ts40 from "typescript";
|
|
9063
|
+
var APIS_TO_CHECK = [
|
|
9064
|
+
INPUT_INITIALIZER_FN,
|
|
9065
|
+
MODEL_INITIALIZER_FN,
|
|
9066
|
+
...OUTPUT_INITIALIZER_FNS,
|
|
9067
|
+
...QUERY_INITIALIZER_FNS
|
|
9068
|
+
];
|
|
9069
|
+
var InitializerApiUsageRule = class {
|
|
9070
|
+
constructor(reflector, importedSymbolsTracker) {
|
|
9071
|
+
this.reflector = reflector;
|
|
9072
|
+
this.importedSymbolsTracker = importedSymbolsTracker;
|
|
9073
|
+
}
|
|
9074
|
+
shouldCheck(sourceFile) {
|
|
9075
|
+
return APIS_TO_CHECK.some(({ functionName, owningModule }) => {
|
|
9076
|
+
return this.importedSymbolsTracker.hasNamedImport(sourceFile, functionName, owningModule) || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, owningModule);
|
|
9077
|
+
});
|
|
9078
|
+
}
|
|
9079
|
+
checkNode(node) {
|
|
9080
|
+
if (!ts40.isCallExpression(node)) {
|
|
9081
|
+
return null;
|
|
9082
|
+
}
|
|
9083
|
+
while (node.parent && (ts40.isParenthesizedExpression(node.parent) || ts40.isAsExpression(node.parent))) {
|
|
9084
|
+
node = node.parent;
|
|
9085
|
+
}
|
|
9086
|
+
if (!node.parent || !ts40.isCallExpression(node)) {
|
|
9087
|
+
return null;
|
|
9088
|
+
}
|
|
9089
|
+
const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK, node, this.reflector, this.importedSymbolsTracker);
|
|
9090
|
+
if (identifiedInitializer === null) {
|
|
9091
|
+
return null;
|
|
9092
|
+
}
|
|
9093
|
+
const functionName = identifiedInitializer.api.functionName + (identifiedInitializer.isRequired ? ".required" : "");
|
|
9094
|
+
if (ts40.isPropertyDeclaration(node.parent) && node.parent.initializer === node) {
|
|
9095
|
+
let closestClass = node.parent;
|
|
9096
|
+
while (closestClass && !ts40.isClassDeclaration(closestClass)) {
|
|
9097
|
+
closestClass = closestClass.parent;
|
|
9098
|
+
}
|
|
9099
|
+
if (closestClass && ts40.isClassDeclaration(closestClass)) {
|
|
9100
|
+
const decorators = this.reflector.getDecoratorsOfDeclaration(closestClass);
|
|
9101
|
+
const isComponentOrDirective = decorators !== null && decorators.some((decorator) => {
|
|
9102
|
+
var _a;
|
|
9103
|
+
return ((_a = decorator.import) == null ? void 0 : _a.from) === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
9104
|
+
});
|
|
9105
|
+
return isComponentOrDirective ? null : makeDiagnostic(ErrorCode.UNSUPPORTED_INITIALIZER_API_USAGE, node, `Unsupported call to the ${functionName} function. This function can only be used as the initializer of a property on a @Component or @Directive class.`);
|
|
9106
|
+
}
|
|
9107
|
+
}
|
|
9108
|
+
return makeDiagnostic(ErrorCode.UNSUPPORTED_INITIALIZER_API_USAGE, node, `Unsupported call to the ${functionName} function. This function can only be called in the initializer of a class member.`);
|
|
9109
|
+
}
|
|
9110
|
+
};
|
|
9111
|
+
|
|
9112
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.mjs
|
|
9113
|
+
var SourceFileValidator = class {
|
|
9114
|
+
constructor(reflector, importedSymbolsTracker) {
|
|
9115
|
+
this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
|
|
9116
|
+
}
|
|
9117
|
+
getDiagnosticsForFile(sourceFile) {
|
|
9118
|
+
if (sourceFile.isDeclarationFile || sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
|
|
9119
|
+
return null;
|
|
9120
|
+
}
|
|
9121
|
+
let rulesToRun = null;
|
|
9122
|
+
for (const rule of this.rules) {
|
|
9123
|
+
if (rule.shouldCheck(sourceFile)) {
|
|
9124
|
+
rulesToRun != null ? rulesToRun : rulesToRun = [];
|
|
9125
|
+
rulesToRun.push(rule);
|
|
9126
|
+
}
|
|
9127
|
+
}
|
|
9128
|
+
if (rulesToRun === null) {
|
|
9129
|
+
return null;
|
|
9130
|
+
}
|
|
9131
|
+
let fileDiagnostics = null;
|
|
9132
|
+
sourceFile.forEachChild(function walk(node) {
|
|
9133
|
+
for (const rule of rulesToRun) {
|
|
9134
|
+
const nodeDiagnostics = rule.checkNode(node);
|
|
9135
|
+
if (nodeDiagnostics !== null) {
|
|
9136
|
+
fileDiagnostics != null ? fileDiagnostics : fileDiagnostics = [];
|
|
9137
|
+
if (Array.isArray(nodeDiagnostics)) {
|
|
9138
|
+
fileDiagnostics.push(...nodeDiagnostics);
|
|
9139
|
+
} else {
|
|
9140
|
+
fileDiagnostics.push(nodeDiagnostics);
|
|
9141
|
+
}
|
|
9142
|
+
}
|
|
9143
|
+
}
|
|
9144
|
+
node.forEachChild(walk);
|
|
9145
|
+
});
|
|
9146
|
+
return fileDiagnostics;
|
|
9147
|
+
}
|
|
9148
|
+
};
|
|
9149
|
+
|
|
8888
9150
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/core_version.mjs
|
|
8889
9151
|
function coreHasSymbol(program, symbol) {
|
|
8890
9152
|
const checker = program.getTypeChecker();
|
|
@@ -9005,7 +9267,7 @@ var NgCompiler = class {
|
|
|
9005
9267
|
this.currentProgram = inputProgram;
|
|
9006
9268
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
9007
9269
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
9008
|
-
const moduleResolutionCache =
|
|
9270
|
+
const moduleResolutionCache = ts41.createModuleResolutionCache(
|
|
9009
9271
|
this.adapter.getCurrentDirectory(),
|
|
9010
9272
|
this.adapter.getCanonicalFileName.bind(this.adapter)
|
|
9011
9273
|
);
|
|
@@ -9049,7 +9311,7 @@ var NgCompiler = class {
|
|
|
9049
9311
|
}
|
|
9050
9312
|
for (const clazz of classesToUpdate) {
|
|
9051
9313
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
9052
|
-
if (!
|
|
9314
|
+
if (!ts41.isClassDeclaration(clazz)) {
|
|
9053
9315
|
continue;
|
|
9054
9316
|
}
|
|
9055
9317
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -9394,9 +9656,15 @@ var NgCompiler = class {
|
|
|
9394
9656
|
runAdditionalChecks(sf) {
|
|
9395
9657
|
const diagnostics = [];
|
|
9396
9658
|
const compilation = this.ensureAnalyzed();
|
|
9397
|
-
const { extendedTemplateChecker, templateSemanticsChecker } = compilation;
|
|
9659
|
+
const { extendedTemplateChecker, templateSemanticsChecker, sourceFileValidator } = compilation;
|
|
9398
9660
|
const files = sf ? [sf] : this.inputProgram.getSourceFiles();
|
|
9399
9661
|
for (const sf2 of files) {
|
|
9662
|
+
if (sourceFileValidator !== null) {
|
|
9663
|
+
const sourceFileDiagnostics = sourceFileValidator.getDiagnosticsForFile(sf2);
|
|
9664
|
+
if (sourceFileDiagnostics !== null) {
|
|
9665
|
+
diagnostics.push(...sourceFileDiagnostics);
|
|
9666
|
+
}
|
|
9667
|
+
}
|
|
9400
9668
|
if (templateSemanticsChecker !== null) {
|
|
9401
9669
|
diagnostics.push(...compilation.traitCompiler.runAdditionalChecks(sf2, (clazz, handler) => {
|
|
9402
9670
|
var _a;
|
|
@@ -9518,6 +9786,7 @@ var NgCompiler = class {
|
|
|
9518
9786
|
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, metaReader, localMetaReader, ngModuleIndex, scopeReader, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
9519
9787
|
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
9520
9788
|
const templateSemanticsChecker = this.constructionDiagnostics.length === 0 ? new TemplateSemanticsCheckerImpl(templateTypeChecker) : null;
|
|
9789
|
+
const sourceFileValidator = this.constructionDiagnostics.length === 0 ? new SourceFileValidator(reflector, importTracker) : null;
|
|
9521
9790
|
return {
|
|
9522
9791
|
isCore,
|
|
9523
9792
|
traitCompiler,
|
|
@@ -9533,7 +9802,8 @@ var NgCompiler = class {
|
|
|
9533
9802
|
resourceRegistry,
|
|
9534
9803
|
extendedTemplateChecker,
|
|
9535
9804
|
localCompilationExtraImportsTracker,
|
|
9536
|
-
templateSemanticsChecker
|
|
9805
|
+
templateSemanticsChecker,
|
|
9806
|
+
sourceFileValidator
|
|
9537
9807
|
};
|
|
9538
9808
|
}
|
|
9539
9809
|
};
|
|
@@ -9543,18 +9813,18 @@ function isAngularCorePackage(program) {
|
|
|
9543
9813
|
return false;
|
|
9544
9814
|
}
|
|
9545
9815
|
return r3Symbols.statements.some((stmt) => {
|
|
9546
|
-
if (!
|
|
9816
|
+
if (!ts41.isVariableStatement(stmt)) {
|
|
9547
9817
|
return false;
|
|
9548
9818
|
}
|
|
9549
|
-
const modifiers =
|
|
9550
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
9819
|
+
const modifiers = ts41.getModifiers(stmt);
|
|
9820
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts41.SyntaxKind.ExportKeyword)) {
|
|
9551
9821
|
return false;
|
|
9552
9822
|
}
|
|
9553
9823
|
return stmt.declarationList.declarations.some((decl) => {
|
|
9554
|
-
if (!
|
|
9824
|
+
if (!ts41.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
9555
9825
|
return false;
|
|
9556
9826
|
}
|
|
9557
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
9827
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts41.SyntaxKind.TrueKeyword) {
|
|
9558
9828
|
return false;
|
|
9559
9829
|
}
|
|
9560
9830
|
return true;
|
|
@@ -9568,7 +9838,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
9568
9838
|
var _a, _b, _c;
|
|
9569
9839
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
9570
9840
|
yield makeConfigDiagnostic({
|
|
9571
|
-
category:
|
|
9841
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9572
9842
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
9573
9843
|
messageText: `
|
|
9574
9844
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -9587,7 +9857,7 @@ https://angular.io/guide/template-typecheck
|
|
|
9587
9857
|
}
|
|
9588
9858
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
9589
9859
|
yield makeConfigDiagnostic({
|
|
9590
|
-
category:
|
|
9860
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9591
9861
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
9592
9862
|
messageText: `
|
|
9593
9863
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -9604,7 +9874,7 @@ One of the following actions is required:
|
|
|
9604
9874
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
9605
9875
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
9606
9876
|
yield makeConfigDiagnostic({
|
|
9607
|
-
category:
|
|
9877
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9608
9878
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
9609
9879
|
messageText: `
|
|
9610
9880
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -9617,7 +9887,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
9617
9887
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
9618
9888
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
9619
9889
|
yield makeConfigDiagnostic({
|
|
9620
|
-
category:
|
|
9890
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9621
9891
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
9622
9892
|
messageText: `
|
|
9623
9893
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -9629,7 +9899,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
9629
9899
|
}
|
|
9630
9900
|
if (!allowedCategoryLabels.includes(category)) {
|
|
9631
9901
|
yield makeConfigDiagnostic({
|
|
9632
|
-
category:
|
|
9902
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9633
9903
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
9634
9904
|
messageText: `
|
|
9635
9905
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -9659,7 +9929,7 @@ var ReferenceGraphAdapter = class {
|
|
|
9659
9929
|
for (const { node } of references) {
|
|
9660
9930
|
let sourceFile = node.getSourceFile();
|
|
9661
9931
|
if (sourceFile === void 0) {
|
|
9662
|
-
sourceFile =
|
|
9932
|
+
sourceFile = ts41.getOriginalNode(node).getSourceFile();
|
|
9663
9933
|
}
|
|
9664
9934
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
9665
9935
|
this.graph.add(source, node);
|
|
@@ -9698,7 +9968,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
9698
9968
|
}
|
|
9699
9969
|
|
|
9700
9970
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
9701
|
-
import
|
|
9971
|
+
import ts42 from "typescript";
|
|
9702
9972
|
var DelegatingCompilerHost2 = class {
|
|
9703
9973
|
get jsDocParsingMode() {
|
|
9704
9974
|
return this.delegate.jsDocParsingMode;
|
|
@@ -9783,7 +10053,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
9783
10053
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
9784
10054
|
if (entryPoint === null) {
|
|
9785
10055
|
diagnostics.push({
|
|
9786
|
-
category:
|
|
10056
|
+
category: ts42.DiagnosticCategory.Error,
|
|
9787
10057
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
9788
10058
|
file: void 0,
|
|
9789
10059
|
start: void 0,
|
|
@@ -9826,10 +10096,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
9826
10096
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
9827
10097
|
}
|
|
9828
10098
|
createCachedResolveModuleNamesFunction() {
|
|
9829
|
-
const moduleResolutionCache =
|
|
10099
|
+
const moduleResolutionCache = ts42.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
9830
10100
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
9831
10101
|
return moduleNames.map((moduleName) => {
|
|
9832
|
-
const module =
|
|
10102
|
+
const module = ts42.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
9833
10103
|
return module.resolvedModule;
|
|
9834
10104
|
});
|
|
9835
10105
|
};
|
|
@@ -9853,7 +10123,7 @@ var NgtscProgram = class {
|
|
|
9853
10123
|
if (reuseProgram !== void 0) {
|
|
9854
10124
|
retagAllTsFiles(reuseProgram);
|
|
9855
10125
|
}
|
|
9856
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
10126
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts43.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
9857
10127
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
9858
10128
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
9859
10129
|
this.host.postProgramCreationCleanup();
|
|
@@ -10069,16 +10339,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
10069
10339
|
}
|
|
10070
10340
|
|
|
10071
10341
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
10072
|
-
import
|
|
10342
|
+
import ts45 from "typescript";
|
|
10073
10343
|
|
|
10074
10344
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
10075
|
-
import
|
|
10345
|
+
import ts44 from "typescript";
|
|
10076
10346
|
function createMessageDiagnostic(messageText) {
|
|
10077
10347
|
return {
|
|
10078
10348
|
file: void 0,
|
|
10079
10349
|
start: void 0,
|
|
10080
10350
|
length: void 0,
|
|
10081
|
-
category:
|
|
10351
|
+
category: ts44.DiagnosticCategory.Message,
|
|
10082
10352
|
messageText,
|
|
10083
10353
|
code: DEFAULT_ERROR_CODE,
|
|
10084
10354
|
source: SOURCE
|
|
@@ -10087,13 +10357,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
10087
10357
|
|
|
10088
10358
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
10089
10359
|
var defaultFormatHost = {
|
|
10090
|
-
getCurrentDirectory: () =>
|
|
10360
|
+
getCurrentDirectory: () => ts45.sys.getCurrentDirectory(),
|
|
10091
10361
|
getCanonicalFileName: (fileName) => fileName,
|
|
10092
|
-
getNewLine: () =>
|
|
10362
|
+
getNewLine: () => ts45.sys.newLine
|
|
10093
10363
|
};
|
|
10094
10364
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
10095
10365
|
if (diags && diags.length) {
|
|
10096
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
10366
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts45.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
10097
10367
|
} else {
|
|
10098
10368
|
return "";
|
|
10099
10369
|
}
|
|
@@ -10110,7 +10380,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10110
10380
|
var _a;
|
|
10111
10381
|
try {
|
|
10112
10382
|
const fs = getFileSystem();
|
|
10113
|
-
const readConfigFile = (configFile) =>
|
|
10383
|
+
const readConfigFile = (configFile) => ts45.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
10114
10384
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
10115
10385
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
10116
10386
|
if (error2) {
|
|
@@ -10145,7 +10415,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10145
10415
|
...existingOptions
|
|
10146
10416
|
};
|
|
10147
10417
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
10148
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
10418
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts45.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
10149
10419
|
let emitFlags = EmitFlags.Default;
|
|
10150
10420
|
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
10151
10421
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -10156,7 +10426,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10156
10426
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
10157
10427
|
} catch (e) {
|
|
10158
10428
|
const errors = [{
|
|
10159
|
-
category:
|
|
10429
|
+
category: ts45.DiagnosticCategory.Error,
|
|
10160
10430
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
10161
10431
|
file: void 0,
|
|
10162
10432
|
start: void 0,
|
|
@@ -10170,7 +10440,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10170
10440
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
10171
10441
|
return {
|
|
10172
10442
|
fileExists: host.exists.bind(host),
|
|
10173
|
-
readDirectory:
|
|
10443
|
+
readDirectory: ts45.sys.readDirectory,
|
|
10174
10444
|
readFile: host.readFile.bind(host),
|
|
10175
10445
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
10176
10446
|
};
|
|
@@ -10190,7 +10460,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
10190
10460
|
}
|
|
10191
10461
|
} else {
|
|
10192
10462
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
10193
|
-
const { resolvedModule } =
|
|
10463
|
+
const { resolvedModule } = ts45.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts45.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
|
|
10194
10464
|
if (resolvedModule) {
|
|
10195
10465
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
10196
10466
|
}
|
|
@@ -10200,7 +10470,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
10200
10470
|
function exitCodeFromResult(diags) {
|
|
10201
10471
|
if (!diags)
|
|
10202
10472
|
return 0;
|
|
10203
|
-
if (diags.every((diag) => diag.category !==
|
|
10473
|
+
if (diags.every((diag) => diag.category !== ts45.DiagnosticCategory.Error)) {
|
|
10204
10474
|
return 0;
|
|
10205
10475
|
}
|
|
10206
10476
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -10233,7 +10503,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
10233
10503
|
} catch (e) {
|
|
10234
10504
|
program = void 0;
|
|
10235
10505
|
allDiagnostics.push({
|
|
10236
|
-
category:
|
|
10506
|
+
category: ts45.DiagnosticCategory.Error,
|
|
10237
10507
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
10238
10508
|
code: UNKNOWN_ERROR_CODE,
|
|
10239
10509
|
file: void 0,
|
|
@@ -10260,7 +10530,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
10260
10530
|
return allDiagnostics;
|
|
10261
10531
|
}
|
|
10262
10532
|
function hasErrors(diags) {
|
|
10263
|
-
return diags.some((d) => d.category ===
|
|
10533
|
+
return diags.some((d) => d.category === ts45.DiagnosticCategory.Error);
|
|
10264
10534
|
}
|
|
10265
10535
|
|
|
10266
10536
|
export {
|
|
@@ -10274,6 +10544,7 @@ export {
|
|
|
10274
10544
|
MemberType,
|
|
10275
10545
|
DecoratorType,
|
|
10276
10546
|
MemberTags,
|
|
10547
|
+
DocsExtractor,
|
|
10277
10548
|
untagAllTsFiles,
|
|
10278
10549
|
TsCreateProgramDriver,
|
|
10279
10550
|
PatchedProgramIncrementalBuildStrategy,
|
|
@@ -10305,4 +10576,4 @@ export {
|
|
|
10305
10576
|
* Use of this source code is governed by an MIT-style license that can be
|
|
10306
10577
|
* found in the LICENSE file at https://angular.io/license
|
|
10307
10578
|
*/
|
|
10308
|
-
//# sourceMappingURL=chunk-
|
|
10579
|
+
//# sourceMappingURL=chunk-YMLYBTFV.js.map
|