@angular/compiler-cli 13.2.0-next.0 → 13.2.0-rc.1
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-GX2C4BSM.js → chunk-3XJZ4ZZZ.js} +801 -1044
- package/bundles/chunk-3XJZ4ZZZ.js.map +6 -0
- package/bundles/{chunk-UAY4RXGC.js → chunk-4QCYPOMC.js} +61 -63
- package/bundles/chunk-4QCYPOMC.js.map +6 -0
- package/bundles/{chunk-TI3THPMZ.js → chunk-676MI6WZ.js} +39 -60
- package/bundles/chunk-676MI6WZ.js.map +6 -0
- package/bundles/{chunk-5QEO6HSG.js → chunk-7PY7XEFH.js} +9 -9
- package/bundles/chunk-7PY7XEFH.js.map +6 -0
- package/bundles/{chunk-GZLU7SCP.js → chunk-A5PL3TE6.js} +9 -9
- package/bundles/chunk-A5PL3TE6.js.map +6 -0
- package/bundles/{chunk-PF3ZPGF5.js → chunk-ADHVDA4A.js} +12 -12
- package/bundles/{chunk-PF3ZPGF5.js.map → chunk-ADHVDA4A.js.map} +1 -1
- package/bundles/{chunk-P2Q3CTKO.js → chunk-DH7A3OBN.js} +16 -20
- package/bundles/chunk-DH7A3OBN.js.map +6 -0
- package/bundles/{chunk-J6CW3T62.js → chunk-GLCRIILX.js} +5 -5
- package/bundles/{chunk-J6CW3T62.js.map → chunk-GLCRIILX.js.map} +0 -0
- package/bundles/{chunk-FUXNWM54.js → chunk-LMCFGUUV.js} +772 -438
- package/bundles/chunk-LMCFGUUV.js.map +6 -0
- package/bundles/{chunk-QFB4WK55.js → chunk-O4XVCXRT.js} +4 -4
- package/bundles/{chunk-QFB4WK55.js.map → chunk-O4XVCXRT.js.map} +0 -0
- package/bundles/{chunk-BXWQHEIB.js → chunk-OOEI5KQH.js} +221 -176
- package/bundles/chunk-OOEI5KQH.js.map +6 -0
- package/bundles/{chunk-C2DR5MYL.js → chunk-QBU7RUKB.js} +270 -100
- package/bundles/chunk-QBU7RUKB.js.map +6 -0
- package/bundles/{chunk-BPCUCINV.js → chunk-QDWL7SZJ.js} +2 -2
- package/bundles/{chunk-BPCUCINV.js.map → chunk-QDWL7SZJ.js.map} +0 -0
- package/bundles/{chunk-JTYUTYS2.js → chunk-SKBLJA43.js} +3 -3
- package/bundles/{chunk-JTYUTYS2.js.map → chunk-SKBLJA43.js.map} +0 -0
- package/bundles/{chunk-5NGMSHHH.js → chunk-UESD6FVI.js} +39 -41
- package/bundles/chunk-UESD6FVI.js.map +6 -0
- package/bundles/{chunk-XA5IZLLC.js → chunk-WQ3TNYTD.js} +6 -6
- package/bundles/{chunk-XA5IZLLC.js.map → chunk-WQ3TNYTD.js.map} +0 -0
- package/bundles/index.js +16 -15
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +85 -85
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +13 -13
- package/bundles/ngcc/main-ngcc.js +14 -14
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +14 -14
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +5 -5
- package/bundles/private/bazel.js +2 -2
- package/bundles/private/localize.js +4 -4
- package/bundles/private/migrations.js +6 -6
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +11 -11
- package/bundles/src/bin/ngc.js +11 -11
- package/bundles/src/bin/ngc.js.map +1 -1
- package/bundles_metadata.json +1 -1
- package/index.d.ts +2 -0
- package/ngcc/src/packages/adjust_cjs_umd_exports.d.ts +17 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/source_file_cache.d.ts +2 -1
- package/package.json +2 -2
- package/src/ngtsc/annotations/src/component.d.ts +2 -1
- package/src/ngtsc/annotations/src/util.d.ts +1 -1
- package/src/ngtsc/core/api/src/options.d.ts +3 -2
- package/src/ngtsc/core/api/src/public_options.d.ts +38 -0
- package/src/ngtsc/core/src/host.d.ts +1 -1
- package/src/ngtsc/diagnostics/index.d.ts +2 -1
- package/src/ngtsc/diagnostics/src/error.d.ts +1 -0
- package/src/ngtsc/diagnostics/src/error_code.d.ts +7 -0
- package/src/ngtsc/diagnostics/src/error_details_base_url.d.ts +1 -1
- package/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.d.ts +21 -0
- package/src/ngtsc/file_system/src/compiler_host.d.ts +1 -0
- package/src/ngtsc/imports/index.d.ts +1 -1
- package/src/ngtsc/imports/src/emitter.d.ts +40 -8
- package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +1 -1
- package/src/ngtsc/translator/src/translator.d.ts +0 -5
- package/src/ngtsc/translator/src/type_translator.d.ts +0 -2
- package/src/ngtsc/typecheck/extended/api/api.d.ts +30 -10
- package/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.d.ts +3 -14
- package/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.d.ts +3 -15
- package/src/ngtsc/typecheck/extended/index.d.ts +3 -0
- package/src/ngtsc/typecheck/extended/src/extended_template_checker.d.ts +5 -4
- package/src/ngtsc/typecheck/src/environment.d.ts +3 -1
- package/src/ngtsc/typecheck/src/tcb_util.d.ts +10 -2
- package/src/ngtsc/typecheck/src/type_constructor.d.ts +3 -2
- package/src/ngtsc/typecheck/src/type_emitter.d.ts +7 -21
- package/src/ngtsc/typecheck/src/type_parameter_emitter.d.ts +2 -2
- package/src/ngtsc/util/src/typescript.d.ts +0 -5
- package/bundles/chunk-5NGMSHHH.js.map +0 -6
- package/bundles/chunk-5QEO6HSG.js.map +0 -6
- package/bundles/chunk-BXWQHEIB.js.map +0 -6
- package/bundles/chunk-C2DR5MYL.js.map +0 -6
- package/bundles/chunk-FUXNWM54.js.map +0 -6
- package/bundles/chunk-GX2C4BSM.js.map +0 -6
- package/bundles/chunk-GZLU7SCP.js.map +0 -6
- package/bundles/chunk-P2Q3CTKO.js.map +0 -6
- package/bundles/chunk-TI3THPMZ.js.map +0 -6
- package/bundles/chunk-UAY4RXGC.js.map +0 -6
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
const __ESM_IMPORT_META_URL__ = import.meta.url;
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
COMPILER_ERRORS_WITH_GUIDES,
|
|
8
7
|
CompilationMode,
|
|
9
8
|
ComponentDecoratorHandler,
|
|
10
9
|
CompoundMetadataReader,
|
|
@@ -12,8 +11,7 @@ import {
|
|
|
12
11
|
DirectiveDecoratorHandler,
|
|
13
12
|
DtsMetadataReader,
|
|
14
13
|
DtsTransformRegistry,
|
|
15
|
-
|
|
16
|
-
ErrorCode,
|
|
14
|
+
FactoryGenerator,
|
|
17
15
|
InjectableClassRegistry,
|
|
18
16
|
InjectableDecoratorHandler,
|
|
19
17
|
LocalMetadataRegistry,
|
|
@@ -23,24 +21,32 @@ import {
|
|
|
23
21
|
PipeDecoratorHandler,
|
|
24
22
|
ResourceRegistry,
|
|
25
23
|
SemanticDepGraphUpdater,
|
|
24
|
+
ShimAdapter,
|
|
25
|
+
ShimReferenceTagger,
|
|
26
|
+
SummaryGenerator,
|
|
26
27
|
TraitCompiler,
|
|
27
28
|
aliasTransformFactory,
|
|
29
|
+
copyFileShimData,
|
|
28
30
|
declarationTransformFactory,
|
|
29
31
|
flattenInheritedDirectiveMetadata,
|
|
32
|
+
generatedFactoryTransform,
|
|
33
|
+
isShim,
|
|
30
34
|
ivyTransformFactory,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
replaceTsWithNgInErrors
|
|
35
|
-
} from "./chunk-FUXNWM54.js";
|
|
35
|
+
retagAllTsFiles,
|
|
36
|
+
untagAllTsFiles
|
|
37
|
+
} from "./chunk-LMCFGUUV.js";
|
|
36
38
|
import {
|
|
37
39
|
TypeScriptReflectionHost,
|
|
38
40
|
isNamedClassDeclaration
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-7PY7XEFH.js";
|
|
40
42
|
import {
|
|
41
43
|
AbsoluteModuleStrategy,
|
|
42
44
|
AliasStrategy,
|
|
45
|
+
COMPILER_ERRORS_WITH_GUIDES,
|
|
43
46
|
DefaultImportTracker,
|
|
47
|
+
ERROR_DETAILS_PAGE_BASE_URL,
|
|
48
|
+
ErrorCode,
|
|
49
|
+
ExtendedTemplateDiagnosticName,
|
|
44
50
|
ImportFlags,
|
|
45
51
|
ImportManager,
|
|
46
52
|
LocalIdentifierStrategy,
|
|
@@ -54,6 +60,7 @@ import {
|
|
|
54
60
|
RelativePathStrategy,
|
|
55
61
|
UnifiedModulesAliasingHost,
|
|
56
62
|
UnifiedModulesStrategy,
|
|
63
|
+
assertSuccessfulReferenceEmit,
|
|
57
64
|
getRootDirs,
|
|
58
65
|
getSourceFileOrNull,
|
|
59
66
|
getTokenAtPosition,
|
|
@@ -62,37 +69,40 @@ import {
|
|
|
62
69
|
isDtsPath,
|
|
63
70
|
isNonDeclarationTsPath,
|
|
64
71
|
isSymbolWithValueDeclaration,
|
|
72
|
+
makeDiagnostic,
|
|
73
|
+
makeRelatedInformation,
|
|
74
|
+
ngErrorCode,
|
|
65
75
|
nodeNameForError,
|
|
66
76
|
normalizeSeparators,
|
|
67
77
|
relativePathBetween,
|
|
78
|
+
replaceTsWithNgInErrors,
|
|
68
79
|
toUnredirectedSourceFile,
|
|
69
80
|
translateExpression,
|
|
70
81
|
translateType
|
|
71
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-QBU7RUKB.js";
|
|
72
83
|
import {
|
|
73
84
|
LogicalFileSystem,
|
|
74
85
|
absoluteFrom,
|
|
75
86
|
absoluteFromSourceFile,
|
|
76
|
-
basename,
|
|
77
87
|
dirname,
|
|
78
88
|
getFileSystem,
|
|
79
89
|
getSourceFileOrError,
|
|
80
90
|
join,
|
|
81
91
|
resolve
|
|
82
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-676MI6WZ.js";
|
|
83
93
|
import {
|
|
84
94
|
ActivePerfRecorder,
|
|
85
95
|
DelegatingPerfRecorder,
|
|
86
96
|
PerfCheckpoint,
|
|
87
97
|
PerfEvent,
|
|
88
98
|
PerfPhase
|
|
89
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-GLCRIILX.js";
|
|
90
100
|
import {
|
|
91
101
|
__spreadProps,
|
|
92
102
|
__spreadValues
|
|
93
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-WQ3TNYTD.js";
|
|
94
104
|
|
|
95
|
-
// bazel-out/
|
|
105
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
96
106
|
var DEFAULT_ERROR_CODE = 100;
|
|
97
107
|
var UNKNOWN_ERROR_CODE = 500;
|
|
98
108
|
var SOURCE = "angular";
|
|
@@ -110,7 +120,7 @@ var EmitFlags;
|
|
|
110
120
|
EmitFlags2[EmitFlags2["All"] = 31] = "All";
|
|
111
121
|
})(EmitFlags || (EmitFlags = {}));
|
|
112
122
|
|
|
113
|
-
// bazel-out/
|
|
123
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/compiler_host.mjs
|
|
114
124
|
import ts from "typescript";
|
|
115
125
|
var wrapHostForTest = null;
|
|
116
126
|
function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, true) }) {
|
|
@@ -120,21 +130,21 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
|
|
|
120
130
|
return tsHost;
|
|
121
131
|
}
|
|
122
132
|
|
|
123
|
-
// bazel-out/
|
|
133
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/checker.mjs
|
|
124
134
|
var OptimizeFor;
|
|
125
135
|
(function(OptimizeFor2) {
|
|
126
136
|
OptimizeFor2[OptimizeFor2["SingleFile"] = 0] = "SingleFile";
|
|
127
137
|
OptimizeFor2[OptimizeFor2["WholeProgram"] = 1] = "WholeProgram";
|
|
128
138
|
})(OptimizeFor || (OptimizeFor = {}));
|
|
129
139
|
|
|
130
|
-
// bazel-out/
|
|
140
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/completion.mjs
|
|
131
141
|
var CompletionKind;
|
|
132
142
|
(function(CompletionKind2) {
|
|
133
143
|
CompletionKind2[CompletionKind2["Reference"] = 0] = "Reference";
|
|
134
144
|
CompletionKind2[CompletionKind2["Variable"] = 1] = "Variable";
|
|
135
145
|
})(CompletionKind || (CompletionKind = {}));
|
|
136
146
|
|
|
137
|
-
// bazel-out/
|
|
147
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.mjs
|
|
138
148
|
var SymbolKind;
|
|
139
149
|
(function(SymbolKind2) {
|
|
140
150
|
SymbolKind2[SymbolKind2["Input"] = 0] = "Input";
|
|
@@ -150,17 +160,13 @@ var SymbolKind;
|
|
|
150
160
|
SymbolKind2[SymbolKind2["Pipe"] = 10] = "Pipe";
|
|
151
161
|
})(SymbolKind || (SymbolKind = {}));
|
|
152
162
|
|
|
153
|
-
// bazel-out/
|
|
163
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
154
164
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
155
|
-
import
|
|
165
|
+
import ts31 from "typescript";
|
|
156
166
|
|
|
157
|
-
// bazel-out/
|
|
167
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
158
168
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
159
|
-
import
|
|
160
|
-
relative,
|
|
161
|
-
resolve as resolve2,
|
|
162
|
-
sep
|
|
163
|
-
} from "path";
|
|
169
|
+
import * as path from "path";
|
|
164
170
|
function i18nGetExtension(formatName) {
|
|
165
171
|
const format = formatName.toLowerCase();
|
|
166
172
|
switch (format) {
|
|
@@ -175,7 +181,7 @@ function i18nGetExtension(formatName) {
|
|
|
175
181
|
}
|
|
176
182
|
throw new Error(`Unsupported format "${formatName}"`);
|
|
177
183
|
}
|
|
178
|
-
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve =
|
|
184
|
+
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve = path.resolve) {
|
|
179
185
|
formatName = formatName || "xlf";
|
|
180
186
|
const ext = i18nGetExtension(formatName);
|
|
181
187
|
const content = i18nSerialize(bundle, formatName, options);
|
|
@@ -204,15 +210,15 @@ function i18nSerialize(bundle, formatName, options) {
|
|
|
204
210
|
}
|
|
205
211
|
function getPathNormalizer(basePath) {
|
|
206
212
|
return (sourcePath) => {
|
|
207
|
-
sourcePath = basePath ? relative(basePath, sourcePath) : sourcePath;
|
|
208
|
-
return sourcePath.split(sep).join("/");
|
|
213
|
+
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
|
|
214
|
+
return sourcePath.split(path.sep).join("/");
|
|
209
215
|
};
|
|
210
216
|
}
|
|
211
217
|
|
|
212
|
-
// bazel-out/
|
|
218
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
213
219
|
import ts2 from "typescript";
|
|
214
220
|
|
|
215
|
-
// bazel-out/
|
|
221
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
216
222
|
function toNumbers(value) {
|
|
217
223
|
const suffixIndex = value.lastIndexOf("-");
|
|
218
224
|
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
@@ -247,7 +253,7 @@ function compareVersions(v1, v2) {
|
|
|
247
253
|
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
248
254
|
}
|
|
249
255
|
|
|
250
|
-
// bazel-out/
|
|
256
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
251
257
|
var MIN_TS_VERSION = "4.4.2";
|
|
252
258
|
var MAX_TS_VERSION = "4.6.0";
|
|
253
259
|
var tsVersion = ts2.version;
|
|
@@ -260,10 +266,10 @@ function verifySupportedTypeScriptVersion() {
|
|
|
260
266
|
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
261
267
|
}
|
|
262
268
|
|
|
263
|
-
// bazel-out/
|
|
264
|
-
import
|
|
269
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
270
|
+
import ts29 from "typescript";
|
|
265
271
|
|
|
266
|
-
// bazel-out/
|
|
272
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
267
273
|
var CycleAnalyzer = class {
|
|
268
274
|
constructor(importGraph) {
|
|
269
275
|
this.importGraph = importGraph;
|
|
@@ -334,13 +340,13 @@ var Cycle = class {
|
|
|
334
340
|
}
|
|
335
341
|
};
|
|
336
342
|
|
|
337
|
-
// bazel-out/
|
|
343
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
338
344
|
import ts3 from "typescript";
|
|
339
345
|
var ImportGraph = class {
|
|
340
346
|
constructor(checker, perf) {
|
|
341
347
|
this.checker = checker;
|
|
342
348
|
this.perf = perf;
|
|
343
|
-
this.imports = new Map();
|
|
349
|
+
this.imports = /* @__PURE__ */ new Map();
|
|
344
350
|
}
|
|
345
351
|
importsOf(sf) {
|
|
346
352
|
if (!this.imports.has(sf)) {
|
|
@@ -352,7 +358,7 @@ var ImportGraph = class {
|
|
|
352
358
|
if (start === end) {
|
|
353
359
|
return [start];
|
|
354
360
|
}
|
|
355
|
-
const found = new Set([start]);
|
|
361
|
+
const found = /* @__PURE__ */ new Set([start]);
|
|
356
362
|
const queue = [new Found(start, null)];
|
|
357
363
|
while (queue.length > 0) {
|
|
358
364
|
const current = queue.shift();
|
|
@@ -377,7 +383,7 @@ var ImportGraph = class {
|
|
|
377
383
|
}
|
|
378
384
|
scanImports(sf) {
|
|
379
385
|
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
380
|
-
const imports = new Set();
|
|
386
|
+
const imports = /* @__PURE__ */ new Set();
|
|
381
387
|
for (const stmt of sf.statements) {
|
|
382
388
|
if (!ts3.isImportDeclaration(stmt) && !ts3.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
383
389
|
continue;
|
|
@@ -426,7 +432,7 @@ var Found = class {
|
|
|
426
432
|
}
|
|
427
433
|
};
|
|
428
434
|
|
|
429
|
-
// bazel-out/
|
|
435
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
430
436
|
import ts4 from "typescript";
|
|
431
437
|
var FlatIndexGenerator = class {
|
|
432
438
|
constructor(entryPoint, relativeFlatIndexPath, moduleName) {
|
|
@@ -451,7 +457,7 @@ export * from '${relativeEntryPoint}';
|
|
|
451
457
|
}
|
|
452
458
|
};
|
|
453
459
|
|
|
454
|
-
// bazel-out/
|
|
460
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/logic.mjs
|
|
455
461
|
function findFlatIndexEntryPoint(rootFiles) {
|
|
456
462
|
const tsFiles = rootFiles.filter((file) => isNonDeclarationTsPath(file));
|
|
457
463
|
let resolvedEntryPoint = null;
|
|
@@ -467,11 +473,11 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
467
473
|
return resolvedEntryPoint;
|
|
468
474
|
}
|
|
469
475
|
|
|
470
|
-
// bazel-out/
|
|
476
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
471
477
|
import ts5 from "typescript";
|
|
472
478
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
473
479
|
const diagnostics = [];
|
|
474
|
-
const topLevelExports = new Set();
|
|
480
|
+
const topLevelExports = /* @__PURE__ */ new Set();
|
|
475
481
|
const moduleSymbol = checker.getSymbolAtLocation(entryPoint);
|
|
476
482
|
if (moduleSymbol === void 0) {
|
|
477
483
|
throw new Error(`Internal error: failed to get symbol for entrypoint`);
|
|
@@ -486,7 +492,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
486
492
|
topLevelExports.add(decl);
|
|
487
493
|
}
|
|
488
494
|
});
|
|
489
|
-
const checkedSet = new Set();
|
|
495
|
+
const checkedSet = /* @__PURE__ */ new Set();
|
|
490
496
|
topLevelExports.forEach((mainExport) => {
|
|
491
497
|
refGraph.transitiveReferencesOf(mainExport).forEach((transitiveReference) => {
|
|
492
498
|
if (checkedSet.has(transitiveReference)) {
|
|
@@ -547,24 +553,24 @@ function getDescriptorOfDeclaration(decl) {
|
|
|
547
553
|
}
|
|
548
554
|
}
|
|
549
555
|
|
|
550
|
-
// bazel-out/
|
|
556
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/reference_graph.mjs
|
|
551
557
|
var ReferenceGraph = class {
|
|
552
558
|
constructor() {
|
|
553
|
-
this.references = new Map();
|
|
559
|
+
this.references = /* @__PURE__ */ new Map();
|
|
554
560
|
}
|
|
555
561
|
add(from, to) {
|
|
556
562
|
if (!this.references.has(from)) {
|
|
557
|
-
this.references.set(from, new Set());
|
|
563
|
+
this.references.set(from, /* @__PURE__ */ new Set());
|
|
558
564
|
}
|
|
559
565
|
this.references.get(from).add(to);
|
|
560
566
|
}
|
|
561
567
|
transitiveReferencesOf(target) {
|
|
562
|
-
const set = new Set();
|
|
568
|
+
const set = /* @__PURE__ */ new Set();
|
|
563
569
|
this.collectTransitiveReferences(set, target);
|
|
564
570
|
return set;
|
|
565
571
|
}
|
|
566
572
|
pathFrom(source, target) {
|
|
567
|
-
return this.collectPathFrom(source, target, new Set());
|
|
573
|
+
return this.collectPathFrom(source, target, /* @__PURE__ */ new Set());
|
|
568
574
|
}
|
|
569
575
|
collectPathFrom(source, target, seen) {
|
|
570
576
|
if (source === target) {
|
|
@@ -601,7 +607,7 @@ var ReferenceGraph = class {
|
|
|
601
607
|
}
|
|
602
608
|
};
|
|
603
609
|
|
|
604
|
-
// bazel-out/
|
|
610
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/api.mjs
|
|
605
611
|
var NgOriginalFile = Symbol("NgOriginalFile");
|
|
606
612
|
var UpdateMode;
|
|
607
613
|
(function(UpdateMode2) {
|
|
@@ -609,408 +615,8 @@ var UpdateMode;
|
|
|
609
615
|
UpdateMode2[UpdateMode2["Incremental"] = 1] = "Incremental";
|
|
610
616
|
})(UpdateMode || (UpdateMode = {}));
|
|
611
617
|
|
|
612
|
-
// bazel-out/
|
|
613
|
-
import ts9 from "typescript";
|
|
614
|
-
|
|
615
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
618
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
616
619
|
import ts6 from "typescript";
|
|
617
|
-
|
|
618
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
619
|
-
var NgExtension = Symbol("NgExtension");
|
|
620
|
-
function isExtended(sf) {
|
|
621
|
-
return sf[NgExtension] !== void 0;
|
|
622
|
-
}
|
|
623
|
-
function sfExtensionData(sf) {
|
|
624
|
-
const extSf = sf;
|
|
625
|
-
if (extSf[NgExtension] !== void 0) {
|
|
626
|
-
return extSf[NgExtension];
|
|
627
|
-
}
|
|
628
|
-
const extension = {
|
|
629
|
-
isTopLevelShim: false,
|
|
630
|
-
fileShim: null,
|
|
631
|
-
originalReferencedFiles: null,
|
|
632
|
-
taggedReferenceFiles: null
|
|
633
|
-
};
|
|
634
|
-
extSf[NgExtension] = extension;
|
|
635
|
-
return extension;
|
|
636
|
-
}
|
|
637
|
-
function isFileShimSourceFile(sf) {
|
|
638
|
-
return isExtended(sf) && sf[NgExtension].fileShim !== null;
|
|
639
|
-
}
|
|
640
|
-
function isShim(sf) {
|
|
641
|
-
return isExtended(sf) && (sf[NgExtension].fileShim !== null || sf[NgExtension].isTopLevelShim);
|
|
642
|
-
}
|
|
643
|
-
function copyFileShimData(from, to) {
|
|
644
|
-
if (!isFileShimSourceFile(from)) {
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
sfExtensionData(to).fileShim = sfExtensionData(from).fileShim;
|
|
648
|
-
}
|
|
649
|
-
function untagAllTsFiles(program) {
|
|
650
|
-
for (const sf of program.getSourceFiles()) {
|
|
651
|
-
untagTsFile(sf);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
function retagAllTsFiles(program) {
|
|
655
|
-
for (const sf of program.getSourceFiles()) {
|
|
656
|
-
retagTsFile(sf);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
function untagTsFile(sf) {
|
|
660
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
const ext = sfExtensionData(sf);
|
|
664
|
-
if (ext.originalReferencedFiles !== null) {
|
|
665
|
-
sf.referencedFiles = ext.originalReferencedFiles;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
function retagTsFile(sf) {
|
|
669
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
const ext = sfExtensionData(sf);
|
|
673
|
-
if (ext.taggedReferenceFiles !== null) {
|
|
674
|
-
sf.referencedFiles = ext.taggedReferenceFiles;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/util.mjs
|
|
679
|
-
var TS_EXTENSIONS = /\.tsx?$/i;
|
|
680
|
-
function makeShimFileName(fileName, suffix) {
|
|
681
|
-
return absoluteFrom(fileName.replace(TS_EXTENSIONS, suffix));
|
|
682
|
-
}
|
|
683
|
-
function generatedModuleName(originalModuleName, originalFileName, genSuffix) {
|
|
684
|
-
let moduleName;
|
|
685
|
-
if (originalFileName.endsWith("/index.ts")) {
|
|
686
|
-
moduleName = originalModuleName + "/index" + genSuffix;
|
|
687
|
-
} else {
|
|
688
|
-
moduleName = originalModuleName + genSuffix;
|
|
689
|
-
}
|
|
690
|
-
return moduleName;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
694
|
-
var ShimAdapter = class {
|
|
695
|
-
constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
|
|
696
|
-
this.delegate = delegate;
|
|
697
|
-
this.shims = new Map();
|
|
698
|
-
this.priorShims = new Map();
|
|
699
|
-
this.notShims = new Set();
|
|
700
|
-
this.generators = [];
|
|
701
|
-
this.ignoreForEmit = new Set();
|
|
702
|
-
this.extensionPrefixes = [];
|
|
703
|
-
for (const gen of perFileGenerators) {
|
|
704
|
-
const pattern = `^(.*)\\.${gen.extensionPrefix}\\.ts$`;
|
|
705
|
-
const regexp = new RegExp(pattern, "i");
|
|
706
|
-
this.generators.push({
|
|
707
|
-
generator: gen,
|
|
708
|
-
test: regexp,
|
|
709
|
-
suffix: `.${gen.extensionPrefix}.ts`
|
|
710
|
-
});
|
|
711
|
-
this.extensionPrefixes.push(gen.extensionPrefix);
|
|
712
|
-
}
|
|
713
|
-
const extraInputFiles = [];
|
|
714
|
-
for (const gen of topLevelGenerators) {
|
|
715
|
-
const sf = gen.makeTopLevelShim();
|
|
716
|
-
sfExtensionData(sf).isTopLevelShim = true;
|
|
717
|
-
if (!gen.shouldEmit) {
|
|
718
|
-
this.ignoreForEmit.add(sf);
|
|
719
|
-
}
|
|
720
|
-
const fileName = absoluteFromSourceFile(sf);
|
|
721
|
-
this.shims.set(fileName, sf);
|
|
722
|
-
extraInputFiles.push(fileName);
|
|
723
|
-
}
|
|
724
|
-
for (const rootFile of tsRootFiles) {
|
|
725
|
-
for (const gen of this.generators) {
|
|
726
|
-
extraInputFiles.push(makeShimFileName(rootFile, gen.suffix));
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
this.extraInputFiles = extraInputFiles;
|
|
730
|
-
if (oldProgram !== null) {
|
|
731
|
-
for (const oldSf of oldProgram.getSourceFiles()) {
|
|
732
|
-
if (oldSf.isDeclarationFile || !isFileShimSourceFile(oldSf)) {
|
|
733
|
-
continue;
|
|
734
|
-
}
|
|
735
|
-
this.priorShims.set(absoluteFromSourceFile(oldSf), oldSf);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
maybeGenerate(fileName) {
|
|
740
|
-
if (this.notShims.has(fileName)) {
|
|
741
|
-
return null;
|
|
742
|
-
} else if (this.shims.has(fileName)) {
|
|
743
|
-
return this.shims.get(fileName);
|
|
744
|
-
}
|
|
745
|
-
if (isDtsPath(fileName)) {
|
|
746
|
-
this.notShims.add(fileName);
|
|
747
|
-
return null;
|
|
748
|
-
}
|
|
749
|
-
for (const record of this.generators) {
|
|
750
|
-
const match = record.test.exec(fileName);
|
|
751
|
-
if (match === null) {
|
|
752
|
-
continue;
|
|
753
|
-
}
|
|
754
|
-
const prefix = match[1];
|
|
755
|
-
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
756
|
-
if (!this.delegate.fileExists(baseFileName)) {
|
|
757
|
-
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
758
|
-
if (!this.delegate.fileExists(baseFileName)) {
|
|
759
|
-
return void 0;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
const inputFile = this.delegate.getSourceFile(baseFileName, ts6.ScriptTarget.Latest);
|
|
763
|
-
if (inputFile === void 0 || isShim(inputFile)) {
|
|
764
|
-
return void 0;
|
|
765
|
-
}
|
|
766
|
-
return this.generateSpecific(fileName, record.generator, inputFile);
|
|
767
|
-
}
|
|
768
|
-
this.notShims.add(fileName);
|
|
769
|
-
return null;
|
|
770
|
-
}
|
|
771
|
-
generateSpecific(fileName, generator, inputFile) {
|
|
772
|
-
let priorShimSf = null;
|
|
773
|
-
if (this.priorShims.has(fileName)) {
|
|
774
|
-
priorShimSf = this.priorShims.get(fileName);
|
|
775
|
-
this.priorShims.delete(fileName);
|
|
776
|
-
}
|
|
777
|
-
const shimSf = generator.generateShimForFile(inputFile, fileName, priorShimSf);
|
|
778
|
-
sfExtensionData(shimSf).fileShim = {
|
|
779
|
-
extension: generator.extensionPrefix,
|
|
780
|
-
generatedFrom: absoluteFromSourceFile(inputFile)
|
|
781
|
-
};
|
|
782
|
-
if (!generator.shouldEmit) {
|
|
783
|
-
this.ignoreForEmit.add(shimSf);
|
|
784
|
-
}
|
|
785
|
-
this.shims.set(fileName, shimSf);
|
|
786
|
-
return shimSf;
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
|
-
|
|
790
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.mjs
|
|
791
|
-
import ts7 from "typescript";
|
|
792
|
-
var TS_DTS_SUFFIX = /(\.d)?\.ts$/;
|
|
793
|
-
var STRIP_NG_FACTORY = /(.*)NgFactory$/;
|
|
794
|
-
var FactoryGenerator = class {
|
|
795
|
-
constructor() {
|
|
796
|
-
this.sourceInfo = new Map();
|
|
797
|
-
this.sourceToFactorySymbols = new Map();
|
|
798
|
-
this.shouldEmit = true;
|
|
799
|
-
this.extensionPrefix = "ngfactory";
|
|
800
|
-
}
|
|
801
|
-
generateShimForFile(sf, genFilePath) {
|
|
802
|
-
const absoluteSfPath = absoluteFromSourceFile(sf);
|
|
803
|
-
const relativePathToSource = "./" + basename(sf.fileName).replace(TS_DTS_SUFFIX, "");
|
|
804
|
-
const symbolNames = sf.statements.filter(ts7.isClassDeclaration).filter((decl) => isExported(decl) && decl.decorators !== void 0 && decl.name !== void 0).map((decl) => decl.name.text);
|
|
805
|
-
let sourceText = "";
|
|
806
|
-
const leadingComment = getFileoverviewComment(sf);
|
|
807
|
-
if (leadingComment !== null) {
|
|
808
|
-
sourceText = leadingComment + "\n\n";
|
|
809
|
-
}
|
|
810
|
-
if (symbolNames.length > 0) {
|
|
811
|
-
const varLines = symbolNames.map((name) => `export const ${name}NgFactory: i0.\u0275NgModuleFactory<any> = new i0.\u0275NgModuleFactory(${name});`);
|
|
812
|
-
sourceText += [
|
|
813
|
-
`import * as i0 from '@angular/core';`,
|
|
814
|
-
`import {${symbolNames.join(", ")}} from '${relativePathToSource}';`,
|
|
815
|
-
...varLines
|
|
816
|
-
].join("\n");
|
|
817
|
-
}
|
|
818
|
-
sourceText += "\nexport const \u0275NonEmptyModule = true;";
|
|
819
|
-
const genFile = ts7.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts7.ScriptKind.TS);
|
|
820
|
-
if (sf.moduleName !== void 0) {
|
|
821
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngfactory");
|
|
822
|
-
}
|
|
823
|
-
const moduleSymbols = new Map();
|
|
824
|
-
this.sourceToFactorySymbols.set(absoluteSfPath, moduleSymbols);
|
|
825
|
-
this.sourceInfo.set(genFilePath, {
|
|
826
|
-
sourceFilePath: absoluteSfPath,
|
|
827
|
-
moduleSymbols
|
|
828
|
-
});
|
|
829
|
-
return genFile;
|
|
830
|
-
}
|
|
831
|
-
track(sf, moduleInfo) {
|
|
832
|
-
if (this.sourceToFactorySymbols.has(sf.fileName)) {
|
|
833
|
-
this.sourceToFactorySymbols.get(sf.fileName).set(moduleInfo.name, moduleInfo);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
function isExported(decl) {
|
|
838
|
-
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts7.SyntaxKind.ExportKeyword);
|
|
839
|
-
}
|
|
840
|
-
function generatedFactoryTransform(factoryMap, importRewriter) {
|
|
841
|
-
return (context) => {
|
|
842
|
-
return (file) => {
|
|
843
|
-
return transformFactorySourceFile(factoryMap, context, importRewriter, file);
|
|
844
|
-
};
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
|
|
848
|
-
if (!factoryMap.has(file.fileName)) {
|
|
849
|
-
return file;
|
|
850
|
-
}
|
|
851
|
-
const { moduleSymbols, sourceFilePath } = factoryMap.get(file.fileName);
|
|
852
|
-
const transformedStatements = [];
|
|
853
|
-
let nonEmptyExport = null;
|
|
854
|
-
const coreImportIdentifiers = new Set();
|
|
855
|
-
for (const stmt of file.statements) {
|
|
856
|
-
if (ts7.isImportDeclaration(stmt) && ts7.isStringLiteral(stmt.moduleSpecifier) && stmt.moduleSpecifier.text === "@angular/core") {
|
|
857
|
-
const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier("@angular/core", sourceFilePath);
|
|
858
|
-
if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
|
|
859
|
-
transformedStatements.push(ts7.updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts7.createStringLiteral(rewrittenModuleSpecifier), void 0));
|
|
860
|
-
if (stmt.importClause !== void 0 && stmt.importClause.namedBindings !== void 0 && ts7.isNamespaceImport(stmt.importClause.namedBindings)) {
|
|
861
|
-
coreImportIdentifiers.add(stmt.importClause.namedBindings.name.text);
|
|
862
|
-
}
|
|
863
|
-
} else {
|
|
864
|
-
transformedStatements.push(stmt);
|
|
865
|
-
}
|
|
866
|
-
} else if (ts7.isVariableStatement(stmt) && stmt.declarationList.declarations.length === 1) {
|
|
867
|
-
const decl = stmt.declarationList.declarations[0];
|
|
868
|
-
if (ts7.isIdentifier(decl.name)) {
|
|
869
|
-
if (decl.name.text === "\u0275NonEmptyModule") {
|
|
870
|
-
nonEmptyExport = stmt;
|
|
871
|
-
continue;
|
|
872
|
-
}
|
|
873
|
-
const match = STRIP_NG_FACTORY.exec(decl.name.text);
|
|
874
|
-
const module = match ? moduleSymbols.get(match[1]) : null;
|
|
875
|
-
if (module) {
|
|
876
|
-
const moduleIsTreeShakable = !module.hasId;
|
|
877
|
-
const newStmt = !moduleIsTreeShakable ? stmt : updateInitializers(stmt, (init) => init ? wrapInNoSideEffects(init) : void 0);
|
|
878
|
-
transformedStatements.push(newStmt);
|
|
879
|
-
}
|
|
880
|
-
} else {
|
|
881
|
-
transformedStatements.push(stmt);
|
|
882
|
-
}
|
|
883
|
-
} else {
|
|
884
|
-
transformedStatements.push(stmt);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
if (!transformedStatements.some(ts7.isVariableStatement) && nonEmptyExport !== null) {
|
|
888
|
-
transformedStatements.push(nonEmptyExport);
|
|
889
|
-
}
|
|
890
|
-
file = ts7.updateSourceFileNode(file, transformedStatements);
|
|
891
|
-
if (coreImportIdentifiers.size > 0) {
|
|
892
|
-
const visit = (node) => {
|
|
893
|
-
node = ts7.visitEachChild(node, (child) => visit(child), context);
|
|
894
|
-
if (ts7.isPropertyAccessExpression(node) && ts7.isIdentifier(node.expression) && coreImportIdentifiers.has(node.expression.text)) {
|
|
895
|
-
const rewrittenSymbol = importRewriter.rewriteSymbol(node.name.text, "@angular/core");
|
|
896
|
-
if (rewrittenSymbol !== node.name.text) {
|
|
897
|
-
const updated = ts7.updatePropertyAccess(node, node.expression, ts7.createIdentifier(rewrittenSymbol));
|
|
898
|
-
node = updated;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
return node;
|
|
902
|
-
};
|
|
903
|
-
file = visit(file);
|
|
904
|
-
}
|
|
905
|
-
return file;
|
|
906
|
-
}
|
|
907
|
-
function getFileoverviewComment(sourceFile) {
|
|
908
|
-
const text = sourceFile.getFullText();
|
|
909
|
-
const trivia = text.substring(0, sourceFile.getStart());
|
|
910
|
-
const leadingComments = ts7.getLeadingCommentRanges(trivia, 0);
|
|
911
|
-
if (!leadingComments || leadingComments.length === 0) {
|
|
912
|
-
return null;
|
|
913
|
-
}
|
|
914
|
-
const comment = leadingComments[0];
|
|
915
|
-
if (comment.kind !== ts7.SyntaxKind.MultiLineCommentTrivia) {
|
|
916
|
-
return null;
|
|
917
|
-
}
|
|
918
|
-
if (text.substring(comment.end, comment.end + 2) !== "\n\n") {
|
|
919
|
-
return null;
|
|
920
|
-
}
|
|
921
|
-
const commentText = text.substring(comment.pos, comment.end);
|
|
922
|
-
if (commentText.indexOf("@license") !== -1) {
|
|
923
|
-
return null;
|
|
924
|
-
}
|
|
925
|
-
return commentText;
|
|
926
|
-
}
|
|
927
|
-
function wrapInNoSideEffects(expr) {
|
|
928
|
-
const noSideEffects = ts7.createPropertyAccess(ts7.createIdentifier("i0"), "\u0275noSideEffects");
|
|
929
|
-
return ts7.createCall(noSideEffects, [], [
|
|
930
|
-
ts7.createFunctionExpression([], void 0, void 0, [], [], void 0, ts7.createBlock([
|
|
931
|
-
ts7.createReturn(expr)
|
|
932
|
-
]))
|
|
933
|
-
]);
|
|
934
|
-
}
|
|
935
|
-
function updateInitializers(stmt, update) {
|
|
936
|
-
return ts7.updateVariableStatement(stmt, stmt.modifiers, ts7.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts7.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
|
|
940
|
-
var ShimReferenceTagger = class {
|
|
941
|
-
constructor(shimExtensions) {
|
|
942
|
-
this.tagged = new Set();
|
|
943
|
-
this.enabled = true;
|
|
944
|
-
this.suffixes = shimExtensions.map((extension) => `.${extension}.ts`);
|
|
945
|
-
}
|
|
946
|
-
tag(sf) {
|
|
947
|
-
if (!this.enabled || sf.isDeclarationFile || isShim(sf) || this.tagged.has(sf) || !isNonDeclarationTsPath(sf.fileName)) {
|
|
948
|
-
return;
|
|
949
|
-
}
|
|
950
|
-
const ext = sfExtensionData(sf);
|
|
951
|
-
if (ext.originalReferencedFiles === null) {
|
|
952
|
-
ext.originalReferencedFiles = sf.referencedFiles;
|
|
953
|
-
}
|
|
954
|
-
const referencedFiles = [...ext.originalReferencedFiles];
|
|
955
|
-
const sfPath = absoluteFromSourceFile(sf);
|
|
956
|
-
for (const suffix of this.suffixes) {
|
|
957
|
-
referencedFiles.push({
|
|
958
|
-
fileName: makeShimFileName(sfPath, suffix),
|
|
959
|
-
pos: 0,
|
|
960
|
-
end: 0
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
ext.taggedReferenceFiles = referencedFiles;
|
|
964
|
-
sf.referencedFiles = referencedFiles;
|
|
965
|
-
this.tagged.add(sf);
|
|
966
|
-
}
|
|
967
|
-
finalize() {
|
|
968
|
-
this.enabled = false;
|
|
969
|
-
this.tagged.clear();
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
|
|
973
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.mjs
|
|
974
|
-
import ts8 from "typescript";
|
|
975
|
-
var SummaryGenerator = class {
|
|
976
|
-
constructor() {
|
|
977
|
-
this.shouldEmit = true;
|
|
978
|
-
this.extensionPrefix = "ngsummary";
|
|
979
|
-
}
|
|
980
|
-
generateShimForFile(sf, genFilePath) {
|
|
981
|
-
const symbolNames = [];
|
|
982
|
-
for (const stmt of sf.statements) {
|
|
983
|
-
if (ts8.isClassDeclaration(stmt)) {
|
|
984
|
-
if (!isExported2(stmt) || stmt.decorators === void 0 || stmt.name === void 0) {
|
|
985
|
-
continue;
|
|
986
|
-
}
|
|
987
|
-
symbolNames.push(stmt.name.text);
|
|
988
|
-
} else if (ts8.isExportDeclaration(stmt)) {
|
|
989
|
-
if (stmt.exportClause === void 0 || stmt.moduleSpecifier !== void 0 || !ts8.isNamedExports(stmt.exportClause)) {
|
|
990
|
-
continue;
|
|
991
|
-
}
|
|
992
|
-
for (const specifier of stmt.exportClause.elements) {
|
|
993
|
-
symbolNames.push(specifier.name.text);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
const varLines = symbolNames.map((name) => `export const ${name}NgSummary: any = null;`);
|
|
998
|
-
if (varLines.length === 0) {
|
|
999
|
-
varLines.push(`export const \u0275empty = null;`);
|
|
1000
|
-
}
|
|
1001
|
-
const sourceText = varLines.join("\n");
|
|
1002
|
-
const genFile = ts8.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts8.ScriptKind.TS);
|
|
1003
|
-
if (sf.moduleName !== void 0) {
|
|
1004
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngsummary");
|
|
1005
|
-
}
|
|
1006
|
-
return genFile;
|
|
1007
|
-
}
|
|
1008
|
-
};
|
|
1009
|
-
function isExported2(decl) {
|
|
1010
|
-
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts8.SyntaxKind.ExportKeyword);
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
1014
620
|
var DelegatingCompilerHost = class {
|
|
1015
621
|
constructor(delegate) {
|
|
1016
622
|
this.delegate = delegate;
|
|
@@ -1082,7 +688,7 @@ var TsCreateProgramDriver = class {
|
|
|
1082
688
|
this.originalHost = originalHost;
|
|
1083
689
|
this.options = options;
|
|
1084
690
|
this.shimExtensionPrefixes = shimExtensionPrefixes;
|
|
1085
|
-
this.sfMap = new Map();
|
|
691
|
+
this.sfMap = /* @__PURE__ */ new Map();
|
|
1086
692
|
this.program = this.originalProgram;
|
|
1087
693
|
this.supportsInlineOperations = true;
|
|
1088
694
|
}
|
|
@@ -1099,7 +705,7 @@ var TsCreateProgramDriver = class {
|
|
|
1099
705
|
this.sfMap.clear();
|
|
1100
706
|
}
|
|
1101
707
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
1102
|
-
const sf =
|
|
708
|
+
const sf = ts6.createSourceFile(filePath, newText, ts6.ScriptTarget.Latest, true);
|
|
1103
709
|
if (originalFile !== null) {
|
|
1104
710
|
sf[NgOriginalFile] = originalFile;
|
|
1105
711
|
}
|
|
@@ -1108,7 +714,7 @@ var TsCreateProgramDriver = class {
|
|
|
1108
714
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
1109
715
|
const oldProgram = this.program;
|
|
1110
716
|
retagAllTsFiles(oldProgram);
|
|
1111
|
-
this.program =
|
|
717
|
+
this.program = ts6.createProgram({
|
|
1112
718
|
host,
|
|
1113
719
|
rootNames: this.program.getRootFileNames(),
|
|
1114
720
|
options: this.options,
|
|
@@ -1120,10 +726,10 @@ var TsCreateProgramDriver = class {
|
|
|
1120
726
|
}
|
|
1121
727
|
};
|
|
1122
728
|
|
|
1123
|
-
// bazel-out/
|
|
729
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/dependency_tracking.mjs
|
|
1124
730
|
var FileDependencyGraph = class {
|
|
1125
731
|
constructor() {
|
|
1126
|
-
this.nodes = new Map();
|
|
732
|
+
this.nodes = /* @__PURE__ */ new Map();
|
|
1127
733
|
}
|
|
1128
734
|
addDependency(from, on) {
|
|
1129
735
|
this.nodeFor(from).dependsOn.add(absoluteFromSourceFile(on));
|
|
@@ -1139,7 +745,7 @@ var FileDependencyGraph = class {
|
|
|
1139
745
|
return node ? [...node.usesResources] : [];
|
|
1140
746
|
}
|
|
1141
747
|
updateWithPhysicalChanges(previous, changedTsPaths, deletedTsPaths, changedResources) {
|
|
1142
|
-
const logicallyChanged = new Set();
|
|
748
|
+
const logicallyChanged = /* @__PURE__ */ new Set();
|
|
1143
749
|
for (const sf of previous.nodes.keys()) {
|
|
1144
750
|
const sfPath = absoluteFromSourceFile(sf);
|
|
1145
751
|
const node = previous.nodeFor(sf);
|
|
@@ -1158,8 +764,8 @@ var FileDependencyGraph = class {
|
|
|
1158
764
|
nodeFor(sf) {
|
|
1159
765
|
if (!this.nodes.has(sf)) {
|
|
1160
766
|
this.nodes.set(sf, {
|
|
1161
|
-
dependsOn: new Set(),
|
|
1162
|
-
usesResources: new Set(),
|
|
767
|
+
dependsOn: /* @__PURE__ */ new Set(),
|
|
768
|
+
usesResources: /* @__PURE__ */ new Set(),
|
|
1163
769
|
failedAnalysis: false
|
|
1164
770
|
});
|
|
1165
771
|
}
|
|
@@ -1187,7 +793,7 @@ function isLogicallyChanged(sf, node, changedTsPaths, deletedTsPaths, changedRes
|
|
|
1187
793
|
return false;
|
|
1188
794
|
}
|
|
1189
795
|
|
|
1190
|
-
// bazel-out/
|
|
796
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/state.mjs
|
|
1191
797
|
var IncrementalStateKind;
|
|
1192
798
|
(function(IncrementalStateKind2) {
|
|
1193
799
|
IncrementalStateKind2[IncrementalStateKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -1195,7 +801,7 @@ var IncrementalStateKind;
|
|
|
1195
801
|
IncrementalStateKind2[IncrementalStateKind2["Analyzed"] = 2] = "Analyzed";
|
|
1196
802
|
})(IncrementalStateKind || (IncrementalStateKind = {}));
|
|
1197
803
|
|
|
1198
|
-
// bazel-out/
|
|
804
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/incremental.mjs
|
|
1199
805
|
var PhaseKind;
|
|
1200
806
|
(function(PhaseKind2) {
|
|
1201
807
|
PhaseKind2[PhaseKind2["Analysis"] = 0] = "Analysis";
|
|
@@ -1220,7 +826,7 @@ var IncrementalCompilation = class {
|
|
|
1220
826
|
}
|
|
1221
827
|
static incremental(program, newVersions, oldProgram, oldState, modifiedResourceFiles, perf) {
|
|
1222
828
|
return perf.inPhase(PerfPhase.Reconciliation, () => {
|
|
1223
|
-
const physicallyChangedTsFiles = new Set();
|
|
829
|
+
const physicallyChangedTsFiles = /* @__PURE__ */ new Set();
|
|
1224
830
|
const changedResourceFiles = new Set(modifiedResourceFiles != null ? modifiedResourceFiles : []);
|
|
1225
831
|
let priorAnalysis;
|
|
1226
832
|
switch (oldState.kind) {
|
|
@@ -1296,7 +902,7 @@ var IncrementalCompilation = class {
|
|
|
1296
902
|
const { needsEmit, needsTypeCheckEmit, newGraph } = this.phase.semanticDepGraphUpdater.finalize();
|
|
1297
903
|
let emitted;
|
|
1298
904
|
if (this.step === null) {
|
|
1299
|
-
emitted = new Set();
|
|
905
|
+
emitted = /* @__PURE__ */ new Set();
|
|
1300
906
|
} else {
|
|
1301
907
|
emitted = new Set(this.step.priorState.emitted);
|
|
1302
908
|
for (const sfPath of this.step.logicallyChangedTsFiles) {
|
|
@@ -1396,7 +1002,7 @@ function toOriginalSourceFile(sf) {
|
|
|
1396
1002
|
}
|
|
1397
1003
|
}
|
|
1398
1004
|
|
|
1399
|
-
// bazel-out/
|
|
1005
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/strategy.mjs
|
|
1400
1006
|
var TrackedIncrementalBuildStrategy = class {
|
|
1401
1007
|
constructor() {
|
|
1402
1008
|
this.state = null;
|
|
@@ -1432,7 +1038,7 @@ var PatchedProgramIncrementalBuildStrategy = class {
|
|
|
1432
1038
|
};
|
|
1433
1039
|
var SYM_INCREMENTAL_STATE = Symbol("NgIncrementalState");
|
|
1434
1040
|
|
|
1435
|
-
// bazel-out/
|
|
1041
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/api.mjs
|
|
1436
1042
|
var IdentifierKind;
|
|
1437
1043
|
(function(IdentifierKind2) {
|
|
1438
1044
|
IdentifierKind2[IdentifierKind2["Property"] = 0] = "Property";
|
|
@@ -1450,21 +1056,21 @@ var AbsoluteSourceSpan = class {
|
|
|
1450
1056
|
}
|
|
1451
1057
|
};
|
|
1452
1058
|
|
|
1453
|
-
// bazel-out/
|
|
1059
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/context.mjs
|
|
1454
1060
|
var IndexingContext = class {
|
|
1455
1061
|
constructor() {
|
|
1456
|
-
this.components = new Set();
|
|
1062
|
+
this.components = /* @__PURE__ */ new Set();
|
|
1457
1063
|
}
|
|
1458
1064
|
addComponent(info) {
|
|
1459
1065
|
this.components.add(info);
|
|
1460
1066
|
}
|
|
1461
1067
|
};
|
|
1462
1068
|
|
|
1463
|
-
// bazel-out/
|
|
1069
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1464
1070
|
import { ParseSourceFile } from "@angular/compiler";
|
|
1465
1071
|
|
|
1466
|
-
// bazel-out/
|
|
1467
|
-
import { ASTWithSource, ImplicitReceiver, RecursiveAstVisitor, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
1072
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/template.mjs
|
|
1073
|
+
import { ASTWithSource, ImplicitReceiver, PropertyRead, PropertyWrite, RecursiveAstVisitor, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
1468
1074
|
var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
1469
1075
|
constructor(expressionStr, absoluteOffset, boundTemplate, targetToIdentifier) {
|
|
1470
1076
|
super();
|
|
@@ -1494,7 +1100,10 @@ var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
|
1494
1100
|
if (!(ast.receiver instanceof ImplicitReceiver)) {
|
|
1495
1101
|
return;
|
|
1496
1102
|
}
|
|
1497
|
-
|
|
1103
|
+
let identifierStart = ast.sourceSpan.start - this.absoluteOffset;
|
|
1104
|
+
if (ast instanceof PropertyRead || ast instanceof PropertyWrite) {
|
|
1105
|
+
identifierStart = ast.nameSpan.start - this.absoluteOffset;
|
|
1106
|
+
}
|
|
1498
1107
|
if (!this.expressionStr.substring(identifierStart).startsWith(ast.name)) {
|
|
1499
1108
|
throw new Error(`Impossible state: "${ast.name}" not found in "${this.expressionStr}" at location ${identifierStart}`);
|
|
1500
1109
|
}
|
|
@@ -1515,9 +1124,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1515
1124
|
constructor(boundTemplate) {
|
|
1516
1125
|
super();
|
|
1517
1126
|
this.boundTemplate = boundTemplate;
|
|
1518
|
-
this.identifiers = new Set();
|
|
1519
|
-
this.targetIdentifierCache = new Map();
|
|
1520
|
-
this.elementAndTemplateIdentifierCache = new Map();
|
|
1127
|
+
this.identifiers = /* @__PURE__ */ new Set();
|
|
1128
|
+
this.targetIdentifierCache = /* @__PURE__ */ new Map();
|
|
1129
|
+
this.elementAndTemplateIdentifierCache = /* @__PURE__ */ new Map();
|
|
1521
1130
|
}
|
|
1522
1131
|
visit(node) {
|
|
1523
1132
|
node.visit(this);
|
|
@@ -1574,7 +1183,11 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1574
1183
|
name = node.tagName;
|
|
1575
1184
|
kind = IdentifierKind.Template;
|
|
1576
1185
|
} else {
|
|
1577
|
-
|
|
1186
|
+
if (node.name.startsWith(":")) {
|
|
1187
|
+
name = node.name.split(":").pop();
|
|
1188
|
+
} else {
|
|
1189
|
+
name = node.name;
|
|
1190
|
+
}
|
|
1578
1191
|
kind = IdentifierKind.Element;
|
|
1579
1192
|
}
|
|
1580
1193
|
const sourceSpan = node.startSourceSpan;
|
|
@@ -1667,12 +1280,12 @@ function getTemplateIdentifiers(boundTemplate) {
|
|
|
1667
1280
|
return visitor.identifiers;
|
|
1668
1281
|
}
|
|
1669
1282
|
|
|
1670
|
-
// bazel-out/
|
|
1283
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1671
1284
|
function generateAnalysis(context) {
|
|
1672
|
-
const analysis = new Map();
|
|
1285
|
+
const analysis = /* @__PURE__ */ new Map();
|
|
1673
1286
|
context.components.forEach(({ declaration, selector, boundTemplate, templateMeta }) => {
|
|
1674
1287
|
const name = declaration.name.getText();
|
|
1675
|
-
const usedComponents = new Set();
|
|
1288
|
+
const usedComponents = /* @__PURE__ */ new Set();
|
|
1676
1289
|
const usedDirs = boundTemplate.getUsedDirectives();
|
|
1677
1290
|
usedDirs.forEach((dir) => {
|
|
1678
1291
|
if (dir.isComponent) {
|
|
@@ -1701,8 +1314,8 @@ function generateAnalysis(context) {
|
|
|
1701
1314
|
return analysis;
|
|
1702
1315
|
}
|
|
1703
1316
|
|
|
1704
|
-
// bazel-out/
|
|
1705
|
-
import
|
|
1317
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
1318
|
+
import ts7 from "typescript";
|
|
1706
1319
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
1707
1320
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
1708
1321
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -1710,8 +1323,8 @@ var AdapterResourceLoader = class {
|
|
|
1710
1323
|
constructor(adapter, options) {
|
|
1711
1324
|
this.adapter = adapter;
|
|
1712
1325
|
this.options = options;
|
|
1713
|
-
this.cache = new Map();
|
|
1714
|
-
this.fetching = new Map();
|
|
1326
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
1327
|
+
this.fetching = /* @__PURE__ */ new Map();
|
|
1715
1328
|
this.lookupResolutionHost = createLookupResolutionHost(this.adapter);
|
|
1716
1329
|
this.canPreload = !!this.adapter.readResource;
|
|
1717
1330
|
this.canPreprocess = !!this.adapter.transformResource;
|
|
@@ -1812,7 +1425,7 @@ var AdapterResourceLoader = class {
|
|
|
1812
1425
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
1813
1426
|
}
|
|
1814
1427
|
getResolvedCandidateLocations(url, fromFile) {
|
|
1815
|
-
const failedLookup =
|
|
1428
|
+
const failedLookup = ts7.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
1816
1429
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
1817
1430
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
1818
1431
|
}
|
|
@@ -1847,12 +1460,12 @@ function createLookupResolutionHost(adapter) {
|
|
|
1847
1460
|
};
|
|
1848
1461
|
}
|
|
1849
1462
|
|
|
1850
|
-
// bazel-out/
|
|
1463
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/dependency.mjs
|
|
1851
1464
|
var MetadataDtsModuleScopeResolver = class {
|
|
1852
1465
|
constructor(dtsMetaReader, aliasingHost) {
|
|
1853
1466
|
this.dtsMetaReader = dtsMetaReader;
|
|
1854
1467
|
this.aliasingHost = aliasingHost;
|
|
1855
|
-
this.cache = new Map();
|
|
1468
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
1856
1469
|
}
|
|
1857
1470
|
resolve(ref) {
|
|
1858
1471
|
const clazz = ref.node;
|
|
@@ -1865,13 +1478,13 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
1865
1478
|
}
|
|
1866
1479
|
const directives = [];
|
|
1867
1480
|
const pipes = [];
|
|
1868
|
-
const ngModules = new Set([clazz]);
|
|
1481
|
+
const ngModules = /* @__PURE__ */ new Set([clazz]);
|
|
1869
1482
|
const meta = this.dtsMetaReader.getNgModuleMetadata(ref);
|
|
1870
1483
|
if (meta === null) {
|
|
1871
1484
|
this.cache.set(clazz, null);
|
|
1872
1485
|
return null;
|
|
1873
1486
|
}
|
|
1874
|
-
const declarations = new Set();
|
|
1487
|
+
const declarations = /* @__PURE__ */ new Set();
|
|
1875
1488
|
for (const declRef of meta.declarations) {
|
|
1876
1489
|
declarations.add(declRef.node);
|
|
1877
1490
|
}
|
|
@@ -1933,9 +1546,9 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
1933
1546
|
}
|
|
1934
1547
|
};
|
|
1935
1548
|
|
|
1936
|
-
// bazel-out/
|
|
1549
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
1937
1550
|
import { ExternalExpr } from "@angular/compiler";
|
|
1938
|
-
import
|
|
1551
|
+
import ts8 from "typescript";
|
|
1939
1552
|
var LocalModuleScopeRegistry = class {
|
|
1940
1553
|
constructor(localReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
1941
1554
|
this.localReader = localReader;
|
|
@@ -1943,13 +1556,13 @@ var LocalModuleScopeRegistry = class {
|
|
|
1943
1556
|
this.refEmitter = refEmitter;
|
|
1944
1557
|
this.aliasingHost = aliasingHost;
|
|
1945
1558
|
this.sealed = false;
|
|
1946
|
-
this.declarationToModule = new Map();
|
|
1947
|
-
this.duplicateDeclarations = new Map();
|
|
1948
|
-
this.moduleToRef = new Map();
|
|
1949
|
-
this.cache = new Map();
|
|
1950
|
-
this.remoteScoping = new Map();
|
|
1951
|
-
this.scopeErrors = new Map();
|
|
1952
|
-
this.modulesWithStructuralErrors = new Set();
|
|
1559
|
+
this.declarationToModule = /* @__PURE__ */ new Map();
|
|
1560
|
+
this.duplicateDeclarations = /* @__PURE__ */ new Map();
|
|
1561
|
+
this.moduleToRef = /* @__PURE__ */ new Map();
|
|
1562
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
1563
|
+
this.remoteScoping = /* @__PURE__ */ new Map();
|
|
1564
|
+
this.scopeErrors = /* @__PURE__ */ new Map();
|
|
1565
|
+
this.modulesWithStructuralErrors = /* @__PURE__ */ new Set();
|
|
1953
1566
|
}
|
|
1954
1567
|
registerNgModuleMetadata(data) {
|
|
1955
1568
|
this.assertCollecting();
|
|
@@ -1993,7 +1606,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
1993
1606
|
if (this.duplicateDeclarations.has(decl.node)) {
|
|
1994
1607
|
this.duplicateDeclarations.get(decl.node).set(ngModule, declData);
|
|
1995
1608
|
} else if (this.declarationToModule.has(decl.node) && this.declarationToModule.get(decl.node).ngModule !== ngModule) {
|
|
1996
|
-
const duplicateDeclMap = new Map();
|
|
1609
|
+
const duplicateDeclMap = /* @__PURE__ */ new Map();
|
|
1997
1610
|
const firstDeclData = this.declarationToModule.get(decl.node);
|
|
1998
1611
|
this.modulesWithStructuralErrors.add(firstDeclData.ngModule);
|
|
1999
1612
|
this.modulesWithStructuralErrors.add(ngModule);
|
|
@@ -2015,14 +1628,14 @@ var LocalModuleScopeRegistry = class {
|
|
|
2015
1628
|
this.cache.set(ref.node, null);
|
|
2016
1629
|
return null;
|
|
2017
1630
|
}
|
|
2018
|
-
const compilationModules = new Set([ngModule.ref.node]);
|
|
2019
|
-
const exportedModules = new Set([ngModule.ref.node]);
|
|
1631
|
+
const compilationModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
1632
|
+
const exportedModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
2020
1633
|
const diagnostics = [];
|
|
2021
|
-
const compilationDirectives = new Map();
|
|
2022
|
-
const compilationPipes = new Map();
|
|
2023
|
-
const declared = new Set();
|
|
2024
|
-
const exportDirectives = new Map();
|
|
2025
|
-
const exportPipes = new Map();
|
|
1634
|
+
const compilationDirectives = /* @__PURE__ */ new Map();
|
|
1635
|
+
const compilationPipes = /* @__PURE__ */ new Map();
|
|
1636
|
+
const declared = /* @__PURE__ */ new Set();
|
|
1637
|
+
const exportDirectives = /* @__PURE__ */ new Map();
|
|
1638
|
+
const exportPipes = /* @__PURE__ */ new Map();
|
|
2026
1639
|
let isPoisoned = false;
|
|
2027
1640
|
if (this.modulesWithStructuralErrors.has(ngModule.ref.node)) {
|
|
2028
1641
|
isPoisoned = true;
|
|
@@ -2136,7 +1749,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
2136
1749
|
}
|
|
2137
1750
|
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
2138
1751
|
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
2139
|
-
if (!
|
|
1752
|
+
if (!ts8.isClassDeclaration(ref.node)) {
|
|
2140
1753
|
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
2141
1754
|
diagnostics.push(makeDiagnostic(code, identifierOfNode(ref.node) || ref.node, `Appears in the NgModule.${type}s of ${nodeNameForError(ownerForErrors)}, but could not be resolved to an NgModule`));
|
|
2142
1755
|
return "invalid";
|
|
@@ -2153,7 +1766,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
2153
1766
|
return null;
|
|
2154
1767
|
}
|
|
2155
1768
|
reexports = [];
|
|
2156
|
-
const reexportMap = new Map();
|
|
1769
|
+
const reexportMap = /* @__PURE__ */ new Map();
|
|
2157
1770
|
const ngModuleRef = ref;
|
|
2158
1771
|
const addReexport = (exportRef) => {
|
|
2159
1772
|
if (exportRef.node.getSourceFile() === sourceFile) {
|
|
@@ -2172,7 +1785,9 @@ var LocalModuleScopeRegistry = class {
|
|
|
2172
1785
|
asAlias: exportName
|
|
2173
1786
|
});
|
|
2174
1787
|
} else {
|
|
2175
|
-
const
|
|
1788
|
+
const emittedRef = this.refEmitter.emit(exportRef.cloneWithNoIdentifiers(), sourceFile);
|
|
1789
|
+
assertSuccessfulReferenceEmit(emittedRef, ngModuleRef.node.name, "class");
|
|
1790
|
+
const expr = emittedRef.expression;
|
|
2176
1791
|
if (!(expr instanceof ExternalExpr) || expr.value.moduleName === null || expr.value.name === null) {
|
|
2177
1792
|
throw new Error("Expected ExternalExpr");
|
|
2178
1793
|
}
|
|
@@ -2241,20 +1856,20 @@ function reexportCollision(module, refA, refB) {
|
|
|
2241
1856
|
]);
|
|
2242
1857
|
}
|
|
2243
1858
|
|
|
2244
|
-
// bazel-out/
|
|
1859
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
2245
1860
|
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
2246
|
-
import
|
|
1861
|
+
import ts9 from "typescript";
|
|
2247
1862
|
var TypeCheckScopeRegistry = class {
|
|
2248
1863
|
constructor(scopeReader, metaReader) {
|
|
2249
1864
|
this.scopeReader = scopeReader;
|
|
2250
1865
|
this.metaReader = metaReader;
|
|
2251
|
-
this.flattenedDirectiveMetaCache = new Map();
|
|
2252
|
-
this.scopeCache = new Map();
|
|
1866
|
+
this.flattenedDirectiveMetaCache = /* @__PURE__ */ new Map();
|
|
1867
|
+
this.scopeCache = /* @__PURE__ */ new Map();
|
|
2253
1868
|
}
|
|
2254
1869
|
getTypeCheckScope(node) {
|
|
2255
1870
|
const matcher = new SelectorMatcher();
|
|
2256
1871
|
const directives = [];
|
|
2257
|
-
const pipes = new Map();
|
|
1872
|
+
const pipes = /* @__PURE__ */ new Map();
|
|
2258
1873
|
const scope = this.scopeReader.getScopeForComponent(node);
|
|
2259
1874
|
if (scope === null) {
|
|
2260
1875
|
return {
|
|
@@ -2276,8 +1891,8 @@ var TypeCheckScopeRegistry = class {
|
|
|
2276
1891
|
}
|
|
2277
1892
|
}
|
|
2278
1893
|
for (const { name, ref } of scope.compilation.pipes) {
|
|
2279
|
-
if (!
|
|
2280
|
-
throw new Error(`Unexpected non-class declaration ${
|
|
1894
|
+
if (!ts9.isClassDeclaration(ref.node)) {
|
|
1895
|
+
throw new Error(`Unexpected non-class declaration ${ts9.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
|
|
2281
1896
|
}
|
|
2282
1897
|
pipes.set(name, ref);
|
|
2283
1898
|
}
|
|
@@ -2302,11 +1917,11 @@ var TypeCheckScopeRegistry = class {
|
|
|
2302
1917
|
}
|
|
2303
1918
|
};
|
|
2304
1919
|
|
|
2305
|
-
// bazel-out/
|
|
1920
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
2306
1921
|
import { CssSelector as CssSelector2, DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
2307
1922
|
|
|
2308
|
-
// bazel-out/
|
|
2309
|
-
import
|
|
1923
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
1924
|
+
import ts10 from "typescript";
|
|
2310
1925
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
2311
1926
|
if (mapping.type === "direct") {
|
|
2312
1927
|
let relatedInformation = void 0;
|
|
@@ -2314,7 +1929,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2314
1929
|
relatedInformation = [];
|
|
2315
1930
|
for (const relatedMessage of relatedMessages) {
|
|
2316
1931
|
relatedInformation.push({
|
|
2317
|
-
category:
|
|
1932
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2318
1933
|
code: 0,
|
|
2319
1934
|
file: relatedMessage.sourceFile,
|
|
2320
1935
|
start: relatedMessage.start,
|
|
@@ -2339,12 +1954,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2339
1954
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
2340
1955
|
const componentName = mapping.componentClass.name.text;
|
|
2341
1956
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
2342
|
-
const sf =
|
|
1957
|
+
const sf = ts10.createSourceFile(fileName, mapping.template, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.JSX);
|
|
2343
1958
|
let relatedInformation = [];
|
|
2344
1959
|
if (relatedMessages !== void 0) {
|
|
2345
1960
|
for (const relatedMessage of relatedMessages) {
|
|
2346
1961
|
relatedInformation.push({
|
|
2347
|
-
category:
|
|
1962
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2348
1963
|
code: 0,
|
|
2349
1964
|
file: relatedMessage.sourceFile,
|
|
2350
1965
|
start: relatedMessage.start,
|
|
@@ -2354,7 +1969,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2354
1969
|
}
|
|
2355
1970
|
}
|
|
2356
1971
|
relatedInformation.push({
|
|
2357
|
-
category:
|
|
1972
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2358
1973
|
code: 0,
|
|
2359
1974
|
file: componentSf,
|
|
2360
1975
|
start: mapping.node.getStart(),
|
|
@@ -2378,7 +1993,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2378
1993
|
}
|
|
2379
1994
|
}
|
|
2380
1995
|
|
|
2381
|
-
// bazel-out/
|
|
1996
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
2382
1997
|
var TEMPLATE_ID = Symbol("ngTemplateId");
|
|
2383
1998
|
var NEXT_TEMPLATE_ID = Symbol("ngNextTemplateId");
|
|
2384
1999
|
function getTemplateId(clazz) {
|
|
@@ -2395,17 +2010,17 @@ function allocateTemplateId(sf) {
|
|
|
2395
2010
|
return `tcb${sf[NEXT_TEMPLATE_ID]++}`;
|
|
2396
2011
|
}
|
|
2397
2012
|
|
|
2398
|
-
// bazel-out/
|
|
2399
|
-
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2400
|
-
import
|
|
2013
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2014
|
+
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2015
|
+
import ts12 from "typescript";
|
|
2401
2016
|
|
|
2402
|
-
// bazel-out/
|
|
2017
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2403
2018
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2404
|
-
import
|
|
2019
|
+
import ts11 from "typescript";
|
|
2405
2020
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2406
2021
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2407
|
-
return
|
|
2408
|
-
if (kind !==
|
|
2022
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2023
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2409
2024
|
return null;
|
|
2410
2025
|
}
|
|
2411
2026
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2428,15 +2043,15 @@ var ExpressionIdentifier;
|
|
|
2428
2043
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
2429
2044
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2430
2045
|
function addExpressionIdentifier(node, identifier) {
|
|
2431
|
-
|
|
2046
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
2432
2047
|
}
|
|
2433
2048
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2434
2049
|
function markIgnoreDiagnostics(node) {
|
|
2435
|
-
|
|
2050
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
2436
2051
|
}
|
|
2437
2052
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2438
|
-
return
|
|
2439
|
-
if (kind !==
|
|
2053
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2054
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2440
2055
|
return null;
|
|
2441
2056
|
}
|
|
2442
2057
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2510,8 +2125,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2510
2125
|
return results;
|
|
2511
2126
|
}
|
|
2512
2127
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2513
|
-
return
|
|
2514
|
-
if (kind !==
|
|
2128
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2129
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2515
2130
|
return false;
|
|
2516
2131
|
}
|
|
2517
2132
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2519,16 +2134,16 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
|
2519
2134
|
}) || false;
|
|
2520
2135
|
}
|
|
2521
2136
|
|
|
2522
|
-
// bazel-out/
|
|
2137
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2523
2138
|
var CompletionEngine = class {
|
|
2524
2139
|
constructor(tcb, data, shimPath) {
|
|
2525
2140
|
this.tcb = tcb;
|
|
2526
2141
|
this.data = data;
|
|
2527
2142
|
this.shimPath = shimPath;
|
|
2528
|
-
this.templateContextCache = new Map();
|
|
2529
|
-
this.expressionCompletionCache = new Map();
|
|
2143
|
+
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2144
|
+
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2530
2145
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2531
|
-
filter:
|
|
2146
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2532
2147
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2533
2148
|
});
|
|
2534
2149
|
if (globalRead !== null) {
|
|
@@ -2551,7 +2166,7 @@ var CompletionEngine = class {
|
|
|
2551
2166
|
let nodeContext = null;
|
|
2552
2167
|
if (node instanceof EmptyExpr) {
|
|
2553
2168
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2554
|
-
filter:
|
|
2169
|
+
filter: ts12.isIdentifier,
|
|
2555
2170
|
withSpan: node.sourceSpan
|
|
2556
2171
|
});
|
|
2557
2172
|
if (nodeLocation !== null) {
|
|
@@ -2561,9 +2176,9 @@ var CompletionEngine = class {
|
|
|
2561
2176
|
};
|
|
2562
2177
|
}
|
|
2563
2178
|
}
|
|
2564
|
-
if (node instanceof
|
|
2179
|
+
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2565
2180
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2566
|
-
filter:
|
|
2181
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2567
2182
|
withSpan: node.sourceSpan
|
|
2568
2183
|
});
|
|
2569
2184
|
if (nodeLocation) {
|
|
@@ -2584,23 +2199,23 @@ var CompletionEngine = class {
|
|
|
2584
2199
|
return this.expressionCompletionCache.get(expr);
|
|
2585
2200
|
}
|
|
2586
2201
|
let tsExpr = null;
|
|
2587
|
-
if (expr instanceof
|
|
2202
|
+
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2588
2203
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2589
|
-
filter:
|
|
2204
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2590
2205
|
withSpan: expr.nameSpan
|
|
2591
2206
|
});
|
|
2592
2207
|
} else if (expr instanceof SafePropertyRead) {
|
|
2593
2208
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2594
|
-
filter:
|
|
2209
|
+
filter: ts12.isParenthesizedExpression,
|
|
2595
2210
|
withSpan: expr.sourceSpan
|
|
2596
2211
|
});
|
|
2597
|
-
if (ternaryExpr === null || !
|
|
2212
|
+
if (ternaryExpr === null || !ts12.isConditionalExpression(ternaryExpr.expression)) {
|
|
2598
2213
|
return null;
|
|
2599
2214
|
}
|
|
2600
2215
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2601
|
-
if (
|
|
2216
|
+
if (ts12.isPropertyAccessExpression(whenTrue)) {
|
|
2602
2217
|
tsExpr = whenTrue;
|
|
2603
|
-
} else if (
|
|
2218
|
+
} else if (ts12.isCallExpression(whenTrue) && ts12.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2604
2219
|
tsExpr = whenTrue.expression;
|
|
2605
2220
|
}
|
|
2606
2221
|
}
|
|
@@ -2621,15 +2236,15 @@ var CompletionEngine = class {
|
|
|
2621
2236
|
let tsExpr = null;
|
|
2622
2237
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2623
2238
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2624
|
-
filter:
|
|
2239
|
+
filter: ts12.isParenthesizedExpression,
|
|
2625
2240
|
withSpan: expr.sourceSpan
|
|
2626
2241
|
});
|
|
2627
|
-
if (strNode !== null &&
|
|
2242
|
+
if (strNode !== null && ts12.isStringLiteral(strNode.expression)) {
|
|
2628
2243
|
tsExpr = strNode.expression;
|
|
2629
2244
|
}
|
|
2630
2245
|
} else {
|
|
2631
2246
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2632
|
-
filter: (n) =>
|
|
2247
|
+
filter: (n) => ts12.isStringLiteral(n) || ts12.isNumericLiteral(n),
|
|
2633
2248
|
withSpan: expr.sourceSpan
|
|
2634
2249
|
});
|
|
2635
2250
|
}
|
|
@@ -2637,7 +2252,7 @@ var CompletionEngine = class {
|
|
|
2637
2252
|
return null;
|
|
2638
2253
|
}
|
|
2639
2254
|
let positionInShimFile = tsExpr.getEnd();
|
|
2640
|
-
if (
|
|
2255
|
+
if (ts12.isStringLiteral(tsExpr)) {
|
|
2641
2256
|
positionInShimFile -= 1;
|
|
2642
2257
|
}
|
|
2643
2258
|
const res = {
|
|
@@ -2651,7 +2266,7 @@ var CompletionEngine = class {
|
|
|
2651
2266
|
if (this.templateContextCache.has(context)) {
|
|
2652
2267
|
return this.templateContextCache.get(context);
|
|
2653
2268
|
}
|
|
2654
|
-
const templateContext = new Map();
|
|
2269
|
+
const templateContext = /* @__PURE__ */ new Map();
|
|
2655
2270
|
for (const node of this.data.boundTarget.getEntitiesInTemplateScope(context)) {
|
|
2656
2271
|
if (node instanceof TmplAstReference2) {
|
|
2657
2272
|
templateContext.set(node.name, {
|
|
@@ -2670,12 +2285,12 @@ var CompletionEngine = class {
|
|
|
2670
2285
|
}
|
|
2671
2286
|
};
|
|
2672
2287
|
|
|
2673
|
-
// bazel-out/
|
|
2674
|
-
import
|
|
2288
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2289
|
+
import ts26 from "typescript";
|
|
2675
2290
|
|
|
2676
|
-
// bazel-out/
|
|
2291
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2677
2292
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
2678
|
-
import
|
|
2293
|
+
import ts13 from "typescript";
|
|
2679
2294
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
2680
2295
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
2681
2296
|
var RegistryDomSchemaChecker = class {
|
|
@@ -2699,7 +2314,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2699
2314
|
} else {
|
|
2700
2315
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2701
2316
|
}
|
|
2702
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
2317
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2703
2318
|
this._diagnostics.push(diag);
|
|
2704
2319
|
}
|
|
2705
2320
|
}
|
|
@@ -2717,70 +2332,70 @@ var RegistryDomSchemaChecker = class {
|
|
|
2717
2332
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
2718
2333
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2719
2334
|
}
|
|
2720
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
2335
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2721
2336
|
this._diagnostics.push(diag);
|
|
2722
2337
|
}
|
|
2723
2338
|
}
|
|
2724
2339
|
};
|
|
2725
2340
|
|
|
2726
|
-
// bazel-out/
|
|
2727
|
-
import { ExpressionType, ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
2728
|
-
import
|
|
2341
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2342
|
+
import { ExpressionType, ExternalExpr as ExternalExpr2, TypeModifier } from "@angular/compiler";
|
|
2343
|
+
import ts19 from "typescript";
|
|
2729
2344
|
|
|
2730
|
-
// bazel-out/
|
|
2731
|
-
import
|
|
2732
|
-
var SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2345
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2346
|
+
import ts14 from "typescript";
|
|
2347
|
+
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2348
|
+
ts14.SyntaxKind.ParenthesizedExpression,
|
|
2349
|
+
ts14.SyntaxKind.Identifier,
|
|
2350
|
+
ts14.SyntaxKind.CallExpression,
|
|
2351
|
+
ts14.SyntaxKind.NonNullExpression,
|
|
2352
|
+
ts14.SyntaxKind.ElementAccessExpression,
|
|
2353
|
+
ts14.SyntaxKind.PropertyAccessExpression,
|
|
2354
|
+
ts14.SyntaxKind.ArrayLiteralExpression,
|
|
2355
|
+
ts14.SyntaxKind.ObjectLiteralExpression,
|
|
2356
|
+
ts14.SyntaxKind.StringLiteral,
|
|
2357
|
+
ts14.SyntaxKind.NumericLiteral,
|
|
2358
|
+
ts14.SyntaxKind.TrueKeyword,
|
|
2359
|
+
ts14.SyntaxKind.FalseKeyword,
|
|
2360
|
+
ts14.SyntaxKind.NullKeyword,
|
|
2361
|
+
ts14.SyntaxKind.UndefinedKeyword
|
|
2747
2362
|
]);
|
|
2748
2363
|
function tsCastToAny(expr) {
|
|
2749
2364
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2750
|
-
expr =
|
|
2365
|
+
expr = ts14.createParen(expr);
|
|
2751
2366
|
}
|
|
2752
|
-
return
|
|
2367
|
+
return ts14.createParen(ts14.createAsExpression(expr, ts14.createKeywordTypeNode(ts14.SyntaxKind.AnyKeyword)));
|
|
2753
2368
|
}
|
|
2754
2369
|
function tsCreateElement(tagName) {
|
|
2755
|
-
const createElement =
|
|
2756
|
-
return
|
|
2370
|
+
const createElement = ts14.createPropertyAccess(ts14.createIdentifier("document"), "createElement");
|
|
2371
|
+
return ts14.createCall(createElement, void 0, [ts14.createLiteral(tagName)]);
|
|
2757
2372
|
}
|
|
2758
2373
|
function tsDeclareVariable(id, type) {
|
|
2759
|
-
const decl =
|
|
2760
|
-
return
|
|
2374
|
+
const decl = ts14.createVariableDeclaration(id, type, ts14.createNonNullExpression(ts14.createNull()));
|
|
2375
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2761
2376
|
}
|
|
2762
2377
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2763
|
-
return
|
|
2378
|
+
return ts14.createTypeQueryNode(ts14.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2764
2379
|
}
|
|
2765
2380
|
function tsCreateVariable(id, initializer) {
|
|
2766
|
-
const decl =
|
|
2767
|
-
return
|
|
2381
|
+
const decl = ts14.createVariableDeclaration(id, void 0, initializer);
|
|
2382
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2768
2383
|
}
|
|
2769
2384
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2770
|
-
const methodAccess =
|
|
2771
|
-
return
|
|
2385
|
+
const methodAccess = ts14.createPropertyAccess(receiver, methodName);
|
|
2386
|
+
return ts14.createCall(methodAccess, void 0, args);
|
|
2772
2387
|
}
|
|
2773
2388
|
function checkIfClassIsExported(node) {
|
|
2774
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
2389
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts14.SyntaxKind.ExportKeyword)) {
|
|
2775
2390
|
return true;
|
|
2776
|
-
} else if (node.parent !== void 0 &&
|
|
2391
|
+
} else if (node.parent !== void 0 && ts14.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
2777
2392
|
return true;
|
|
2778
2393
|
}
|
|
2779
2394
|
return false;
|
|
2780
2395
|
}
|
|
2781
2396
|
function checkIfFileHasExport(sf, name) {
|
|
2782
2397
|
for (const stmt of sf.statements) {
|
|
2783
|
-
if (
|
|
2398
|
+
if (ts14.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts14.isNamedExports(stmt.exportClause)) {
|
|
2784
2399
|
for (const element of stmt.exportClause.elements) {
|
|
2785
2400
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
2786
2401
|
return true;
|
|
@@ -2793,126 +2408,122 @@ function checkIfFileHasExport(sf, name) {
|
|
|
2793
2408
|
return false;
|
|
2794
2409
|
}
|
|
2795
2410
|
function isAccessExpression(node) {
|
|
2796
|
-
return
|
|
2411
|
+
return ts14.isPropertyAccessExpression(node) || ts14.isElementAccessExpression(node);
|
|
2797
2412
|
}
|
|
2798
2413
|
|
|
2799
|
-
// bazel-out/
|
|
2800
|
-
import
|
|
2414
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2415
|
+
import ts18 from "typescript";
|
|
2801
2416
|
|
|
2802
|
-
// bazel-out/
|
|
2803
|
-
import
|
|
2417
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2418
|
+
import ts17 from "typescript";
|
|
2804
2419
|
|
|
2805
|
-
// bazel-out/
|
|
2806
|
-
import
|
|
2420
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2421
|
+
import ts16 from "typescript";
|
|
2807
2422
|
|
|
2808
|
-
// bazel-out/
|
|
2809
|
-
import
|
|
2423
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2424
|
+
import ts15 from "typescript";
|
|
2810
2425
|
var INELIGIBLE = {};
|
|
2811
|
-
function canEmitType(type,
|
|
2426
|
+
function canEmitType(type, canEmit) {
|
|
2812
2427
|
return canEmitTypeWorker(type);
|
|
2813
2428
|
function canEmitTypeWorker(type2) {
|
|
2814
2429
|
return visitNode(type2) !== INELIGIBLE;
|
|
2815
2430
|
}
|
|
2816
2431
|
function visitNode(node) {
|
|
2817
|
-
if (
|
|
2432
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2818
2433
|
return INELIGIBLE;
|
|
2819
2434
|
}
|
|
2820
|
-
if (
|
|
2435
|
+
if (ts15.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2821
2436
|
return INELIGIBLE;
|
|
2822
2437
|
} else {
|
|
2823
|
-
return
|
|
2438
|
+
return ts15.forEachChild(node, visitNode);
|
|
2824
2439
|
}
|
|
2825
2440
|
}
|
|
2826
2441
|
function canEmitTypeReference(type2) {
|
|
2827
|
-
|
|
2828
|
-
if (reference === null) {
|
|
2442
|
+
if (!canEmit(type2)) {
|
|
2829
2443
|
return false;
|
|
2830
2444
|
}
|
|
2831
|
-
if (reference instanceof Reference) {
|
|
2832
|
-
return true;
|
|
2833
|
-
}
|
|
2834
2445
|
return type2.typeArguments === void 0 || type2.typeArguments.every(canEmitTypeWorker);
|
|
2835
2446
|
}
|
|
2836
2447
|
}
|
|
2837
2448
|
var TypeEmitter = class {
|
|
2838
|
-
constructor(
|
|
2839
|
-
this.
|
|
2840
|
-
this.emitReference = emitReference;
|
|
2449
|
+
constructor(translator) {
|
|
2450
|
+
this.translator = translator;
|
|
2841
2451
|
}
|
|
2842
2452
|
emitType(type) {
|
|
2843
2453
|
const typeReferenceTransformer = (context) => {
|
|
2844
2454
|
const visitNode = (node) => {
|
|
2845
|
-
if (
|
|
2455
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2846
2456
|
throw new Error("Unable to emit import type");
|
|
2847
2457
|
}
|
|
2848
|
-
if (
|
|
2458
|
+
if (ts15.isTypeReferenceNode(node)) {
|
|
2849
2459
|
return this.emitTypeReference(node);
|
|
2850
|
-
} else if (
|
|
2851
|
-
const clone =
|
|
2852
|
-
|
|
2460
|
+
} else if (ts15.isLiteralExpression(node)) {
|
|
2461
|
+
const clone = ts15.getMutableClone(node);
|
|
2462
|
+
ts15.setTextRange(clone, { pos: -1, end: -1 });
|
|
2853
2463
|
return clone;
|
|
2854
2464
|
} else {
|
|
2855
|
-
return
|
|
2465
|
+
return ts15.visitEachChild(node, visitNode, context);
|
|
2856
2466
|
}
|
|
2857
2467
|
};
|
|
2858
|
-
return (node) =>
|
|
2468
|
+
return (node) => ts15.visitNode(node, visitNode);
|
|
2859
2469
|
};
|
|
2860
|
-
return
|
|
2470
|
+
return ts15.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2861
2471
|
}
|
|
2862
2472
|
emitTypeReference(type) {
|
|
2863
|
-
const
|
|
2864
|
-
if (
|
|
2473
|
+
const translatedType = this.translator(type);
|
|
2474
|
+
if (translatedType === null) {
|
|
2865
2475
|
throw new Error("Unable to emit an unresolved reference");
|
|
2866
2476
|
}
|
|
2867
2477
|
let typeArguments = void 0;
|
|
2868
2478
|
if (type.typeArguments !== void 0) {
|
|
2869
|
-
typeArguments =
|
|
2870
|
-
}
|
|
2871
|
-
let typeName = type.typeName;
|
|
2872
|
-
if (reference instanceof Reference) {
|
|
2873
|
-
const emittedType = this.emitReference(reference);
|
|
2874
|
-
if (!ts18.isTypeReferenceNode(emittedType)) {
|
|
2875
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts18.SyntaxKind[emittedType.kind]}`);
|
|
2876
|
-
}
|
|
2877
|
-
typeName = emittedType.typeName;
|
|
2479
|
+
typeArguments = ts15.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2878
2480
|
}
|
|
2879
|
-
return
|
|
2481
|
+
return ts15.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2880
2482
|
}
|
|
2881
2483
|
};
|
|
2882
2484
|
|
|
2883
|
-
// bazel-out/
|
|
2485
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2884
2486
|
var TypeParameterEmitter = class {
|
|
2885
2487
|
constructor(typeParameters, reflector) {
|
|
2886
2488
|
this.typeParameters = typeParameters;
|
|
2887
2489
|
this.reflector = reflector;
|
|
2888
2490
|
}
|
|
2889
|
-
canEmit() {
|
|
2491
|
+
canEmit(canEmitReference) {
|
|
2890
2492
|
if (this.typeParameters === void 0) {
|
|
2891
2493
|
return true;
|
|
2892
2494
|
}
|
|
2893
2495
|
return this.typeParameters.every((typeParam) => {
|
|
2894
|
-
return this.canEmitType(typeParam.constraint) && this.canEmitType(typeParam.default);
|
|
2496
|
+
return this.canEmitType(typeParam.constraint, canEmitReference) && this.canEmitType(typeParam.default, canEmitReference);
|
|
2895
2497
|
});
|
|
2896
2498
|
}
|
|
2897
|
-
canEmitType(type) {
|
|
2499
|
+
canEmitType(type, canEmitReference) {
|
|
2898
2500
|
if (type === void 0) {
|
|
2899
2501
|
return true;
|
|
2900
2502
|
}
|
|
2901
|
-
return canEmitType(type, (typeReference) =>
|
|
2503
|
+
return canEmitType(type, (typeReference) => {
|
|
2504
|
+
const reference = this.resolveTypeReference(typeReference);
|
|
2505
|
+
if (reference === null) {
|
|
2506
|
+
return false;
|
|
2507
|
+
}
|
|
2508
|
+
if (reference instanceof Reference) {
|
|
2509
|
+
return canEmitReference(reference);
|
|
2510
|
+
}
|
|
2511
|
+
return true;
|
|
2512
|
+
});
|
|
2902
2513
|
}
|
|
2903
2514
|
emit(emitReference) {
|
|
2904
2515
|
if (this.typeParameters === void 0) {
|
|
2905
2516
|
return void 0;
|
|
2906
2517
|
}
|
|
2907
|
-
const emitter = new TypeEmitter((type) => this.
|
|
2518
|
+
const emitter = new TypeEmitter((type) => this.translateTypeReference(type, emitReference));
|
|
2908
2519
|
return this.typeParameters.map((typeParam) => {
|
|
2909
2520
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2910
2521
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2911
|
-
return
|
|
2522
|
+
return ts16.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2912
2523
|
});
|
|
2913
2524
|
}
|
|
2914
2525
|
resolveTypeReference(type) {
|
|
2915
|
-
const target =
|
|
2526
|
+
const target = ts16.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2916
2527
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2917
2528
|
if (declaration === null || declaration.node === null) {
|
|
2918
2529
|
return null;
|
|
@@ -2927,33 +2538,38 @@ var TypeParameterEmitter = class {
|
|
|
2927
2538
|
resolutionContext: type.getSourceFile().fileName
|
|
2928
2539
|
};
|
|
2929
2540
|
}
|
|
2930
|
-
if (!this.isTopLevelExport(declaration.node)) {
|
|
2931
|
-
return null;
|
|
2932
|
-
}
|
|
2933
2541
|
return new Reference(declaration.node, owningModule);
|
|
2934
2542
|
}
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2543
|
+
translateTypeReference(type, emitReference) {
|
|
2544
|
+
const reference = this.resolveTypeReference(type);
|
|
2545
|
+
if (!(reference instanceof Reference)) {
|
|
2546
|
+
return reference;
|
|
2547
|
+
}
|
|
2548
|
+
const typeNode = emitReference(reference);
|
|
2549
|
+
if (typeNode === null) {
|
|
2550
|
+
return null;
|
|
2938
2551
|
}
|
|
2939
|
-
|
|
2552
|
+
if (!ts16.isTypeReferenceNode(typeNode)) {
|
|
2553
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts16.SyntaxKind[typeNode.kind]}.`);
|
|
2554
|
+
}
|
|
2555
|
+
return typeNode;
|
|
2940
2556
|
}
|
|
2941
2557
|
isLocalTypeParameter(decl) {
|
|
2942
2558
|
return this.typeParameters.some((param) => param === decl);
|
|
2943
2559
|
}
|
|
2944
2560
|
};
|
|
2945
2561
|
|
|
2946
|
-
// bazel-out/
|
|
2562
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2947
2563
|
var TcbInliningRequirement;
|
|
2948
2564
|
(function(TcbInliningRequirement2) {
|
|
2949
2565
|
TcbInliningRequirement2[TcbInliningRequirement2["MustInline"] = 0] = "MustInline";
|
|
2950
2566
|
TcbInliningRequirement2[TcbInliningRequirement2["ShouldInlineForGenericBounds"] = 1] = "ShouldInlineForGenericBounds";
|
|
2951
2567
|
TcbInliningRequirement2[TcbInliningRequirement2["None"] = 2] = "None";
|
|
2952
2568
|
})(TcbInliningRequirement || (TcbInliningRequirement = {}));
|
|
2953
|
-
function requiresInlineTypeCheckBlock(node, usedPipes, reflector) {
|
|
2569
|
+
function requiresInlineTypeCheckBlock(node, env, usedPipes, reflector) {
|
|
2954
2570
|
if (!checkIfClassIsExported(node)) {
|
|
2955
2571
|
return TcbInliningRequirement.MustInline;
|
|
2956
|
-
} else if (!
|
|
2572
|
+
} else if (!checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env)) {
|
|
2957
2573
|
return TcbInliningRequirement.ShouldInlineForGenericBounds;
|
|
2958
2574
|
} else if (Array.from(usedPipes.values()).some((pipeRef) => !checkIfClassIsExported(pipeRef.node))) {
|
|
2959
2575
|
return TcbInliningRequirement.MustInline;
|
|
@@ -2976,14 +2592,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2976
2592
|
}
|
|
2977
2593
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2978
2594
|
for (const stmt of file.statements) {
|
|
2979
|
-
if (
|
|
2595
|
+
if (ts17.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2980
2596
|
return stmt;
|
|
2981
2597
|
}
|
|
2982
2598
|
}
|
|
2983
2599
|
return null;
|
|
2984
2600
|
}
|
|
2985
2601
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2986
|
-
while (node !== void 0 && !
|
|
2602
|
+
while (node !== void 0 && !ts17.isFunctionDeclaration(node)) {
|
|
2987
2603
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2988
2604
|
return null;
|
|
2989
2605
|
}
|
|
@@ -3000,7 +2616,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
3000
2616
|
return null;
|
|
3001
2617
|
}
|
|
3002
2618
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
3003
|
-
while (!
|
|
2619
|
+
while (!ts17.isFunctionDeclaration(node)) {
|
|
3004
2620
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
3005
2621
|
return null;
|
|
3006
2622
|
}
|
|
@@ -3010,47 +2626,45 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
3010
2626
|
}
|
|
3011
2627
|
}
|
|
3012
2628
|
const start = node.getFullStart();
|
|
3013
|
-
return
|
|
3014
|
-
if (kind !==
|
|
2629
|
+
return ts17.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2630
|
+
if (kind !== ts17.SyntaxKind.MultiLineCommentTrivia) {
|
|
3015
2631
|
return null;
|
|
3016
2632
|
}
|
|
3017
2633
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
3018
2634
|
return commentText;
|
|
3019
2635
|
}) || null;
|
|
3020
2636
|
}
|
|
3021
|
-
function
|
|
3022
|
-
|
|
2637
|
+
function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
2638
|
+
const emitter = new TypeParameterEmitter(node.typeParameters, reflector);
|
|
2639
|
+
return emitter.canEmit((ref) => env.canReferenceType(ref));
|
|
3023
2640
|
}
|
|
3024
2641
|
|
|
3025
|
-
// bazel-out/
|
|
3026
|
-
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams
|
|
3027
|
-
if (requiresInlineTypeCtor(node, reflector)) {
|
|
3028
|
-
throw new Error(`${node.name.text} requires an inline type constructor`);
|
|
3029
|
-
}
|
|
2642
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2643
|
+
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
3030
2644
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
3031
|
-
const rawType =
|
|
2645
|
+
const rawType = ts18.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
3032
2646
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3033
2647
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
3034
2648
|
if (meta.body) {
|
|
3035
|
-
const fnType =
|
|
3036
|
-
const decl =
|
|
3037
|
-
const declList =
|
|
3038
|
-
return
|
|
2649
|
+
const fnType = ts18.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2650
|
+
const decl = ts18.createVariableDeclaration(meta.fnName, fnType, ts18.createNonNullExpression(ts18.createNull()));
|
|
2651
|
+
const declList = ts18.createVariableDeclarationList([decl], ts18.NodeFlags.Const);
|
|
2652
|
+
return ts18.createVariableStatement(void 0, declList);
|
|
3039
2653
|
} else {
|
|
3040
|
-
return
|
|
2654
|
+
return ts18.createFunctionDeclaration(void 0, [ts18.createModifier(ts18.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
3041
2655
|
}
|
|
3042
2656
|
}
|
|
3043
2657
|
function generateInlineTypeCtor(node, meta) {
|
|
3044
2658
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
3045
|
-
const rawType =
|
|
2659
|
+
const rawType = ts18.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
3046
2660
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3047
2661
|
let body = void 0;
|
|
3048
2662
|
if (meta.body) {
|
|
3049
|
-
body =
|
|
3050
|
-
|
|
2663
|
+
body = ts18.createBlock([
|
|
2664
|
+
ts18.createReturn(ts18.createNonNullExpression(ts18.createNull()))
|
|
3051
2665
|
]);
|
|
3052
2666
|
}
|
|
3053
|
-
return
|
|
2667
|
+
return ts18.createMethod(void 0, [ts18.createModifier(ts18.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
3054
2668
|
}
|
|
3055
2669
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
3056
2670
|
let initType = null;
|
|
@@ -3059,29 +2673,29 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
3059
2673
|
const coercedKeys = [];
|
|
3060
2674
|
for (const key of keys) {
|
|
3061
2675
|
if (!meta.coercedInputFields.has(key)) {
|
|
3062
|
-
plainKeys.push(
|
|
2676
|
+
plainKeys.push(ts18.createLiteralTypeNode(ts18.createStringLiteral(key)));
|
|
3063
2677
|
} else {
|
|
3064
|
-
coercedKeys.push(
|
|
2678
|
+
coercedKeys.push(ts18.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key), void 0));
|
|
3065
2679
|
}
|
|
3066
2680
|
}
|
|
3067
2681
|
if (plainKeys.length > 0) {
|
|
3068
|
-
const keyTypeUnion =
|
|
3069
|
-
initType =
|
|
2682
|
+
const keyTypeUnion = ts18.createUnionTypeNode(plainKeys);
|
|
2683
|
+
initType = ts18.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
3070
2684
|
}
|
|
3071
2685
|
if (coercedKeys.length > 0) {
|
|
3072
|
-
const coercedLiteral =
|
|
3073
|
-
initType = initType !== null ?
|
|
2686
|
+
const coercedLiteral = ts18.createTypeLiteralNode(coercedKeys);
|
|
2687
|
+
initType = initType !== null ? ts18.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
3074
2688
|
}
|
|
3075
2689
|
if (initType === null) {
|
|
3076
|
-
initType =
|
|
2690
|
+
initType = ts18.createTypeLiteralNode([]);
|
|
3077
2691
|
}
|
|
3078
|
-
return
|
|
2692
|
+
return ts18.createParameter(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
3079
2693
|
}
|
|
3080
2694
|
function generateGenericArgs(params) {
|
|
3081
|
-
return params.map((param) =>
|
|
2695
|
+
return params.map((param) => ts18.createTypeReferenceNode(param.name, void 0));
|
|
3082
2696
|
}
|
|
3083
|
-
function requiresInlineTypeCtor(node, host) {
|
|
3084
|
-
return !
|
|
2697
|
+
function requiresInlineTypeCtor(node, host, env) {
|
|
2698
|
+
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
3085
2699
|
}
|
|
3086
2700
|
function typeParametersWithDefaultTypes(params) {
|
|
3087
2701
|
if (params === void 0) {
|
|
@@ -3089,14 +2703,14 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
3089
2703
|
}
|
|
3090
2704
|
return params.map((param) => {
|
|
3091
2705
|
if (param.default === void 0) {
|
|
3092
|
-
return
|
|
2706
|
+
return ts18.updateTypeParameterDeclaration(param, param.name, param.constraint, ts18.createKeywordTypeNode(ts18.SyntaxKind.AnyKeyword));
|
|
3093
2707
|
} else {
|
|
3094
2708
|
return param;
|
|
3095
2709
|
}
|
|
3096
2710
|
});
|
|
3097
2711
|
}
|
|
3098
2712
|
|
|
3099
|
-
// bazel-out/
|
|
2713
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
3100
2714
|
var Environment = class {
|
|
3101
2715
|
constructor(config, importManager, refEmitter, reflector, contextFile) {
|
|
3102
2716
|
this.config = config;
|
|
@@ -3108,9 +2722,9 @@ var Environment = class {
|
|
|
3108
2722
|
pipeInst: 1,
|
|
3109
2723
|
typeCtor: 1
|
|
3110
2724
|
};
|
|
3111
|
-
this.typeCtors = new Map();
|
|
2725
|
+
this.typeCtors = /* @__PURE__ */ new Map();
|
|
3112
2726
|
this.typeCtorStatements = [];
|
|
3113
|
-
this.pipeInsts = new Map();
|
|
2727
|
+
this.pipeInsts = /* @__PURE__ */ new Map();
|
|
3114
2728
|
this.pipeInstStatements = [];
|
|
3115
2729
|
}
|
|
3116
2730
|
typeCtorFor(dir) {
|
|
@@ -3119,15 +2733,15 @@ var Environment = class {
|
|
|
3119
2733
|
if (this.typeCtors.has(node)) {
|
|
3120
2734
|
return this.typeCtors.get(node);
|
|
3121
2735
|
}
|
|
3122
|
-
if (requiresInlineTypeCtor(node, this.reflector)) {
|
|
2736
|
+
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
3123
2737
|
const ref = this.reference(dirRef);
|
|
3124
|
-
const typeCtorExpr =
|
|
2738
|
+
const typeCtorExpr = ts19.createPropertyAccess(ref, "ngTypeCtor");
|
|
3125
2739
|
this.typeCtors.set(node, typeCtorExpr);
|
|
3126
2740
|
return typeCtorExpr;
|
|
3127
2741
|
} else {
|
|
3128
2742
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
3129
2743
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
3130
|
-
if (!
|
|
2744
|
+
if (!ts19.isTypeReferenceNode(nodeTypeRef)) {
|
|
3131
2745
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
3132
2746
|
}
|
|
3133
2747
|
const meta = {
|
|
@@ -3141,9 +2755,9 @@ var Environment = class {
|
|
|
3141
2755
|
coercedInputFields: dir.coercedInputFields
|
|
3142
2756
|
};
|
|
3143
2757
|
const typeParams = this.emitTypeParameters(node);
|
|
3144
|
-
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams
|
|
2758
|
+
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
3145
2759
|
this.typeCtorStatements.push(typeCtor);
|
|
3146
|
-
const fnId =
|
|
2760
|
+
const fnId = ts19.createIdentifier(fnName);
|
|
3147
2761
|
this.typeCtors.set(node, fnId);
|
|
3148
2762
|
return fnId;
|
|
3149
2763
|
}
|
|
@@ -3153,17 +2767,23 @@ var Environment = class {
|
|
|
3153
2767
|
return this.pipeInsts.get(ref.node);
|
|
3154
2768
|
}
|
|
3155
2769
|
const pipeType = this.referenceType(ref);
|
|
3156
|
-
const pipeInstId =
|
|
2770
|
+
const pipeInstId = ts19.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
3157
2771
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
3158
2772
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
3159
2773
|
return pipeInstId;
|
|
3160
2774
|
}
|
|
3161
2775
|
reference(ref) {
|
|
3162
2776
|
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
|
|
2777
|
+
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
|
|
3163
2778
|
return translateExpression(ngExpr.expression, this.importManager);
|
|
3164
2779
|
}
|
|
2780
|
+
canReferenceType(ref) {
|
|
2781
|
+
const result = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2782
|
+
return result.kind === 0;
|
|
2783
|
+
}
|
|
3165
2784
|
referenceType(ref) {
|
|
3166
2785
|
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2786
|
+
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
|
|
3167
2787
|
return translateType(new ExpressionType(ngExpr.expression), this.importManager);
|
|
3168
2788
|
}
|
|
3169
2789
|
emitTypeParameters(declaration) {
|
|
@@ -3172,7 +2792,7 @@ var Environment = class {
|
|
|
3172
2792
|
}
|
|
3173
2793
|
referenceExternalType(moduleName, name, typeParams) {
|
|
3174
2794
|
const external = new ExternalExpr2({ moduleName, name });
|
|
3175
|
-
return translateType(new ExpressionType(external,
|
|
2795
|
+
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.importManager);
|
|
3176
2796
|
}
|
|
3177
2797
|
getPreludeStatements() {
|
|
3178
2798
|
return [
|
|
@@ -3182,14 +2802,14 @@ var Environment = class {
|
|
|
3182
2802
|
}
|
|
3183
2803
|
};
|
|
3184
2804
|
|
|
3185
|
-
// bazel-out/
|
|
2805
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
3186
2806
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
3187
|
-
import
|
|
2807
|
+
import ts20 from "typescript";
|
|
3188
2808
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
3189
2809
|
constructor(resolver) {
|
|
3190
2810
|
this.resolver = resolver;
|
|
3191
2811
|
this._diagnostics = [];
|
|
3192
|
-
this.recordedPipes = new Set();
|
|
2812
|
+
this.recordedPipes = /* @__PURE__ */ new Set();
|
|
3193
2813
|
}
|
|
3194
2814
|
get diagnostics() {
|
|
3195
2815
|
return this._diagnostics;
|
|
@@ -3198,7 +2818,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3198
2818
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3199
2819
|
const value = ref.value.trim();
|
|
3200
2820
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
3201
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2821
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
3202
2822
|
}
|
|
3203
2823
|
missingPipe(templateId, ast) {
|
|
3204
2824
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -3210,7 +2830,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3210
2830
|
if (sourceSpan === null) {
|
|
3211
2831
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
3212
2832
|
}
|
|
3213
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2833
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
3214
2834
|
this.recordedPipes.add(ast);
|
|
3215
2835
|
}
|
|
3216
2836
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -3221,7 +2841,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3221
2841
|
if (sourceSpan === null) {
|
|
3222
2842
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
3223
2843
|
}
|
|
3224
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2844
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
3225
2845
|
text: `The variable ${assignment.name} is declared here.`,
|
|
3226
2846
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
3227
2847
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -3231,7 +2851,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3231
2851
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
3232
2852
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3233
2853
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
3234
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
2854
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
3235
2855
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
3236
2856
|
start: firstDecl.sourceSpan.start.offset,
|
|
3237
2857
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -3270,7 +2890,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3270
2890
|
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.
|
|
3271
2891
|
|
|
3272
2892
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
3273
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
2893
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts20.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
3274
2894
|
}
|
|
3275
2895
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
3276
2896
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -3304,7 +2924,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
3304
2924
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
3305
2925
|
});
|
|
3306
2926
|
}
|
|
3307
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2927
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
3308
2928
|
}
|
|
3309
2929
|
};
|
|
3310
2930
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -3314,8 +2934,8 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
3314
2934
|
});
|
|
3315
2935
|
}
|
|
3316
2936
|
|
|
3317
|
-
// bazel-out/
|
|
3318
|
-
import
|
|
2937
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
2938
|
+
import ts21 from "typescript";
|
|
3319
2939
|
var TypeCheckShimGenerator = class {
|
|
3320
2940
|
constructor() {
|
|
3321
2941
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -3325,25 +2945,25 @@ var TypeCheckShimGenerator = class {
|
|
|
3325
2945
|
if (priorShimSf !== null) {
|
|
3326
2946
|
return priorShimSf;
|
|
3327
2947
|
}
|
|
3328
|
-
return
|
|
2948
|
+
return ts21.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts21.ScriptTarget.Latest, true, ts21.ScriptKind.TS);
|
|
3329
2949
|
}
|
|
3330
2950
|
static shimFor(fileName) {
|
|
3331
2951
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
3332
2952
|
}
|
|
3333
2953
|
};
|
|
3334
2954
|
|
|
3335
|
-
// bazel-out/
|
|
3336
|
-
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as
|
|
3337
|
-
import
|
|
2955
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
2956
|
+
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, SafeCall, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
2957
|
+
import ts24 from "typescript";
|
|
3338
2958
|
|
|
3339
|
-
// bazel-out/
|
|
2959
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
3340
2960
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
3341
|
-
import
|
|
2961
|
+
import ts22 from "typescript";
|
|
3342
2962
|
function wrapForDiagnostics(expr) {
|
|
3343
|
-
return
|
|
2963
|
+
return ts22.createParen(expr);
|
|
3344
2964
|
}
|
|
3345
2965
|
function wrapForTypeChecker(expr) {
|
|
3346
|
-
return
|
|
2966
|
+
return ts22.createParen(expr);
|
|
3347
2967
|
}
|
|
3348
2968
|
function addParseSpanInfo(node, span) {
|
|
3349
2969
|
let commentText;
|
|
@@ -3352,10 +2972,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3352
2972
|
} else {
|
|
3353
2973
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3354
2974
|
}
|
|
3355
|
-
|
|
2975
|
+
ts22.addSyntheticTrailingComment(node, ts22.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3356
2976
|
}
|
|
3357
2977
|
function addTemplateId(tcb, id) {
|
|
3358
|
-
|
|
2978
|
+
ts22.addSyntheticLeadingComment(tcb, ts22.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3359
2979
|
}
|
|
3360
2980
|
function shouldReportDiagnostic(diagnostic) {
|
|
3361
2981
|
const { code } = diagnostic;
|
|
@@ -3382,34 +3002,34 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3382
3002
|
return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
|
|
3383
3003
|
}
|
|
3384
3004
|
|
|
3385
|
-
// bazel-out/
|
|
3386
|
-
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3387
|
-
import
|
|
3388
|
-
var NULL_AS_ANY =
|
|
3389
|
-
var UNDEFINED =
|
|
3390
|
-
var UNARY_OPS = new Map([
|
|
3391
|
-
["+",
|
|
3392
|
-
["-",
|
|
3005
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3006
|
+
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3007
|
+
import ts23 from "typescript";
|
|
3008
|
+
var NULL_AS_ANY = ts23.createAsExpression(ts23.createNull(), ts23.createKeywordTypeNode(ts23.SyntaxKind.AnyKeyword));
|
|
3009
|
+
var UNDEFINED = ts23.createIdentifier("undefined");
|
|
3010
|
+
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3011
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3012
|
+
["-", ts23.SyntaxKind.MinusToken]
|
|
3393
3013
|
]);
|
|
3394
|
-
var BINARY_OPS = new Map([
|
|
3395
|
-
["+",
|
|
3396
|
-
["-",
|
|
3397
|
-
["<",
|
|
3398
|
-
[">",
|
|
3399
|
-
["<=",
|
|
3400
|
-
[">=",
|
|
3401
|
-
["==",
|
|
3402
|
-
["===",
|
|
3403
|
-
["*",
|
|
3404
|
-
["/",
|
|
3405
|
-
["%",
|
|
3406
|
-
["!=",
|
|
3407
|
-
["!==",
|
|
3408
|
-
["||",
|
|
3409
|
-
["&&",
|
|
3410
|
-
["&",
|
|
3411
|
-
["|",
|
|
3412
|
-
["??",
|
|
3014
|
+
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3015
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3016
|
+
["-", ts23.SyntaxKind.MinusToken],
|
|
3017
|
+
["<", ts23.SyntaxKind.LessThanToken],
|
|
3018
|
+
[">", ts23.SyntaxKind.GreaterThanToken],
|
|
3019
|
+
["<=", ts23.SyntaxKind.LessThanEqualsToken],
|
|
3020
|
+
[">=", ts23.SyntaxKind.GreaterThanEqualsToken],
|
|
3021
|
+
["==", ts23.SyntaxKind.EqualsEqualsToken],
|
|
3022
|
+
["===", ts23.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3023
|
+
["*", ts23.SyntaxKind.AsteriskToken],
|
|
3024
|
+
["/", ts23.SyntaxKind.SlashToken],
|
|
3025
|
+
["%", ts23.SyntaxKind.PercentToken],
|
|
3026
|
+
["!=", ts23.SyntaxKind.ExclamationEqualsToken],
|
|
3027
|
+
["!==", ts23.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3028
|
+
["||", ts23.SyntaxKind.BarBarToken],
|
|
3029
|
+
["&&", ts23.SyntaxKind.AmpersandAmpersandToken],
|
|
3030
|
+
["&", ts23.SyntaxKind.AmpersandToken],
|
|
3031
|
+
["|", ts23.SyntaxKind.BarToken],
|
|
3032
|
+
["??", ts23.SyntaxKind.QuestionQuestionToken]
|
|
3413
3033
|
]);
|
|
3414
3034
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3415
3035
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3425,7 +3045,7 @@ var AstTranslator = class {
|
|
|
3425
3045
|
ast = ast.ast;
|
|
3426
3046
|
}
|
|
3427
3047
|
if (ast instanceof EmptyExpr2) {
|
|
3428
|
-
const res =
|
|
3048
|
+
const res = ts23.factory.createIdentifier("undefined");
|
|
3429
3049
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3430
3050
|
return res;
|
|
3431
3051
|
}
|
|
@@ -3441,7 +3061,7 @@ var AstTranslator = class {
|
|
|
3441
3061
|
if (op === void 0) {
|
|
3442
3062
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3443
3063
|
}
|
|
3444
|
-
const node = wrapForDiagnostics(
|
|
3064
|
+
const node = wrapForDiagnostics(ts23.createPrefix(op, expr));
|
|
3445
3065
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3446
3066
|
return node;
|
|
3447
3067
|
}
|
|
@@ -3452,13 +3072,13 @@ var AstTranslator = class {
|
|
|
3452
3072
|
if (op === void 0) {
|
|
3453
3073
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3454
3074
|
}
|
|
3455
|
-
const node =
|
|
3075
|
+
const node = ts23.createBinary(lhs, op, rhs);
|
|
3456
3076
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3457
3077
|
return node;
|
|
3458
3078
|
}
|
|
3459
3079
|
visitChain(ast) {
|
|
3460
3080
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3461
|
-
const node = wrapForDiagnostics(
|
|
3081
|
+
const node = wrapForDiagnostics(ts23.createCommaList(elements));
|
|
3462
3082
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3463
3083
|
return node;
|
|
3464
3084
|
}
|
|
@@ -3466,7 +3086,7 @@ var AstTranslator = class {
|
|
|
3466
3086
|
const condExpr = this.translate(ast.condition);
|
|
3467
3087
|
const trueExpr = this.translate(ast.trueExp);
|
|
3468
3088
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3469
|
-
const node =
|
|
3089
|
+
const node = ts23.createParen(ts23.createConditional(condExpr, trueExpr, falseExpr));
|
|
3470
3090
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3471
3091
|
return node;
|
|
3472
3092
|
}
|
|
@@ -3477,26 +3097,26 @@ var AstTranslator = class {
|
|
|
3477
3097
|
throw new Error("Method not implemented.");
|
|
3478
3098
|
}
|
|
3479
3099
|
visitInterpolation(ast) {
|
|
3480
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3100
|
+
return ast.expressions.reduce((lhs, ast2) => ts23.createBinary(lhs, ts23.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts23.createLiteral(""));
|
|
3481
3101
|
}
|
|
3482
3102
|
visitKeyedRead(ast) {
|
|
3483
3103
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3484
3104
|
const key = this.translate(ast.key);
|
|
3485
|
-
const node =
|
|
3105
|
+
const node = ts23.createElementAccess(receiver, key);
|
|
3486
3106
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3487
3107
|
return node;
|
|
3488
3108
|
}
|
|
3489
3109
|
visitKeyedWrite(ast) {
|
|
3490
3110
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3491
|
-
const left =
|
|
3111
|
+
const left = ts23.createElementAccess(receiver, this.translate(ast.key));
|
|
3492
3112
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3493
|
-
const node = wrapForDiagnostics(
|
|
3113
|
+
const node = wrapForDiagnostics(ts23.createBinary(left, ts23.SyntaxKind.EqualsToken, right));
|
|
3494
3114
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3495
3115
|
return node;
|
|
3496
3116
|
}
|
|
3497
3117
|
visitLiteralArray(ast) {
|
|
3498
3118
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3499
|
-
const literal =
|
|
3119
|
+
const literal = ts23.createArrayLiteral(elements);
|
|
3500
3120
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3501
3121
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3502
3122
|
return node;
|
|
@@ -3504,9 +3124,9 @@ var AstTranslator = class {
|
|
|
3504
3124
|
visitLiteralMap(ast) {
|
|
3505
3125
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3506
3126
|
const value = this.translate(ast.values[idx]);
|
|
3507
|
-
return
|
|
3127
|
+
return ts23.createPropertyAssignment(ts23.createStringLiteral(key), value);
|
|
3508
3128
|
});
|
|
3509
|
-
const literal =
|
|
3129
|
+
const literal = ts23.createObjectLiteral(properties, true);
|
|
3510
3130
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3511
3131
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3512
3132
|
return node;
|
|
@@ -3514,18 +3134,18 @@ var AstTranslator = class {
|
|
|
3514
3134
|
visitLiteralPrimitive(ast) {
|
|
3515
3135
|
let node;
|
|
3516
3136
|
if (ast.value === void 0) {
|
|
3517
|
-
node =
|
|
3137
|
+
node = ts23.createIdentifier("undefined");
|
|
3518
3138
|
} else if (ast.value === null) {
|
|
3519
|
-
node =
|
|
3139
|
+
node = ts23.createNull();
|
|
3520
3140
|
} else {
|
|
3521
|
-
node =
|
|
3141
|
+
node = ts23.createLiteral(ast.value);
|
|
3522
3142
|
}
|
|
3523
3143
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3524
3144
|
return node;
|
|
3525
3145
|
}
|
|
3526
3146
|
visitNonNullAssert(ast) {
|
|
3527
3147
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3528
|
-
const node =
|
|
3148
|
+
const node = ts23.createNonNullExpression(expr);
|
|
3529
3149
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3530
3150
|
return node;
|
|
3531
3151
|
}
|
|
@@ -3534,13 +3154,13 @@ var AstTranslator = class {
|
|
|
3534
3154
|
}
|
|
3535
3155
|
visitPrefixNot(ast) {
|
|
3536
3156
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3537
|
-
const node =
|
|
3157
|
+
const node = ts23.createLogicalNot(expression);
|
|
3538
3158
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3539
3159
|
return node;
|
|
3540
3160
|
}
|
|
3541
3161
|
visitPropertyRead(ast) {
|
|
3542
3162
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3543
|
-
const name =
|
|
3163
|
+
const name = ts23.createPropertyAccess(receiver, ast.name);
|
|
3544
3164
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3545
3165
|
const node = wrapForDiagnostics(name);
|
|
3546
3166
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3548,12 +3168,12 @@ var AstTranslator = class {
|
|
|
3548
3168
|
}
|
|
3549
3169
|
visitPropertyWrite(ast) {
|
|
3550
3170
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3551
|
-
const left =
|
|
3171
|
+
const left = ts23.createPropertyAccess(receiver, ast.name);
|
|
3552
3172
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3553
3173
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3554
3174
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3555
3175
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3556
|
-
const node = wrapForDiagnostics(
|
|
3176
|
+
const node = wrapForDiagnostics(ts23.createBinary(leftWithPath, ts23.SyntaxKind.EqualsToken, right));
|
|
3557
3177
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3558
3178
|
return node;
|
|
3559
3179
|
}
|
|
@@ -3564,13 +3184,13 @@ var AstTranslator = class {
|
|
|
3564
3184
|
let node;
|
|
3565
3185
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3566
3186
|
if (this.config.strictSafeNavigationTypes) {
|
|
3567
|
-
const expr =
|
|
3187
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3568
3188
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3569
|
-
node =
|
|
3189
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3570
3190
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3571
|
-
node =
|
|
3191
|
+
node = ts23.createPropertyAccess(tsCastToAny(receiver), ast.name);
|
|
3572
3192
|
} else {
|
|
3573
|
-
const expr =
|
|
3193
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3574
3194
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3575
3195
|
node = tsCastToAny(expr);
|
|
3576
3196
|
}
|
|
@@ -3582,13 +3202,13 @@ var AstTranslator = class {
|
|
|
3582
3202
|
const key = this.translate(ast.key);
|
|
3583
3203
|
let node;
|
|
3584
3204
|
if (this.config.strictSafeNavigationTypes) {
|
|
3585
|
-
const expr =
|
|
3205
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3586
3206
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3587
|
-
node =
|
|
3207
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3588
3208
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3589
|
-
node =
|
|
3209
|
+
node = ts23.createElementAccess(tsCastToAny(receiver), key);
|
|
3590
3210
|
} else {
|
|
3591
|
-
const expr =
|
|
3211
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3592
3212
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3593
3213
|
node = tsCastToAny(expr);
|
|
3594
3214
|
}
|
|
@@ -3597,23 +3217,46 @@ var AstTranslator = class {
|
|
|
3597
3217
|
}
|
|
3598
3218
|
visitCall(ast) {
|
|
3599
3219
|
const args = ast.args.map((expr2) => this.translate(expr2));
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
if (
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3607
|
-
node = ts26.createCall(tsCastToAny(expr), void 0, args);
|
|
3220
|
+
let expr;
|
|
3221
|
+
const receiver = ast.receiver;
|
|
3222
|
+
if (receiver instanceof PropertyRead3) {
|
|
3223
|
+
const resolved = this.maybeResolve(receiver);
|
|
3224
|
+
if (resolved !== null) {
|
|
3225
|
+
expr = resolved;
|
|
3608
3226
|
} else {
|
|
3609
|
-
|
|
3227
|
+
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3228
|
+
expr = ts23.createPropertyAccess(propertyReceiver, receiver.name);
|
|
3229
|
+
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3610
3230
|
}
|
|
3611
3231
|
} else {
|
|
3612
|
-
|
|
3232
|
+
expr = this.translate(receiver);
|
|
3233
|
+
}
|
|
3234
|
+
let node;
|
|
3235
|
+
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3236
|
+
node = this.convertToSafeCall(ast, expr, args);
|
|
3237
|
+
} else {
|
|
3238
|
+
node = ts23.createCall(expr, void 0, args);
|
|
3613
3239
|
}
|
|
3614
3240
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3615
3241
|
return node;
|
|
3616
3242
|
}
|
|
3243
|
+
visitSafeCall(ast) {
|
|
3244
|
+
const args = ast.args.map((expr2) => this.translate(expr2));
|
|
3245
|
+
const expr = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3246
|
+
const node = this.convertToSafeCall(ast, expr, args);
|
|
3247
|
+
addParseSpanInfo(node, ast.sourceSpan);
|
|
3248
|
+
return node;
|
|
3249
|
+
}
|
|
3250
|
+
convertToSafeCall(ast, expr, args) {
|
|
3251
|
+
if (this.config.strictSafeNavigationTypes) {
|
|
3252
|
+
const call = ts23.createCall(ts23.createNonNullExpression(expr), void 0, args);
|
|
3253
|
+
return ts23.createParen(ts23.createConditional(NULL_AS_ANY, call, UNDEFINED));
|
|
3254
|
+
}
|
|
3255
|
+
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3256
|
+
return ts23.createCall(tsCastToAny(expr), void 0, args);
|
|
3257
|
+
}
|
|
3258
|
+
return tsCastToAny(ts23.createCall(ts23.createNonNullExpression(expr), void 0, args));
|
|
3259
|
+
}
|
|
3617
3260
|
};
|
|
3618
3261
|
var VeSafeLhsInferenceBugDetector = class {
|
|
3619
3262
|
static veWillInferAnyFor(ast) {
|
|
@@ -3635,6 +3278,9 @@ var VeSafeLhsInferenceBugDetector = class {
|
|
|
3635
3278
|
visitCall(ast) {
|
|
3636
3279
|
return true;
|
|
3637
3280
|
}
|
|
3281
|
+
visitSafeCall(ast) {
|
|
3282
|
+
return false;
|
|
3283
|
+
}
|
|
3638
3284
|
visitImplicitReceiver(ast) {
|
|
3639
3285
|
return false;
|
|
3640
3286
|
}
|
|
@@ -3686,7 +3332,7 @@ var VeSafeLhsInferenceBugDetector = class {
|
|
|
3686
3332
|
};
|
|
3687
3333
|
VeSafeLhsInferenceBugDetector.SINGLETON = new VeSafeLhsInferenceBugDetector();
|
|
3688
3334
|
|
|
3689
|
-
// bazel-out/
|
|
3335
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.mjs
|
|
3690
3336
|
import { ImplicitReceiver as ImplicitReceiver3, RecursiveAstVisitor as RecursiveAstVisitor2, TmplAstVariable } from "@angular/compiler";
|
|
3691
3337
|
var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
3692
3338
|
constructor(templateId, boundTarget, oob) {
|
|
@@ -3710,7 +3356,7 @@ var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
|
3710
3356
|
}
|
|
3711
3357
|
};
|
|
3712
3358
|
|
|
3713
|
-
// bazel-out/
|
|
3359
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3714
3360
|
var TcbGenericContextBehavior;
|
|
3715
3361
|
(function(TcbGenericContextBehavior2) {
|
|
3716
3362
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
@@ -3721,7 +3367,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3721
3367
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
3722
3368
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3723
3369
|
const ctxRawType = env.referenceType(ref);
|
|
3724
|
-
if (!
|
|
3370
|
+
if (!ts24.isTypeReferenceNode(ctxRawType)) {
|
|
3725
3371
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3726
3372
|
}
|
|
3727
3373
|
let typeParameters = void 0;
|
|
@@ -3733,25 +3379,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3733
3379
|
switch (genericContextBehavior) {
|
|
3734
3380
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3735
3381
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3736
|
-
typeArguments = typeParameters.map((param) =>
|
|
3382
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3737
3383
|
break;
|
|
3738
3384
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3739
3385
|
typeParameters = [...ref.node.typeParameters];
|
|
3740
|
-
typeArguments = typeParameters.map((param) =>
|
|
3386
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3741
3387
|
break;
|
|
3742
3388
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3743
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3389
|
+
typeArguments = ref.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3744
3390
|
break;
|
|
3745
3391
|
}
|
|
3746
3392
|
}
|
|
3747
3393
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3748
3394
|
const scopeStatements = scope.render();
|
|
3749
|
-
const innerBody =
|
|
3395
|
+
const innerBody = ts24.createBlock([
|
|
3750
3396
|
...env.getPreludeStatements(),
|
|
3751
3397
|
...scopeStatements
|
|
3752
3398
|
]);
|
|
3753
|
-
const body =
|
|
3754
|
-
const fnDecl =
|
|
3399
|
+
const body = ts24.createBlock([ts24.createIf(ts24.createTrue(), innerBody, void 0)]);
|
|
3400
|
+
const fnDecl = ts24.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3755
3401
|
addTemplateId(fnDecl, meta.id);
|
|
3756
3402
|
return fnDecl;
|
|
3757
3403
|
}
|
|
@@ -3792,7 +3438,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3792
3438
|
execute() {
|
|
3793
3439
|
const ctx = this.scope.resolve(this.template);
|
|
3794
3440
|
const id = this.tcb.allocateId();
|
|
3795
|
-
const initializer =
|
|
3441
|
+
const initializer = ts24.createPropertyAccess(ctx, this.variable.value || "$implicit");
|
|
3796
3442
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3797
3443
|
let variable;
|
|
3798
3444
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3815,7 +3461,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3815
3461
|
}
|
|
3816
3462
|
execute() {
|
|
3817
3463
|
const ctx = this.tcb.allocateId();
|
|
3818
|
-
const type =
|
|
3464
|
+
const type = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
3819
3465
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3820
3466
|
return ctx;
|
|
3821
3467
|
}
|
|
@@ -3868,16 +3514,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3868
3514
|
}
|
|
3869
3515
|
let guard = null;
|
|
3870
3516
|
if (directiveGuards.length > 0) {
|
|
3871
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3517
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts24.createBinary(expr, ts24.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3872
3518
|
}
|
|
3873
3519
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3874
3520
|
const statements = tmplScope.render();
|
|
3875
3521
|
if (statements.length === 0) {
|
|
3876
3522
|
return null;
|
|
3877
3523
|
}
|
|
3878
|
-
let tmplBlock =
|
|
3524
|
+
let tmplBlock = ts24.createBlock(statements);
|
|
3879
3525
|
if (guard !== null) {
|
|
3880
|
-
tmplBlock =
|
|
3526
|
+
tmplBlock = ts24.createIf(guard, tmplBlock);
|
|
3881
3527
|
}
|
|
3882
3528
|
this.scope.addStatement(tmplBlock);
|
|
3883
3529
|
return null;
|
|
@@ -3895,7 +3541,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3895
3541
|
}
|
|
3896
3542
|
execute() {
|
|
3897
3543
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3898
|
-
this.scope.addStatement(
|
|
3544
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
3899
3545
|
return null;
|
|
3900
3546
|
}
|
|
3901
3547
|
};
|
|
@@ -3917,11 +3563,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3917
3563
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3918
3564
|
type = rawType;
|
|
3919
3565
|
} else {
|
|
3920
|
-
if (!
|
|
3566
|
+
if (!ts24.isTypeReferenceNode(rawType)) {
|
|
3921
3567
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3922
3568
|
}
|
|
3923
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3924
|
-
type =
|
|
3569
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3570
|
+
type = ts24.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3925
3571
|
}
|
|
3926
3572
|
const id = this.tcb.allocateId();
|
|
3927
3573
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3962,11 +3608,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3962
3608
|
const id = this.tcb.allocateId();
|
|
3963
3609
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3964
3610
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3965
|
-
initializer =
|
|
3611
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3966
3612
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3967
|
-
initializer =
|
|
3968
|
-
initializer =
|
|
3969
|
-
initializer =
|
|
3613
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3614
|
+
initializer = ts24.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3615
|
+
initializer = ts24.createParen(initializer);
|
|
3970
3616
|
}
|
|
3971
3617
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3972
3618
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -4002,7 +3648,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
|
|
|
4002
3648
|
const id = this.tcb.allocateId();
|
|
4003
3649
|
addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
|
|
4004
3650
|
addParseSpanInfo(id, this.node.startSourceSpan || this.node.sourceSpan);
|
|
4005
|
-
const genericInputs = new Map();
|
|
3651
|
+
const genericInputs = /* @__PURE__ */ new Map();
|
|
4006
3652
|
const inputs = getBoundInputs(this.dir, this.node, this.tcb);
|
|
4007
3653
|
for (const input of inputs) {
|
|
4008
3654
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
@@ -4056,7 +3702,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4056
3702
|
let target;
|
|
4057
3703
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
4058
3704
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4059
|
-
if (!
|
|
3705
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4060
3706
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4061
3707
|
}
|
|
4062
3708
|
const id = this.tcb.allocateId();
|
|
@@ -4071,10 +3717,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4071
3717
|
}
|
|
4072
3718
|
const id = this.tcb.allocateId();
|
|
4073
3719
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4074
|
-
if (!
|
|
3720
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4075
3721
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4076
3722
|
}
|
|
4077
|
-
const type =
|
|
3723
|
+
const type = ts24.createIndexedAccessTypeNode(ts24.createTypeQueryNode(dirId), ts24.createLiteralTypeNode(ts24.createStringLiteral(fieldName)));
|
|
4078
3724
|
const temp = tsDeclareVariable(id, type);
|
|
4079
3725
|
this.scope.addStatement(temp);
|
|
4080
3726
|
target = id;
|
|
@@ -4082,18 +3728,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4082
3728
|
if (dirId === null) {
|
|
4083
3729
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4084
3730
|
}
|
|
4085
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3731
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts24.createElementAccess(dirId, ts24.createStringLiteral(fieldName)) : ts24.createPropertyAccess(dirId, ts24.createIdentifier(fieldName));
|
|
4086
3732
|
}
|
|
4087
3733
|
if (input.attribute.keySpan !== void 0) {
|
|
4088
3734
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
4089
3735
|
}
|
|
4090
|
-
assignment =
|
|
3736
|
+
assignment = ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, assignment);
|
|
4091
3737
|
}
|
|
4092
3738
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
4093
3739
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
4094
3740
|
markIgnoreDiagnostics(assignment);
|
|
4095
3741
|
}
|
|
4096
|
-
this.scope.addStatement(
|
|
3742
|
+
this.scope.addStatement(ts24.createExpressionStatement(assignment));
|
|
4097
3743
|
}
|
|
4098
3744
|
return null;
|
|
4099
3745
|
}
|
|
@@ -4112,7 +3758,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
4112
3758
|
execute() {
|
|
4113
3759
|
const id = this.tcb.allocateId();
|
|
4114
3760
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
4115
|
-
const circularPlaceholder =
|
|
3761
|
+
const circularPlaceholder = ts24.createCall(typeCtor, void 0, [ts24.createNonNullExpression(ts24.createNull())]);
|
|
4116
3762
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
4117
3763
|
return id;
|
|
4118
3764
|
}
|
|
@@ -4178,15 +3824,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
4178
3824
|
elId = this.scope.resolve(this.element);
|
|
4179
3825
|
}
|
|
4180
3826
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
4181
|
-
const prop =
|
|
4182
|
-
const stmt =
|
|
3827
|
+
const prop = ts24.createElementAccess(elId, ts24.createStringLiteral(propertyName));
|
|
3828
|
+
const stmt = ts24.createBinary(prop, ts24.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
4183
3829
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
4184
|
-
this.scope.addStatement(
|
|
3830
|
+
this.scope.addStatement(ts24.createExpressionStatement(stmt));
|
|
4185
3831
|
} else {
|
|
4186
|
-
this.scope.addStatement(
|
|
3832
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4187
3833
|
}
|
|
4188
3834
|
} else {
|
|
4189
|
-
this.scope.addStatement(
|
|
3835
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4190
3836
|
}
|
|
4191
3837
|
}
|
|
4192
3838
|
return null;
|
|
@@ -4218,18 +3864,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
4218
3864
|
if (dirId === null) {
|
|
4219
3865
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4220
3866
|
}
|
|
4221
|
-
const outputField =
|
|
3867
|
+
const outputField = ts24.createElementAccess(dirId, ts24.createStringLiteral(field));
|
|
4222
3868
|
addParseSpanInfo(outputField, output.keySpan);
|
|
4223
3869
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
4224
3870
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4225
|
-
const subscribeFn =
|
|
4226
|
-
const call =
|
|
3871
|
+
const subscribeFn = ts24.createPropertyAccess(outputField, "subscribe");
|
|
3872
|
+
const call = ts24.createCall(subscribeFn, void 0, [handler]);
|
|
4227
3873
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4228
|
-
this.scope.addStatement(
|
|
3874
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4229
3875
|
} else {
|
|
4230
|
-
this.scope.addStatement(
|
|
3876
|
+
this.scope.addStatement(ts24.createExpressionStatement(outputField));
|
|
4231
3877
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4232
|
-
this.scope.addStatement(
|
|
3878
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4233
3879
|
}
|
|
4234
3880
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4235
3881
|
}
|
|
@@ -4262,20 +3908,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
4262
3908
|
if (output.type === 1) {
|
|
4263
3909
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
4264
3910
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
4265
|
-
this.scope.addStatement(
|
|
3911
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4266
3912
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
4267
3913
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4268
3914
|
if (elId === null) {
|
|
4269
3915
|
elId = this.scope.resolve(this.element);
|
|
4270
3916
|
}
|
|
4271
|
-
const propertyAccess =
|
|
3917
|
+
const propertyAccess = ts24.createPropertyAccess(elId, "addEventListener");
|
|
4272
3918
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
4273
|
-
const call =
|
|
3919
|
+
const call = ts24.createCall(propertyAccess, void 0, [ts24.createStringLiteral(output.name), handler]);
|
|
4274
3920
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4275
|
-
this.scope.addStatement(
|
|
3921
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4276
3922
|
} else {
|
|
4277
3923
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4278
|
-
this.scope.addStatement(
|
|
3924
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4279
3925
|
}
|
|
4280
3926
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4281
3927
|
}
|
|
@@ -4289,15 +3935,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
4289
3935
|
this.optional = false;
|
|
4290
3936
|
}
|
|
4291
3937
|
execute() {
|
|
4292
|
-
const ctx =
|
|
4293
|
-
const ctxDot =
|
|
3938
|
+
const ctx = ts24.createIdentifier("ctx");
|
|
3939
|
+
const ctxDot = ts24.createPropertyAccess(ctx, "");
|
|
4294
3940
|
markIgnoreDiagnostics(ctxDot);
|
|
4295
3941
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
4296
|
-
this.scope.addStatement(
|
|
3942
|
+
this.scope.addStatement(ts24.createExpressionStatement(ctxDot));
|
|
4297
3943
|
return null;
|
|
4298
3944
|
}
|
|
4299
3945
|
};
|
|
4300
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3946
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts24.createNonNullExpression(ts24.createNull());
|
|
4301
3947
|
var Context = class {
|
|
4302
3948
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
4303
3949
|
this.env = env;
|
|
@@ -4310,7 +3956,7 @@ var Context = class {
|
|
|
4310
3956
|
this.nextId = 1;
|
|
4311
3957
|
}
|
|
4312
3958
|
allocateId() {
|
|
4313
|
-
return
|
|
3959
|
+
return ts24.createIdentifier(`_t${this.nextId++}`);
|
|
4314
3960
|
}
|
|
4315
3961
|
getPipeByName(name) {
|
|
4316
3962
|
if (!this.pipes.has(name)) {
|
|
@@ -4325,11 +3971,11 @@ var Scope = class {
|
|
|
4325
3971
|
this.parent = parent;
|
|
4326
3972
|
this.guard = guard;
|
|
4327
3973
|
this.opQueue = [];
|
|
4328
|
-
this.elementOpMap = new Map();
|
|
4329
|
-
this.directiveOpMap = new Map();
|
|
4330
|
-
this.referenceOpMap = new Map();
|
|
4331
|
-
this.templateCtxOpMap = new Map();
|
|
4332
|
-
this.varMap = new Map();
|
|
3974
|
+
this.elementOpMap = /* @__PURE__ */ new Map();
|
|
3975
|
+
this.directiveOpMap = /* @__PURE__ */ new Map();
|
|
3976
|
+
this.referenceOpMap = /* @__PURE__ */ new Map();
|
|
3977
|
+
this.templateCtxOpMap = /* @__PURE__ */ new Map();
|
|
3978
|
+
this.varMap = /* @__PURE__ */ new Map();
|
|
4333
3979
|
this.statements = [];
|
|
4334
3980
|
}
|
|
4335
3981
|
static forNodes(tcb, parent, templateOrNodes, guard) {
|
|
@@ -4339,7 +3985,7 @@ var Scope = class {
|
|
|
4339
3985
|
}
|
|
4340
3986
|
let children;
|
|
4341
3987
|
if (templateOrNodes instanceof TmplAstTemplate2) {
|
|
4342
|
-
const varMap = new Map();
|
|
3988
|
+
const varMap = /* @__PURE__ */ new Map();
|
|
4343
3989
|
for (const v of templateOrNodes.variables) {
|
|
4344
3990
|
if (!varMap.has(v.name)) {
|
|
4345
3991
|
varMap.set(v.name, v);
|
|
@@ -4362,8 +4008,8 @@ var Scope = class {
|
|
|
4362
4008
|
resolve(node, directive) {
|
|
4363
4009
|
const res = this.resolveLocal(node, directive);
|
|
4364
4010
|
if (res !== null) {
|
|
4365
|
-
const clone =
|
|
4366
|
-
|
|
4011
|
+
const clone = ts24.getMutableClone(res);
|
|
4012
|
+
ts24.setSyntheticTrailingComments(clone, []);
|
|
4367
4013
|
return clone;
|
|
4368
4014
|
} else if (this.parent !== null) {
|
|
4369
4015
|
return this.parent.resolve(node, directive);
|
|
@@ -4391,7 +4037,7 @@ var Scope = class {
|
|
|
4391
4037
|
} else if (parentGuards === null) {
|
|
4392
4038
|
return this.guard;
|
|
4393
4039
|
} else {
|
|
4394
|
-
return
|
|
4040
|
+
return ts24.createBinary(parentGuards, ts24.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4395
4041
|
}
|
|
4396
4042
|
}
|
|
4397
4043
|
resolveLocal(ref, directive) {
|
|
@@ -4477,7 +4123,7 @@ var Scope = class {
|
|
|
4477
4123
|
}
|
|
4478
4124
|
}
|
|
4479
4125
|
appendDirectivesAndInputsOfNode(node) {
|
|
4480
|
-
const claimedInputs = new Set();
|
|
4126
|
+
const claimedInputs = /* @__PURE__ */ new Set();
|
|
4481
4127
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
|
|
4482
4128
|
if (directives === null || directives.length === 0) {
|
|
4483
4129
|
if (node instanceof TmplAstElement3) {
|
|
@@ -4486,14 +4132,14 @@ var Scope = class {
|
|
|
4486
4132
|
}
|
|
4487
4133
|
return;
|
|
4488
4134
|
}
|
|
4489
|
-
const dirMap = new Map();
|
|
4135
|
+
const dirMap = /* @__PURE__ */ new Map();
|
|
4490
4136
|
for (const dir of directives) {
|
|
4491
4137
|
let directiveOp;
|
|
4492
4138
|
const host = this.tcb.env.reflector;
|
|
4493
4139
|
const dirRef = dir.ref;
|
|
4494
4140
|
if (!dir.isGeneric) {
|
|
4495
4141
|
directiveOp = new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir);
|
|
4496
|
-
} else if (!requiresInlineTypeCtor(dirRef.node, host) || this.tcb.env.config.useInlineTypeConstructors) {
|
|
4142
|
+
} else if (!requiresInlineTypeCtor(dirRef.node, host, this.tcb.env) || this.tcb.env.config.useInlineTypeConstructors) {
|
|
4497
4143
|
directiveOp = new TcbDirectiveCtorOp(this.tcb, this, node, dir);
|
|
4498
4144
|
} else {
|
|
4499
4145
|
directiveOp = new TcbGenericDirectiveTypeWithAnyParamsOp(this.tcb, this, node, dir);
|
|
@@ -4515,7 +4161,7 @@ var Scope = class {
|
|
|
4515
4161
|
}
|
|
4516
4162
|
}
|
|
4517
4163
|
appendOutputsOfNode(node) {
|
|
4518
|
-
const claimedOutputs = new Set();
|
|
4164
|
+
const claimedOutputs = /* @__PURE__ */ new Set();
|
|
4519
4165
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
|
|
4520
4166
|
if (directives === null || directives.length === 0) {
|
|
4521
4167
|
if (node instanceof TmplAstElement3) {
|
|
@@ -4541,7 +4187,7 @@ var Scope = class {
|
|
|
4541
4187
|
continue;
|
|
4542
4188
|
}
|
|
4543
4189
|
if (node instanceof TmplAstElement3) {
|
|
4544
|
-
const claimedInputs = new Set();
|
|
4190
|
+
const claimedInputs = /* @__PURE__ */ new Set();
|
|
4545
4191
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
|
|
4546
4192
|
let hasDirectives;
|
|
4547
4193
|
if (directives === null || directives.length === 0) {
|
|
@@ -4571,8 +4217,8 @@ var Scope = class {
|
|
|
4571
4217
|
}
|
|
4572
4218
|
};
|
|
4573
4219
|
function tcbCtxParam(node, name, typeArguments) {
|
|
4574
|
-
const type =
|
|
4575
|
-
return
|
|
4220
|
+
const type = ts24.factory.createTypeReferenceNode(name, typeArguments);
|
|
4221
|
+
return ts24.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
4576
4222
|
}
|
|
4577
4223
|
function tcbExpression(ast, tcb, scope) {
|
|
4578
4224
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -4587,19 +4233,19 @@ var TcbExpressionTranslator = class {
|
|
|
4587
4233
|
return astToTypescript(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
|
|
4588
4234
|
}
|
|
4589
4235
|
resolve(ast) {
|
|
4590
|
-
if (ast instanceof
|
|
4236
|
+
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4) {
|
|
4591
4237
|
return this.resolveTarget(ast);
|
|
4592
|
-
} else if (ast instanceof
|
|
4238
|
+
} else if (ast instanceof PropertyWrite3 && ast.receiver instanceof ImplicitReceiver4) {
|
|
4593
4239
|
const target = this.resolveTarget(ast);
|
|
4594
4240
|
if (target === null) {
|
|
4595
4241
|
return null;
|
|
4596
4242
|
}
|
|
4597
4243
|
const expr = this.translate(ast.value);
|
|
4598
|
-
const result =
|
|
4244
|
+
const result = ts24.createParen(ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, expr));
|
|
4599
4245
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4600
4246
|
return result;
|
|
4601
4247
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4602
|
-
return
|
|
4248
|
+
return ts24.createIdentifier("ctx");
|
|
4603
4249
|
} else if (ast instanceof BindingPipe) {
|
|
4604
4250
|
const expr = this.translate(ast.exp);
|
|
4605
4251
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4611,19 +4257,19 @@ var TcbExpressionTranslator = class {
|
|
|
4611
4257
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4612
4258
|
}
|
|
4613
4259
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4614
|
-
let methodAccess =
|
|
4260
|
+
let methodAccess = ts24.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4615
4261
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4616
4262
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4617
|
-
methodAccess =
|
|
4263
|
+
methodAccess = ts24.factory.createAsExpression(methodAccess, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4618
4264
|
}
|
|
4619
|
-
const result =
|
|
4265
|
+
const result = ts24.createCall(methodAccess, void 0, [expr, ...args]);
|
|
4620
4266
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4621
4267
|
return result;
|
|
4622
|
-
} else if (ast instanceof Call2
|
|
4623
|
-
if (ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4268
|
+
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4269
|
+
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4624
4270
|
const expr = this.translate(ast.args[0]);
|
|
4625
|
-
const exprAsAny =
|
|
4626
|
-
const result =
|
|
4271
|
+
const exprAsAny = ts24.createAsExpression(expr, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4272
|
+
const result = ts24.createParen(exprAsAny);
|
|
4627
4273
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4628
4274
|
return result;
|
|
4629
4275
|
}
|
|
@@ -4634,7 +4280,7 @@ var TcbExpressionTranslator = class {
|
|
|
4634
4280
|
const method = wrapForDiagnostics(receiver);
|
|
4635
4281
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4636
4282
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4637
|
-
const node =
|
|
4283
|
+
const node = ts24.createCall(method, void 0, args);
|
|
4638
4284
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4639
4285
|
return node;
|
|
4640
4286
|
} else {
|
|
@@ -4654,17 +4300,17 @@ var TcbExpressionTranslator = class {
|
|
|
4654
4300
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4655
4301
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4656
4302
|
const members = inputs.map((input) => {
|
|
4657
|
-
const propertyName =
|
|
4303
|
+
const propertyName = ts24.createStringLiteral(input.field);
|
|
4658
4304
|
if (input.type === "binding") {
|
|
4659
4305
|
const expr = widenBinding(input.expression, tcb);
|
|
4660
|
-
const assignment =
|
|
4306
|
+
const assignment = ts24.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4661
4307
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4662
4308
|
return assignment;
|
|
4663
4309
|
} else {
|
|
4664
|
-
return
|
|
4310
|
+
return ts24.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4665
4311
|
}
|
|
4666
4312
|
});
|
|
4667
|
-
return
|
|
4313
|
+
return ts24.createCall(typeCtor, void 0, [ts24.createObjectLiteral(members)]);
|
|
4668
4314
|
}
|
|
4669
4315
|
function getBoundInputs(directive, node, tcb) {
|
|
4670
4316
|
const boundInputs = [];
|
|
@@ -4690,17 +4336,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4690
4336
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4691
4337
|
return tcbExpression(attr.value, tcb, scope);
|
|
4692
4338
|
} else {
|
|
4693
|
-
return
|
|
4339
|
+
return ts24.createStringLiteral(attr.value);
|
|
4694
4340
|
}
|
|
4695
4341
|
}
|
|
4696
4342
|
function widenBinding(expr, tcb) {
|
|
4697
4343
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4698
4344
|
return tsCastToAny(expr);
|
|
4699
4345
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4700
|
-
if (
|
|
4346
|
+
if (ts24.isObjectLiteralExpression(expr) || ts24.isArrayLiteralExpression(expr)) {
|
|
4701
4347
|
return expr;
|
|
4702
4348
|
} else {
|
|
4703
|
-
return
|
|
4349
|
+
return ts24.createNonNullExpression(expr);
|
|
4704
4350
|
}
|
|
4705
4351
|
} else {
|
|
4706
4352
|
return expr;
|
|
@@ -4713,18 +4359,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4713
4359
|
if (eventType === 0) {
|
|
4714
4360
|
eventParamType = void 0;
|
|
4715
4361
|
} else if (eventType === 1) {
|
|
4716
|
-
eventParamType =
|
|
4362
|
+
eventParamType = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
4717
4363
|
} else {
|
|
4718
4364
|
eventParamType = eventType;
|
|
4719
4365
|
}
|
|
4720
4366
|
const guards = scope.guards();
|
|
4721
|
-
let body =
|
|
4367
|
+
let body = ts24.createExpressionStatement(handler);
|
|
4722
4368
|
if (guards !== null) {
|
|
4723
|
-
body =
|
|
4369
|
+
body = ts24.createIf(guards, body);
|
|
4724
4370
|
}
|
|
4725
|
-
const eventParam =
|
|
4371
|
+
const eventParam = ts24.createParameter(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4726
4372
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4727
|
-
return
|
|
4373
|
+
return ts24.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword), ts24.createBlock([body]));
|
|
4728
4374
|
}
|
|
4729
4375
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4730
4376
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4751,8 +4397,8 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4751
4397
|
}
|
|
4752
4398
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4753
4399
|
resolve(ast) {
|
|
4754
|
-
if (ast instanceof
|
|
4755
|
-
const event =
|
|
4400
|
+
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4401
|
+
const event = ts24.createIdentifier(EVENT_PARAMETER);
|
|
4756
4402
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4757
4403
|
return event;
|
|
4758
4404
|
}
|
|
@@ -4760,33 +4406,33 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4760
4406
|
}
|
|
4761
4407
|
};
|
|
4762
4408
|
|
|
4763
|
-
// bazel-out/
|
|
4764
|
-
import
|
|
4409
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4410
|
+
import ts25 from "typescript";
|
|
4765
4411
|
var TypeCheckFile = class extends Environment {
|
|
4766
4412
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4767
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
4413
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts25.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts25.ScriptTarget.Latest, true));
|
|
4768
4414
|
this.fileName = fileName;
|
|
4769
4415
|
this.nextTcbId = 1;
|
|
4770
4416
|
this.tcbStatements = [];
|
|
4771
4417
|
}
|
|
4772
4418
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4773
|
-
const fnId =
|
|
4419
|
+
const fnId = ts25.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4774
4420
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4775
4421
|
this.tcbStatements.push(fn);
|
|
4776
4422
|
}
|
|
4777
4423
|
render(removeComments) {
|
|
4778
4424
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
4779
|
-
const printer =
|
|
4425
|
+
const printer = ts25.createPrinter({ removeComments });
|
|
4780
4426
|
source += "\n";
|
|
4781
4427
|
for (const stmt of this.pipeInstStatements) {
|
|
4782
|
-
source += printer.printNode(
|
|
4428
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4783
4429
|
}
|
|
4784
4430
|
for (const stmt of this.typeCtorStatements) {
|
|
4785
|
-
source += printer.printNode(
|
|
4431
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4786
4432
|
}
|
|
4787
4433
|
source += "\n";
|
|
4788
4434
|
for (const stmt of this.tcbStatements) {
|
|
4789
|
-
source += printer.printNode(
|
|
4435
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4790
4436
|
}
|
|
4791
4437
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4792
4438
|
return source;
|
|
@@ -4796,7 +4442,7 @@ var TypeCheckFile = class extends Environment {
|
|
|
4796
4442
|
}
|
|
4797
4443
|
};
|
|
4798
4444
|
|
|
4799
|
-
// bazel-out/
|
|
4445
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
4800
4446
|
var InliningMode;
|
|
4801
4447
|
(function(InliningMode2) {
|
|
4802
4448
|
InliningMode2[InliningMode2["InlineOps"] = 0] = "InlineOps";
|
|
@@ -4811,9 +4457,9 @@ var TypeCheckContextImpl = class {
|
|
|
4811
4457
|
this.host = host;
|
|
4812
4458
|
this.inlining = inlining;
|
|
4813
4459
|
this.perf = perf;
|
|
4814
|
-
this.fileMap = new Map();
|
|
4815
|
-
this.opMap = new Map();
|
|
4816
|
-
this.typeCtorPending = new Set();
|
|
4460
|
+
this.fileMap = /* @__PURE__ */ new Map();
|
|
4461
|
+
this.opMap = /* @__PURE__ */ new Map();
|
|
4462
|
+
this.typeCtorPending = /* @__PURE__ */ new Set();
|
|
4817
4463
|
if (inlining === InliningMode.Error && config.useInlineTypeConstructors) {
|
|
4818
4464
|
throw new Error(`AssertionError: invalid inlining configuration.`);
|
|
4819
4465
|
}
|
|
@@ -4834,7 +4480,7 @@ var TypeCheckContextImpl = class {
|
|
|
4834
4480
|
for (const dir of boundTarget.getUsedDirectives()) {
|
|
4835
4481
|
const dirRef = dir.ref;
|
|
4836
4482
|
const dirNode = dirRef.node;
|
|
4837
|
-
if (!dir.isGeneric || !requiresInlineTypeCtor(dirNode, this.reflector)) {
|
|
4483
|
+
if (!dir.isGeneric || !requiresInlineTypeCtor(dirNode, this.reflector, shimData.file)) {
|
|
4838
4484
|
continue;
|
|
4839
4485
|
}
|
|
4840
4486
|
this.addInlineTypeCtor(fileData, dirNode.getSourceFile(), dirRef, {
|
|
@@ -4854,7 +4500,7 @@ var TypeCheckContextImpl = class {
|
|
|
4854
4500
|
boundTarget,
|
|
4855
4501
|
templateDiagnostics
|
|
4856
4502
|
});
|
|
4857
|
-
const inliningRequirement = requiresInlineTypeCheckBlock(ref.node, pipes, this.reflector);
|
|
4503
|
+
const inliningRequirement = requiresInlineTypeCheckBlock(ref.node, shimData.file, pipes, this.reflector);
|
|
4858
4504
|
if (this.inlining === InliningMode.Error && inliningRequirement === TcbInliningRequirement.MustInline) {
|
|
4859
4505
|
shimData.oobRecorder.requiresInlineTcb(templateId, ref.node);
|
|
4860
4506
|
this.perf.eventCount(PerfEvent.SkipGenerateTcbNoInline);
|
|
@@ -4894,7 +4540,7 @@ var TypeCheckContextImpl = class {
|
|
|
4894
4540
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4895
4541
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4896
4542
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4897
|
-
const printer =
|
|
4543
|
+
const printer = ts26.createPrinter({ omitTrailingSemicolon: true });
|
|
4898
4544
|
let code = textParts[0];
|
|
4899
4545
|
ops.forEach((op, idx) => {
|
|
4900
4546
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4905,7 +4551,7 @@ var TypeCheckContextImpl = class {
|
|
|
4905
4551
|
return code;
|
|
4906
4552
|
}
|
|
4907
4553
|
finalize() {
|
|
4908
|
-
const updates = new Map();
|
|
4554
|
+
const updates = /* @__PURE__ */ new Map();
|
|
4909
4555
|
for (const originalSf of this.opMap.keys()) {
|
|
4910
4556
|
const newText = this.transform(originalSf);
|
|
4911
4557
|
if (newText !== null) {
|
|
@@ -4952,7 +4598,7 @@ var TypeCheckContextImpl = class {
|
|
|
4952
4598
|
domSchemaChecker: new RegistryDomSchemaChecker(fileData.sourceManager),
|
|
4953
4599
|
oobRecorder: new OutOfBandDiagnosticRecorderImpl(fileData.sourceManager),
|
|
4954
4600
|
file: new TypeCheckFile(shimPath, this.config, this.refEmitter, this.reflector, this.compilerHost),
|
|
4955
|
-
templates: new Map()
|
|
4601
|
+
templates: /* @__PURE__ */ new Map()
|
|
4956
4602
|
});
|
|
4957
4603
|
}
|
|
4958
4604
|
return fileData.shimData.get(shimPath);
|
|
@@ -4963,7 +4609,7 @@ var TypeCheckContextImpl = class {
|
|
|
4963
4609
|
const data = {
|
|
4964
4610
|
hasInlines: false,
|
|
4965
4611
|
sourceManager: this.host.getSourceManager(sfPath),
|
|
4966
|
-
shimData: new Map()
|
|
4612
|
+
shimData: /* @__PURE__ */ new Map()
|
|
4967
4613
|
};
|
|
4968
4614
|
this.fileMap.set(sfPath, data);
|
|
4969
4615
|
}
|
|
@@ -4975,7 +4621,7 @@ var TypeCheckContextImpl = class {
|
|
|
4975
4621
|
if (span.start.offset === span.end.offset) {
|
|
4976
4622
|
span.end.offset++;
|
|
4977
4623
|
}
|
|
4978
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4624
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts26.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4979
4625
|
});
|
|
4980
4626
|
}
|
|
4981
4627
|
};
|
|
@@ -4993,9 +4639,9 @@ var InlineTcbOp = class {
|
|
|
4993
4639
|
}
|
|
4994
4640
|
execute(im, sf, refEmitter, printer) {
|
|
4995
4641
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4996
|
-
const fnName =
|
|
4642
|
+
const fnName = ts26.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4997
4643
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4998
|
-
return printer.printNode(
|
|
4644
|
+
return printer.printNode(ts26.EmitHint.Unspecified, fn, sf);
|
|
4999
4645
|
}
|
|
5000
4646
|
};
|
|
5001
4647
|
var TypeCtorOp = class {
|
|
@@ -5008,7 +4654,7 @@ var TypeCtorOp = class {
|
|
|
5008
4654
|
}
|
|
5009
4655
|
execute(im, sf, refEmitter, printer) {
|
|
5010
4656
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
5011
|
-
return printer.printNode(
|
|
4657
|
+
return printer.printNode(ts26.EmitHint.Unspecified, tcb, sf);
|
|
5012
4658
|
}
|
|
5013
4659
|
};
|
|
5014
4660
|
function orderOps(op1, op2) {
|
|
@@ -5026,10 +4672,10 @@ function splitStringAtPoints(str, points) {
|
|
|
5026
4672
|
return splits;
|
|
5027
4673
|
}
|
|
5028
4674
|
|
|
5029
|
-
// bazel-out/
|
|
4675
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
5030
4676
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
5031
4677
|
|
|
5032
|
-
// bazel-out/
|
|
4678
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/line_mappings.mjs
|
|
5033
4679
|
var LF_CHAR = 10;
|
|
5034
4680
|
var CR_CHAR = 13;
|
|
5035
4681
|
var LINE_SEP_CHAR = 8232;
|
|
@@ -5070,7 +4716,7 @@ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesM
|
|
|
5070
4716
|
return low - 1;
|
|
5071
4717
|
}
|
|
5072
4718
|
|
|
5073
|
-
// bazel-out/
|
|
4719
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
5074
4720
|
var TemplateSource = class {
|
|
5075
4721
|
constructor(mapping, file) {
|
|
5076
4722
|
this.mapping = mapping;
|
|
@@ -5096,7 +4742,7 @@ var TemplateSource = class {
|
|
|
5096
4742
|
};
|
|
5097
4743
|
var TemplateSourceManager = class {
|
|
5098
4744
|
constructor() {
|
|
5099
|
-
this.templateSources = new Map();
|
|
4745
|
+
this.templateSources = /* @__PURE__ */ new Map();
|
|
5100
4746
|
}
|
|
5101
4747
|
getTemplateId(node) {
|
|
5102
4748
|
return getTemplateId(node);
|
|
@@ -5121,9 +4767,9 @@ var TemplateSourceManager = class {
|
|
|
5121
4767
|
}
|
|
5122
4768
|
};
|
|
5123
4769
|
|
|
5124
|
-
// bazel-out/
|
|
5125
|
-
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as
|
|
5126
|
-
import
|
|
4770
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4771
|
+
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, PropertyWrite as PropertyWrite4, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
4772
|
+
import ts27 from "typescript";
|
|
5127
4773
|
var SymbolBuilder = class {
|
|
5128
4774
|
constructor(shimPath, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
5129
4775
|
this.shimPath = shimPath;
|
|
@@ -5131,7 +4777,7 @@ var SymbolBuilder = class {
|
|
|
5131
4777
|
this.templateData = templateData;
|
|
5132
4778
|
this.componentScopeReader = componentScopeReader;
|
|
5133
4779
|
this.getTypeChecker = getTypeChecker;
|
|
5134
|
-
this.symbolCache = new Map();
|
|
4780
|
+
this.symbolCache = /* @__PURE__ */ new Map();
|
|
5135
4781
|
}
|
|
5136
4782
|
getSymbol(node) {
|
|
5137
4783
|
if (this.symbolCache.has(node)) {
|
|
@@ -5166,7 +4812,7 @@ var SymbolBuilder = class {
|
|
|
5166
4812
|
getSymbolOfElement(element) {
|
|
5167
4813
|
var _a;
|
|
5168
4814
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5169
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4815
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts27.isVariableDeclaration });
|
|
5170
4816
|
if (node === null) {
|
|
5171
4817
|
return null;
|
|
5172
4818
|
}
|
|
@@ -5185,12 +4831,12 @@ var SymbolBuilder = class {
|
|
|
5185
4831
|
var _a;
|
|
5186
4832
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5187
4833
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
5188
|
-
const isDirectiveDeclaration = (node) => (
|
|
4834
|
+
const isDirectiveDeclaration = (node) => (ts27.isTypeNode(node) || ts27.isIdentifier(node)) && ts27.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
5189
4835
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
5190
4836
|
return nodes.map((node) => {
|
|
5191
4837
|
var _a2;
|
|
5192
4838
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
5193
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4839
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5194
4840
|
return null;
|
|
5195
4841
|
}
|
|
5196
4842
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -5259,17 +4905,17 @@ var SymbolBuilder = class {
|
|
|
5259
4905
|
if (!isAccessExpression(n)) {
|
|
5260
4906
|
return false;
|
|
5261
4907
|
}
|
|
5262
|
-
if (
|
|
4908
|
+
if (ts27.isPropertyAccessExpression(n)) {
|
|
5263
4909
|
return n.name.getText() === expectedAccess;
|
|
5264
4910
|
} else {
|
|
5265
|
-
return
|
|
4911
|
+
return ts27.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
5266
4912
|
}
|
|
5267
4913
|
}
|
|
5268
4914
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
5269
4915
|
const bindings = [];
|
|
5270
4916
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
5271
4917
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
5272
|
-
if (!
|
|
4918
|
+
if (!ts27.isPropertyAccessExpression(outputFieldAccess)) {
|
|
5273
4919
|
continue;
|
|
5274
4920
|
}
|
|
5275
4921
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -5288,7 +4934,7 @@ var SymbolBuilder = class {
|
|
|
5288
4934
|
shimLocation: { shimPath: this.shimPath, positionInShimFile }
|
|
5289
4935
|
});
|
|
5290
4936
|
} else {
|
|
5291
|
-
if (!
|
|
4937
|
+
if (!ts27.isElementAccessExpression(outputFieldAccess)) {
|
|
5292
4938
|
continue;
|
|
5293
4939
|
}
|
|
5294
4940
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -5356,11 +5002,11 @@ var SymbolBuilder = class {
|
|
|
5356
5002
|
return null;
|
|
5357
5003
|
}
|
|
5358
5004
|
const [declaration] = tsSymbol.declarations;
|
|
5359
|
-
if (!
|
|
5005
|
+
if (!ts27.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
5360
5006
|
return null;
|
|
5361
5007
|
}
|
|
5362
5008
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5363
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5009
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5364
5010
|
return null;
|
|
5365
5011
|
}
|
|
5366
5012
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5376,7 +5022,7 @@ var SymbolBuilder = class {
|
|
|
5376
5022
|
};
|
|
5377
5023
|
}
|
|
5378
5024
|
getSymbolOfVariable(variable) {
|
|
5379
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5025
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5380
5026
|
if (node === null || node.initializer === void 0) {
|
|
5381
5027
|
return null;
|
|
5382
5028
|
}
|
|
@@ -5398,11 +5044,11 @@ var SymbolBuilder = class {
|
|
|
5398
5044
|
}
|
|
5399
5045
|
getSymbolOfReference(ref) {
|
|
5400
5046
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5401
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5047
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5402
5048
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5403
5049
|
return null;
|
|
5404
5050
|
}
|
|
5405
|
-
const originalDeclaration =
|
|
5051
|
+
const originalDeclaration = ts27.isParenthesizedExpression(node.initializer) && ts27.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5406
5052
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5407
5053
|
return null;
|
|
5408
5054
|
}
|
|
@@ -5425,7 +5071,7 @@ var SymbolBuilder = class {
|
|
|
5425
5071
|
referenceVarLocation: referenceVarShimLocation
|
|
5426
5072
|
};
|
|
5427
5073
|
} else {
|
|
5428
|
-
if (!
|
|
5074
|
+
if (!ts27.isClassDeclaration(target.directive.ref.node)) {
|
|
5429
5075
|
return null;
|
|
5430
5076
|
}
|
|
5431
5077
|
return {
|
|
@@ -5440,7 +5086,7 @@ var SymbolBuilder = class {
|
|
|
5440
5086
|
}
|
|
5441
5087
|
}
|
|
5442
5088
|
getSymbolOfPipe(expression) {
|
|
5443
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5089
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts27.isPropertyAccessExpression });
|
|
5444
5090
|
if (methodAccess === null) {
|
|
5445
5091
|
return null;
|
|
5446
5092
|
}
|
|
@@ -5474,12 +5120,12 @@ var SymbolBuilder = class {
|
|
|
5474
5120
|
return this.getSymbol(expressionTarget);
|
|
5475
5121
|
}
|
|
5476
5122
|
let withSpan = expression.sourceSpan;
|
|
5477
|
-
if (expression instanceof
|
|
5123
|
+
if (expression instanceof PropertyWrite4) {
|
|
5478
5124
|
withSpan = expression.nameSpan;
|
|
5479
5125
|
}
|
|
5480
5126
|
let node = null;
|
|
5481
|
-
if (expression instanceof
|
|
5482
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5127
|
+
if (expression instanceof PropertyRead5) {
|
|
5128
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts27.isPropertyAccessExpression });
|
|
5483
5129
|
}
|
|
5484
5130
|
if (node === null) {
|
|
5485
5131
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5487,10 +5133,10 @@ var SymbolBuilder = class {
|
|
|
5487
5133
|
if (node === null) {
|
|
5488
5134
|
return null;
|
|
5489
5135
|
}
|
|
5490
|
-
while (
|
|
5136
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5491
5137
|
node = node.expression;
|
|
5492
5138
|
}
|
|
5493
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5139
|
+
if (expression instanceof SafePropertyRead4 && ts27.isConditionalExpression(node)) {
|
|
5494
5140
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5495
5141
|
if (whenTrueSymbol === null) {
|
|
5496
5142
|
return null;
|
|
@@ -5506,13 +5152,13 @@ var SymbolBuilder = class {
|
|
|
5506
5152
|
}
|
|
5507
5153
|
getSymbolOfTsNode(node) {
|
|
5508
5154
|
var _a;
|
|
5509
|
-
while (
|
|
5155
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5510
5156
|
node = node.expression;
|
|
5511
5157
|
}
|
|
5512
5158
|
let tsSymbol;
|
|
5513
|
-
if (
|
|
5159
|
+
if (ts27.isPropertyAccessExpression(node)) {
|
|
5514
5160
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5515
|
-
} else if (
|
|
5161
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5516
5162
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5517
5163
|
} else {
|
|
5518
5164
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -5526,13 +5172,13 @@ var SymbolBuilder = class {
|
|
|
5526
5172
|
};
|
|
5527
5173
|
}
|
|
5528
5174
|
getShimPositionForNode(node) {
|
|
5529
|
-
if (
|
|
5175
|
+
if (ts27.isTypeReferenceNode(node)) {
|
|
5530
5176
|
return this.getShimPositionForNode(node.typeName);
|
|
5531
|
-
} else if (
|
|
5177
|
+
} else if (ts27.isQualifiedName(node)) {
|
|
5532
5178
|
return node.right.getStart();
|
|
5533
|
-
} else if (
|
|
5179
|
+
} else if (ts27.isPropertyAccessExpression(node)) {
|
|
5534
5180
|
return node.name.getStart();
|
|
5535
|
-
} else if (
|
|
5181
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5536
5182
|
return node.argumentExpression.getStart();
|
|
5537
5183
|
} else {
|
|
5538
5184
|
return node.getStart();
|
|
@@ -5546,7 +5192,7 @@ function sourceSpanEqual(a, b) {
|
|
|
5546
5192
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
5547
5193
|
}
|
|
5548
5194
|
|
|
5549
|
-
// bazel-out/
|
|
5195
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
5550
5196
|
var REGISTRY2 = new DomElementSchemaRegistry2();
|
|
5551
5197
|
var TemplateTypeCheckerImpl = class {
|
|
5552
5198
|
constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, componentScopeReader, typeCheckScopeRegistry, perf) {
|
|
@@ -5561,11 +5207,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5561
5207
|
this.componentScopeReader = componentScopeReader;
|
|
5562
5208
|
this.typeCheckScopeRegistry = typeCheckScopeRegistry;
|
|
5563
5209
|
this.perf = perf;
|
|
5564
|
-
this.state = new Map();
|
|
5565
|
-
this.completionCache = new Map();
|
|
5566
|
-
this.symbolBuilderCache = new Map();
|
|
5567
|
-
this.scopeCache = new Map();
|
|
5568
|
-
this.elementTagCache = new Map();
|
|
5210
|
+
this.state = /* @__PURE__ */ new Map();
|
|
5211
|
+
this.completionCache = /* @__PURE__ */ new Map();
|
|
5212
|
+
this.symbolBuilderCache = /* @__PURE__ */ new Map();
|
|
5213
|
+
this.scopeCache = /* @__PURE__ */ new Map();
|
|
5214
|
+
this.elementTagCache = /* @__PURE__ */ new Map();
|
|
5569
5215
|
this.isComplete = false;
|
|
5570
5216
|
}
|
|
5571
5217
|
getTemplate(component) {
|
|
@@ -5848,7 +5494,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5848
5494
|
hasInlines: false,
|
|
5849
5495
|
sourceManager: new TemplateSourceManager(),
|
|
5850
5496
|
isComplete: false,
|
|
5851
|
-
shimData: new Map()
|
|
5497
|
+
shimData: /* @__PURE__ */ new Map()
|
|
5852
5498
|
});
|
|
5853
5499
|
}
|
|
5854
5500
|
return this.state.get(path2);
|
|
@@ -5896,7 +5542,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5896
5542
|
if (this.elementTagCache.has(component)) {
|
|
5897
5543
|
return this.elementTagCache.get(component);
|
|
5898
5544
|
}
|
|
5899
|
-
const tagMap = new Map();
|
|
5545
|
+
const tagMap = /* @__PURE__ */ new Map();
|
|
5900
5546
|
for (const tag of REGISTRY2.allKnownElementNames()) {
|
|
5901
5547
|
tagMap.set(tag, null);
|
|
5902
5548
|
}
|
|
@@ -6062,30 +5708,10 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
6062
5708
|
}
|
|
6063
5709
|
};
|
|
6064
5710
|
|
|
6065
|
-
// bazel-out/
|
|
6066
|
-
var ExtendedTemplateCheckerImpl = class {
|
|
6067
|
-
constructor(templateTypeChecker, typeChecker, templateChecks) {
|
|
6068
|
-
this.templateChecks = templateChecks;
|
|
6069
|
-
this.ctx = { templateTypeChecker, typeChecker };
|
|
6070
|
-
}
|
|
6071
|
-
getDiagnosticsForComponent(component) {
|
|
6072
|
-
const template = this.ctx.templateTypeChecker.getTemplate(component);
|
|
6073
|
-
if (template === null) {
|
|
6074
|
-
return [];
|
|
6075
|
-
}
|
|
6076
|
-
const diagnostics = [];
|
|
6077
|
-
for (const check of this.templateChecks) {
|
|
6078
|
-
diagnostics.push(...check.run(this.ctx, component, template));
|
|
6079
|
-
}
|
|
6080
|
-
return diagnostics;
|
|
6081
|
-
}
|
|
6082
|
-
};
|
|
6083
|
-
|
|
6084
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
5711
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6085
5712
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
6086
|
-
import ts31 from "typescript";
|
|
6087
5713
|
|
|
6088
|
-
// bazel-out/
|
|
5714
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
6089
5715
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
6090
5716
|
var TemplateCheckWithVisitor = class {
|
|
6091
5717
|
run(ctx, component, template) {
|
|
@@ -6162,7 +5788,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6162
5788
|
}
|
|
6163
5789
|
};
|
|
6164
5790
|
|
|
6165
|
-
// bazel-out/
|
|
5791
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6166
5792
|
var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
6167
5793
|
constructor() {
|
|
6168
5794
|
super(...arguments);
|
|
@@ -6176,15 +5802,19 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
6176
5802
|
return [];
|
|
6177
5803
|
const boundSyntax = node.sourceSpan.toString();
|
|
6178
5804
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
6179
|
-
const diagnostic = ctx.
|
|
5805
|
+
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'.
|
|
6180
5806
|
Find more at https://angular.io/guide/two-way-binding`);
|
|
6181
5807
|
return [diagnostic];
|
|
6182
5808
|
}
|
|
6183
5809
|
};
|
|
5810
|
+
var factory = {
|
|
5811
|
+
code: ErrorCode.INVALID_BANANA_IN_BOX,
|
|
5812
|
+
name: ExtendedTemplateDiagnosticName.INVALID_BANANA_IN_BOX,
|
|
5813
|
+
create: () => new InvalidBananaInBoxCheck()
|
|
5814
|
+
};
|
|
6184
5815
|
|
|
6185
|
-
// bazel-out/
|
|
5816
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
6186
5817
|
import { Binary } from "@angular/compiler";
|
|
6187
|
-
import ts32 from "typescript";
|
|
6188
5818
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6189
5819
|
constructor() {
|
|
6190
5820
|
super(...arguments);
|
|
@@ -6205,12 +5835,91 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6205
5835
|
return [];
|
|
6206
5836
|
}
|
|
6207
5837
|
const span = ctx.templateTypeChecker.getTemplateMappingAtShimLocation(symbol.shimLocation).span;
|
|
6208
|
-
const diagnostic = ctx.
|
|
5838
|
+
const diagnostic = ctx.makeTemplateDiagnostic(span, `The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.`);
|
|
6209
5839
|
return [diagnostic];
|
|
6210
5840
|
}
|
|
6211
5841
|
};
|
|
5842
|
+
var factory2 = {
|
|
5843
|
+
code: ErrorCode.NULLISH_COALESCING_NOT_NULLABLE,
|
|
5844
|
+
name: ExtendedTemplateDiagnosticName.NULLISH_COALESCING_NOT_NULLABLE,
|
|
5845
|
+
create: (options) => {
|
|
5846
|
+
if (options.strictNullChecks === false) {
|
|
5847
|
+
return null;
|
|
5848
|
+
}
|
|
5849
|
+
return new NullishCoalescingNotNullableCheck();
|
|
5850
|
+
}
|
|
5851
|
+
};
|
|
5852
|
+
|
|
5853
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5854
|
+
import ts28 from "typescript";
|
|
5855
|
+
|
|
5856
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
5857
|
+
var DiagnosticCategoryLabel;
|
|
5858
|
+
(function(DiagnosticCategoryLabel2) {
|
|
5859
|
+
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
5860
|
+
DiagnosticCategoryLabel2["Error"] = "error";
|
|
5861
|
+
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
5862
|
+
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
5863
|
+
|
|
5864
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5865
|
+
var ExtendedTemplateCheckerImpl = class {
|
|
5866
|
+
constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
|
|
5867
|
+
var _a, _b, _c, _d, _e;
|
|
5868
|
+
this.partialCtx = { templateTypeChecker, typeChecker };
|
|
5869
|
+
this.templateChecks = /* @__PURE__ */ new Map();
|
|
5870
|
+
for (const factory3 of templateCheckFactories) {
|
|
5871
|
+
const category = diagnosticLabelToCategory((_e = (_d = (_b = (_a = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _a.checks) == null ? void 0 : _b[factory3.name]) != null ? _d : (_c = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _c.defaultCategory) != null ? _e : DiagnosticCategoryLabel.Warning);
|
|
5872
|
+
if (category === null) {
|
|
5873
|
+
continue;
|
|
5874
|
+
}
|
|
5875
|
+
const check = factory3.create(options);
|
|
5876
|
+
if (check === null) {
|
|
5877
|
+
continue;
|
|
5878
|
+
}
|
|
5879
|
+
this.templateChecks.set(check, category);
|
|
5880
|
+
}
|
|
5881
|
+
}
|
|
5882
|
+
getDiagnosticsForComponent(component) {
|
|
5883
|
+
const template = this.partialCtx.templateTypeChecker.getTemplate(component);
|
|
5884
|
+
if (template === null) {
|
|
5885
|
+
return [];
|
|
5886
|
+
}
|
|
5887
|
+
const diagnostics = [];
|
|
5888
|
+
for (const [check, category] of this.templateChecks.entries()) {
|
|
5889
|
+
const ctx = __spreadProps(__spreadValues({}, this.partialCtx), {
|
|
5890
|
+
makeTemplateDiagnostic: (span, message, relatedInformation) => {
|
|
5891
|
+
return this.partialCtx.templateTypeChecker.makeTemplateDiagnostic(component, span, category, check.code, message, relatedInformation);
|
|
5892
|
+
}
|
|
5893
|
+
});
|
|
5894
|
+
diagnostics.push(...check.run(ctx, component, template));
|
|
5895
|
+
}
|
|
5896
|
+
return diagnostics;
|
|
5897
|
+
}
|
|
5898
|
+
};
|
|
5899
|
+
function diagnosticLabelToCategory(label) {
|
|
5900
|
+
switch (label) {
|
|
5901
|
+
case DiagnosticCategoryLabel.Warning:
|
|
5902
|
+
return ts28.DiagnosticCategory.Warning;
|
|
5903
|
+
case DiagnosticCategoryLabel.Error:
|
|
5904
|
+
return ts28.DiagnosticCategory.Error;
|
|
5905
|
+
case DiagnosticCategoryLabel.Suppress:
|
|
5906
|
+
return null;
|
|
5907
|
+
default:
|
|
5908
|
+
return assertNever(label);
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5911
|
+
function assertNever(value) {
|
|
5912
|
+
throw new Error(`Unexpected call to 'assertNever()' with value:
|
|
5913
|
+
${value}`);
|
|
5914
|
+
}
|
|
5915
|
+
|
|
5916
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.mjs
|
|
5917
|
+
var ALL_DIAGNOSTIC_FACTORIES = [
|
|
5918
|
+
factory,
|
|
5919
|
+
factory2
|
|
5920
|
+
];
|
|
6212
5921
|
|
|
6213
|
-
// bazel-out/
|
|
5922
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
6214
5923
|
var CompilationTicketKind;
|
|
6215
5924
|
(function(CompilationTicketKind2) {
|
|
6216
5925
|
CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -6286,15 +5995,11 @@ var NgCompiler = class {
|
|
|
6286
5995
|
if (this.options._extendedTemplateDiagnostics === true && this.options.strictTemplates === false) {
|
|
6287
5996
|
throw new Error("The '_extendedTemplateDiagnostics' option requires 'strictTemplates' to also be enabled.");
|
|
6288
5997
|
}
|
|
6289
|
-
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics);
|
|
6290
|
-
const incompatibleTypeCheckOptionsDiagnostic = verifyCompatibleTypeCheckOptions(this.options);
|
|
6291
|
-
if (incompatibleTypeCheckOptionsDiagnostic !== null) {
|
|
6292
|
-
this.constructionDiagnostics.push(incompatibleTypeCheckOptionsDiagnostic);
|
|
6293
|
-
}
|
|
5998
|
+
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
|
|
6294
5999
|
this.currentProgram = inputProgram;
|
|
6295
6000
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6296
6001
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6297
|
-
const moduleResolutionCache =
|
|
6002
|
+
const moduleResolutionCache = ts29.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
6298
6003
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
6299
6004
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
6300
6005
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -6339,7 +6044,7 @@ var NgCompiler = class {
|
|
|
6339
6044
|
return;
|
|
6340
6045
|
}
|
|
6341
6046
|
this.resourceManager.invalidate();
|
|
6342
|
-
const classesToUpdate = new Set();
|
|
6047
|
+
const classesToUpdate = /* @__PURE__ */ new Set();
|
|
6343
6048
|
for (const resourceFile of changedResources) {
|
|
6344
6049
|
for (const templateClass of this.getComponentsWithTemplateFile(resourceFile)) {
|
|
6345
6050
|
classesToUpdate.add(templateClass);
|
|
@@ -6350,7 +6055,7 @@ var NgCompiler = class {
|
|
|
6350
6055
|
}
|
|
6351
6056
|
for (const clazz of classesToUpdate) {
|
|
6352
6057
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6353
|
-
if (!
|
|
6058
|
+
if (!ts29.isClassDeclaration(clazz)) {
|
|
6354
6059
|
continue;
|
|
6355
6060
|
}
|
|
6356
6061
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6364,7 +6069,7 @@ var NgCompiler = class {
|
|
|
6364
6069
|
getDiagnostics() {
|
|
6365
6070
|
const diagnostics = [];
|
|
6366
6071
|
diagnostics.push(...this.getNonTemplateDiagnostics(), ...this.getTemplateDiagnostics());
|
|
6367
|
-
if (this.options.
|
|
6072
|
+
if (this.options.strictTemplates) {
|
|
6368
6073
|
diagnostics.push(...this.getExtendedTemplateDiagnostics());
|
|
6369
6074
|
}
|
|
6370
6075
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6372,7 +6077,7 @@ var NgCompiler = class {
|
|
|
6372
6077
|
getDiagnosticsForFile(file, optimizeFor) {
|
|
6373
6078
|
const diagnostics = [];
|
|
6374
6079
|
diagnostics.push(...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file), ...this.getTemplateDiagnosticsForFile(file, optimizeFor));
|
|
6375
|
-
if (this.options.
|
|
6080
|
+
if (this.options.strictTemplates) {
|
|
6376
6081
|
diagnostics.push(...this.getExtendedTemplateDiagnostics(file));
|
|
6377
6082
|
}
|
|
6378
6083
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6382,8 +6087,8 @@ var NgCompiler = class {
|
|
|
6382
6087
|
const ttc = compilation.templateTypeChecker;
|
|
6383
6088
|
const diagnostics = [];
|
|
6384
6089
|
diagnostics.push(...ttc.getDiagnosticsForComponent(component));
|
|
6385
|
-
|
|
6386
|
-
|
|
6090
|
+
const extendedTemplateChecker = compilation.extendedTemplateChecker;
|
|
6091
|
+
if (this.options.strictTemplates && extendedTemplateChecker) {
|
|
6387
6092
|
diagnostics.push(...extendedTemplateChecker.getDiagnosticsForComponent(component));
|
|
6388
6093
|
}
|
|
6389
6094
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6657,6 +6362,9 @@ var NgCompiler = class {
|
|
|
6657
6362
|
const diagnostics = [];
|
|
6658
6363
|
const compilation = this.ensureAnalyzed();
|
|
6659
6364
|
const extendedTemplateChecker = compilation.extendedTemplateChecker;
|
|
6365
|
+
if (!extendedTemplateChecker) {
|
|
6366
|
+
return [];
|
|
6367
|
+
}
|
|
6660
6368
|
if (sf !== void 0) {
|
|
6661
6369
|
return compilation.traitCompiler.extendedTemplateCheck(sf, extendedTemplateChecker);
|
|
6662
6370
|
}
|
|
@@ -6731,11 +6439,7 @@ var NgCompiler = class {
|
|
|
6731
6439
|
this.currentProgram = program;
|
|
6732
6440
|
});
|
|
6733
6441
|
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, scopeRegistry, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
6734
|
-
const
|
|
6735
|
-
if (this.options.strictNullChecks) {
|
|
6736
|
-
templateChecks.push(new NullishCoalescingNotNullableCheck());
|
|
6737
|
-
}
|
|
6738
|
-
const extendedTemplateChecker = new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, templateChecks);
|
|
6442
|
+
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
6739
6443
|
return {
|
|
6740
6444
|
isCore,
|
|
6741
6445
|
traitCompiler,
|
|
@@ -6759,17 +6463,17 @@ function isAngularCorePackage(program) {
|
|
|
6759
6463
|
return false;
|
|
6760
6464
|
}
|
|
6761
6465
|
return r3Symbols.statements.some((stmt) => {
|
|
6762
|
-
if (!
|
|
6466
|
+
if (!ts29.isVariableStatement(stmt)) {
|
|
6763
6467
|
return false;
|
|
6764
6468
|
}
|
|
6765
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
6469
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts29.SyntaxKind.ExportKeyword)) {
|
|
6766
6470
|
return false;
|
|
6767
6471
|
}
|
|
6768
6472
|
return stmt.declarationList.declarations.some((decl) => {
|
|
6769
|
-
if (!
|
|
6473
|
+
if (!ts29.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
6770
6474
|
return false;
|
|
6771
6475
|
}
|
|
6772
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
6476
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts29.SyntaxKind.TrueKeyword) {
|
|
6773
6477
|
return false;
|
|
6774
6478
|
}
|
|
6775
6479
|
return true;
|
|
@@ -6779,15 +6483,14 @@ function isAngularCorePackage(program) {
|
|
|
6779
6483
|
function getR3SymbolsFile(program) {
|
|
6780
6484
|
return program.getSourceFiles().find((file) => file.fileName.indexOf("r3_symbols.ts") >= 0) || null;
|
|
6781
6485
|
}
|
|
6782
|
-
function verifyCompatibleTypeCheckOptions(options) {
|
|
6486
|
+
function* verifyCompatibleTypeCheckOptions(options) {
|
|
6487
|
+
var _a, _b, _c;
|
|
6783
6488
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
6784
|
-
|
|
6785
|
-
category:
|
|
6786
|
-
code:
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
length: void 0,
|
|
6790
|
-
messageText: `Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
6489
|
+
yield makeConfigDiagnostic({
|
|
6490
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6491
|
+
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
6492
|
+
messageText: `
|
|
6493
|
+
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
6791
6494
|
|
|
6792
6495
|
Having the "strictTemplates" flag enabled implies that "fullTemplateTypeCheck" is also enabled, so
|
|
6793
6496
|
the latter can not be explicitly disabled.
|
|
@@ -6797,10 +6500,76 @@ One of the following actions is required:
|
|
|
6797
6500
|
2. Remove "strictTemplates" or set it to 'false'.
|
|
6798
6501
|
|
|
6799
6502
|
More information about the template type checking compiler options can be found in the documentation:
|
|
6800
|
-
https://
|
|
6801
|
-
|
|
6503
|
+
https://angular.io/guide/template-typecheck
|
|
6504
|
+
`.trim()
|
|
6505
|
+
});
|
|
6802
6506
|
}
|
|
6803
|
-
|
|
6507
|
+
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
6508
|
+
yield makeConfigDiagnostic({
|
|
6509
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6510
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
6511
|
+
messageText: `
|
|
6512
|
+
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
6513
|
+
|
|
6514
|
+
Using "extendedDiagnostics" requires that "strictTemplates" is also enabled.
|
|
6515
|
+
|
|
6516
|
+
One of the following actions is required:
|
|
6517
|
+
1. Remove "strictTemplates: false" to enable it.
|
|
6518
|
+
2. Remove "extendedDiagnostics" configuration to disable them.
|
|
6519
|
+
`.trim()
|
|
6520
|
+
});
|
|
6521
|
+
}
|
|
6522
|
+
const allowedCategoryLabels = Array.from(Object.values(DiagnosticCategoryLabel));
|
|
6523
|
+
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
6524
|
+
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
6525
|
+
yield makeConfigDiagnostic({
|
|
6526
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6527
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6528
|
+
messageText: `
|
|
6529
|
+
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
6530
|
+
|
|
6531
|
+
Allowed diagnostic categories are:
|
|
6532
|
+
${allowedCategoryLabels.join("\n")}
|
|
6533
|
+
`.trim()
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
6536
|
+
const allExtendedDiagnosticNames = ALL_DIAGNOSTIC_FACTORIES.map((factory3) => factory3.name);
|
|
6537
|
+
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
6538
|
+
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
6539
|
+
yield makeConfigDiagnostic({
|
|
6540
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6541
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
6542
|
+
messageText: `
|
|
6543
|
+
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
6544
|
+
|
|
6545
|
+
Allowed check names are:
|
|
6546
|
+
${allExtendedDiagnosticNames.join("\n")}
|
|
6547
|
+
`.trim()
|
|
6548
|
+
});
|
|
6549
|
+
}
|
|
6550
|
+
if (!allowedCategoryLabels.includes(category)) {
|
|
6551
|
+
yield makeConfigDiagnostic({
|
|
6552
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6553
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6554
|
+
messageText: `
|
|
6555
|
+
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
6556
|
+
|
|
6557
|
+
Allowed diagnostic categories are:
|
|
6558
|
+
${allowedCategoryLabels.join("\n")}
|
|
6559
|
+
`.trim()
|
|
6560
|
+
});
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
function makeConfigDiagnostic({ category, code, messageText }) {
|
|
6565
|
+
return {
|
|
6566
|
+
category,
|
|
6567
|
+
code: ngErrorCode(code),
|
|
6568
|
+
file: void 0,
|
|
6569
|
+
start: void 0,
|
|
6570
|
+
length: void 0,
|
|
6571
|
+
messageText
|
|
6572
|
+
};
|
|
6804
6573
|
}
|
|
6805
6574
|
var ReferenceGraphAdapter = class {
|
|
6806
6575
|
constructor(graph) {
|
|
@@ -6810,7 +6579,7 @@ var ReferenceGraphAdapter = class {
|
|
|
6810
6579
|
for (const { node } of references) {
|
|
6811
6580
|
let sourceFile = node.getSourceFile();
|
|
6812
6581
|
if (sourceFile === void 0) {
|
|
6813
|
-
sourceFile =
|
|
6582
|
+
sourceFile = ts29.getOriginalNode(node).getSourceFile();
|
|
6814
6583
|
}
|
|
6815
6584
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
6816
6585
|
this.graph.add(source, node);
|
|
@@ -6840,7 +6609,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
6840
6609
|
if (driver.getSourceFileVersion === void 0) {
|
|
6841
6610
|
return null;
|
|
6842
6611
|
}
|
|
6843
|
-
const versions = new Map();
|
|
6612
|
+
const versions = /* @__PURE__ */ new Map();
|
|
6844
6613
|
for (const possiblyRedirectedSourceFile of program.getSourceFiles()) {
|
|
6845
6614
|
const sf = toUnredirectedSourceFile(possiblyRedirectedSourceFile);
|
|
6846
6615
|
versions.set(absoluteFromSourceFile(sf), driver.getSourceFileVersion(sf));
|
|
@@ -6848,8 +6617,8 @@ function versionMapFromProgram(program, driver) {
|
|
|
6848
6617
|
return versions;
|
|
6849
6618
|
}
|
|
6850
6619
|
|
|
6851
|
-
// bazel-out/
|
|
6852
|
-
import
|
|
6620
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
6621
|
+
import ts30 from "typescript";
|
|
6853
6622
|
var DelegatingCompilerHost2 = class {
|
|
6854
6623
|
constructor(delegate) {
|
|
6855
6624
|
this.delegate = delegate;
|
|
@@ -6939,7 +6708,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6939
6708
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
6940
6709
|
if (entryPoint === null) {
|
|
6941
6710
|
diagnostics.push({
|
|
6942
|
-
category:
|
|
6711
|
+
category: ts30.DiagnosticCategory.Error,
|
|
6943
6712
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
6944
6713
|
file: void 0,
|
|
6945
6714
|
start: void 0,
|
|
@@ -6979,17 +6748,17 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6979
6748
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
6980
6749
|
}
|
|
6981
6750
|
createCachedResolveModuleNamesFunction() {
|
|
6982
|
-
const moduleResolutionCache =
|
|
6751
|
+
const moduleResolutionCache = ts30.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
6983
6752
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
6984
6753
|
return moduleNames.map((moduleName) => {
|
|
6985
|
-
const module =
|
|
6754
|
+
const module = ts30.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
6986
6755
|
return module.resolvedModule;
|
|
6987
6756
|
});
|
|
6988
6757
|
};
|
|
6989
6758
|
}
|
|
6990
6759
|
};
|
|
6991
6760
|
|
|
6992
|
-
// bazel-out/
|
|
6761
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
6993
6762
|
var NgtscProgram = class {
|
|
6994
6763
|
constructor(rootNames, options, delegateHost, oldProgram) {
|
|
6995
6764
|
this.options = options;
|
|
@@ -7003,14 +6772,14 @@ var NgtscProgram = class {
|
|
|
7003
6772
|
if (reuseProgram !== void 0) {
|
|
7004
6773
|
retagAllTsFiles(reuseProgram);
|
|
7005
6774
|
}
|
|
7006
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
6775
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts31.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
7007
6776
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
7008
6777
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
7009
6778
|
this.host.postProgramCreationCleanup();
|
|
7010
6779
|
untagAllTsFiles(this.tsProgram);
|
|
7011
6780
|
const programDriver = new TsCreateProgramDriver(this.tsProgram, this.host, this.options, this.host.shimExtensionPrefixes);
|
|
7012
6781
|
this.incrementalStrategy = oldProgram !== void 0 ? oldProgram.incrementalStrategy.toNextBuildStrategy() : new TrackedIncrementalBuildStrategy();
|
|
7013
|
-
const modifiedResourceFiles = new Set();
|
|
6782
|
+
const modifiedResourceFiles = /* @__PURE__ */ new Set();
|
|
7014
6783
|
if (this.host.getModifiedResourceFiles !== void 0) {
|
|
7015
6784
|
const strings = this.host.getModifiedResourceFiles();
|
|
7016
6785
|
if (strings !== void 0) {
|
|
@@ -7196,39 +6965,38 @@ function mergeEmitResults(emitResults) {
|
|
|
7196
6965
|
return { diagnostics, emitSkipped, emittedFiles };
|
|
7197
6966
|
}
|
|
7198
6967
|
|
|
7199
|
-
// bazel-out/
|
|
6968
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
7200
6969
|
function createProgram({ rootNames, options, host, oldProgram }) {
|
|
7201
6970
|
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
7202
6971
|
}
|
|
7203
6972
|
|
|
7204
|
-
// bazel-out/
|
|
7205
|
-
import
|
|
7206
|
-
import ts37 from "typescript";
|
|
6973
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
6974
|
+
import ts33 from "typescript";
|
|
7207
6975
|
|
|
7208
|
-
// bazel-out/
|
|
7209
|
-
import
|
|
6976
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
6977
|
+
import ts32 from "typescript";
|
|
7210
6978
|
var GENERATED_FILES = /(.*?)\.(ngfactory|shim\.ngstyle|ngstyle|ngsummary)\.(js|d\.ts|ts)$/;
|
|
7211
6979
|
function createMessageDiagnostic(messageText) {
|
|
7212
6980
|
return {
|
|
7213
6981
|
file: void 0,
|
|
7214
6982
|
start: void 0,
|
|
7215
6983
|
length: void 0,
|
|
7216
|
-
category:
|
|
6984
|
+
category: ts32.DiagnosticCategory.Message,
|
|
7217
6985
|
messageText,
|
|
7218
6986
|
code: DEFAULT_ERROR_CODE,
|
|
7219
6987
|
source: SOURCE
|
|
7220
6988
|
};
|
|
7221
6989
|
}
|
|
7222
6990
|
|
|
7223
|
-
// bazel-out/
|
|
6991
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7224
6992
|
var defaultFormatHost = {
|
|
7225
|
-
getCurrentDirectory: () =>
|
|
6993
|
+
getCurrentDirectory: () => ts33.sys.getCurrentDirectory(),
|
|
7226
6994
|
getCanonicalFileName: (fileName) => fileName,
|
|
7227
|
-
getNewLine: () =>
|
|
6995
|
+
getNewLine: () => ts33.sys.newLine
|
|
7228
6996
|
};
|
|
7229
6997
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7230
6998
|
if (diags && diags.length) {
|
|
7231
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
6999
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts33.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7232
7000
|
} else {
|
|
7233
7001
|
return "";
|
|
7234
7002
|
}
|
|
@@ -7245,7 +7013,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7245
7013
|
var _a;
|
|
7246
7014
|
try {
|
|
7247
7015
|
const fs = getFileSystem();
|
|
7248
|
-
const readConfigFile = (configFile) =>
|
|
7016
|
+
const readConfigFile = (configFile) => ts33.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7249
7017
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7250
7018
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7251
7019
|
if (error2) {
|
|
@@ -7277,7 +7045,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7277
7045
|
basePath
|
|
7278
7046
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
7279
7047
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7280
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
7048
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts33.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7281
7049
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
7282
7050
|
let emitFlags = EmitFlags.Default;
|
|
7283
7051
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -7289,7 +7057,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7289
7057
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7290
7058
|
} catch (e) {
|
|
7291
7059
|
const errors = [{
|
|
7292
|
-
category:
|
|
7060
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7293
7061
|
messageText: e.stack,
|
|
7294
7062
|
file: void 0,
|
|
7295
7063
|
start: void 0,
|
|
@@ -7303,7 +7071,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7303
7071
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7304
7072
|
return {
|
|
7305
7073
|
fileExists: host.exists.bind(host),
|
|
7306
|
-
readDirectory:
|
|
7074
|
+
readDirectory: ts33.sys.readDirectory,
|
|
7307
7075
|
readFile: host.readFile.bind(host),
|
|
7308
7076
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7309
7077
|
};
|
|
@@ -7323,7 +7091,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7323
7091
|
}
|
|
7324
7092
|
} else {
|
|
7325
7093
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7326
|
-
const { resolvedModule } =
|
|
7094
|
+
const { resolvedModule } = ts33.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts33.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
7327
7095
|
if (resolvedModule) {
|
|
7328
7096
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
7329
7097
|
}
|
|
@@ -7333,7 +7101,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7333
7101
|
function exitCodeFromResult(diags) {
|
|
7334
7102
|
if (!diags)
|
|
7335
7103
|
return 0;
|
|
7336
|
-
if (diags.every((diag) => diag.category !==
|
|
7104
|
+
if (diags.every((diag) => diag.category !== ts33.DiagnosticCategory.Error)) {
|
|
7337
7105
|
return 0;
|
|
7338
7106
|
}
|
|
7339
7107
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7363,20 +7131,11 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7363
7131
|
}
|
|
7364
7132
|
return { diagnostics: allDiagnostics, program };
|
|
7365
7133
|
} catch (e) {
|
|
7366
|
-
|
|
7367
|
-
let code;
|
|
7368
|
-
if (isSyntaxError(e)) {
|
|
7369
|
-
errMsg = e.message;
|
|
7370
|
-
code = DEFAULT_ERROR_CODE;
|
|
7371
|
-
} else {
|
|
7372
|
-
errMsg = e.stack;
|
|
7373
|
-
program = void 0;
|
|
7374
|
-
code = UNKNOWN_ERROR_CODE;
|
|
7375
|
-
}
|
|
7134
|
+
program = void 0;
|
|
7376
7135
|
allDiagnostics.push({
|
|
7377
|
-
category:
|
|
7378
|
-
messageText:
|
|
7379
|
-
code,
|
|
7136
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7137
|
+
messageText: e.stack,
|
|
7138
|
+
code: UNKNOWN_ERROR_CODE,
|
|
7380
7139
|
file: void 0,
|
|
7381
7140
|
start: void 0,
|
|
7382
7141
|
length: void 0
|
|
@@ -7401,7 +7160,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7401
7160
|
return allDiagnostics;
|
|
7402
7161
|
}
|
|
7403
7162
|
function hasErrors(diags) {
|
|
7404
|
-
return diags.some((d) => d.category ===
|
|
7163
|
+
return diags.some((d) => d.category === ts33.DiagnosticCategory.Error);
|
|
7405
7164
|
}
|
|
7406
7165
|
|
|
7407
7166
|
export {
|
|
@@ -7413,7 +7172,6 @@ export {
|
|
|
7413
7172
|
createCompilerHost,
|
|
7414
7173
|
CycleAnalyzer,
|
|
7415
7174
|
ImportGraph,
|
|
7416
|
-
untagAllTsFiles,
|
|
7417
7175
|
TsCreateProgramDriver,
|
|
7418
7176
|
PatchedProgramIncrementalBuildStrategy,
|
|
7419
7177
|
MetadataDtsModuleScopeResolver,
|
|
@@ -7442,5 +7200,4 @@ export {
|
|
|
7442
7200
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7443
7201
|
* found in the LICENSE file at https://angular.io/license
|
|
7444
7202
|
*/
|
|
7445
|
-
|
|
7446
|
-
//# sourceMappingURL=chunk-GX2C4BSM.js.map
|
|
7203
|
+
//# sourceMappingURL=chunk-3XJZ4ZZZ.js.map
|