@angular/compiler-cli 18.0.0-next.1 → 18.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-WCD6LVCP.js → chunk-2WQIUGOU.js} +7 -7
- package/bundles/{chunk-C4L7A7U3.js → chunk-45SUUHP7.js} +74 -35
- package/bundles/chunk-45SUUHP7.js.map +6 -0
- package/bundles/{chunk-R4KQI5XI.js → chunk-64JBPJBS.js} +5 -5
- package/bundles/{chunk-ALDR4XSX.js → chunk-75Z2LUBT.js} +1189 -934
- package/bundles/chunk-75Z2LUBT.js.map +6 -0
- package/bundles/{chunk-B454JZVO.js → chunk-KVMNPNPQ.js} +5 -5
- package/bundles/{chunk-SBDNBITT.js → chunk-LYJKWJUC.js} +3 -3
- package/bundles/{chunk-AWB4ZG2D.js → chunk-QA6MINWF.js} +52 -50
- package/bundles/chunk-QA6MINWF.js.map +6 -0
- package/bundles/{chunk-GGJA4IFT.js → chunk-RUNTWSSX.js} +170 -91
- package/bundles/chunk-RUNTWSSX.js.map +6 -0
- package/bundles/{chunk-75YFKYUJ.js → chunk-UM6JO3VZ.js} +7 -7
- package/bundles/{chunk-OHOBDHII.js → chunk-UYDKSYFP.js} +180 -106
- package/bundles/chunk-UYDKSYFP.js.map +6 -0
- package/bundles/{chunk-YUMIYLNL.js → chunk-XIYC7KSQ.js} +5 -5
- package/bundles/index.js +14 -12
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +20 -13
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +4 -4
- package/bundles/ngcc/index.js +1 -1
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +5 -5
- package/bundles/private/tooling.js +5 -5
- package/bundles/src/bin/ng_xi18n.js +10 -10
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles_metadata.json +1 -1
- package/index.d.ts +1 -0
- package/linker/babel/src/ast/babel_ast_host.d.ts +2 -1
- package/linker/src/ast/ast_host.d.ts +4 -0
- package/linker/src/ast/ast_value.d.ts +5 -0
- package/linker/src/ast/typescript/typescript_ast_host.d.ts +1 -0
- package/linker/src/file_linker/partial_linkers/partial_class_metadata_async_linker_1.d.ts +16 -0
- package/linker/src/file_linker/partial_linkers/partial_linker_selector.d.ts +1 -0
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +4 -4
- package/src/ngtsc/annotations/component/src/handler.d.ts +1 -1
- package/src/ngtsc/annotations/directive/index.d.ts +1 -0
- package/src/ngtsc/annotations/directive/src/initializer_function_access.d.ts +17 -0
- package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +10 -6
- package/src/ngtsc/annotations/directive/src/input_function.d.ts +4 -1
- package/src/ngtsc/annotations/directive/src/model_function.d.ts +4 -1
- package/src/ngtsc/annotations/directive/src/output_function.d.ts +4 -1
- package/src/ngtsc/annotations/directive/src/query_functions.d.ts +8 -2
- package/src/ngtsc/annotations/index.d.ts +1 -1
- package/src/ngtsc/diagnostics/src/error_code.d.ts +19 -0
- package/src/ngtsc/docs/src/entities.d.ts +36 -1
- package/src/ngtsc/docs/src/function_extractor.d.ts +3 -2
- package/src/ngtsc/docs/src/initializer_api_function_extractor.d.ts +24 -0
- package/src/ngtsc/docs/src/internal.d.ts +8 -0
- package/src/ngtsc/imports/src/imported_symbols_tracker.d.ts +13 -0
- package/src/ngtsc/reflection/src/host.d.ts +13 -3
- package/src/ngtsc/reflection/src/typescript.d.ts +8 -1
- package/src/ngtsc/reflection/src/util.d.ts +6 -1
- package/src/ngtsc/typecheck/src/oob.d.ts +3 -3
- package/src/ngtsc/validation/index.d.ts +8 -0
- package/src/ngtsc/validation/src/rules/api.d.ts +24 -0
- package/src/ngtsc/validation/src/rules/initializer_api_usage_rule.d.ts +21 -0
- package/src/ngtsc/validation/src/source_file_validator.d.ts +22 -0
- package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +3 -3
- package/bundles/chunk-ALDR4XSX.js.map +0 -6
- package/bundles/chunk-AWB4ZG2D.js.map +0 -6
- package/bundles/chunk-C4L7A7U3.js.map +0 -6
- package/bundles/chunk-GGJA4IFT.js.map +0 -6
- package/bundles/chunk-OHOBDHII.js.map +0 -6
- /package/bundles/{chunk-WCD6LVCP.js.map → chunk-2WQIUGOU.js.map} +0 -0
- /package/bundles/{chunk-R4KQI5XI.js.map → chunk-64JBPJBS.js.map} +0 -0
- /package/bundles/{chunk-B454JZVO.js.map → chunk-KVMNPNPQ.js.map} +0 -0
- /package/bundles/{chunk-SBDNBITT.js.map → chunk-LYJKWJUC.js.map} +0 -0
- /package/bundles/{chunk-75YFKYUJ.js.map → chunk-UM6JO3VZ.js.map} +0 -0
- /package/bundles/{chunk-YUMIYLNL.js.map → chunk-XIYC7KSQ.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
PotentialImportKind,
|
|
9
9
|
PotentialImportMode,
|
|
10
10
|
SymbolKind
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XIYC7KSQ.js";
|
|
12
12
|
import {
|
|
13
13
|
CompilationMode,
|
|
14
14
|
ComponentDecoratorHandler,
|
|
@@ -21,16 +21,20 @@ import {
|
|
|
21
21
|
DtsTransformRegistry,
|
|
22
22
|
ExportedProviderStatusResolver,
|
|
23
23
|
HostDirectivesResolver,
|
|
24
|
+
INPUT_INITIALIZER_FN,
|
|
24
25
|
InjectableClassRegistry,
|
|
25
26
|
InjectableDecoratorHandler,
|
|
26
27
|
LocalMetadataRegistry,
|
|
27
28
|
LocalModuleScopeRegistry,
|
|
29
|
+
MODEL_INITIALIZER_FN,
|
|
28
30
|
MetaKind,
|
|
29
31
|
MetadataDtsModuleScopeResolver,
|
|
30
32
|
NgModuleDecoratorHandler,
|
|
31
33
|
NoopReferencesRegistry,
|
|
34
|
+
OUTPUT_INITIALIZER_FNS,
|
|
32
35
|
PartialEvaluator,
|
|
33
36
|
PipeDecoratorHandler,
|
|
37
|
+
QUERY_INITIALIZER_FNS,
|
|
34
38
|
ResourceRegistry,
|
|
35
39
|
SemanticDepGraphUpdater,
|
|
36
40
|
TraitCompiler,
|
|
@@ -38,8 +42,9 @@ import {
|
|
|
38
42
|
aliasTransformFactory,
|
|
39
43
|
declarationTransformFactory,
|
|
40
44
|
isHostDirectiveMetaForGlobalMode,
|
|
41
|
-
ivyTransformFactory
|
|
42
|
-
|
|
45
|
+
ivyTransformFactory,
|
|
46
|
+
tryParseInitializerApi
|
|
47
|
+
} from "./chunk-UYDKSYFP.js";
|
|
43
48
|
import {
|
|
44
49
|
AbsoluteModuleStrategy,
|
|
45
50
|
AliasStrategy,
|
|
@@ -89,14 +94,14 @@ import {
|
|
|
89
94
|
toUnredirectedSourceFile,
|
|
90
95
|
translateExpression,
|
|
91
96
|
translateType
|
|
92
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-RUNTWSSX.js";
|
|
93
98
|
import {
|
|
94
99
|
ActivePerfRecorder,
|
|
95
100
|
DelegatingPerfRecorder,
|
|
96
101
|
PerfCheckpoint,
|
|
97
102
|
PerfEvent,
|
|
98
103
|
PerfPhase
|
|
99
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-64JBPJBS.js";
|
|
100
105
|
import {
|
|
101
106
|
LogicalFileSystem,
|
|
102
107
|
absoluteFrom,
|
|
@@ -106,9 +111,9 @@ import {
|
|
|
106
111
|
getSourceFileOrError,
|
|
107
112
|
join,
|
|
108
113
|
resolve
|
|
109
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-UM6JO3VZ.js";
|
|
110
115
|
|
|
111
|
-
// bazel-out/
|
|
116
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
112
117
|
var DEFAULT_ERROR_CODE = 100;
|
|
113
118
|
var UNKNOWN_ERROR_CODE = 500;
|
|
114
119
|
var SOURCE = "angular";
|
|
@@ -126,7 +131,7 @@ var EmitFlags;
|
|
|
126
131
|
EmitFlags2[EmitFlags2["All"] = 31] = "All";
|
|
127
132
|
})(EmitFlags || (EmitFlags = {}));
|
|
128
133
|
|
|
129
|
-
// bazel-out/
|
|
134
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/compiler_host.mjs
|
|
130
135
|
import ts from "typescript";
|
|
131
136
|
var wrapHostForTest = null;
|
|
132
137
|
function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, true) }) {
|
|
@@ -136,7 +141,7 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
|
|
|
136
141
|
return tsHost;
|
|
137
142
|
}
|
|
138
143
|
|
|
139
|
-
// bazel-out/
|
|
144
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/entities.mjs
|
|
140
145
|
var EntryType;
|
|
141
146
|
(function(EntryType2) {
|
|
142
147
|
EntryType2["Block"] = "block";
|
|
@@ -152,6 +157,7 @@ var EntryType;
|
|
|
152
157
|
EntryType2["Pipe"] = "pipe";
|
|
153
158
|
EntryType2["TypeAlias"] = "type_alias";
|
|
154
159
|
EntryType2["UndecoratedClass"] = "undecorated_class";
|
|
160
|
+
EntryType2["InitializerApiFunction"] = "initializer_api_function";
|
|
155
161
|
})(EntryType || (EntryType = {}));
|
|
156
162
|
var MemberType;
|
|
157
163
|
(function(MemberType2) {
|
|
@@ -179,296 +185,23 @@ var MemberTags;
|
|
|
179
185
|
MemberTags2["Inherited"] = "override";
|
|
180
186
|
})(MemberTags || (MemberTags = {}));
|
|
181
187
|
|
|
182
|
-
// bazel-out/
|
|
183
|
-
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
184
|
-
import ts40 from "typescript";
|
|
185
|
-
|
|
186
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
187
|
-
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
188
|
-
import * as path from "path";
|
|
189
|
-
function i18nGetExtension(formatName) {
|
|
190
|
-
const format = formatName.toLowerCase();
|
|
191
|
-
switch (format) {
|
|
192
|
-
case "xmb":
|
|
193
|
-
return "xmb";
|
|
194
|
-
case "xlf":
|
|
195
|
-
case "xlif":
|
|
196
|
-
case "xliff":
|
|
197
|
-
case "xlf2":
|
|
198
|
-
case "xliff2":
|
|
199
|
-
return "xlf";
|
|
200
|
-
}
|
|
201
|
-
throw new Error(`Unsupported format "${formatName}"`);
|
|
202
|
-
}
|
|
203
|
-
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve = path.resolve) {
|
|
204
|
-
formatName = formatName || "xlf";
|
|
205
|
-
const ext = i18nGetExtension(formatName);
|
|
206
|
-
const content = i18nSerialize(bundle, formatName, options);
|
|
207
|
-
const dstFile = outFile || `messages.${ext}`;
|
|
208
|
-
const dstPath = pathResolve(options.outDir || options.basePath, dstFile);
|
|
209
|
-
host.writeFile(dstPath, content, false, void 0, []);
|
|
210
|
-
return [dstPath];
|
|
211
|
-
}
|
|
212
|
-
function i18nSerialize(bundle, formatName, options) {
|
|
213
|
-
const format = formatName.toLowerCase();
|
|
214
|
-
let serializer;
|
|
215
|
-
switch (format) {
|
|
216
|
-
case "xmb":
|
|
217
|
-
serializer = new Xmb();
|
|
218
|
-
break;
|
|
219
|
-
case "xliff2":
|
|
220
|
-
case "xlf2":
|
|
221
|
-
serializer = new Xliff2();
|
|
222
|
-
break;
|
|
223
|
-
case "xlf":
|
|
224
|
-
case "xliff":
|
|
225
|
-
default:
|
|
226
|
-
serializer = new Xliff();
|
|
227
|
-
}
|
|
228
|
-
return bundle.write(serializer, getPathNormalizer(options.basePath));
|
|
229
|
-
}
|
|
230
|
-
function getPathNormalizer(basePath) {
|
|
231
|
-
return (sourcePath) => {
|
|
232
|
-
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
|
|
233
|
-
return sourcePath.split(path.sep).join("/");
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
238
|
-
import ts2 from "typescript";
|
|
239
|
-
|
|
240
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
241
|
-
function toNumbers(value) {
|
|
242
|
-
const suffixIndex = value.lastIndexOf("-");
|
|
243
|
-
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
244
|
-
const parsed = parseInt(segment, 10);
|
|
245
|
-
if (isNaN(parsed)) {
|
|
246
|
-
throw Error(`Unable to parse version string ${value}.`);
|
|
247
|
-
}
|
|
248
|
-
return parsed;
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
function compareNumbers(a, b) {
|
|
252
|
-
const max = Math.max(a.length, b.length);
|
|
253
|
-
const min = Math.min(a.length, b.length);
|
|
254
|
-
for (let i = 0; i < min; i++) {
|
|
255
|
-
if (a[i] > b[i])
|
|
256
|
-
return 1;
|
|
257
|
-
if (a[i] < b[i])
|
|
258
|
-
return -1;
|
|
259
|
-
}
|
|
260
|
-
if (min !== max) {
|
|
261
|
-
const longestArray = a.length === max ? a : b;
|
|
262
|
-
const comparisonResult = a.length === max ? 1 : -1;
|
|
263
|
-
for (let i = min; i < max; i++) {
|
|
264
|
-
if (longestArray[i] > 0) {
|
|
265
|
-
return comparisonResult;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return 0;
|
|
270
|
-
}
|
|
271
|
-
function compareVersions(v1, v2) {
|
|
272
|
-
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
276
|
-
var MIN_TS_VERSION = "5.2.0";
|
|
277
|
-
var MAX_TS_VERSION = "5.5.0";
|
|
278
|
-
var tsVersion = ts2.version;
|
|
279
|
-
function checkVersion(version, minVersion, maxVersion) {
|
|
280
|
-
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
281
|
-
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
function verifySupportedTypeScriptVersion() {
|
|
285
|
-
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
289
|
-
import { R3Identifiers as R3Identifiers5 } from "@angular/compiler";
|
|
290
|
-
import ts38 from "typescript";
|
|
291
|
-
|
|
292
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
293
|
-
var CycleAnalyzer = class {
|
|
294
|
-
constructor(importGraph) {
|
|
295
|
-
this.importGraph = importGraph;
|
|
296
|
-
this.cachedResults = null;
|
|
297
|
-
}
|
|
298
|
-
wouldCreateCycle(from, to) {
|
|
299
|
-
if (this.cachedResults === null || this.cachedResults.from !== from) {
|
|
300
|
-
this.cachedResults = new CycleResults(from, this.importGraph);
|
|
301
|
-
}
|
|
302
|
-
return this.cachedResults.wouldBeCyclic(to) ? new Cycle(this.importGraph, from, to) : null;
|
|
303
|
-
}
|
|
304
|
-
recordSyntheticImport(from, to) {
|
|
305
|
-
this.cachedResults = null;
|
|
306
|
-
this.importGraph.addSyntheticImport(from, to);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
var NgCyclicResult = Symbol("NgCyclicResult");
|
|
310
|
-
var CycleResults = class {
|
|
311
|
-
constructor(from, importGraph) {
|
|
312
|
-
this.from = from;
|
|
313
|
-
this.importGraph = importGraph;
|
|
314
|
-
this.cyclic = {};
|
|
315
|
-
this.acyclic = {};
|
|
316
|
-
}
|
|
317
|
-
wouldBeCyclic(sf) {
|
|
318
|
-
const cached = this.getCachedResult(sf);
|
|
319
|
-
if (cached !== null) {
|
|
320
|
-
return cached;
|
|
321
|
-
}
|
|
322
|
-
if (sf === this.from) {
|
|
323
|
-
return true;
|
|
324
|
-
}
|
|
325
|
-
this.markAcyclic(sf);
|
|
326
|
-
const imports = this.importGraph.importsOf(sf);
|
|
327
|
-
for (const imported of imports) {
|
|
328
|
-
if (this.wouldBeCyclic(imported)) {
|
|
329
|
-
this.markCyclic(sf);
|
|
330
|
-
return true;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
getCachedResult(sf) {
|
|
336
|
-
const result = sf[NgCyclicResult];
|
|
337
|
-
if (result === this.cyclic) {
|
|
338
|
-
return true;
|
|
339
|
-
} else if (result === this.acyclic) {
|
|
340
|
-
return false;
|
|
341
|
-
} else {
|
|
342
|
-
return null;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
markCyclic(sf) {
|
|
346
|
-
sf[NgCyclicResult] = this.cyclic;
|
|
347
|
-
}
|
|
348
|
-
markAcyclic(sf) {
|
|
349
|
-
sf[NgCyclicResult] = this.acyclic;
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
var Cycle = class {
|
|
353
|
-
constructor(importGraph, from, to) {
|
|
354
|
-
this.importGraph = importGraph;
|
|
355
|
-
this.from = from;
|
|
356
|
-
this.to = to;
|
|
357
|
-
}
|
|
358
|
-
getPath() {
|
|
359
|
-
return [this.from, ...this.importGraph.findPath(this.to, this.from)];
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
364
|
-
import ts3 from "typescript";
|
|
365
|
-
var ImportGraph = class {
|
|
366
|
-
constructor(checker, perf) {
|
|
367
|
-
this.checker = checker;
|
|
368
|
-
this.perf = perf;
|
|
369
|
-
this.imports = /* @__PURE__ */ new Map();
|
|
370
|
-
}
|
|
371
|
-
importsOf(sf) {
|
|
372
|
-
if (!this.imports.has(sf)) {
|
|
373
|
-
this.imports.set(sf, this.scanImports(sf));
|
|
374
|
-
}
|
|
375
|
-
return this.imports.get(sf);
|
|
376
|
-
}
|
|
377
|
-
findPath(start, end) {
|
|
378
|
-
if (start === end) {
|
|
379
|
-
return [start];
|
|
380
|
-
}
|
|
381
|
-
const found = /* @__PURE__ */ new Set([start]);
|
|
382
|
-
const queue = [new Found(start, null)];
|
|
383
|
-
while (queue.length > 0) {
|
|
384
|
-
const current = queue.shift();
|
|
385
|
-
const imports = this.importsOf(current.sourceFile);
|
|
386
|
-
for (const importedFile of imports) {
|
|
387
|
-
if (!found.has(importedFile)) {
|
|
388
|
-
const next = new Found(importedFile, current);
|
|
389
|
-
if (next.sourceFile === end) {
|
|
390
|
-
return next.toPath();
|
|
391
|
-
}
|
|
392
|
-
found.add(importedFile);
|
|
393
|
-
queue.push(next);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
return null;
|
|
398
|
-
}
|
|
399
|
-
addSyntheticImport(sf, imported) {
|
|
400
|
-
if (isLocalFile(imported)) {
|
|
401
|
-
this.importsOf(sf).add(imported);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
scanImports(sf) {
|
|
405
|
-
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
406
|
-
const imports = /* @__PURE__ */ new Set();
|
|
407
|
-
for (const stmt of sf.statements) {
|
|
408
|
-
if (!ts3.isImportDeclaration(stmt) && !ts3.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
409
|
-
continue;
|
|
410
|
-
}
|
|
411
|
-
if (ts3.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
412
|
-
continue;
|
|
413
|
-
}
|
|
414
|
-
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
415
|
-
if (symbol === void 0 || symbol.valueDeclaration === void 0) {
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
418
|
-
const moduleFile = symbol.valueDeclaration;
|
|
419
|
-
if (ts3.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
420
|
-
imports.add(moduleFile);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return imports;
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
function isLocalFile(sf) {
|
|
428
|
-
return !sf.isDeclarationFile;
|
|
429
|
-
}
|
|
430
|
-
function isTypeOnlyImportClause(node) {
|
|
431
|
-
if (node.isTypeOnly) {
|
|
432
|
-
return true;
|
|
433
|
-
}
|
|
434
|
-
if (node.namedBindings !== void 0 && ts3.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
435
|
-
return true;
|
|
436
|
-
}
|
|
437
|
-
return false;
|
|
438
|
-
}
|
|
439
|
-
var Found = class {
|
|
440
|
-
constructor(sourceFile, parent) {
|
|
441
|
-
this.sourceFile = sourceFile;
|
|
442
|
-
this.parent = parent;
|
|
443
|
-
}
|
|
444
|
-
toPath() {
|
|
445
|
-
const array = [];
|
|
446
|
-
let current = this;
|
|
447
|
-
while (current !== null) {
|
|
448
|
-
array.push(current.sourceFile);
|
|
449
|
-
current = current.parent;
|
|
450
|
-
}
|
|
451
|
-
return array.reverse();
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.mjs
|
|
188
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.mjs
|
|
456
189
|
import ts10 from "typescript";
|
|
457
190
|
|
|
458
|
-
// bazel-out/
|
|
459
|
-
import
|
|
191
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.mjs
|
|
192
|
+
import ts5 from "typescript";
|
|
460
193
|
|
|
461
|
-
// bazel-out/
|
|
194
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/filters.mjs
|
|
462
195
|
function isAngularPrivateName(name) {
|
|
463
196
|
var _a;
|
|
464
197
|
const firstChar = (_a = name[0]) != null ? _a : "";
|
|
465
198
|
return firstChar === "\u0275" || firstChar === "_";
|
|
466
199
|
}
|
|
467
200
|
|
|
468
|
-
// bazel-out/
|
|
469
|
-
import
|
|
201
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/function_extractor.mjs
|
|
202
|
+
import ts3 from "typescript";
|
|
470
203
|
|
|
471
|
-
// bazel-out/
|
|
204
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.mjs
|
|
472
205
|
function extractGenerics(declaration) {
|
|
473
206
|
var _a, _b;
|
|
474
207
|
return (_b = (_a = declaration.typeParameters) == null ? void 0 : _a.map((typeParam) => {
|
|
@@ -481,42 +214,42 @@ function extractGenerics(declaration) {
|
|
|
481
214
|
})) != null ? _b : [];
|
|
482
215
|
}
|
|
483
216
|
|
|
484
|
-
// bazel-out/
|
|
485
|
-
import
|
|
217
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.mjs
|
|
218
|
+
import ts2 from "typescript";
|
|
486
219
|
var decoratorExpression = /@(?=(Injectable|Component|Directive|Pipe|NgModule|Input|Output|HostBinding|HostListener|Inject|Optional|Self|Host|SkipSelf))/g;
|
|
487
220
|
function extractJsDocTags(node) {
|
|
488
221
|
const escapedNode = getEscapedNode(node);
|
|
489
|
-
return
|
|
222
|
+
return ts2.getJSDocTags(escapedNode).map((t) => {
|
|
490
223
|
var _a;
|
|
491
224
|
return {
|
|
492
225
|
name: t.tagName.getText(),
|
|
493
|
-
comment: unescapeAngularDecorators((_a =
|
|
226
|
+
comment: unescapeAngularDecorators((_a = ts2.getTextOfJSDocComment(t.comment)) != null ? _a : "")
|
|
494
227
|
};
|
|
495
228
|
});
|
|
496
229
|
}
|
|
497
230
|
function extractJsDocDescription(node) {
|
|
498
231
|
var _a, _b;
|
|
499
232
|
const escapedNode = getEscapedNode(node);
|
|
500
|
-
const commentOrTag =
|
|
501
|
-
return
|
|
233
|
+
const commentOrTag = ts2.getJSDocCommentsAndTags(escapedNode).find((d) => {
|
|
234
|
+
return ts2.isJSDoc(d) || ts2.isJSDocParameterTag(d);
|
|
502
235
|
});
|
|
503
236
|
const comment = (_a = commentOrTag == null ? void 0 : commentOrTag.comment) != null ? _a : "";
|
|
504
|
-
const description = typeof comment === "string" ? comment : (_b =
|
|
237
|
+
const description = typeof comment === "string" ? comment : (_b = ts2.getTextOfJSDocComment(comment)) != null ? _b : "";
|
|
505
238
|
return unescapeAngularDecorators(description);
|
|
506
239
|
}
|
|
507
240
|
function extractRawJsDoc(node) {
|
|
508
241
|
var _a, _b;
|
|
509
|
-
const comment = (_b = (_a =
|
|
242
|
+
const comment = (_b = (_a = ts2.getJSDocCommentsAndTags(node).find(ts2.isJSDoc)) == null ? void 0 : _a.getFullText()) != null ? _b : "";
|
|
510
243
|
return unescapeAngularDecorators(comment);
|
|
511
244
|
}
|
|
512
245
|
function getEscapedNode(node) {
|
|
513
|
-
if (
|
|
246
|
+
if (ts2.isParameter(node)) {
|
|
514
247
|
return node;
|
|
515
248
|
}
|
|
516
249
|
const rawComment = extractRawJsDoc(node);
|
|
517
250
|
const escaped = escapeAngularDecorators(rawComment);
|
|
518
|
-
const file =
|
|
519
|
-
return file.statements.find((s) =>
|
|
251
|
+
const file = ts2.createSourceFile("x.ts", `${escaped}class X {}`, ts2.ScriptTarget.ES2020, true);
|
|
252
|
+
return file.statements.find((s) => ts2.isClassDeclaration(s));
|
|
520
253
|
}
|
|
521
254
|
function escapeAngularDecorators(comment) {
|
|
522
255
|
return comment.replace(decoratorExpression, "_NG_AT_");
|
|
@@ -525,12 +258,12 @@ function unescapeAngularDecorators(comment) {
|
|
|
525
258
|
return comment.replace(/_NG_AT_/g, "@");
|
|
526
259
|
}
|
|
527
260
|
|
|
528
|
-
// bazel-out/
|
|
261
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/type_extractor.mjs
|
|
529
262
|
function extractResolvedTypeString(node, checker) {
|
|
530
263
|
return checker.typeToString(checker.getTypeAtLocation(node));
|
|
531
264
|
}
|
|
532
265
|
|
|
533
|
-
// bazel-out/
|
|
266
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/function_extractor.mjs
|
|
534
267
|
var FunctionExtractor = class {
|
|
535
268
|
constructor(name, declaration, typeChecker) {
|
|
536
269
|
this.name = name;
|
|
@@ -541,9 +274,9 @@ var FunctionExtractor = class {
|
|
|
541
274
|
const signature = this.typeChecker.getSignatureFromDeclaration(this.declaration);
|
|
542
275
|
const returnType = signature ? this.typeChecker.typeToString(this.typeChecker.getReturnTypeOfSignature(signature)) : "unknown";
|
|
543
276
|
return {
|
|
544
|
-
params:
|
|
277
|
+
params: extractAllParams(this.declaration.parameters, this.typeChecker),
|
|
545
278
|
name: this.name,
|
|
546
|
-
isNewType:
|
|
279
|
+
isNewType: ts3.isConstructSignatureDeclaration(this.declaration),
|
|
547
280
|
returnType,
|
|
548
281
|
entryType: EntryType.Function,
|
|
549
282
|
generics: extractGenerics(this.declaration),
|
|
@@ -552,15 +285,6 @@ var FunctionExtractor = class {
|
|
|
552
285
|
rawComment: extractRawJsDoc(this.declaration)
|
|
553
286
|
};
|
|
554
287
|
}
|
|
555
|
-
extractAllParams(params) {
|
|
556
|
-
return params.map((param) => ({
|
|
557
|
-
name: param.name.getText(),
|
|
558
|
-
description: extractJsDocDescription(param),
|
|
559
|
-
type: extractResolvedTypeString(param, this.typeChecker),
|
|
560
|
-
isOptional: !!(param.questionToken || param.initializer),
|
|
561
|
-
isRestParam: !!param.dotDotDotToken
|
|
562
|
-
}));
|
|
563
|
-
}
|
|
564
288
|
getOverloads() {
|
|
565
289
|
var _a, _b, _c, _d;
|
|
566
290
|
const overloads = [];
|
|
@@ -571,7 +295,7 @@ var FunctionExtractor = class {
|
|
|
571
295
|
const overloadDeclaration = (_c = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _c[i];
|
|
572
296
|
if ((overloadDeclaration == null ? void 0 : overloadDeclaration.pos) === this.declaration.pos)
|
|
573
297
|
continue;
|
|
574
|
-
if (overloadDeclaration &&
|
|
298
|
+
if (overloadDeclaration && ts3.isFunctionDeclaration(overloadDeclaration) && ((_d = overloadDeclaration.modifiers) == null ? void 0 : _d.some((mod) => mod.kind === ts3.SyntaxKind.ExportKeyword))) {
|
|
575
299
|
overloads.push(overloadDeclaration);
|
|
576
300
|
}
|
|
577
301
|
}
|
|
@@ -579,14 +303,42 @@ var FunctionExtractor = class {
|
|
|
579
303
|
return overloads;
|
|
580
304
|
}
|
|
581
305
|
getSymbol() {
|
|
582
|
-
return this.typeChecker.getSymbolsInScope(this.declaration,
|
|
306
|
+
return this.typeChecker.getSymbolsInScope(this.declaration, ts3.SymbolFlags.Function).find((s) => {
|
|
583
307
|
var _a;
|
|
584
308
|
return s.name === ((_a = this.declaration.name) == null ? void 0 : _a.getText());
|
|
585
309
|
});
|
|
586
310
|
}
|
|
587
311
|
};
|
|
312
|
+
function extractAllParams(params, typeChecker) {
|
|
313
|
+
return params.map((param) => ({
|
|
314
|
+
name: param.name.getText(),
|
|
315
|
+
description: extractJsDocDescription(param),
|
|
316
|
+
type: extractResolvedTypeString(param, typeChecker),
|
|
317
|
+
isOptional: !!(param.questionToken || param.initializer),
|
|
318
|
+
isRestParam: !!param.dotDotDotToken
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/internal.mjs
|
|
323
|
+
import ts4 from "typescript";
|
|
324
|
+
function isInternal(member) {
|
|
325
|
+
return extractJsDocTags(member).some((tag) => tag.name === "internal") || hasLeadingInternalComment(member);
|
|
326
|
+
}
|
|
327
|
+
function hasLeadingInternalComment(member) {
|
|
328
|
+
var _a;
|
|
329
|
+
const memberText = member.getSourceFile().text;
|
|
330
|
+
return (_a = ts4.reduceEachLeadingCommentRange(
|
|
331
|
+
memberText,
|
|
332
|
+
member.getFullStart(),
|
|
333
|
+
(pos, end, kind, hasTrailingNewLine, containsInternal) => {
|
|
334
|
+
return containsInternal || memberText.slice(pos, end).includes("@internal");
|
|
335
|
+
},
|
|
336
|
+
false,
|
|
337
|
+
false
|
|
338
|
+
)) != null ? _a : false;
|
|
339
|
+
}
|
|
588
340
|
|
|
589
|
-
// bazel-out/
|
|
341
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.mjs
|
|
590
342
|
var ClassExtractor = class {
|
|
591
343
|
constructor(declaration, typeChecker) {
|
|
592
344
|
this.declaration = declaration;
|
|
@@ -596,7 +348,7 @@ var ClassExtractor = class {
|
|
|
596
348
|
return {
|
|
597
349
|
name: this.declaration.name.text,
|
|
598
350
|
isAbstract: this.isAbstract(),
|
|
599
|
-
entryType:
|
|
351
|
+
entryType: ts5.isInterfaceDeclaration(this.declaration) ? EntryType.Interface : EntryType.UndecoratedClass,
|
|
600
352
|
members: this.extractSignatures().concat(this.extractAllClassMembers()),
|
|
601
353
|
generics: extractGenerics(this.declaration),
|
|
602
354
|
description: extractJsDocDescription(this.declaration),
|
|
@@ -621,7 +373,7 @@ var ClassExtractor = class {
|
|
|
621
373
|
return this.extractMethod(memberDeclaration);
|
|
622
374
|
} else if (this.isProperty(memberDeclaration)) {
|
|
623
375
|
return this.extractClassProperty(memberDeclaration);
|
|
624
|
-
} else if (
|
|
376
|
+
} else if (ts5.isAccessor(memberDeclaration)) {
|
|
625
377
|
return this.extractGetterSetter(memberDeclaration);
|
|
626
378
|
}
|
|
627
379
|
return void 0;
|
|
@@ -638,7 +390,7 @@ var ClassExtractor = class {
|
|
|
638
390
|
};
|
|
639
391
|
}
|
|
640
392
|
extractSignature(signature) {
|
|
641
|
-
const functionExtractor = new FunctionExtractor(
|
|
393
|
+
const functionExtractor = new FunctionExtractor(ts5.isConstructSignatureDeclaration(signature) ? "new" : "", signature, this.typeChecker);
|
|
642
394
|
return {
|
|
643
395
|
...functionExtractor.extract(),
|
|
644
396
|
memberType: MemberType.Method,
|
|
@@ -658,7 +410,7 @@ var ClassExtractor = class {
|
|
|
658
410
|
extractGetterSetter(accessor) {
|
|
659
411
|
return {
|
|
660
412
|
...this.extractClassProperty(accessor),
|
|
661
|
-
memberType:
|
|
413
|
+
memberType: ts5.isGetAccessor(accessor) ? MemberType.Getter : MemberType.Setter
|
|
662
414
|
};
|
|
663
415
|
}
|
|
664
416
|
getMemberTags(member) {
|
|
@@ -674,10 +426,7 @@ var ClassExtractor = class {
|
|
|
674
426
|
}
|
|
675
427
|
computeAllSignatureDeclarations() {
|
|
676
428
|
const type = this.typeChecker.getTypeAtLocation(this.declaration);
|
|
677
|
-
const signatures = [
|
|
678
|
-
...type.getCallSignatures(),
|
|
679
|
-
...type.getConstructSignatures()
|
|
680
|
-
];
|
|
429
|
+
const signatures = [...type.getCallSignatures(), ...type.getConstructSignatures()];
|
|
681
430
|
const result = [];
|
|
682
431
|
for (const signature of signatures) {
|
|
683
432
|
const decl = signature.getDeclaration();
|
|
@@ -715,13 +464,13 @@ var ClassExtractor = class {
|
|
|
715
464
|
}
|
|
716
465
|
getTagForMemberModifier(mod) {
|
|
717
466
|
switch (mod.kind) {
|
|
718
|
-
case
|
|
467
|
+
case ts5.SyntaxKind.StaticKeyword:
|
|
719
468
|
return MemberTags.Static;
|
|
720
|
-
case
|
|
469
|
+
case ts5.SyntaxKind.ReadonlyKeyword:
|
|
721
470
|
return MemberTags.Readonly;
|
|
722
|
-
case
|
|
471
|
+
case ts5.SyntaxKind.ProtectedKeyword:
|
|
723
472
|
return MemberTags.Protected;
|
|
724
|
-
case
|
|
473
|
+
case ts5.SyntaxKind.AbstractKeyword:
|
|
725
474
|
return MemberTags.Abstract;
|
|
726
475
|
default:
|
|
727
476
|
return void 0;
|
|
@@ -729,27 +478,27 @@ var ClassExtractor = class {
|
|
|
729
478
|
}
|
|
730
479
|
isMemberExcluded(member) {
|
|
731
480
|
var _a;
|
|
732
|
-
return !member.name || !this.isDocumentableMember(member) || !!((_a = member.modifiers) == null ? void 0 : _a.some((mod) => mod.kind ===
|
|
481
|
+
return !member.name || !this.isDocumentableMember(member) || !!((_a = member.modifiers) == null ? void 0 : _a.some((mod) => mod.kind === ts5.SyntaxKind.PrivateKeyword)) || member.name.getText() === "prototype" || isAngularPrivateName(member.name.getText()) || isInternal(member);
|
|
733
482
|
}
|
|
734
483
|
isDocumentableMember(member) {
|
|
735
|
-
return this.isMethod(member) || this.isProperty(member) ||
|
|
484
|
+
return this.isMethod(member) || this.isProperty(member) || ts5.isAccessor(member);
|
|
736
485
|
}
|
|
737
486
|
isProperty(member) {
|
|
738
|
-
return
|
|
487
|
+
return ts5.isPropertyDeclaration(member) || ts5.isPropertySignature(member);
|
|
739
488
|
}
|
|
740
489
|
isMethod(member) {
|
|
741
|
-
return
|
|
490
|
+
return ts5.isMethodDeclaration(member) || ts5.isMethodSignature(member);
|
|
742
491
|
}
|
|
743
492
|
isDocumentableSignature(signature) {
|
|
744
|
-
return
|
|
493
|
+
return ts5.isConstructSignatureDeclaration(signature) || ts5.isCallSignatureDeclaration(signature);
|
|
745
494
|
}
|
|
746
495
|
isAbstract() {
|
|
747
496
|
var _a;
|
|
748
497
|
const modifiers = (_a = this.declaration.modifiers) != null ? _a : [];
|
|
749
|
-
return modifiers.some((mod) => mod.kind ===
|
|
498
|
+
return modifiers.some((mod) => mod.kind === ts5.SyntaxKind.AbstractKeyword);
|
|
750
499
|
}
|
|
751
500
|
isImplementationForOverload(method) {
|
|
752
|
-
if (method.kind ===
|
|
501
|
+
if (method.kind === ts5.SyntaxKind.MethodSignature)
|
|
753
502
|
return false;
|
|
754
503
|
const signature = this.typeChecker.getSignatureFromDeclaration(method);
|
|
755
504
|
return signature && this.typeChecker.isImplementationOfOverload(signature.declaration);
|
|
@@ -847,8 +596,8 @@ function extractInterface(declaration, typeChecker) {
|
|
|
847
596
|
return extractor.extract();
|
|
848
597
|
}
|
|
849
598
|
|
|
850
|
-
// bazel-out/
|
|
851
|
-
import
|
|
599
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.mjs
|
|
600
|
+
import ts6 from "typescript";
|
|
852
601
|
var LITERAL_AS_ENUM_TAG = "object-literal-as-enum";
|
|
853
602
|
function extractConstant(declaration, typeChecker) {
|
|
854
603
|
const resolvedType = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(declaration));
|
|
@@ -880,17 +629,17 @@ function isSyntheticAngularConstant(declaration) {
|
|
|
880
629
|
}
|
|
881
630
|
function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
882
631
|
let initializer = declaration.initializer;
|
|
883
|
-
while (initializer && (
|
|
632
|
+
while (initializer && (ts6.isAsExpression(initializer) || ts6.isParenthesizedExpression(initializer))) {
|
|
884
633
|
initializer = initializer.expression;
|
|
885
634
|
}
|
|
886
|
-
if (initializer === void 0 || !
|
|
887
|
-
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ?
|
|
635
|
+
if (initializer === void 0 || !ts6.isObjectLiteralExpression(initializer)) {
|
|
636
|
+
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ? ts6.SyntaxKind[initializer.kind] : "undefined"}`);
|
|
888
637
|
}
|
|
889
638
|
return initializer.properties.map((prop) => {
|
|
890
|
-
if (!
|
|
639
|
+
if (!ts6.isPropertyAssignment(prop) || !ts6.isIdentifier(prop.name)) {
|
|
891
640
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be a property assignment with a static name`);
|
|
892
641
|
}
|
|
893
|
-
if (!
|
|
642
|
+
if (!ts6.isNumericLiteral(prop.initializer) && !ts6.isStringLiteralLike(prop.initializer)) {
|
|
894
643
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to a number or string literal`);
|
|
895
644
|
}
|
|
896
645
|
return {
|
|
@@ -905,8 +654,8 @@ function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
|
905
654
|
});
|
|
906
655
|
}
|
|
907
656
|
|
|
908
|
-
// bazel-out/
|
|
909
|
-
import
|
|
657
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/decorator_extractor.mjs
|
|
658
|
+
import ts7 from "typescript";
|
|
910
659
|
function extractorDecorator(declaration, typeChecker) {
|
|
911
660
|
const documentedNode = getDecoratorJsDocNode(declaration);
|
|
912
661
|
const decoratorType = getDecoratorType(declaration);
|
|
@@ -927,7 +676,7 @@ function isDecoratorDeclaration(declaration) {
|
|
|
927
676
|
return !!getDecoratorType(declaration);
|
|
928
677
|
}
|
|
929
678
|
function isDecoratorOptionsInterface(declaration) {
|
|
930
|
-
return declaration.getSourceFile().statements.some((s) =>
|
|
679
|
+
return declaration.getSourceFile().statements.some((s) => ts7.isVariableStatement(s) && s.declarationList.declarations.some((d) => isDecoratorDeclaration(d) && d.name.getText() === declaration.name.getText()));
|
|
931
680
|
}
|
|
932
681
|
function getDecoratorType(declaration) {
|
|
933
682
|
var _a, _b;
|
|
@@ -944,19 +693,19 @@ function getDecoratorOptions(declaration, typeChecker) {
|
|
|
944
693
|
var _a, _b;
|
|
945
694
|
const name = declaration.name.getText();
|
|
946
695
|
const optionsDeclaration = declaration.getSourceFile().statements.find((node) => {
|
|
947
|
-
return (
|
|
696
|
+
return (ts7.isInterfaceDeclaration(node) || ts7.isTypeAliasDeclaration(node)) && node.name.getText() === name;
|
|
948
697
|
});
|
|
949
698
|
if (!optionsDeclaration) {
|
|
950
699
|
throw new Error(`Decorator "${name}" has no corresponding options interface.`);
|
|
951
700
|
}
|
|
952
701
|
let optionsInterface;
|
|
953
|
-
if (
|
|
702
|
+
if (ts7.isTypeAliasDeclaration(optionsDeclaration)) {
|
|
954
703
|
const aliasedType = typeChecker.getTypeAtLocation(optionsDeclaration.type);
|
|
955
|
-
optionsInterface = ((_b = (_a = aliasedType.getSymbol()) == null ? void 0 : _a.getDeclarations()) != null ? _b : []).find((d) =>
|
|
704
|
+
optionsInterface = ((_b = (_a = aliasedType.getSymbol()) == null ? void 0 : _a.getDeclarations()) != null ? _b : []).find((d) => ts7.isInterfaceDeclaration(d));
|
|
956
705
|
} else {
|
|
957
706
|
optionsInterface = optionsDeclaration;
|
|
958
707
|
}
|
|
959
|
-
if (!optionsInterface || !
|
|
708
|
+
if (!optionsInterface || !ts7.isInterfaceDeclaration(optionsInterface)) {
|
|
960
709
|
throw new Error(`Options for decorator "${name}" is not an interface.`);
|
|
961
710
|
}
|
|
962
711
|
return extractInterface(optionsInterface, typeChecker).members;
|
|
@@ -964,22 +713,22 @@ function getDecoratorOptions(declaration, typeChecker) {
|
|
|
964
713
|
function getDecoratorJsDocNode(declaration) {
|
|
965
714
|
const name = declaration.name.getText();
|
|
966
715
|
const decoratorInterface = declaration.getSourceFile().statements.find((s) => {
|
|
967
|
-
return
|
|
716
|
+
return ts7.isInterfaceDeclaration(s) && s.name.getText() === `${name}Decorator`;
|
|
968
717
|
});
|
|
969
|
-
if (!decoratorInterface || !
|
|
718
|
+
if (!decoratorInterface || !ts7.isInterfaceDeclaration(decoratorInterface)) {
|
|
970
719
|
throw new Error(`No interface "${name}Decorator" found.`);
|
|
971
720
|
}
|
|
972
721
|
const callSignature = decoratorInterface.members.find((node) => {
|
|
973
|
-
return
|
|
722
|
+
return ts7.isCallSignatureDeclaration(node) && extractRawJsDoc(node);
|
|
974
723
|
});
|
|
975
|
-
if (!callSignature || !
|
|
724
|
+
if (!callSignature || !ts7.isCallSignatureDeclaration(callSignature)) {
|
|
976
725
|
throw new Error(`No call signature with JsDoc on "${name}Decorator"`);
|
|
977
726
|
}
|
|
978
727
|
return callSignature;
|
|
979
728
|
}
|
|
980
729
|
|
|
981
|
-
// bazel-out/
|
|
982
|
-
import
|
|
730
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/enum_extractor.mjs
|
|
731
|
+
import ts8 from "typescript";
|
|
983
732
|
function extractEnum(declaration, typeChecker) {
|
|
984
733
|
return {
|
|
985
734
|
name: declaration.name.getText(),
|
|
@@ -1004,12 +753,149 @@ function extractEnumMembers(declaration, checker) {
|
|
|
1004
753
|
function getEnumMemberValue(memberNode) {
|
|
1005
754
|
var _a;
|
|
1006
755
|
const literal = memberNode.getChildren().find((n2) => {
|
|
1007
|
-
return
|
|
756
|
+
return ts8.isNumericLiteral(n2) || ts8.isStringLiteral(n2) || ts8.isPrefixUnaryExpression(n2) && n2.operator === ts8.SyntaxKind.MinusToken && ts8.isNumericLiteral(n2.operand);
|
|
1008
757
|
});
|
|
1009
758
|
return (_a = literal == null ? void 0 : literal.getText()) != null ? _a : "";
|
|
1010
759
|
}
|
|
1011
760
|
|
|
1012
|
-
// bazel-out/
|
|
761
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.mjs
|
|
762
|
+
import ts9 from "typescript";
|
|
763
|
+
var initializerApiTag = "initializerApiFunction";
|
|
764
|
+
function isInitializerApiFunction(node, typeChecker) {
|
|
765
|
+
if (ts9.isFunctionDeclaration(node) && node.name !== void 0 && node.body === void 0) {
|
|
766
|
+
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
767
|
+
if (implementation !== void 0) {
|
|
768
|
+
node = implementation;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
if (!ts9.isFunctionDeclaration(node) && !ts9.isVariableDeclaration(node)) {
|
|
772
|
+
return false;
|
|
773
|
+
}
|
|
774
|
+
let tagContainer = ts9.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
775
|
+
if (tagContainer === null) {
|
|
776
|
+
return false;
|
|
777
|
+
}
|
|
778
|
+
const tags = ts9.getJSDocTags(tagContainer);
|
|
779
|
+
return tags.some((t) => t.tagName.text === initializerApiTag);
|
|
780
|
+
}
|
|
781
|
+
function extractInitializerApiFunction(node, typeChecker) {
|
|
782
|
+
var _a;
|
|
783
|
+
if (node.name === void 0 || !ts9.isIdentifier(node.name)) {
|
|
784
|
+
throw new Error(`Initializer API: Expected literal variable name.`);
|
|
785
|
+
}
|
|
786
|
+
const container = ts9.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
787
|
+
if (container === null) {
|
|
788
|
+
throw new Error("Initializer API: Could not find container AST node of variable.");
|
|
789
|
+
}
|
|
790
|
+
const name = node.name.text;
|
|
791
|
+
const type = typeChecker.getTypeAtLocation(node);
|
|
792
|
+
const callFunction = extractFunctionWithOverloads(name, type.getCallSignatures(), typeChecker);
|
|
793
|
+
const subFunctions = [];
|
|
794
|
+
for (const property of type.getProperties()) {
|
|
795
|
+
const subName = property.getName();
|
|
796
|
+
const subDecl = (_a = property.getDeclarations()) == null ? void 0 : _a[0];
|
|
797
|
+
if (subDecl === void 0 || !ts9.isPropertySignature(subDecl)) {
|
|
798
|
+
throw new Error(`Initializer API: Could not resolve declaration of sub-property: ${name}.${subName}`);
|
|
799
|
+
}
|
|
800
|
+
const subType = typeChecker.getTypeAtLocation(subDecl);
|
|
801
|
+
subFunctions.push(extractFunctionWithOverloads(subName, subType.getCallSignatures(), typeChecker));
|
|
802
|
+
}
|
|
803
|
+
let jsdocTags;
|
|
804
|
+
let description;
|
|
805
|
+
let rawComment;
|
|
806
|
+
if (ts9.isFunctionDeclaration(node)) {
|
|
807
|
+
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
808
|
+
if (implementation === void 0) {
|
|
809
|
+
throw new Error(`Initializer API: Could not find implementation of function: ${name}`);
|
|
810
|
+
}
|
|
811
|
+
callFunction.implementation = {
|
|
812
|
+
name,
|
|
813
|
+
entryType: EntryType.Function,
|
|
814
|
+
isNewType: false,
|
|
815
|
+
description: extractJsDocDescription(implementation),
|
|
816
|
+
generics: extractGenerics(implementation),
|
|
817
|
+
jsdocTags: extractJsDocTags(implementation),
|
|
818
|
+
params: extractAllParams(implementation.parameters, typeChecker),
|
|
819
|
+
rawComment: extractRawJsDoc(implementation),
|
|
820
|
+
returnType: typeChecker.typeToString(typeChecker.getReturnTypeOfSignature(typeChecker.getSignatureFromDeclaration(implementation)))
|
|
821
|
+
};
|
|
822
|
+
jsdocTags = callFunction.implementation.jsdocTags;
|
|
823
|
+
description = callFunction.implementation.description;
|
|
824
|
+
rawComment = callFunction.implementation.description;
|
|
825
|
+
} else {
|
|
826
|
+
jsdocTags = extractJsDocTags(container);
|
|
827
|
+
description = extractJsDocDescription(container);
|
|
828
|
+
rawComment = extractRawJsDoc(container);
|
|
829
|
+
}
|
|
830
|
+
const metadataTag = jsdocTags.find((t) => t.name === initializerApiTag);
|
|
831
|
+
if (metadataTag === void 0) {
|
|
832
|
+
throw new Error(`Initializer API: Detected initializer API function does not have "@initializerApiFunction" tag: ${name}`);
|
|
833
|
+
}
|
|
834
|
+
let parsedMetadata = void 0;
|
|
835
|
+
if (metadataTag.comment.trim() !== "") {
|
|
836
|
+
try {
|
|
837
|
+
parsedMetadata = JSON.parse(metadataTag.comment);
|
|
838
|
+
} catch (e) {
|
|
839
|
+
throw new Error(`Could not parse initializer API function metadata: ${e}`);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return {
|
|
843
|
+
entryType: EntryType.InitializerApiFunction,
|
|
844
|
+
name,
|
|
845
|
+
description,
|
|
846
|
+
jsdocTags,
|
|
847
|
+
rawComment,
|
|
848
|
+
callFunction,
|
|
849
|
+
subFunctions,
|
|
850
|
+
__docsMetadata__: parsedMetadata
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
function getContainerVariableStatement(node) {
|
|
854
|
+
if (!ts9.isVariableDeclarationList(node.parent)) {
|
|
855
|
+
return null;
|
|
856
|
+
}
|
|
857
|
+
if (!ts9.isVariableStatement(node.parent.parent)) {
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
return node.parent.parent;
|
|
861
|
+
}
|
|
862
|
+
function filterSignatureDeclarations(signatures) {
|
|
863
|
+
const result = [];
|
|
864
|
+
for (const signature of signatures) {
|
|
865
|
+
const decl = signature.getDeclaration();
|
|
866
|
+
if (ts9.isFunctionDeclaration(decl) || ts9.isCallSignatureDeclaration(decl)) {
|
|
867
|
+
result.push(decl);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return result;
|
|
871
|
+
}
|
|
872
|
+
function extractFunctionWithOverloads(name, signatures, typeChecker) {
|
|
873
|
+
return {
|
|
874
|
+
name,
|
|
875
|
+
signatures: filterSignatureDeclarations(signatures).map((s) => ({
|
|
876
|
+
name,
|
|
877
|
+
entryType: EntryType.Function,
|
|
878
|
+
description: extractJsDocDescription(s),
|
|
879
|
+
generics: extractGenerics(s),
|
|
880
|
+
isNewType: false,
|
|
881
|
+
jsdocTags: extractJsDocTags(s),
|
|
882
|
+
params: extractAllParams(s.parameters, typeChecker),
|
|
883
|
+
rawComment: extractRawJsDoc(s),
|
|
884
|
+
returnType: typeChecker.typeToString(typeChecker.getReturnTypeOfSignature(typeChecker.getSignatureFromDeclaration(s)))
|
|
885
|
+
})),
|
|
886
|
+
implementation: null
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
function findImplementationOfFunction(node, typeChecker) {
|
|
890
|
+
var _a;
|
|
891
|
+
if (node.body !== void 0 || node.name === void 0) {
|
|
892
|
+
return node;
|
|
893
|
+
}
|
|
894
|
+
const symbol = typeChecker.getSymbolAtLocation(node.name);
|
|
895
|
+
return (_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a.find((s) => ts9.isFunctionDeclaration(s) && s.body !== void 0);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/type_alias_extractor.mjs
|
|
1013
899
|
function extractTypeAlias(declaration) {
|
|
1014
900
|
return {
|
|
1015
901
|
name: declaration.name.getText(),
|
|
@@ -1021,7 +907,7 @@ function extractTypeAlias(declaration) {
|
|
|
1021
907
|
};
|
|
1022
908
|
}
|
|
1023
909
|
|
|
1024
|
-
// bazel-out/
|
|
910
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.mjs
|
|
1025
911
|
var DocsExtractor = class {
|
|
1026
912
|
constructor(typeChecker, metadataReader) {
|
|
1027
913
|
this.typeChecker = typeChecker;
|
|
@@ -1031,60 +917,344 @@ var DocsExtractor = class {
|
|
|
1031
917
|
const entries = [];
|
|
1032
918
|
const exportedDeclarations = this.getExportedDeclarations(sourceFile);
|
|
1033
919
|
for (const [exportName, node] of exportedDeclarations) {
|
|
1034
|
-
if (isAngularPrivateName(exportName))
|
|
920
|
+
if (isAngularPrivateName(exportName)) {
|
|
1035
921
|
continue;
|
|
922
|
+
}
|
|
1036
923
|
const entry = this.extractDeclaration(node);
|
|
1037
|
-
if (entry) {
|
|
924
|
+
if (entry && !isIgnoredDocEntry(entry)) {
|
|
1038
925
|
entries.push({ ...entry, name: exportName });
|
|
1039
926
|
}
|
|
1040
927
|
}
|
|
1041
|
-
return entries;
|
|
928
|
+
return entries;
|
|
929
|
+
}
|
|
930
|
+
extractDeclaration(node) {
|
|
931
|
+
if (isNamedClassDeclaration(node)) {
|
|
932
|
+
return extractClass(node, this.metadataReader, this.typeChecker);
|
|
933
|
+
}
|
|
934
|
+
if (isInitializerApiFunction(node, this.typeChecker)) {
|
|
935
|
+
return extractInitializerApiFunction(node, this.typeChecker);
|
|
936
|
+
}
|
|
937
|
+
if (ts10.isInterfaceDeclaration(node) && !isIgnoredInterface(node)) {
|
|
938
|
+
return extractInterface(node, this.typeChecker);
|
|
939
|
+
}
|
|
940
|
+
if (ts10.isFunctionDeclaration(node)) {
|
|
941
|
+
const functionExtractor = new FunctionExtractor(node.name.getText(), node, this.typeChecker);
|
|
942
|
+
return functionExtractor.extract();
|
|
943
|
+
}
|
|
944
|
+
if (ts10.isVariableDeclaration(node) && !isSyntheticAngularConstant(node)) {
|
|
945
|
+
return isDecoratorDeclaration(node) ? extractorDecorator(node, this.typeChecker) : extractConstant(node, this.typeChecker);
|
|
946
|
+
}
|
|
947
|
+
if (ts10.isTypeAliasDeclaration(node)) {
|
|
948
|
+
return extractTypeAlias(node);
|
|
949
|
+
}
|
|
950
|
+
if (ts10.isEnumDeclaration(node)) {
|
|
951
|
+
return extractEnum(node, this.typeChecker);
|
|
952
|
+
}
|
|
953
|
+
return null;
|
|
954
|
+
}
|
|
955
|
+
getExportedDeclarations(sourceFile) {
|
|
956
|
+
var _a;
|
|
957
|
+
const reflector = new TypeScriptReflectionHost(this.typeChecker);
|
|
958
|
+
const exportedDeclarationMap = reflector.getExportsOfModule(sourceFile);
|
|
959
|
+
let exportedDeclarations = Array.from((_a = exportedDeclarationMap == null ? void 0 : exportedDeclarationMap.entries()) != null ? _a : []).map(([exportName, declaration]) => [exportName, declaration.node]);
|
|
960
|
+
const declarationCount = exportedDeclarations.length;
|
|
961
|
+
for (let i = 0; i < declarationCount; i++) {
|
|
962
|
+
const [exportName, declaration] = exportedDeclarations[i];
|
|
963
|
+
if (ts10.isFunctionDeclaration(declaration)) {
|
|
964
|
+
const extractor = new FunctionExtractor(exportName, declaration, this.typeChecker);
|
|
965
|
+
const overloads = extractor.getOverloads().map((overload) => [exportName, overload]);
|
|
966
|
+
exportedDeclarations.push(...overloads);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
return exportedDeclarations.sort(([a, declarationA], [b, declarationB]) => declarationA.pos - declarationB.pos);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
function isIgnoredInterface(node) {
|
|
973
|
+
return node.name.getText().endsWith("Decorator") || isDecoratorOptionsInterface(node);
|
|
974
|
+
}
|
|
975
|
+
function isIgnoredDocEntry(entry) {
|
|
976
|
+
const isDocsPrivate = entry.jsdocTags.find((e) => e.name === "docsPrivate");
|
|
977
|
+
if (isDocsPrivate !== void 0 && isDocsPrivate.comment === "") {
|
|
978
|
+
throw new Error(`Docs extraction: Entry "${entry.name}" is marked as "@docsPrivate" but without reasoning.`);
|
|
979
|
+
}
|
|
980
|
+
return isDocsPrivate !== void 0;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
984
|
+
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
985
|
+
import ts43 from "typescript";
|
|
986
|
+
|
|
987
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
988
|
+
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
989
|
+
import * as path from "path";
|
|
990
|
+
function i18nGetExtension(formatName) {
|
|
991
|
+
const format = formatName.toLowerCase();
|
|
992
|
+
switch (format) {
|
|
993
|
+
case "xmb":
|
|
994
|
+
return "xmb";
|
|
995
|
+
case "xlf":
|
|
996
|
+
case "xlif":
|
|
997
|
+
case "xliff":
|
|
998
|
+
case "xlf2":
|
|
999
|
+
case "xliff2":
|
|
1000
|
+
return "xlf";
|
|
1001
|
+
}
|
|
1002
|
+
throw new Error(`Unsupported format "${formatName}"`);
|
|
1003
|
+
}
|
|
1004
|
+
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve = path.resolve) {
|
|
1005
|
+
formatName = formatName || "xlf";
|
|
1006
|
+
const ext = i18nGetExtension(formatName);
|
|
1007
|
+
const content = i18nSerialize(bundle, formatName, options);
|
|
1008
|
+
const dstFile = outFile || `messages.${ext}`;
|
|
1009
|
+
const dstPath = pathResolve(options.outDir || options.basePath, dstFile);
|
|
1010
|
+
host.writeFile(dstPath, content, false, void 0, []);
|
|
1011
|
+
return [dstPath];
|
|
1012
|
+
}
|
|
1013
|
+
function i18nSerialize(bundle, formatName, options) {
|
|
1014
|
+
const format = formatName.toLowerCase();
|
|
1015
|
+
let serializer;
|
|
1016
|
+
switch (format) {
|
|
1017
|
+
case "xmb":
|
|
1018
|
+
serializer = new Xmb();
|
|
1019
|
+
break;
|
|
1020
|
+
case "xliff2":
|
|
1021
|
+
case "xlf2":
|
|
1022
|
+
serializer = new Xliff2();
|
|
1023
|
+
break;
|
|
1024
|
+
case "xlf":
|
|
1025
|
+
case "xliff":
|
|
1026
|
+
default:
|
|
1027
|
+
serializer = new Xliff();
|
|
1028
|
+
}
|
|
1029
|
+
return bundle.write(serializer, getPathNormalizer(options.basePath));
|
|
1030
|
+
}
|
|
1031
|
+
function getPathNormalizer(basePath) {
|
|
1032
|
+
return (sourcePath) => {
|
|
1033
|
+
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
|
|
1034
|
+
return sourcePath.split(path.sep).join("/");
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
1039
|
+
import ts11 from "typescript";
|
|
1040
|
+
|
|
1041
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
1042
|
+
function toNumbers(value) {
|
|
1043
|
+
const suffixIndex = value.lastIndexOf("-");
|
|
1044
|
+
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
1045
|
+
const parsed = parseInt(segment, 10);
|
|
1046
|
+
if (isNaN(parsed)) {
|
|
1047
|
+
throw Error(`Unable to parse version string ${value}.`);
|
|
1048
|
+
}
|
|
1049
|
+
return parsed;
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function compareNumbers(a, b) {
|
|
1053
|
+
const max = Math.max(a.length, b.length);
|
|
1054
|
+
const min = Math.min(a.length, b.length);
|
|
1055
|
+
for (let i = 0; i < min; i++) {
|
|
1056
|
+
if (a[i] > b[i])
|
|
1057
|
+
return 1;
|
|
1058
|
+
if (a[i] < b[i])
|
|
1059
|
+
return -1;
|
|
1060
|
+
}
|
|
1061
|
+
if (min !== max) {
|
|
1062
|
+
const longestArray = a.length === max ? a : b;
|
|
1063
|
+
const comparisonResult = a.length === max ? 1 : -1;
|
|
1064
|
+
for (let i = min; i < max; i++) {
|
|
1065
|
+
if (longestArray[i] > 0) {
|
|
1066
|
+
return comparisonResult;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
return 0;
|
|
1071
|
+
}
|
|
1072
|
+
function compareVersions(v1, v2) {
|
|
1073
|
+
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
1077
|
+
var MIN_TS_VERSION = "5.4.0";
|
|
1078
|
+
var MAX_TS_VERSION = "5.5.0";
|
|
1079
|
+
var tsVersion = ts11.version;
|
|
1080
|
+
function checkVersion(version, minVersion, maxVersion) {
|
|
1081
|
+
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
1082
|
+
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
function verifySupportedTypeScriptVersion() {
|
|
1086
|
+
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
1090
|
+
import { R3Identifiers as R3Identifiers5 } from "@angular/compiler";
|
|
1091
|
+
import ts41 from "typescript";
|
|
1092
|
+
|
|
1093
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
1094
|
+
var CycleAnalyzer = class {
|
|
1095
|
+
constructor(importGraph) {
|
|
1096
|
+
this.importGraph = importGraph;
|
|
1097
|
+
this.cachedResults = null;
|
|
1098
|
+
}
|
|
1099
|
+
wouldCreateCycle(from, to) {
|
|
1100
|
+
if (this.cachedResults === null || this.cachedResults.from !== from) {
|
|
1101
|
+
this.cachedResults = new CycleResults(from, this.importGraph);
|
|
1102
|
+
}
|
|
1103
|
+
return this.cachedResults.wouldBeCyclic(to) ? new Cycle(this.importGraph, from, to) : null;
|
|
1104
|
+
}
|
|
1105
|
+
recordSyntheticImport(from, to) {
|
|
1106
|
+
this.cachedResults = null;
|
|
1107
|
+
this.importGraph.addSyntheticImport(from, to);
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
var NgCyclicResult = Symbol("NgCyclicResult");
|
|
1111
|
+
var CycleResults = class {
|
|
1112
|
+
constructor(from, importGraph) {
|
|
1113
|
+
this.from = from;
|
|
1114
|
+
this.importGraph = importGraph;
|
|
1115
|
+
this.cyclic = {};
|
|
1116
|
+
this.acyclic = {};
|
|
1117
|
+
}
|
|
1118
|
+
wouldBeCyclic(sf) {
|
|
1119
|
+
const cached = this.getCachedResult(sf);
|
|
1120
|
+
if (cached !== null) {
|
|
1121
|
+
return cached;
|
|
1122
|
+
}
|
|
1123
|
+
if (sf === this.from) {
|
|
1124
|
+
return true;
|
|
1125
|
+
}
|
|
1126
|
+
this.markAcyclic(sf);
|
|
1127
|
+
const imports = this.importGraph.importsOf(sf);
|
|
1128
|
+
for (const imported of imports) {
|
|
1129
|
+
if (this.wouldBeCyclic(imported)) {
|
|
1130
|
+
this.markCyclic(sf);
|
|
1131
|
+
return true;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
return false;
|
|
1042
1135
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
if (
|
|
1048
|
-
return
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
const functionExtractor = new FunctionExtractor(node.name.getText(), node, this.typeChecker);
|
|
1052
|
-
return functionExtractor.extract();
|
|
1136
|
+
getCachedResult(sf) {
|
|
1137
|
+
const result = sf[NgCyclicResult];
|
|
1138
|
+
if (result === this.cyclic) {
|
|
1139
|
+
return true;
|
|
1140
|
+
} else if (result === this.acyclic) {
|
|
1141
|
+
return false;
|
|
1142
|
+
} else {
|
|
1143
|
+
return null;
|
|
1053
1144
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1145
|
+
}
|
|
1146
|
+
markCyclic(sf) {
|
|
1147
|
+
sf[NgCyclicResult] = this.cyclic;
|
|
1148
|
+
}
|
|
1149
|
+
markAcyclic(sf) {
|
|
1150
|
+
sf[NgCyclicResult] = this.acyclic;
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
var Cycle = class {
|
|
1154
|
+
constructor(importGraph, from, to) {
|
|
1155
|
+
this.importGraph = importGraph;
|
|
1156
|
+
this.from = from;
|
|
1157
|
+
this.to = to;
|
|
1158
|
+
}
|
|
1159
|
+
getPath() {
|
|
1160
|
+
return [this.from, ...this.importGraph.findPath(this.to, this.from)];
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
1165
|
+
import ts12 from "typescript";
|
|
1166
|
+
var ImportGraph = class {
|
|
1167
|
+
constructor(checker, perf) {
|
|
1168
|
+
this.checker = checker;
|
|
1169
|
+
this.perf = perf;
|
|
1170
|
+
this.imports = /* @__PURE__ */ new Map();
|
|
1171
|
+
}
|
|
1172
|
+
importsOf(sf) {
|
|
1173
|
+
if (!this.imports.has(sf)) {
|
|
1174
|
+
this.imports.set(sf, this.scanImports(sf));
|
|
1056
1175
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1176
|
+
return this.imports.get(sf);
|
|
1177
|
+
}
|
|
1178
|
+
findPath(start, end) {
|
|
1179
|
+
if (start === end) {
|
|
1180
|
+
return [start];
|
|
1059
1181
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1182
|
+
const found = /* @__PURE__ */ new Set([start]);
|
|
1183
|
+
const queue = [new Found(start, null)];
|
|
1184
|
+
while (queue.length > 0) {
|
|
1185
|
+
const current = queue.shift();
|
|
1186
|
+
const imports = this.importsOf(current.sourceFile);
|
|
1187
|
+
for (const importedFile of imports) {
|
|
1188
|
+
if (!found.has(importedFile)) {
|
|
1189
|
+
const next = new Found(importedFile, current);
|
|
1190
|
+
if (next.sourceFile === end) {
|
|
1191
|
+
return next.toPath();
|
|
1192
|
+
}
|
|
1193
|
+
found.add(importedFile);
|
|
1194
|
+
queue.push(next);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1062
1197
|
}
|
|
1063
1198
|
return null;
|
|
1064
1199
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
const exportedDeclarationMap = reflector.getExportsOfModule(sourceFile);
|
|
1069
|
-
let exportedDeclarations = Array.from((_a = exportedDeclarationMap == null ? void 0 : exportedDeclarationMap.entries()) != null ? _a : []).map(([exportName, declaration]) => [exportName, declaration.node]);
|
|
1070
|
-
const declarationCount = exportedDeclarations.length;
|
|
1071
|
-
for (let i = 0; i < declarationCount; i++) {
|
|
1072
|
-
const [exportName, declaration] = exportedDeclarations[i];
|
|
1073
|
-
if (ts10.isFunctionDeclaration(declaration)) {
|
|
1074
|
-
const extractor = new FunctionExtractor(exportName, declaration, this.typeChecker);
|
|
1075
|
-
const overloads = extractor.getOverloads().map((overload) => [exportName, overload]);
|
|
1076
|
-
exportedDeclarations.push(...overloads);
|
|
1077
|
-
}
|
|
1200
|
+
addSyntheticImport(sf, imported) {
|
|
1201
|
+
if (isLocalFile(imported)) {
|
|
1202
|
+
this.importsOf(sf).add(imported);
|
|
1078
1203
|
}
|
|
1079
|
-
|
|
1204
|
+
}
|
|
1205
|
+
scanImports(sf) {
|
|
1206
|
+
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
1207
|
+
const imports = /* @__PURE__ */ new Set();
|
|
1208
|
+
for (const stmt of sf.statements) {
|
|
1209
|
+
if (!ts12.isImportDeclaration(stmt) && !ts12.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1212
|
+
if (ts12.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
1216
|
+
if (symbol === void 0 || symbol.valueDeclaration === void 0) {
|
|
1217
|
+
continue;
|
|
1218
|
+
}
|
|
1219
|
+
const moduleFile = symbol.valueDeclaration;
|
|
1220
|
+
if (ts12.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
1221
|
+
imports.add(moduleFile);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
return imports;
|
|
1225
|
+
});
|
|
1080
1226
|
}
|
|
1081
1227
|
};
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1228
|
+
function isLocalFile(sf) {
|
|
1229
|
+
return !sf.isDeclarationFile;
|
|
1230
|
+
}
|
|
1231
|
+
function isTypeOnlyImportClause(node) {
|
|
1232
|
+
if (node.isTypeOnly) {
|
|
1233
|
+
return true;
|
|
1234
|
+
}
|
|
1235
|
+
if (node.namedBindings !== void 0 && ts12.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
1236
|
+
return true;
|
|
1237
|
+
}
|
|
1238
|
+
return false;
|
|
1084
1239
|
}
|
|
1240
|
+
var Found = class {
|
|
1241
|
+
constructor(sourceFile, parent) {
|
|
1242
|
+
this.sourceFile = sourceFile;
|
|
1243
|
+
this.parent = parent;
|
|
1244
|
+
}
|
|
1245
|
+
toPath() {
|
|
1246
|
+
const array = [];
|
|
1247
|
+
let current = this;
|
|
1248
|
+
while (current !== null) {
|
|
1249
|
+
array.push(current.sourceFile);
|
|
1250
|
+
current = current.parent;
|
|
1251
|
+
}
|
|
1252
|
+
return array.reverse();
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1085
1255
|
|
|
1086
|
-
// bazel-out/
|
|
1087
|
-
import
|
|
1256
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
1257
|
+
import ts13 from "typescript";
|
|
1088
1258
|
var FlatIndexGenerator = class {
|
|
1089
1259
|
constructor(entryPoint, relativeFlatIndexPath, moduleName) {
|
|
1090
1260
|
this.entryPoint = entryPoint;
|
|
@@ -1100,7 +1270,7 @@ var FlatIndexGenerator = class {
|
|
|
1100
1270
|
|
|
1101
1271
|
export * from '${relativeEntryPoint}';
|
|
1102
1272
|
`;
|
|
1103
|
-
const genFile =
|
|
1273
|
+
const genFile = ts13.createSourceFile(this.flatIndexPath, contents, ts13.ScriptTarget.ES2015, true, ts13.ScriptKind.TS);
|
|
1104
1274
|
if (this.moduleName !== null) {
|
|
1105
1275
|
genFile.moduleName = this.moduleName;
|
|
1106
1276
|
}
|
|
@@ -1108,7 +1278,7 @@ export * from '${relativeEntryPoint}';
|
|
|
1108
1278
|
}
|
|
1109
1279
|
};
|
|
1110
1280
|
|
|
1111
|
-
// bazel-out/
|
|
1281
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/logic.mjs
|
|
1112
1282
|
function findFlatIndexEntryPoint(rootFiles) {
|
|
1113
1283
|
const tsFiles = rootFiles.filter((file) => isNonDeclarationTsPath(file));
|
|
1114
1284
|
let resolvedEntryPoint = null;
|
|
@@ -1124,8 +1294,8 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
1124
1294
|
return resolvedEntryPoint;
|
|
1125
1295
|
}
|
|
1126
1296
|
|
|
1127
|
-
// bazel-out/
|
|
1128
|
-
import
|
|
1297
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
1298
|
+
import ts14 from "typescript";
|
|
1129
1299
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
1130
1300
|
const diagnostics = [];
|
|
1131
1301
|
const topLevelExports = /* @__PURE__ */ new Set();
|
|
@@ -1135,7 +1305,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1135
1305
|
}
|
|
1136
1306
|
const exportedSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
1137
1307
|
exportedSymbols.forEach((symbol) => {
|
|
1138
|
-
if (symbol.flags &
|
|
1308
|
+
if (symbol.flags & ts14.SymbolFlags.Alias) {
|
|
1139
1309
|
symbol = checker.getAliasedSymbol(symbol);
|
|
1140
1310
|
}
|
|
1141
1311
|
const decl = symbol.valueDeclaration;
|
|
@@ -1159,7 +1329,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1159
1329
|
visibleVia = transitivePath.map((seg) => getNameOfDeclaration(seg)).join(" -> ");
|
|
1160
1330
|
}
|
|
1161
1331
|
const diagnostic = {
|
|
1162
|
-
category:
|
|
1332
|
+
category: ts14.DiagnosticCategory.Error,
|
|
1163
1333
|
code: ngErrorCode(ErrorCode.SYMBOL_NOT_EXPORTED),
|
|
1164
1334
|
file: transitiveReference.getSourceFile(),
|
|
1165
1335
|
...getPosOfDeclaration(transitiveReference),
|
|
@@ -1179,7 +1349,7 @@ function getPosOfDeclaration(decl) {
|
|
|
1179
1349
|
};
|
|
1180
1350
|
}
|
|
1181
1351
|
function getIdentifierOfDeclaration(decl) {
|
|
1182
|
-
if ((
|
|
1352
|
+
if ((ts14.isClassDeclaration(decl) || ts14.isVariableDeclaration(decl) || ts14.isFunctionDeclaration(decl)) && decl.name !== void 0 && ts14.isIdentifier(decl.name)) {
|
|
1183
1353
|
return decl.name;
|
|
1184
1354
|
} else {
|
|
1185
1355
|
return null;
|
|
@@ -1191,20 +1361,20 @@ function getNameOfDeclaration(decl) {
|
|
|
1191
1361
|
}
|
|
1192
1362
|
function getDescriptorOfDeclaration(decl) {
|
|
1193
1363
|
switch (decl.kind) {
|
|
1194
|
-
case
|
|
1364
|
+
case ts14.SyntaxKind.ClassDeclaration:
|
|
1195
1365
|
return "class";
|
|
1196
|
-
case
|
|
1366
|
+
case ts14.SyntaxKind.FunctionDeclaration:
|
|
1197
1367
|
return "function";
|
|
1198
|
-
case
|
|
1368
|
+
case ts14.SyntaxKind.VariableDeclaration:
|
|
1199
1369
|
return "variable";
|
|
1200
|
-
case
|
|
1370
|
+
case ts14.SyntaxKind.EnumDeclaration:
|
|
1201
1371
|
return "enum";
|
|
1202
1372
|
default:
|
|
1203
1373
|
return "declaration";
|
|
1204
1374
|
}
|
|
1205
1375
|
}
|
|
1206
1376
|
|
|
1207
|
-
// bazel-out/
|
|
1377
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/reference_graph.mjs
|
|
1208
1378
|
var ReferenceGraph = class {
|
|
1209
1379
|
constructor() {
|
|
1210
1380
|
this.references = /* @__PURE__ */ new Map();
|
|
@@ -1258,7 +1428,7 @@ var ReferenceGraph = class {
|
|
|
1258
1428
|
}
|
|
1259
1429
|
};
|
|
1260
1430
|
|
|
1261
|
-
// bazel-out/
|
|
1431
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/api.mjs
|
|
1262
1432
|
var NgOriginalFile = Symbol("NgOriginalFile");
|
|
1263
1433
|
var UpdateMode;
|
|
1264
1434
|
(function(UpdateMode2) {
|
|
@@ -1266,13 +1436,13 @@ var UpdateMode;
|
|
|
1266
1436
|
UpdateMode2[UpdateMode2["Incremental"] = 1] = "Incremental";
|
|
1267
1437
|
})(UpdateMode || (UpdateMode = {}));
|
|
1268
1438
|
|
|
1269
|
-
// bazel-out/
|
|
1270
|
-
import
|
|
1439
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
1440
|
+
import ts16 from "typescript";
|
|
1271
1441
|
|
|
1272
|
-
// bazel-out/
|
|
1273
|
-
import
|
|
1442
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
1443
|
+
import ts15 from "typescript";
|
|
1274
1444
|
|
|
1275
|
-
// bazel-out/
|
|
1445
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
1276
1446
|
var NgExtension = Symbol("NgExtension");
|
|
1277
1447
|
function isExtended(sf) {
|
|
1278
1448
|
return sf[NgExtension] !== void 0;
|
|
@@ -1332,13 +1502,13 @@ function retagTsFile(sf) {
|
|
|
1332
1502
|
}
|
|
1333
1503
|
}
|
|
1334
1504
|
|
|
1335
|
-
// bazel-out/
|
|
1505
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/util.mjs
|
|
1336
1506
|
var TS_EXTENSIONS = /\.tsx?$/i;
|
|
1337
1507
|
function makeShimFileName(fileName, suffix) {
|
|
1338
1508
|
return absoluteFrom(fileName.replace(TS_EXTENSIONS, suffix));
|
|
1339
1509
|
}
|
|
1340
1510
|
|
|
1341
|
-
// bazel-out/
|
|
1511
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
1342
1512
|
var ShimAdapter = class {
|
|
1343
1513
|
constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
|
|
1344
1514
|
this.delegate = delegate;
|
|
@@ -1401,10 +1571,10 @@ var ShimAdapter = class {
|
|
|
1401
1571
|
}
|
|
1402
1572
|
const prefix = match[1];
|
|
1403
1573
|
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
1404
|
-
let inputFile = this.delegate.getSourceFile(baseFileName,
|
|
1574
|
+
let inputFile = this.delegate.getSourceFile(baseFileName, ts15.ScriptTarget.Latest);
|
|
1405
1575
|
if (inputFile === void 0) {
|
|
1406
1576
|
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
1407
|
-
inputFile = this.delegate.getSourceFile(baseFileName,
|
|
1577
|
+
inputFile = this.delegate.getSourceFile(baseFileName, ts15.ScriptTarget.Latest);
|
|
1408
1578
|
}
|
|
1409
1579
|
if (inputFile === void 0 || isShim(inputFile)) {
|
|
1410
1580
|
return void 0;
|
|
@@ -1433,7 +1603,7 @@ var ShimAdapter = class {
|
|
|
1433
1603
|
}
|
|
1434
1604
|
};
|
|
1435
1605
|
|
|
1436
|
-
// bazel-out/
|
|
1606
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
|
|
1437
1607
|
var ShimReferenceTagger = class {
|
|
1438
1608
|
constructor(shimExtensions) {
|
|
1439
1609
|
this.tagged = /* @__PURE__ */ new Set();
|
|
@@ -1467,7 +1637,7 @@ var ShimReferenceTagger = class {
|
|
|
1467
1637
|
}
|
|
1468
1638
|
};
|
|
1469
1639
|
|
|
1470
|
-
// bazel-out/
|
|
1640
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
1471
1641
|
var DelegatingCompilerHost = class {
|
|
1472
1642
|
get jsDocParsingMode() {
|
|
1473
1643
|
return this.delegate.jsDocParsingMode;
|
|
@@ -1565,7 +1735,7 @@ var TsCreateProgramDriver = class {
|
|
|
1565
1735
|
this.sfMap.clear();
|
|
1566
1736
|
}
|
|
1567
1737
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
1568
|
-
const sf =
|
|
1738
|
+
const sf = ts16.createSourceFile(filePath, newText, ts16.ScriptTarget.Latest, true);
|
|
1569
1739
|
if (originalFile !== null) {
|
|
1570
1740
|
sf[NgOriginalFile] = originalFile;
|
|
1571
1741
|
}
|
|
@@ -1574,7 +1744,7 @@ var TsCreateProgramDriver = class {
|
|
|
1574
1744
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
1575
1745
|
const oldProgram = this.program;
|
|
1576
1746
|
retagAllTsFiles(oldProgram);
|
|
1577
|
-
this.program =
|
|
1747
|
+
this.program = ts16.createProgram({
|
|
1578
1748
|
host,
|
|
1579
1749
|
rootNames: this.program.getRootFileNames(),
|
|
1580
1750
|
options: this.options,
|
|
@@ -1586,7 +1756,7 @@ var TsCreateProgramDriver = class {
|
|
|
1586
1756
|
}
|
|
1587
1757
|
};
|
|
1588
1758
|
|
|
1589
|
-
// bazel-out/
|
|
1759
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/dependency_tracking.mjs
|
|
1590
1760
|
var FileDependencyGraph = class {
|
|
1591
1761
|
constructor() {
|
|
1592
1762
|
this.nodes = /* @__PURE__ */ new Map();
|
|
@@ -1653,7 +1823,7 @@ function isLogicallyChanged(sf, node, changedTsPaths, deletedTsPaths, changedRes
|
|
|
1653
1823
|
return false;
|
|
1654
1824
|
}
|
|
1655
1825
|
|
|
1656
|
-
// bazel-out/
|
|
1826
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/state.mjs
|
|
1657
1827
|
var IncrementalStateKind;
|
|
1658
1828
|
(function(IncrementalStateKind2) {
|
|
1659
1829
|
IncrementalStateKind2[IncrementalStateKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -1661,7 +1831,7 @@ var IncrementalStateKind;
|
|
|
1661
1831
|
IncrementalStateKind2[IncrementalStateKind2["Analyzed"] = 2] = "Analyzed";
|
|
1662
1832
|
})(IncrementalStateKind || (IncrementalStateKind = {}));
|
|
1663
1833
|
|
|
1664
|
-
// bazel-out/
|
|
1834
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/incremental.mjs
|
|
1665
1835
|
var PhaseKind;
|
|
1666
1836
|
(function(PhaseKind2) {
|
|
1667
1837
|
PhaseKind2[PhaseKind2["Analysis"] = 0] = "Analysis";
|
|
@@ -1862,7 +2032,7 @@ function toOriginalSourceFile(sf) {
|
|
|
1862
2032
|
}
|
|
1863
2033
|
}
|
|
1864
2034
|
|
|
1865
|
-
// bazel-out/
|
|
2035
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/strategy.mjs
|
|
1866
2036
|
var TrackedIncrementalBuildStrategy = class {
|
|
1867
2037
|
constructor() {
|
|
1868
2038
|
this.state = null;
|
|
@@ -1898,7 +2068,7 @@ var PatchedProgramIncrementalBuildStrategy = class {
|
|
|
1898
2068
|
};
|
|
1899
2069
|
var SYM_INCREMENTAL_STATE = Symbol("NgIncrementalState");
|
|
1900
2070
|
|
|
1901
|
-
// bazel-out/
|
|
2071
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/api.mjs
|
|
1902
2072
|
var IdentifierKind;
|
|
1903
2073
|
(function(IdentifierKind2) {
|
|
1904
2074
|
IdentifierKind2[IdentifierKind2["Property"] = 0] = "Property";
|
|
@@ -1916,7 +2086,7 @@ var AbsoluteSourceSpan = class {
|
|
|
1916
2086
|
}
|
|
1917
2087
|
};
|
|
1918
2088
|
|
|
1919
|
-
// bazel-out/
|
|
2089
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/context.mjs
|
|
1920
2090
|
var IndexingContext = class {
|
|
1921
2091
|
constructor() {
|
|
1922
2092
|
this.components = /* @__PURE__ */ new Set();
|
|
@@ -1926,10 +2096,10 @@ var IndexingContext = class {
|
|
|
1926
2096
|
}
|
|
1927
2097
|
};
|
|
1928
2098
|
|
|
1929
|
-
// bazel-out/
|
|
2099
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1930
2100
|
import { ParseSourceFile } from "@angular/compiler";
|
|
1931
2101
|
|
|
1932
|
-
// bazel-out/
|
|
2102
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/template.mjs
|
|
1933
2103
|
import { ASTWithSource, ImplicitReceiver, PropertyRead, PropertyWrite, RecursiveAstVisitor, TmplAstBoundDeferredTrigger, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
1934
2104
|
var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
1935
2105
|
constructor(expressionStr, absoluteOffset, boundTemplate, targetToIdentifier) {
|
|
@@ -2075,7 +2245,7 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
2075
2245
|
visitForLoopBlock(block) {
|
|
2076
2246
|
var _a;
|
|
2077
2247
|
block.item.visit(this);
|
|
2078
|
-
this.visitAll(
|
|
2248
|
+
this.visitAll(block.contextVariables);
|
|
2079
2249
|
this.visitExpression(block.expression);
|
|
2080
2250
|
this.visitAll(block.children);
|
|
2081
2251
|
(_a = block.empty) == null ? void 0 : _a.visit(this);
|
|
@@ -2211,7 +2381,7 @@ function getTemplateIdentifiers(boundTemplate) {
|
|
|
2211
2381
|
return { identifiers: visitor.identifiers, errors: visitor.errors };
|
|
2212
2382
|
}
|
|
2213
2383
|
|
|
2214
|
-
// bazel-out/
|
|
2384
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
2215
2385
|
function generateAnalysis(context) {
|
|
2216
2386
|
const analysis = /* @__PURE__ */ new Map();
|
|
2217
2387
|
context.components.forEach(({ declaration, selector, boundTemplate, templateMeta }) => {
|
|
@@ -2247,7 +2417,7 @@ function generateAnalysis(context) {
|
|
|
2247
2417
|
return analysis;
|
|
2248
2418
|
}
|
|
2249
2419
|
|
|
2250
|
-
// bazel-out/
|
|
2420
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/ng_module_index.mjs
|
|
2251
2421
|
var NgModuleIndexImpl = class {
|
|
2252
2422
|
constructor(metaReader, localReader) {
|
|
2253
2423
|
this.metaReader = metaReader;
|
|
@@ -2336,8 +2506,8 @@ var NgModuleIndexImpl = class {
|
|
|
2336
2506
|
}
|
|
2337
2507
|
};
|
|
2338
2508
|
|
|
2339
|
-
// bazel-out/
|
|
2340
|
-
import
|
|
2509
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
2510
|
+
import ts17 from "typescript";
|
|
2341
2511
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
2342
2512
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
2343
2513
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -2447,7 +2617,7 @@ var AdapterResourceLoader = class {
|
|
|
2447
2617
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
2448
2618
|
}
|
|
2449
2619
|
getResolvedCandidateLocations(url, fromFile) {
|
|
2450
|
-
const failedLookup =
|
|
2620
|
+
const failedLookup = ts17.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
2451
2621
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
2452
2622
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
2453
2623
|
}
|
|
@@ -2482,7 +2652,7 @@ function createLookupResolutionHost(adapter) {
|
|
|
2482
2652
|
};
|
|
2483
2653
|
}
|
|
2484
2654
|
|
|
2485
|
-
// bazel-out/
|
|
2655
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/standalone.mjs
|
|
2486
2656
|
var StandaloneComponentScopeReader = class {
|
|
2487
2657
|
constructor(metaReader, localModuleReader, dtsModuleReader) {
|
|
2488
2658
|
this.metaReader = metaReader;
|
|
@@ -2578,11 +2748,11 @@ var StandaloneComponentScopeReader = class {
|
|
|
2578
2748
|
}
|
|
2579
2749
|
};
|
|
2580
2750
|
|
|
2581
|
-
// bazel-out/
|
|
2751
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
2582
2752
|
import { CssSelector as CssSelector2, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr2, WrappedNodeExpr as WrappedNodeExpr2 } from "@angular/compiler";
|
|
2583
2753
|
|
|
2584
|
-
// bazel-out/
|
|
2585
|
-
import
|
|
2754
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
2755
|
+
import ts18 from "typescript";
|
|
2586
2756
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
2587
2757
|
var _a;
|
|
2588
2758
|
if (mapping.type === "direct") {
|
|
@@ -2591,7 +2761,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2591
2761
|
relatedInformation = [];
|
|
2592
2762
|
for (const relatedMessage of relatedMessages) {
|
|
2593
2763
|
relatedInformation.push({
|
|
2594
|
-
category:
|
|
2764
|
+
category: ts18.DiagnosticCategory.Message,
|
|
2595
2765
|
code: 0,
|
|
2596
2766
|
file: relatedMessage.sourceFile,
|
|
2597
2767
|
start: relatedMessage.start,
|
|
@@ -2620,7 +2790,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2620
2790
|
if (relatedMessages !== void 0) {
|
|
2621
2791
|
for (const relatedMessage of relatedMessages) {
|
|
2622
2792
|
relatedInformation.push({
|
|
2623
|
-
category:
|
|
2793
|
+
category: ts18.DiagnosticCategory.Message,
|
|
2624
2794
|
code: 0,
|
|
2625
2795
|
file: relatedMessage.sourceFile,
|
|
2626
2796
|
start: relatedMessage.start,
|
|
@@ -2650,7 +2820,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2650
2820
|
};
|
|
2651
2821
|
}
|
|
2652
2822
|
relatedInformation.push({
|
|
2653
|
-
category:
|
|
2823
|
+
category: ts18.DiagnosticCategory.Message,
|
|
2654
2824
|
code: 0,
|
|
2655
2825
|
file: componentSf,
|
|
2656
2826
|
start: mapping.node.getStart(),
|
|
@@ -2685,10 +2855,10 @@ function parseTemplateAsSourceFile(fileName, template) {
|
|
|
2685
2855
|
if (parseTemplateAsSourceFileForTest !== null) {
|
|
2686
2856
|
return parseTemplateAsSourceFileForTest(fileName, template);
|
|
2687
2857
|
}
|
|
2688
|
-
return
|
|
2858
|
+
return ts18.createSourceFile(fileName, template, ts18.ScriptTarget.Latest, false, ts18.ScriptKind.JSX);
|
|
2689
2859
|
}
|
|
2690
2860
|
|
|
2691
|
-
// bazel-out/
|
|
2861
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
2692
2862
|
var TEMPLATE_ID = Symbol("ngTemplateId");
|
|
2693
2863
|
var NEXT_TEMPLATE_ID = Symbol("ngNextTemplateId");
|
|
2694
2864
|
function getTemplateId(clazz) {
|
|
@@ -2705,17 +2875,17 @@ function allocateTemplateId(sf) {
|
|
|
2705
2875
|
return `tcb${sf[NEXT_TEMPLATE_ID]++}`;
|
|
2706
2876
|
}
|
|
2707
2877
|
|
|
2708
|
-
// bazel-out/
|
|
2878
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2709
2879
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2710
|
-
import
|
|
2880
|
+
import ts20 from "typescript";
|
|
2711
2881
|
|
|
2712
|
-
// bazel-out/
|
|
2882
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2713
2883
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2714
|
-
import
|
|
2884
|
+
import ts19 from "typescript";
|
|
2715
2885
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2716
2886
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2717
|
-
return
|
|
2718
|
-
if (kind !==
|
|
2887
|
+
return ts19.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2888
|
+
if (kind !== ts19.SyntaxKind.MultiLineCommentTrivia) {
|
|
2719
2889
|
return null;
|
|
2720
2890
|
}
|
|
2721
2891
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2739,25 +2909,25 @@ var ExpressionIdentifier;
|
|
|
2739
2909
|
ExpressionIdentifier2["VARIABLE_AS_EXPRESSION"] = "VAE";
|
|
2740
2910
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2741
2911
|
function addExpressionIdentifier(node, identifier) {
|
|
2742
|
-
|
|
2912
|
+
ts19.addSyntheticTrailingComment(
|
|
2743
2913
|
node,
|
|
2744
|
-
|
|
2914
|
+
ts19.SyntaxKind.MultiLineCommentTrivia,
|
|
2745
2915
|
`${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
|
|
2746
2916
|
false
|
|
2747
2917
|
);
|
|
2748
2918
|
}
|
|
2749
2919
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2750
2920
|
function markIgnoreDiagnostics(node) {
|
|
2751
|
-
|
|
2921
|
+
ts19.addSyntheticTrailingComment(
|
|
2752
2922
|
node,
|
|
2753
|
-
|
|
2923
|
+
ts19.SyntaxKind.MultiLineCommentTrivia,
|
|
2754
2924
|
IGNORE_FOR_DIAGNOSTICS_MARKER,
|
|
2755
2925
|
false
|
|
2756
2926
|
);
|
|
2757
2927
|
}
|
|
2758
2928
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2759
|
-
return
|
|
2760
|
-
if (kind !==
|
|
2929
|
+
return ts19.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2930
|
+
if (kind !== ts19.SyntaxKind.MultiLineCommentTrivia) {
|
|
2761
2931
|
return null;
|
|
2762
2932
|
}
|
|
2763
2933
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2831,8 +3001,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2831
3001
|
return results;
|
|
2832
3002
|
}
|
|
2833
3003
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2834
|
-
return
|
|
2835
|
-
if (kind !==
|
|
3004
|
+
return ts19.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
3005
|
+
if (kind !== ts19.SyntaxKind.MultiLineCommentTrivia) {
|
|
2836
3006
|
return false;
|
|
2837
3007
|
}
|
|
2838
3008
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2840,7 +3010,7 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
|
2840
3010
|
}) || false;
|
|
2841
3011
|
}
|
|
2842
3012
|
|
|
2843
|
-
// bazel-out/
|
|
3013
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2844
3014
|
var CompletionEngine = class {
|
|
2845
3015
|
constructor(tcb, data, tcbPath, tcbIsShim) {
|
|
2846
3016
|
this.tcb = tcb;
|
|
@@ -2850,7 +3020,7 @@ var CompletionEngine = class {
|
|
|
2850
3020
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2851
3021
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2852
3022
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2853
|
-
filter:
|
|
3023
|
+
filter: ts20.isPropertyAccessExpression,
|
|
2854
3024
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2855
3025
|
});
|
|
2856
3026
|
if (globalRead !== null) {
|
|
@@ -2874,7 +3044,7 @@ var CompletionEngine = class {
|
|
|
2874
3044
|
let nodeContext = null;
|
|
2875
3045
|
if (node instanceof EmptyExpr) {
|
|
2876
3046
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2877
|
-
filter:
|
|
3047
|
+
filter: ts20.isIdentifier,
|
|
2878
3048
|
withSpan: node.sourceSpan
|
|
2879
3049
|
});
|
|
2880
3050
|
if (nodeLocation !== null) {
|
|
@@ -2887,7 +3057,7 @@ var CompletionEngine = class {
|
|
|
2887
3057
|
}
|
|
2888
3058
|
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2889
3059
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2890
|
-
filter:
|
|
3060
|
+
filter: ts20.isPropertyAccessExpression,
|
|
2891
3061
|
withSpan: node.sourceSpan
|
|
2892
3062
|
});
|
|
2893
3063
|
if (nodeLocation) {
|
|
@@ -2911,21 +3081,21 @@ var CompletionEngine = class {
|
|
|
2911
3081
|
let tsExpr = null;
|
|
2912
3082
|
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2913
3083
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2914
|
-
filter:
|
|
3084
|
+
filter: ts20.isPropertyAccessExpression,
|
|
2915
3085
|
withSpan: expr.nameSpan
|
|
2916
3086
|
});
|
|
2917
3087
|
} else if (expr instanceof SafePropertyRead) {
|
|
2918
3088
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2919
|
-
filter:
|
|
3089
|
+
filter: ts20.isParenthesizedExpression,
|
|
2920
3090
|
withSpan: expr.sourceSpan
|
|
2921
3091
|
});
|
|
2922
|
-
if (ternaryExpr === null || !
|
|
3092
|
+
if (ternaryExpr === null || !ts20.isConditionalExpression(ternaryExpr.expression)) {
|
|
2923
3093
|
return null;
|
|
2924
3094
|
}
|
|
2925
3095
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2926
|
-
if (
|
|
3096
|
+
if (ts20.isPropertyAccessExpression(whenTrue)) {
|
|
2927
3097
|
tsExpr = whenTrue;
|
|
2928
|
-
} else if (
|
|
3098
|
+
} else if (ts20.isCallExpression(whenTrue) && ts20.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2929
3099
|
tsExpr = whenTrue.expression;
|
|
2930
3100
|
}
|
|
2931
3101
|
}
|
|
@@ -2947,15 +3117,15 @@ var CompletionEngine = class {
|
|
|
2947
3117
|
let tsExpr = null;
|
|
2948
3118
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2949
3119
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2950
|
-
filter:
|
|
3120
|
+
filter: ts20.isParenthesizedExpression,
|
|
2951
3121
|
withSpan: expr.sourceSpan
|
|
2952
3122
|
});
|
|
2953
|
-
if (strNode !== null &&
|
|
3123
|
+
if (strNode !== null && ts20.isStringLiteral(strNode.expression)) {
|
|
2954
3124
|
tsExpr = strNode.expression;
|
|
2955
3125
|
}
|
|
2956
3126
|
} else {
|
|
2957
3127
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2958
|
-
filter: (n2) =>
|
|
3128
|
+
filter: (n2) => ts20.isStringLiteral(n2) || ts20.isNumericLiteral(n2),
|
|
2959
3129
|
withSpan: expr.sourceSpan
|
|
2960
3130
|
});
|
|
2961
3131
|
}
|
|
@@ -2963,7 +3133,7 @@ var CompletionEngine = class {
|
|
|
2963
3133
|
return null;
|
|
2964
3134
|
}
|
|
2965
3135
|
let positionInShimFile = tsExpr.getEnd();
|
|
2966
|
-
if (
|
|
3136
|
+
if (ts20.isStringLiteral(tsExpr)) {
|
|
2967
3137
|
positionInShimFile -= 1;
|
|
2968
3138
|
}
|
|
2969
3139
|
const res = {
|
|
@@ -4007,12 +4177,12 @@ var MagicString = class {
|
|
|
4007
4177
|
}
|
|
4008
4178
|
};
|
|
4009
4179
|
|
|
4010
|
-
// bazel-out/
|
|
4011
|
-
import
|
|
4180
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
4181
|
+
import ts33 from "typescript";
|
|
4012
4182
|
|
|
4013
|
-
// bazel-out/
|
|
4183
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
4014
4184
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
4015
|
-
import
|
|
4185
|
+
import ts21 from "typescript";
|
|
4016
4186
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
4017
4187
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
4018
4188
|
var RegistryDomSchemaChecker = class {
|
|
@@ -4037,7 +4207,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
4037
4207
|
} else {
|
|
4038
4208
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
4039
4209
|
}
|
|
4040
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
4210
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
4041
4211
|
this._diagnostics.push(diag);
|
|
4042
4212
|
}
|
|
4043
4213
|
}
|
|
@@ -4057,16 +4227,16 @@ var RegistryDomSchemaChecker = class {
|
|
|
4057
4227
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
|
|
4058
4228
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
4059
4229
|
}
|
|
4060
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
4230
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
4061
4231
|
this._diagnostics.push(diag);
|
|
4062
4232
|
}
|
|
4063
4233
|
}
|
|
4064
4234
|
};
|
|
4065
4235
|
|
|
4066
|
-
// bazel-out/
|
|
4067
|
-
import
|
|
4236
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
4237
|
+
import ts26 from "typescript";
|
|
4068
4238
|
|
|
4069
|
-
// bazel-out/
|
|
4239
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.mjs
|
|
4070
4240
|
import { ExpressionType, ExternalExpr, TypeModifier } from "@angular/compiler";
|
|
4071
4241
|
var ReferenceEmitEnvironment = class {
|
|
4072
4242
|
constructor(importManager, refEmitter, reflector, contextFile) {
|
|
@@ -4097,99 +4267,99 @@ var ReferenceEmitEnvironment = class {
|
|
|
4097
4267
|
}
|
|
4098
4268
|
};
|
|
4099
4269
|
|
|
4100
|
-
// bazel-out/
|
|
4101
|
-
import
|
|
4270
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
4271
|
+
import ts22 from "typescript";
|
|
4102
4272
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4273
|
+
ts22.SyntaxKind.ParenthesizedExpression,
|
|
4274
|
+
ts22.SyntaxKind.Identifier,
|
|
4275
|
+
ts22.SyntaxKind.CallExpression,
|
|
4276
|
+
ts22.SyntaxKind.NonNullExpression,
|
|
4277
|
+
ts22.SyntaxKind.ElementAccessExpression,
|
|
4278
|
+
ts22.SyntaxKind.PropertyAccessExpression,
|
|
4279
|
+
ts22.SyntaxKind.ArrayLiteralExpression,
|
|
4280
|
+
ts22.SyntaxKind.ObjectLiteralExpression,
|
|
4281
|
+
ts22.SyntaxKind.StringLiteral,
|
|
4282
|
+
ts22.SyntaxKind.NumericLiteral,
|
|
4283
|
+
ts22.SyntaxKind.TrueKeyword,
|
|
4284
|
+
ts22.SyntaxKind.FalseKeyword,
|
|
4285
|
+
ts22.SyntaxKind.NullKeyword,
|
|
4286
|
+
ts22.SyntaxKind.UndefinedKeyword
|
|
4117
4287
|
]);
|
|
4118
4288
|
function tsCastToAny(expr) {
|
|
4119
4289
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
4120
|
-
expr =
|
|
4290
|
+
expr = ts22.factory.createParenthesizedExpression(expr);
|
|
4121
4291
|
}
|
|
4122
|
-
return
|
|
4292
|
+
return ts22.factory.createParenthesizedExpression(ts22.factory.createAsExpression(expr, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword)));
|
|
4123
4293
|
}
|
|
4124
4294
|
function tsCreateElement(tagName) {
|
|
4125
|
-
const createElement =
|
|
4126
|
-
|
|
4295
|
+
const createElement = ts22.factory.createPropertyAccessExpression(
|
|
4296
|
+
ts22.factory.createIdentifier("document"),
|
|
4127
4297
|
"createElement"
|
|
4128
4298
|
);
|
|
4129
|
-
return
|
|
4299
|
+
return ts22.factory.createCallExpression(
|
|
4130
4300
|
createElement,
|
|
4131
4301
|
void 0,
|
|
4132
|
-
[
|
|
4302
|
+
[ts22.factory.createStringLiteral(tagName)]
|
|
4133
4303
|
);
|
|
4134
4304
|
}
|
|
4135
4305
|
function tsDeclareVariable(id, type) {
|
|
4136
4306
|
addExpressionIdentifier(type, ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
|
|
4137
|
-
const initializer =
|
|
4138
|
-
const decl =
|
|
4307
|
+
const initializer = ts22.factory.createAsExpression(ts22.factory.createNonNullExpression(ts22.factory.createNull()), type);
|
|
4308
|
+
const decl = ts22.factory.createVariableDeclaration(
|
|
4139
4309
|
id,
|
|
4140
4310
|
void 0,
|
|
4141
4311
|
void 0,
|
|
4142
4312
|
initializer
|
|
4143
4313
|
);
|
|
4144
|
-
return
|
|
4314
|
+
return ts22.factory.createVariableStatement(
|
|
4145
4315
|
void 0,
|
|
4146
4316
|
[decl]
|
|
4147
4317
|
);
|
|
4148
4318
|
}
|
|
4149
4319
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
4150
|
-
return
|
|
4320
|
+
return ts22.factory.createTypeQueryNode(ts22.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
4151
4321
|
}
|
|
4152
4322
|
function tsCreateVariable(id, initializer) {
|
|
4153
|
-
const decl =
|
|
4323
|
+
const decl = ts22.factory.createVariableDeclaration(
|
|
4154
4324
|
id,
|
|
4155
4325
|
void 0,
|
|
4156
4326
|
void 0,
|
|
4157
4327
|
initializer
|
|
4158
4328
|
);
|
|
4159
|
-
return
|
|
4329
|
+
return ts22.factory.createVariableStatement(
|
|
4160
4330
|
void 0,
|
|
4161
4331
|
[decl]
|
|
4162
4332
|
);
|
|
4163
4333
|
}
|
|
4164
4334
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
4165
|
-
const methodAccess =
|
|
4166
|
-
return
|
|
4335
|
+
const methodAccess = ts22.factory.createPropertyAccessExpression(receiver, methodName);
|
|
4336
|
+
return ts22.factory.createCallExpression(
|
|
4167
4337
|
methodAccess,
|
|
4168
4338
|
void 0,
|
|
4169
4339
|
args
|
|
4170
4340
|
);
|
|
4171
4341
|
}
|
|
4172
4342
|
function isAccessExpression(node) {
|
|
4173
|
-
return
|
|
4343
|
+
return ts22.isPropertyAccessExpression(node) || ts22.isElementAccessExpression(node);
|
|
4174
4344
|
}
|
|
4175
4345
|
function tsNumericExpression(value) {
|
|
4176
4346
|
if (value < 0) {
|
|
4177
|
-
const operand =
|
|
4178
|
-
return
|
|
4347
|
+
const operand = ts22.factory.createNumericLiteral(Math.abs(value));
|
|
4348
|
+
return ts22.factory.createPrefixUnaryExpression(ts22.SyntaxKind.MinusToken, operand);
|
|
4179
4349
|
}
|
|
4180
|
-
return
|
|
4350
|
+
return ts22.factory.createNumericLiteral(value);
|
|
4181
4351
|
}
|
|
4182
4352
|
|
|
4183
|
-
// bazel-out/
|
|
4353
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
4184
4354
|
import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers2, WrappedNodeExpr } from "@angular/compiler";
|
|
4185
|
-
import
|
|
4355
|
+
import ts25 from "typescript";
|
|
4186
4356
|
|
|
4187
|
-
// bazel-out/
|
|
4357
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
4188
4358
|
import { R3Identifiers } from "@angular/compiler";
|
|
4189
|
-
import
|
|
4359
|
+
import ts24 from "typescript";
|
|
4190
4360
|
|
|
4191
|
-
// bazel-out/
|
|
4192
|
-
import
|
|
4361
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
4362
|
+
import ts23 from "typescript";
|
|
4193
4363
|
var TypeParameterEmitter = class {
|
|
4194
4364
|
constructor(typeParameters, reflector) {
|
|
4195
4365
|
this.typeParameters = typeParameters;
|
|
@@ -4226,11 +4396,11 @@ var TypeParameterEmitter = class {
|
|
|
4226
4396
|
return this.typeParameters.map((typeParam) => {
|
|
4227
4397
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
4228
4398
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
4229
|
-
return
|
|
4399
|
+
return ts23.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
|
|
4230
4400
|
});
|
|
4231
4401
|
}
|
|
4232
4402
|
resolveTypeReference(type) {
|
|
4233
|
-
const target =
|
|
4403
|
+
const target = ts23.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
4234
4404
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
4235
4405
|
if (declaration === null || declaration.node === null) {
|
|
4236
4406
|
return null;
|
|
@@ -4256,8 +4426,8 @@ var TypeParameterEmitter = class {
|
|
|
4256
4426
|
if (typeNode === null) {
|
|
4257
4427
|
return null;
|
|
4258
4428
|
}
|
|
4259
|
-
if (!
|
|
4260
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
4429
|
+
if (!ts23.isTypeReferenceNode(typeNode)) {
|
|
4430
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts23.SyntaxKind[typeNode.kind]}.`);
|
|
4261
4431
|
}
|
|
4262
4432
|
return typeNode;
|
|
4263
4433
|
}
|
|
@@ -4266,7 +4436,7 @@ var TypeParameterEmitter = class {
|
|
|
4266
4436
|
}
|
|
4267
4437
|
};
|
|
4268
4438
|
|
|
4269
|
-
// bazel-out/
|
|
4439
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
4270
4440
|
var TCB_FILE_IMPORT_GRAPH_PREPARE_IDENTIFIERS = [
|
|
4271
4441
|
R3Identifiers.InputSignalBrandWriteType
|
|
4272
4442
|
];
|
|
@@ -4302,14 +4472,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
4302
4472
|
}
|
|
4303
4473
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
4304
4474
|
for (const stmt of file.statements) {
|
|
4305
|
-
if (
|
|
4475
|
+
if (ts24.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
4306
4476
|
return stmt;
|
|
4307
4477
|
}
|
|
4308
4478
|
}
|
|
4309
4479
|
return null;
|
|
4310
4480
|
}
|
|
4311
4481
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
4312
|
-
while (node !== void 0 && !
|
|
4482
|
+
while (node !== void 0 && !ts24.isFunctionDeclaration(node)) {
|
|
4313
4483
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
4314
4484
|
return null;
|
|
4315
4485
|
}
|
|
@@ -4326,7 +4496,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
4326
4496
|
return null;
|
|
4327
4497
|
}
|
|
4328
4498
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
4329
|
-
while (!
|
|
4499
|
+
while (!ts24.isFunctionDeclaration(node)) {
|
|
4330
4500
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
4331
4501
|
return null;
|
|
4332
4502
|
}
|
|
@@ -4336,8 +4506,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
4336
4506
|
}
|
|
4337
4507
|
}
|
|
4338
4508
|
const start = node.getFullStart();
|
|
4339
|
-
return
|
|
4340
|
-
if (kind !==
|
|
4509
|
+
return ts24.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
4510
|
+
if (kind !== ts24.SyntaxKind.MultiLineCommentTrivia) {
|
|
4341
4511
|
return null;
|
|
4342
4512
|
}
|
|
4343
4513
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -4358,32 +4528,32 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
4358
4528
|
return emitter.canEmit((ref) => env.canReferenceType(ref));
|
|
4359
4529
|
}
|
|
4360
4530
|
|
|
4361
|
-
// bazel-out/
|
|
4531
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
4362
4532
|
function generateTypeCtorDeclarationFn(env, meta, nodeTypeRef, typeParams) {
|
|
4363
4533
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
4364
|
-
const rawType =
|
|
4534
|
+
const rawType = ts25.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
4365
4535
|
const initParam = constructTypeCtorParameter(env, meta, rawType);
|
|
4366
4536
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
4367
4537
|
if (meta.body) {
|
|
4368
|
-
const fnType =
|
|
4538
|
+
const fnType = ts25.factory.createFunctionTypeNode(
|
|
4369
4539
|
typeParameters,
|
|
4370
4540
|
[initParam],
|
|
4371
4541
|
rawType
|
|
4372
4542
|
);
|
|
4373
|
-
const decl =
|
|
4543
|
+
const decl = ts25.factory.createVariableDeclaration(
|
|
4374
4544
|
meta.fnName,
|
|
4375
4545
|
void 0,
|
|
4376
4546
|
fnType,
|
|
4377
|
-
|
|
4547
|
+
ts25.factory.createNonNullExpression(ts25.factory.createNull())
|
|
4378
4548
|
);
|
|
4379
|
-
const declList =
|
|
4380
|
-
return
|
|
4549
|
+
const declList = ts25.factory.createVariableDeclarationList([decl], ts25.NodeFlags.Const);
|
|
4550
|
+
return ts25.factory.createVariableStatement(
|
|
4381
4551
|
void 0,
|
|
4382
4552
|
declList
|
|
4383
4553
|
);
|
|
4384
4554
|
} else {
|
|
4385
|
-
return
|
|
4386
|
-
[
|
|
4555
|
+
return ts25.factory.createFunctionDeclaration(
|
|
4556
|
+
[ts25.factory.createModifier(ts25.SyntaxKind.DeclareKeyword)],
|
|
4387
4557
|
void 0,
|
|
4388
4558
|
meta.fnName,
|
|
4389
4559
|
typeParameters,
|
|
@@ -4395,16 +4565,16 @@ function generateTypeCtorDeclarationFn(env, meta, nodeTypeRef, typeParams) {
|
|
|
4395
4565
|
}
|
|
4396
4566
|
function generateInlineTypeCtor(env, node, meta) {
|
|
4397
4567
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
4398
|
-
const rawType =
|
|
4568
|
+
const rawType = ts25.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
4399
4569
|
const initParam = constructTypeCtorParameter(env, meta, rawType);
|
|
4400
4570
|
let body = void 0;
|
|
4401
4571
|
if (meta.body) {
|
|
4402
|
-
body =
|
|
4403
|
-
|
|
4572
|
+
body = ts25.factory.createBlock([
|
|
4573
|
+
ts25.factory.createReturnStatement(ts25.factory.createNonNullExpression(ts25.factory.createNull()))
|
|
4404
4574
|
]);
|
|
4405
4575
|
}
|
|
4406
|
-
return
|
|
4407
|
-
[
|
|
4576
|
+
return ts25.factory.createMethodDeclaration(
|
|
4577
|
+
[ts25.factory.createModifier(ts25.SyntaxKind.StaticKeyword)],
|
|
4408
4578
|
void 0,
|
|
4409
4579
|
meta.fnName,
|
|
4410
4580
|
void 0,
|
|
@@ -4421,12 +4591,12 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
4421
4591
|
const signalInputKeys = [];
|
|
4422
4592
|
for (const { classPropertyName, transform, isSignal } of meta.fields.inputs) {
|
|
4423
4593
|
if (isSignal) {
|
|
4424
|
-
signalInputKeys.push(
|
|
4594
|
+
signalInputKeys.push(ts25.factory.createLiteralTypeNode(ts25.factory.createStringLiteral(classPropertyName)));
|
|
4425
4595
|
} else if (!meta.coercedInputFields.has(classPropertyName)) {
|
|
4426
|
-
plainKeys.push(
|
|
4596
|
+
plainKeys.push(ts25.factory.createLiteralTypeNode(ts25.factory.createStringLiteral(classPropertyName)));
|
|
4427
4597
|
} else {
|
|
4428
4598
|
const coercionType = transform != null ? transform.type.node : tsCreateTypeQueryForCoercedInput(rawType.typeName, classPropertyName);
|
|
4429
|
-
coercedKeys.push(
|
|
4599
|
+
coercedKeys.push(ts25.factory.createPropertySignature(
|
|
4430
4600
|
void 0,
|
|
4431
4601
|
classPropertyName,
|
|
4432
4602
|
void 0,
|
|
@@ -4435,25 +4605,25 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
4435
4605
|
}
|
|
4436
4606
|
}
|
|
4437
4607
|
if (plainKeys.length > 0) {
|
|
4438
|
-
const keyTypeUnion =
|
|
4439
|
-
initType =
|
|
4608
|
+
const keyTypeUnion = ts25.factory.createUnionTypeNode(plainKeys);
|
|
4609
|
+
initType = ts25.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
4440
4610
|
}
|
|
4441
4611
|
if (coercedKeys.length > 0) {
|
|
4442
|
-
const coercedLiteral =
|
|
4443
|
-
initType = initType !== null ?
|
|
4612
|
+
const coercedLiteral = ts25.factory.createTypeLiteralNode(coercedKeys);
|
|
4613
|
+
initType = initType !== null ? ts25.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
4444
4614
|
}
|
|
4445
4615
|
if (signalInputKeys.length > 0) {
|
|
4446
|
-
const keyTypeUnion =
|
|
4616
|
+
const keyTypeUnion = ts25.factory.createUnionTypeNode(signalInputKeys);
|
|
4447
4617
|
const unwrapDirectiveSignalInputsExpr = env.referenceExternalType(R3Identifiers2.UnwrapDirectiveSignalInputs.moduleName, R3Identifiers2.UnwrapDirectiveSignalInputs.name, [
|
|
4448
4618
|
new ExpressionType2(new WrappedNodeExpr(rawType)),
|
|
4449
4619
|
new ExpressionType2(new WrappedNodeExpr(keyTypeUnion))
|
|
4450
4620
|
]);
|
|
4451
|
-
initType = initType !== null ?
|
|
4621
|
+
initType = initType !== null ? ts25.factory.createIntersectionTypeNode([initType, unwrapDirectiveSignalInputsExpr]) : unwrapDirectiveSignalInputsExpr;
|
|
4452
4622
|
}
|
|
4453
4623
|
if (initType === null) {
|
|
4454
|
-
initType =
|
|
4624
|
+
initType = ts25.factory.createTypeLiteralNode([]);
|
|
4455
4625
|
}
|
|
4456
|
-
return
|
|
4626
|
+
return ts25.factory.createParameterDeclaration(
|
|
4457
4627
|
void 0,
|
|
4458
4628
|
void 0,
|
|
4459
4629
|
"init",
|
|
@@ -4463,7 +4633,7 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
4463
4633
|
);
|
|
4464
4634
|
}
|
|
4465
4635
|
function generateGenericArgs(params) {
|
|
4466
|
-
return params.map((param) =>
|
|
4636
|
+
return params.map((param) => ts25.factory.createTypeReferenceNode(param.name, void 0));
|
|
4467
4637
|
}
|
|
4468
4638
|
function requiresInlineTypeCtor(node, host, env) {
|
|
4469
4639
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -4474,14 +4644,14 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
4474
4644
|
}
|
|
4475
4645
|
return params.map((param) => {
|
|
4476
4646
|
if (param.default === void 0) {
|
|
4477
|
-
return
|
|
4647
|
+
return ts25.factory.updateTypeParameterDeclaration(param, param.modifiers, param.name, param.constraint, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
4478
4648
|
} else {
|
|
4479
4649
|
return param;
|
|
4480
4650
|
}
|
|
4481
4651
|
});
|
|
4482
4652
|
}
|
|
4483
4653
|
|
|
4484
|
-
// bazel-out/
|
|
4654
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
4485
4655
|
var Environment = class extends ReferenceEmitEnvironment {
|
|
4486
4656
|
constructor(config, importManager, refEmitter, reflector, contextFile) {
|
|
4487
4657
|
super(importManager, refEmitter, reflector, contextFile);
|
|
@@ -4503,13 +4673,13 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4503
4673
|
}
|
|
4504
4674
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
4505
4675
|
const ref = this.reference(dirRef);
|
|
4506
|
-
const typeCtorExpr =
|
|
4676
|
+
const typeCtorExpr = ts26.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
4507
4677
|
this.typeCtors.set(node, typeCtorExpr);
|
|
4508
4678
|
return typeCtorExpr;
|
|
4509
4679
|
} else {
|
|
4510
4680
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
4511
4681
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
4512
|
-
if (!
|
|
4682
|
+
if (!ts26.isTypeReferenceNode(nodeTypeRef)) {
|
|
4513
4683
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
4514
4684
|
}
|
|
4515
4685
|
const meta = {
|
|
@@ -4524,7 +4694,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4524
4694
|
const typeParams = this.emitTypeParameters(node);
|
|
4525
4695
|
const typeCtor = generateTypeCtorDeclarationFn(this, meta, nodeTypeRef.typeName, typeParams);
|
|
4526
4696
|
this.typeCtorStatements.push(typeCtor);
|
|
4527
|
-
const fnId =
|
|
4697
|
+
const fnId = ts26.factory.createIdentifier(fnName);
|
|
4528
4698
|
this.typeCtors.set(node, fnId);
|
|
4529
4699
|
return fnId;
|
|
4530
4700
|
}
|
|
@@ -4534,7 +4704,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4534
4704
|
return this.pipeInsts.get(ref.node);
|
|
4535
4705
|
}
|
|
4536
4706
|
const pipeType = this.referenceType(ref);
|
|
4537
|
-
const pipeInstId =
|
|
4707
|
+
const pipeInstId = ts26.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
4538
4708
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
4539
4709
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
4540
4710
|
return pipeInstId;
|
|
@@ -4556,9 +4726,9 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
4556
4726
|
}
|
|
4557
4727
|
};
|
|
4558
4728
|
|
|
4559
|
-
// bazel-out/
|
|
4560
|
-
import { AbsoluteSourceSpan as AbsoluteSourceSpan3, TmplAstElement as TmplAstElement2
|
|
4561
|
-
import
|
|
4729
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
4730
|
+
import { AbsoluteSourceSpan as AbsoluteSourceSpan3, TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
4731
|
+
import ts27 from "typescript";
|
|
4562
4732
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
4563
4733
|
constructor(resolver) {
|
|
4564
4734
|
this.resolver = resolver;
|
|
@@ -4572,7 +4742,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4572
4742
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
4573
4743
|
const value = ref.value.trim();
|
|
4574
4744
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
4575
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
4745
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
4576
4746
|
}
|
|
4577
4747
|
missingPipe(templateId, ast) {
|
|
4578
4748
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -4584,7 +4754,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4584
4754
|
if (sourceSpan === null) {
|
|
4585
4755
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
4586
4756
|
}
|
|
4587
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
4757
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
4588
4758
|
this.recordedPipes.add(ast);
|
|
4589
4759
|
}
|
|
4590
4760
|
deferredPipeUsedEagerly(templateId, ast) {
|
|
@@ -4597,7 +4767,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4597
4767
|
if (sourceSpan === null) {
|
|
4598
4768
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
4599
4769
|
}
|
|
4600
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
4770
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
|
|
4601
4771
|
this.recordedPipes.add(ast);
|
|
4602
4772
|
}
|
|
4603
4773
|
deferredComponentUsedEagerly(templateId, element) {
|
|
@@ -4609,12 +4779,12 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4609
4779
|
if (sourceSpan === null) {
|
|
4610
4780
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element.name}'.`);
|
|
4611
4781
|
}
|
|
4612
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
4782
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
|
|
4613
4783
|
}
|
|
4614
4784
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
4615
4785
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
4616
4786
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
4617
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
4787
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
4618
4788
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
4619
4789
|
start: firstDecl.sourceSpan.start.offset,
|
|
4620
4790
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -4653,7 +4823,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
4653
4823
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
4654
4824
|
|
|
4655
4825
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
4656
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
4826
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts27.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
4657
4827
|
}
|
|
4658
4828
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
4659
4829
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -4687,19 +4857,20 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
4687
4857
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
4688
4858
|
});
|
|
4689
4859
|
}
|
|
4690
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
4860
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
4691
4861
|
}
|
|
4692
4862
|
missingRequiredInputs(templateId, element, directiveName, isComponent, inputAliases) {
|
|
4693
4863
|
const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
|
|
4694
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan,
|
|
4864
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
|
|
4695
4865
|
}
|
|
4696
4866
|
illegalForLoopTrackAccess(templateId, block, access) {
|
|
4697
4867
|
const sourceSpan = this.resolver.toParseSourceSpan(templateId, access.sourceSpan);
|
|
4698
4868
|
if (sourceSpan === null) {
|
|
4699
4869
|
throw new Error(`Assertion failure: no SourceLocation found for property read.`);
|
|
4700
4870
|
}
|
|
4701
|
-
const
|
|
4702
|
-
|
|
4871
|
+
const messageVars = [block.item, ...block.contextVariables.filter((v) => v.value === "$index")].map((v) => `'${v.name}'`).join(", ");
|
|
4872
|
+
const message = `Cannot access '${access.name}' inside of a track expression. Only ${messageVars} and properties on the containing component are available to this expression.`;
|
|
4873
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
|
|
4703
4874
|
}
|
|
4704
4875
|
inaccessibleDeferredTriggerElement(templateId, trigger) {
|
|
4705
4876
|
let message;
|
|
@@ -4710,17 +4881,10 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
4710
4881
|
Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
|
|
4711
4882
|
Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
|
|
4712
4883
|
}
|
|
4713
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan,
|
|
4884
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
|
|
4714
4885
|
}
|
|
4715
4886
|
controlFlowPreventingContentProjection(templateId, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
|
|
4716
|
-
|
|
4717
|
-
if (controlFlowNode instanceof TmplAstForLoopBlockEmpty) {
|
|
4718
|
-
blockName = "@empty";
|
|
4719
|
-
} else if (controlFlowNode instanceof TmplAstForLoopBlock) {
|
|
4720
|
-
blockName = "@for";
|
|
4721
|
-
} else {
|
|
4722
|
-
blockName = "@if";
|
|
4723
|
-
}
|
|
4887
|
+
const blockName = controlFlowNode.nameSpan.toString().trim();
|
|
4724
4888
|
const lines = [
|
|
4725
4889
|
`Node matches the "${slotSelector}" slot of the "${componentName}" component, but will not be projected into the specific slot because the surrounding ${blockName} has more than one node at its root. To project the node in the right slot, you can:
|
|
4726
4890
|
`,
|
|
@@ -4743,8 +4907,8 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
4743
4907
|
};
|
|
4744
4908
|
}
|
|
4745
4909
|
|
|
4746
|
-
// bazel-out/
|
|
4747
|
-
import
|
|
4910
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
4911
|
+
import ts28 from "typescript";
|
|
4748
4912
|
var TypeCheckShimGenerator = class {
|
|
4749
4913
|
constructor() {
|
|
4750
4914
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -4754,25 +4918,25 @@ var TypeCheckShimGenerator = class {
|
|
|
4754
4918
|
if (priorShimSf !== null) {
|
|
4755
4919
|
return priorShimSf;
|
|
4756
4920
|
}
|
|
4757
|
-
return
|
|
4921
|
+
return ts28.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts28.ScriptTarget.Latest, true, ts28.ScriptKind.TS);
|
|
4758
4922
|
}
|
|
4759
4923
|
static shimFor(fileName) {
|
|
4760
4924
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
4761
4925
|
}
|
|
4762
4926
|
};
|
|
4763
4927
|
|
|
4764
|
-
// bazel-out/
|
|
4765
|
-
import { BindingPipe, BindingType, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock
|
|
4766
|
-
import
|
|
4928
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
4929
|
+
import { BindingPipe, BindingType, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TransplantedType } from "@angular/compiler";
|
|
4930
|
+
import ts31 from "typescript";
|
|
4767
4931
|
|
|
4768
|
-
// bazel-out/
|
|
4932
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
4769
4933
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan4 } from "@angular/compiler";
|
|
4770
|
-
import
|
|
4934
|
+
import ts29 from "typescript";
|
|
4771
4935
|
function wrapForDiagnostics(expr) {
|
|
4772
|
-
return
|
|
4936
|
+
return ts29.factory.createParenthesizedExpression(expr);
|
|
4773
4937
|
}
|
|
4774
4938
|
function wrapForTypeChecker(expr) {
|
|
4775
|
-
return
|
|
4939
|
+
return ts29.factory.createParenthesizedExpression(expr);
|
|
4776
4940
|
}
|
|
4777
4941
|
function addParseSpanInfo(node, span) {
|
|
4778
4942
|
let commentText;
|
|
@@ -4781,10 +4945,10 @@ function addParseSpanInfo(node, span) {
|
|
|
4781
4945
|
} else {
|
|
4782
4946
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
4783
4947
|
}
|
|
4784
|
-
|
|
4948
|
+
ts29.addSyntheticTrailingComment(node, ts29.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
4785
4949
|
}
|
|
4786
4950
|
function addTemplateId(tcb, id) {
|
|
4787
|
-
|
|
4951
|
+
ts29.addSyntheticLeadingComment(tcb, ts29.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
4788
4952
|
}
|
|
4789
4953
|
function shouldReportDiagnostic(diagnostic) {
|
|
4790
4954
|
const { code } = diagnostic;
|
|
@@ -4811,34 +4975,34 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
4811
4975
|
return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
|
|
4812
4976
|
}
|
|
4813
4977
|
|
|
4814
|
-
// bazel-out/
|
|
4978
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
4815
4979
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
4816
|
-
import
|
|
4817
|
-
var NULL_AS_ANY =
|
|
4818
|
-
var UNDEFINED =
|
|
4980
|
+
import ts30 from "typescript";
|
|
4981
|
+
var NULL_AS_ANY = ts30.factory.createAsExpression(ts30.factory.createNull(), ts30.factory.createKeywordTypeNode(ts30.SyntaxKind.AnyKeyword));
|
|
4982
|
+
var UNDEFINED = ts30.factory.createIdentifier("undefined");
|
|
4819
4983
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
4820
|
-
["+",
|
|
4821
|
-
["-",
|
|
4984
|
+
["+", ts30.SyntaxKind.PlusToken],
|
|
4985
|
+
["-", ts30.SyntaxKind.MinusToken]
|
|
4822
4986
|
]);
|
|
4823
4987
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
4824
|
-
["+",
|
|
4825
|
-
["-",
|
|
4826
|
-
["<",
|
|
4827
|
-
[">",
|
|
4828
|
-
["<=",
|
|
4829
|
-
[">=",
|
|
4830
|
-
["==",
|
|
4831
|
-
["===",
|
|
4832
|
-
["*",
|
|
4833
|
-
["/",
|
|
4834
|
-
["%",
|
|
4835
|
-
["!=",
|
|
4836
|
-
["!==",
|
|
4837
|
-
["||",
|
|
4838
|
-
["&&",
|
|
4839
|
-
["&",
|
|
4840
|
-
["|",
|
|
4841
|
-
["??",
|
|
4988
|
+
["+", ts30.SyntaxKind.PlusToken],
|
|
4989
|
+
["-", ts30.SyntaxKind.MinusToken],
|
|
4990
|
+
["<", ts30.SyntaxKind.LessThanToken],
|
|
4991
|
+
[">", ts30.SyntaxKind.GreaterThanToken],
|
|
4992
|
+
["<=", ts30.SyntaxKind.LessThanEqualsToken],
|
|
4993
|
+
[">=", ts30.SyntaxKind.GreaterThanEqualsToken],
|
|
4994
|
+
["==", ts30.SyntaxKind.EqualsEqualsToken],
|
|
4995
|
+
["===", ts30.SyntaxKind.EqualsEqualsEqualsToken],
|
|
4996
|
+
["*", ts30.SyntaxKind.AsteriskToken],
|
|
4997
|
+
["/", ts30.SyntaxKind.SlashToken],
|
|
4998
|
+
["%", ts30.SyntaxKind.PercentToken],
|
|
4999
|
+
["!=", ts30.SyntaxKind.ExclamationEqualsToken],
|
|
5000
|
+
["!==", ts30.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
5001
|
+
["||", ts30.SyntaxKind.BarBarToken],
|
|
5002
|
+
["&&", ts30.SyntaxKind.AmpersandAmpersandToken],
|
|
5003
|
+
["&", ts30.SyntaxKind.AmpersandToken],
|
|
5004
|
+
["|", ts30.SyntaxKind.BarToken],
|
|
5005
|
+
["??", ts30.SyntaxKind.QuestionQuestionToken]
|
|
4842
5006
|
]);
|
|
4843
5007
|
function astToTypescript(ast, maybeResolve, config) {
|
|
4844
5008
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -4854,7 +5018,7 @@ var AstTranslator = class {
|
|
|
4854
5018
|
ast = ast.ast;
|
|
4855
5019
|
}
|
|
4856
5020
|
if (ast instanceof EmptyExpr2) {
|
|
4857
|
-
const res =
|
|
5021
|
+
const res = ts30.factory.createIdentifier("undefined");
|
|
4858
5022
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
4859
5023
|
return res;
|
|
4860
5024
|
}
|
|
@@ -4870,7 +5034,7 @@ var AstTranslator = class {
|
|
|
4870
5034
|
if (op === void 0) {
|
|
4871
5035
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
4872
5036
|
}
|
|
4873
|
-
const node = wrapForDiagnostics(
|
|
5037
|
+
const node = wrapForDiagnostics(ts30.factory.createPrefixUnaryExpression(op, expr));
|
|
4874
5038
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4875
5039
|
return node;
|
|
4876
5040
|
}
|
|
@@ -4881,13 +5045,13 @@ var AstTranslator = class {
|
|
|
4881
5045
|
if (op === void 0) {
|
|
4882
5046
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
4883
5047
|
}
|
|
4884
|
-
const node =
|
|
5048
|
+
const node = ts30.factory.createBinaryExpression(lhs, op, rhs);
|
|
4885
5049
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4886
5050
|
return node;
|
|
4887
5051
|
}
|
|
4888
5052
|
visitChain(ast) {
|
|
4889
5053
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
4890
|
-
const node = wrapForDiagnostics(
|
|
5054
|
+
const node = wrapForDiagnostics(ts30.factory.createCommaListExpression(elements));
|
|
4891
5055
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4892
5056
|
return node;
|
|
4893
5057
|
}
|
|
@@ -4895,7 +5059,7 @@ var AstTranslator = class {
|
|
|
4895
5059
|
const condExpr = this.translate(ast.condition);
|
|
4896
5060
|
const trueExpr = this.translate(ast.trueExp);
|
|
4897
5061
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
4898
|
-
const node =
|
|
5062
|
+
const node = ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
4899
5063
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4900
5064
|
return node;
|
|
4901
5065
|
}
|
|
@@ -4906,26 +5070,26 @@ var AstTranslator = class {
|
|
|
4906
5070
|
throw new Error("Method not implemented.");
|
|
4907
5071
|
}
|
|
4908
5072
|
visitInterpolation(ast) {
|
|
4909
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
5073
|
+
return ast.expressions.reduce((lhs, ast2) => ts30.factory.createBinaryExpression(lhs, ts30.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts30.factory.createStringLiteral(""));
|
|
4910
5074
|
}
|
|
4911
5075
|
visitKeyedRead(ast) {
|
|
4912
5076
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4913
5077
|
const key = this.translate(ast.key);
|
|
4914
|
-
const node =
|
|
5078
|
+
const node = ts30.factory.createElementAccessExpression(receiver, key);
|
|
4915
5079
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4916
5080
|
return node;
|
|
4917
5081
|
}
|
|
4918
5082
|
visitKeyedWrite(ast) {
|
|
4919
5083
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4920
|
-
const left =
|
|
5084
|
+
const left = ts30.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
4921
5085
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
4922
|
-
const node = wrapForDiagnostics(
|
|
5086
|
+
const node = wrapForDiagnostics(ts30.factory.createBinaryExpression(left, ts30.SyntaxKind.EqualsToken, right));
|
|
4923
5087
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4924
5088
|
return node;
|
|
4925
5089
|
}
|
|
4926
5090
|
visitLiteralArray(ast) {
|
|
4927
5091
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
4928
|
-
const literal =
|
|
5092
|
+
const literal = ts30.factory.createArrayLiteralExpression(elements);
|
|
4929
5093
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
4930
5094
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4931
5095
|
return node;
|
|
@@ -4933,9 +5097,9 @@ var AstTranslator = class {
|
|
|
4933
5097
|
visitLiteralMap(ast) {
|
|
4934
5098
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
4935
5099
|
const value = this.translate(ast.values[idx]);
|
|
4936
|
-
return
|
|
5100
|
+
return ts30.factory.createPropertyAssignment(ts30.factory.createStringLiteral(key), value);
|
|
4937
5101
|
});
|
|
4938
|
-
const literal =
|
|
5102
|
+
const literal = ts30.factory.createObjectLiteralExpression(properties, true);
|
|
4939
5103
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
4940
5104
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4941
5105
|
return node;
|
|
@@ -4943,15 +5107,15 @@ var AstTranslator = class {
|
|
|
4943
5107
|
visitLiteralPrimitive(ast) {
|
|
4944
5108
|
let node;
|
|
4945
5109
|
if (ast.value === void 0) {
|
|
4946
|
-
node =
|
|
5110
|
+
node = ts30.factory.createIdentifier("undefined");
|
|
4947
5111
|
} else if (ast.value === null) {
|
|
4948
|
-
node =
|
|
5112
|
+
node = ts30.factory.createNull();
|
|
4949
5113
|
} else if (typeof ast.value === "string") {
|
|
4950
|
-
node =
|
|
5114
|
+
node = ts30.factory.createStringLiteral(ast.value);
|
|
4951
5115
|
} else if (typeof ast.value === "number") {
|
|
4952
5116
|
node = tsNumericExpression(ast.value);
|
|
4953
5117
|
} else if (typeof ast.value === "boolean") {
|
|
4954
|
-
node = ast.value ?
|
|
5118
|
+
node = ast.value ? ts30.factory.createTrue() : ts30.factory.createFalse();
|
|
4955
5119
|
} else {
|
|
4956
5120
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
4957
5121
|
}
|
|
@@ -4960,7 +5124,7 @@ var AstTranslator = class {
|
|
|
4960
5124
|
}
|
|
4961
5125
|
visitNonNullAssert(ast) {
|
|
4962
5126
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
4963
|
-
const node =
|
|
5127
|
+
const node = ts30.factory.createNonNullExpression(expr);
|
|
4964
5128
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4965
5129
|
return node;
|
|
4966
5130
|
}
|
|
@@ -4969,13 +5133,13 @@ var AstTranslator = class {
|
|
|
4969
5133
|
}
|
|
4970
5134
|
visitPrefixNot(ast) {
|
|
4971
5135
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
4972
|
-
const node =
|
|
5136
|
+
const node = ts30.factory.createLogicalNot(expression);
|
|
4973
5137
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4974
5138
|
return node;
|
|
4975
5139
|
}
|
|
4976
5140
|
visitPropertyRead(ast) {
|
|
4977
5141
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4978
|
-
const name =
|
|
5142
|
+
const name = ts30.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
4979
5143
|
addParseSpanInfo(name, ast.nameSpan);
|
|
4980
5144
|
const node = wrapForDiagnostics(name);
|
|
4981
5145
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -4983,12 +5147,12 @@ var AstTranslator = class {
|
|
|
4983
5147
|
}
|
|
4984
5148
|
visitPropertyWrite(ast) {
|
|
4985
5149
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4986
|
-
const left =
|
|
5150
|
+
const left = ts30.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
4987
5151
|
addParseSpanInfo(left, ast.nameSpan);
|
|
4988
5152
|
const leftWithPath = wrapForDiagnostics(left);
|
|
4989
5153
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
4990
5154
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
4991
|
-
const node = wrapForDiagnostics(
|
|
5155
|
+
const node = wrapForDiagnostics(ts30.factory.createBinaryExpression(leftWithPath, ts30.SyntaxKind.EqualsToken, right));
|
|
4992
5156
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4993
5157
|
return node;
|
|
4994
5158
|
}
|
|
@@ -4996,13 +5160,13 @@ var AstTranslator = class {
|
|
|
4996
5160
|
let node;
|
|
4997
5161
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
4998
5162
|
if (this.config.strictSafeNavigationTypes) {
|
|
4999
|
-
const expr =
|
|
5163
|
+
const expr = ts30.factory.createPropertyAccessExpression(ts30.factory.createNonNullExpression(receiver), ast.name);
|
|
5000
5164
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
5001
|
-
node =
|
|
5165
|
+
node = ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
5002
5166
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
5003
|
-
node =
|
|
5167
|
+
node = ts30.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
5004
5168
|
} else {
|
|
5005
|
-
const expr =
|
|
5169
|
+
const expr = ts30.factory.createPropertyAccessExpression(ts30.factory.createNonNullExpression(receiver), ast.name);
|
|
5006
5170
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
5007
5171
|
node = tsCastToAny(expr);
|
|
5008
5172
|
}
|
|
@@ -5014,13 +5178,13 @@ var AstTranslator = class {
|
|
|
5014
5178
|
const key = this.translate(ast.key);
|
|
5015
5179
|
let node;
|
|
5016
5180
|
if (this.config.strictSafeNavigationTypes) {
|
|
5017
|
-
const expr =
|
|
5181
|
+
const expr = ts30.factory.createElementAccessExpression(ts30.factory.createNonNullExpression(receiver), key);
|
|
5018
5182
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
5019
|
-
node =
|
|
5183
|
+
node = ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
5020
5184
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
5021
|
-
node =
|
|
5185
|
+
node = ts30.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
5022
5186
|
} else {
|
|
5023
|
-
const expr =
|
|
5187
|
+
const expr = ts30.factory.createElementAccessExpression(ts30.factory.createNonNullExpression(receiver), key);
|
|
5024
5188
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
5025
5189
|
node = tsCastToAny(expr);
|
|
5026
5190
|
}
|
|
@@ -5037,7 +5201,7 @@ var AstTranslator = class {
|
|
|
5037
5201
|
expr = resolved;
|
|
5038
5202
|
} else {
|
|
5039
5203
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
5040
|
-
expr =
|
|
5204
|
+
expr = ts30.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
5041
5205
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
5042
5206
|
}
|
|
5043
5207
|
} else {
|
|
@@ -5047,7 +5211,7 @@ var AstTranslator = class {
|
|
|
5047
5211
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
5048
5212
|
node = this.convertToSafeCall(ast, expr, args);
|
|
5049
5213
|
} else {
|
|
5050
|
-
node =
|
|
5214
|
+
node = ts30.factory.createCallExpression(expr, void 0, args);
|
|
5051
5215
|
}
|
|
5052
5216
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
5053
5217
|
return node;
|
|
@@ -5061,13 +5225,13 @@ var AstTranslator = class {
|
|
|
5061
5225
|
}
|
|
5062
5226
|
convertToSafeCall(ast, expr, args) {
|
|
5063
5227
|
if (this.config.strictSafeNavigationTypes) {
|
|
5064
|
-
const call =
|
|
5065
|
-
return
|
|
5228
|
+
const call = ts30.factory.createCallExpression(ts30.factory.createNonNullExpression(expr), void 0, args);
|
|
5229
|
+
return ts30.factory.createParenthesizedExpression(ts30.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
5066
5230
|
}
|
|
5067
5231
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
5068
|
-
return
|
|
5232
|
+
return ts30.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
5069
5233
|
}
|
|
5070
|
-
return tsCastToAny(
|
|
5234
|
+
return tsCastToAny(ts30.factory.createCallExpression(ts30.factory.createNonNullExpression(expr), void 0, args));
|
|
5071
5235
|
}
|
|
5072
5236
|
};
|
|
5073
5237
|
var _VeSafeLhsInferenceBugDetector = class {
|
|
@@ -5144,7 +5308,7 @@ var VeSafeLhsInferenceBugDetector = _VeSafeLhsInferenceBugDetector;
|
|
|
5144
5308
|
_VeSafeLhsInferenceBugDetector.SINGLETON = new _VeSafeLhsInferenceBugDetector();
|
|
5145
5309
|
})();
|
|
5146
5310
|
|
|
5147
|
-
// bazel-out/
|
|
5311
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
5148
5312
|
var TcbGenericContextBehavior;
|
|
5149
5313
|
(function(TcbGenericContextBehavior2) {
|
|
5150
5314
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
@@ -5155,7 +5319,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
5155
5319
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
|
|
5156
5320
|
const scope = Scope.forNodes(tcb, null, null, tcb.boundTarget.target.template, null);
|
|
5157
5321
|
const ctxRawType = env.referenceType(ref);
|
|
5158
|
-
if (!
|
|
5322
|
+
if (!ts31.isTypeReferenceNode(ctxRawType)) {
|
|
5159
5323
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
5160
5324
|
}
|
|
5161
5325
|
let typeParameters = void 0;
|
|
@@ -5167,25 +5331,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
5167
5331
|
switch (genericContextBehavior) {
|
|
5168
5332
|
case TcbGenericContextBehavior.UseEmitter:
|
|
5169
5333
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
5170
|
-
typeArguments = typeParameters.map((param) =>
|
|
5334
|
+
typeArguments = typeParameters.map((param) => ts31.factory.createTypeReferenceNode(param.name));
|
|
5171
5335
|
break;
|
|
5172
5336
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
5173
5337
|
typeParameters = [...ref.node.typeParameters];
|
|
5174
|
-
typeArguments = typeParameters.map((param) =>
|
|
5338
|
+
typeArguments = typeParameters.map((param) => ts31.factory.createTypeReferenceNode(param.name));
|
|
5175
5339
|
break;
|
|
5176
5340
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
5177
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
5341
|
+
typeArguments = ref.node.typeParameters.map(() => ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5178
5342
|
break;
|
|
5179
5343
|
}
|
|
5180
5344
|
}
|
|
5181
5345
|
const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
|
|
5182
5346
|
const scopeStatements = scope.render();
|
|
5183
|
-
const innerBody =
|
|
5347
|
+
const innerBody = ts31.factory.createBlock([
|
|
5184
5348
|
...env.getPreludeStatements(),
|
|
5185
5349
|
...scopeStatements
|
|
5186
5350
|
]);
|
|
5187
|
-
const body =
|
|
5188
|
-
const fnDecl =
|
|
5351
|
+
const body = ts31.factory.createBlock([ts31.factory.createIfStatement(ts31.factory.createTrue(), innerBody, void 0)]);
|
|
5352
|
+
const fnDecl = ts31.factory.createFunctionDeclaration(
|
|
5189
5353
|
void 0,
|
|
5190
5354
|
void 0,
|
|
5191
5355
|
name,
|
|
@@ -5234,7 +5398,7 @@ var TcbTemplateVariableOp = class extends TcbOp {
|
|
|
5234
5398
|
execute() {
|
|
5235
5399
|
const ctx = this.scope.resolve(this.template);
|
|
5236
5400
|
const id = this.tcb.allocateId();
|
|
5237
|
-
const initializer =
|
|
5401
|
+
const initializer = ts31.factory.createPropertyAccessExpression(
|
|
5238
5402
|
ctx,
|
|
5239
5403
|
this.variable.value || "$implicit"
|
|
5240
5404
|
);
|
|
@@ -5260,7 +5424,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
5260
5424
|
}
|
|
5261
5425
|
execute() {
|
|
5262
5426
|
const ctx = this.tcb.allocateId();
|
|
5263
|
-
const type =
|
|
5427
|
+
const type = ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword);
|
|
5264
5428
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
5265
5429
|
return ctx;
|
|
5266
5430
|
}
|
|
@@ -5313,16 +5477,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
5313
5477
|
}
|
|
5314
5478
|
let guard = null;
|
|
5315
5479
|
if (directiveGuards.length > 0) {
|
|
5316
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
5480
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts31.factory.createBinaryExpression(expr, ts31.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
5317
5481
|
}
|
|
5318
5482
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, this.template.children, guard);
|
|
5319
5483
|
const statements = tmplScope.render();
|
|
5320
5484
|
if (statements.length === 0) {
|
|
5321
5485
|
return null;
|
|
5322
5486
|
}
|
|
5323
|
-
let tmplBlock =
|
|
5487
|
+
let tmplBlock = ts31.factory.createBlock(statements);
|
|
5324
5488
|
if (guard !== null) {
|
|
5325
|
-
tmplBlock =
|
|
5489
|
+
tmplBlock = ts31.factory.createIfStatement(guard, tmplBlock);
|
|
5326
5490
|
}
|
|
5327
5491
|
this.scope.addStatement(tmplBlock);
|
|
5328
5492
|
return null;
|
|
@@ -5340,7 +5504,7 @@ var TcbExpressionOp = class extends TcbOp {
|
|
|
5340
5504
|
}
|
|
5341
5505
|
execute() {
|
|
5342
5506
|
const expr = tcbExpression(this.expression, this.tcb, this.scope);
|
|
5343
|
-
this.scope.addStatement(
|
|
5507
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(expr));
|
|
5344
5508
|
return null;
|
|
5345
5509
|
}
|
|
5346
5510
|
};
|
|
@@ -5362,11 +5526,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
5362
5526
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
5363
5527
|
type = rawType;
|
|
5364
5528
|
} else {
|
|
5365
|
-
if (!
|
|
5529
|
+
if (!ts31.isTypeReferenceNode(rawType)) {
|
|
5366
5530
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
5367
5531
|
}
|
|
5368
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
5369
|
-
type =
|
|
5532
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5533
|
+
type = ts31.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
5370
5534
|
}
|
|
5371
5535
|
const id = this.tcb.allocateId();
|
|
5372
5536
|
addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -5407,11 +5571,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
5407
5571
|
const id = this.tcb.allocateId();
|
|
5408
5572
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
5409
5573
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
5410
|
-
initializer =
|
|
5574
|
+
initializer = ts31.factory.createAsExpression(initializer, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5411
5575
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
5412
|
-
initializer =
|
|
5413
|
-
initializer =
|
|
5414
|
-
initializer =
|
|
5576
|
+
initializer = ts31.factory.createAsExpression(initializer, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
5577
|
+
initializer = ts31.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
5578
|
+
initializer = ts31.factory.createParenthesizedExpression(initializer);
|
|
5415
5579
|
}
|
|
5416
5580
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
5417
5581
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -5510,7 +5674,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5510
5674
|
type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
|
|
5511
5675
|
} else {
|
|
5512
5676
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
5513
|
-
if (!
|
|
5677
|
+
if (!ts31.isTypeReferenceNode(dirTypeRef)) {
|
|
5514
5678
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
5515
5679
|
}
|
|
5516
5680
|
type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
|
|
@@ -5526,10 +5690,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5526
5690
|
}
|
|
5527
5691
|
const id = this.tcb.allocateId();
|
|
5528
5692
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
5529
|
-
if (!
|
|
5693
|
+
if (!ts31.isTypeReferenceNode(dirTypeRef)) {
|
|
5530
5694
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
5531
5695
|
}
|
|
5532
|
-
const type =
|
|
5696
|
+
const type = ts31.factory.createIndexedAccessTypeNode(ts31.factory.createTypeQueryNode(dirId), ts31.factory.createLiteralTypeNode(ts31.factory.createStringLiteral(fieldName)));
|
|
5533
5697
|
const temp = tsDeclareVariable(id, type);
|
|
5534
5698
|
this.scope.addStatement(temp);
|
|
5535
5699
|
target = id;
|
|
@@ -5537,14 +5701,14 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5537
5701
|
if (dirId === null) {
|
|
5538
5702
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
5539
5703
|
}
|
|
5540
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
5704
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts31.factory.createElementAccessExpression(dirId, ts31.factory.createStringLiteral(fieldName)) : ts31.factory.createPropertyAccessExpression(dirId, ts31.factory.createIdentifier(fieldName));
|
|
5541
5705
|
}
|
|
5542
5706
|
if (isSignal) {
|
|
5543
5707
|
const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(R3Identifiers3.InputSignalBrandWriteType.moduleName, R3Identifiers3.InputSignalBrandWriteType.name);
|
|
5544
|
-
if (!
|
|
5708
|
+
if (!ts31.isIdentifier(inputSignalBrandWriteSymbol) && !ts31.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
|
|
5545
5709
|
throw new Error(`Expected identifier or property access for reference to ${R3Identifiers3.InputSignalBrandWriteType.name}`);
|
|
5546
5710
|
}
|
|
5547
|
-
target =
|
|
5711
|
+
target = ts31.factory.createElementAccessExpression(target, inputSignalBrandWriteSymbol);
|
|
5548
5712
|
}
|
|
5549
5713
|
if (attr.attribute.keySpan !== void 0) {
|
|
5550
5714
|
addParseSpanInfo(target, attr.attribute.keySpan);
|
|
@@ -5552,13 +5716,13 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
5552
5716
|
if (isTwoWayBinding && this.tcb.env.config.allowSignalsInTwoWayBindings) {
|
|
5553
5717
|
assignment = unwrapWritableSignal(assignment, this.tcb);
|
|
5554
5718
|
}
|
|
5555
|
-
assignment =
|
|
5719
|
+
assignment = ts31.factory.createBinaryExpression(target, ts31.SyntaxKind.EqualsToken, assignment);
|
|
5556
5720
|
}
|
|
5557
5721
|
addParseSpanInfo(assignment, attr.attribute.sourceSpan);
|
|
5558
5722
|
if (!this.tcb.env.config.checkTypeOfAttributes && attr.attribute instanceof TmplAstTextAttribute2) {
|
|
5559
5723
|
markIgnoreDiagnostics(assignment);
|
|
5560
5724
|
}
|
|
5561
|
-
this.scope.addStatement(
|
|
5725
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(assignment));
|
|
5562
5726
|
}
|
|
5563
5727
|
this.checkRequiredInputs(seenRequiredInputs);
|
|
5564
5728
|
return null;
|
|
@@ -5589,7 +5753,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
5589
5753
|
execute() {
|
|
5590
5754
|
const id = this.tcb.allocateId();
|
|
5591
5755
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
5592
|
-
const circularPlaceholder =
|
|
5756
|
+
const circularPlaceholder = ts31.factory.createCallExpression(typeCtor, void 0, [ts31.factory.createNonNullExpression(ts31.factory.createNull())]);
|
|
5593
5757
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
5594
5758
|
return id;
|
|
5595
5759
|
}
|
|
@@ -5631,7 +5795,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5631
5795
|
this.ngContentSelectors = ngContentSelectors;
|
|
5632
5796
|
this.componentName = componentName;
|
|
5633
5797
|
this.optional = false;
|
|
5634
|
-
this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ?
|
|
5798
|
+
this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts31.DiagnosticCategory.Error : ts31.DiagnosticCategory.Warning;
|
|
5635
5799
|
}
|
|
5636
5800
|
execute() {
|
|
5637
5801
|
const controlFlowToCheck = this.findPotentialControlFlowNodes();
|
|
@@ -5657,8 +5821,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5657
5821
|
findPotentialControlFlowNodes() {
|
|
5658
5822
|
const result = [];
|
|
5659
5823
|
for (const child of this.element.children) {
|
|
5660
|
-
|
|
5661
|
-
if (child instanceof TmplAstForLoopBlock2) {
|
|
5824
|
+
if (child instanceof TmplAstForLoopBlock) {
|
|
5662
5825
|
if (this.shouldCheck(child)) {
|
|
5663
5826
|
result.push(child);
|
|
5664
5827
|
}
|
|
@@ -5666,19 +5829,17 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5666
5829
|
result.push(child.empty);
|
|
5667
5830
|
}
|
|
5668
5831
|
} else if (child instanceof TmplAstIfBlock) {
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5832
|
+
for (const branch of child.branches) {
|
|
5833
|
+
if (this.shouldCheck(branch)) {
|
|
5834
|
+
result.push(branch);
|
|
5835
|
+
}
|
|
5836
|
+
}
|
|
5837
|
+
} else if (child instanceof TmplAstSwitchBlock) {
|
|
5838
|
+
for (const current of child.cases) {
|
|
5839
|
+
if (this.shouldCheck(current)) {
|
|
5840
|
+
result.push(current);
|
|
5841
|
+
}
|
|
5677
5842
|
}
|
|
5678
|
-
return count;
|
|
5679
|
-
}, 0);
|
|
5680
|
-
if (rootNodeCount > 1) {
|
|
5681
|
-
result.push(eligibleNode);
|
|
5682
5843
|
}
|
|
5683
5844
|
}
|
|
5684
5845
|
return result;
|
|
@@ -5687,13 +5848,16 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
5687
5848
|
if (node.children.length < 2) {
|
|
5688
5849
|
return false;
|
|
5689
5850
|
}
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5851
|
+
let hasSeenRootNode = false;
|
|
5852
|
+
for (const child of node.children) {
|
|
5853
|
+
if (!(child instanceof TmplAstText) || this.tcb.hostPreserveWhitespaces || child.value.trim().length > 0) {
|
|
5854
|
+
if (hasSeenRootNode) {
|
|
5855
|
+
return true;
|
|
5856
|
+
}
|
|
5857
|
+
hasSeenRootNode = true;
|
|
5693
5858
|
}
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
return rootNodeCount > 1;
|
|
5859
|
+
}
|
|
5860
|
+
return false;
|
|
5697
5861
|
}
|
|
5698
5862
|
};
|
|
5699
5863
|
var ATTR_TO_PROP = new Map(Object.entries({
|
|
@@ -5730,15 +5894,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
5730
5894
|
elId = this.scope.resolve(this.element);
|
|
5731
5895
|
}
|
|
5732
5896
|
const propertyName = (_a = ATTR_TO_PROP.get(binding.name)) != null ? _a : binding.name;
|
|
5733
|
-
const prop =
|
|
5734
|
-
const stmt =
|
|
5897
|
+
const prop = ts31.factory.createElementAccessExpression(elId, ts31.factory.createStringLiteral(propertyName));
|
|
5898
|
+
const stmt = ts31.factory.createBinaryExpression(prop, ts31.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
5735
5899
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
5736
|
-
this.scope.addStatement(
|
|
5900
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(stmt));
|
|
5737
5901
|
} else {
|
|
5738
|
-
this.scope.addStatement(
|
|
5902
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(expr));
|
|
5739
5903
|
}
|
|
5740
5904
|
} else {
|
|
5741
|
-
this.scope.addStatement(
|
|
5905
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(expr));
|
|
5742
5906
|
}
|
|
5743
5907
|
}
|
|
5744
5908
|
return null;
|
|
@@ -5770,18 +5934,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
5770
5934
|
if (dirId === null) {
|
|
5771
5935
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
5772
5936
|
}
|
|
5773
|
-
const outputField =
|
|
5937
|
+
const outputField = ts31.factory.createElementAccessExpression(dirId, ts31.factory.createStringLiteral(field));
|
|
5774
5938
|
addParseSpanInfo(outputField, output.keySpan);
|
|
5775
5939
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
5776
5940
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
5777
|
-
const subscribeFn =
|
|
5778
|
-
const call =
|
|
5941
|
+
const subscribeFn = ts31.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
5942
|
+
const call = ts31.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
5779
5943
|
addParseSpanInfo(call, output.sourceSpan);
|
|
5780
|
-
this.scope.addStatement(
|
|
5944
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(call));
|
|
5781
5945
|
} else {
|
|
5782
|
-
this.scope.addStatement(
|
|
5946
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(outputField));
|
|
5783
5947
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
5784
|
-
this.scope.addStatement(
|
|
5948
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(handler));
|
|
5785
5949
|
}
|
|
5786
5950
|
}
|
|
5787
5951
|
return null;
|
|
@@ -5813,24 +5977,24 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
5813
5977
|
if (output.type === ParsedEventType.Animation) {
|
|
5814
5978
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
5815
5979
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
5816
|
-
this.scope.addStatement(
|
|
5980
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(handler));
|
|
5817
5981
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
5818
5982
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
5819
5983
|
if (elId === null) {
|
|
5820
5984
|
elId = this.scope.resolve(this.element);
|
|
5821
5985
|
}
|
|
5822
|
-
const propertyAccess =
|
|
5986
|
+
const propertyAccess = ts31.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
5823
5987
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
5824
|
-
const call =
|
|
5988
|
+
const call = ts31.factory.createCallExpression(
|
|
5825
5989
|
propertyAccess,
|
|
5826
5990
|
void 0,
|
|
5827
|
-
[
|
|
5991
|
+
[ts31.factory.createStringLiteral(output.name), handler]
|
|
5828
5992
|
);
|
|
5829
5993
|
addParseSpanInfo(call, output.sourceSpan);
|
|
5830
|
-
this.scope.addStatement(
|
|
5994
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(call));
|
|
5831
5995
|
} else {
|
|
5832
5996
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
5833
|
-
this.scope.addStatement(
|
|
5997
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(handler));
|
|
5834
5998
|
}
|
|
5835
5999
|
}
|
|
5836
6000
|
return null;
|
|
@@ -5843,11 +6007,11 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
5843
6007
|
this.optional = false;
|
|
5844
6008
|
}
|
|
5845
6009
|
execute() {
|
|
5846
|
-
const ctx =
|
|
5847
|
-
const ctxDot =
|
|
6010
|
+
const ctx = ts31.factory.createThis();
|
|
6011
|
+
const ctxDot = ts31.factory.createPropertyAccessExpression(ctx, "");
|
|
5848
6012
|
markIgnoreDiagnostics(ctxDot);
|
|
5849
6013
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
5850
|
-
this.scope.addStatement(
|
|
6014
|
+
this.scope.addStatement(ts31.factory.createExpressionStatement(ctxDot));
|
|
5851
6015
|
return null;
|
|
5852
6016
|
}
|
|
5853
6017
|
};
|
|
@@ -5912,14 +6076,14 @@ var TcbIfOp = class extends TcbOp {
|
|
|
5912
6076
|
}
|
|
5913
6077
|
if (branch.expression === null) {
|
|
5914
6078
|
const branchScope = Scope.forNodes(this.tcb, this.scope, null, branch.children, this.generateBranchGuard(index));
|
|
5915
|
-
return
|
|
6079
|
+
return ts31.factory.createBlock(branchScope.render());
|
|
5916
6080
|
}
|
|
5917
6081
|
const expressionScope = Scope.forNodes(this.tcb, this.scope, branch, [], null);
|
|
5918
6082
|
expressionScope.render().forEach((stmt) => this.scope.addStatement(stmt));
|
|
5919
6083
|
this.expressionScopes.set(branch, expressionScope);
|
|
5920
6084
|
const expression = branch.expressionAlias === null ? tcbExpression(branch.expression, this.tcb, expressionScope) : expressionScope.resolve(branch.expressionAlias);
|
|
5921
6085
|
const bodyScope = Scope.forNodes(this.tcb, expressionScope, null, branch.children, this.generateBranchGuard(index));
|
|
5922
|
-
return
|
|
6086
|
+
return ts31.factory.createIfStatement(expression, ts31.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
|
|
5923
6087
|
}
|
|
5924
6088
|
generateBranchGuard(index) {
|
|
5925
6089
|
let guard = null;
|
|
@@ -5939,8 +6103,8 @@ var TcbIfOp = class extends TcbOp {
|
|
|
5939
6103
|
} else {
|
|
5940
6104
|
expression = expressionScope.resolve(branch.expressionAlias);
|
|
5941
6105
|
}
|
|
5942
|
-
const comparisonExpression = i === index ? expression :
|
|
5943
|
-
guard = guard === null ? comparisonExpression :
|
|
6106
|
+
const comparisonExpression = i === index ? expression : ts31.factory.createPrefixUnaryExpression(ts31.SyntaxKind.ExclamationToken, ts31.factory.createParenthesizedExpression(expression));
|
|
6107
|
+
guard = guard === null ? comparisonExpression : ts31.factory.createBinaryExpression(guard, ts31.SyntaxKind.AmpersandAmpersandToken, comparisonExpression);
|
|
5944
6108
|
}
|
|
5945
6109
|
return guard;
|
|
5946
6110
|
}
|
|
@@ -5956,36 +6120,20 @@ var TcbSwitchOp = class extends TcbOp {
|
|
|
5956
6120
|
return false;
|
|
5957
6121
|
}
|
|
5958
6122
|
execute() {
|
|
5959
|
-
const
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
6123
|
+
const switchExpression = tcbExpression(this.block.expression, this.tcb, this.scope);
|
|
6124
|
+
const clauses = this.block.cases.map((current) => {
|
|
6125
|
+
const clauseScope = Scope.forNodes(this.tcb, this.scope, null, current.children, this.generateGuard(current, switchExpression));
|
|
6126
|
+
const statements = [...clauseScope.render(), ts31.factory.createBreakStatement()];
|
|
6127
|
+
return current.expression === null ? ts31.factory.createDefaultClause(statements) : ts31.factory.createCaseClause(tcbExpression(current.expression, this.tcb, clauseScope), statements);
|
|
6128
|
+
});
|
|
6129
|
+
this.scope.addStatement(ts31.factory.createSwitchStatement(switchExpression, ts31.factory.createCaseBlock(clauses)));
|
|
5966
6130
|
return null;
|
|
5967
6131
|
}
|
|
5968
|
-
generateCase(index, switchValue, defaultCase) {
|
|
5969
|
-
if (index >= this.block.cases.length) {
|
|
5970
|
-
if (defaultCase !== null) {
|
|
5971
|
-
const defaultScope = Scope.forNodes(this.tcb, this.scope, null, defaultCase.children, this.generateGuard(defaultCase, switchValue));
|
|
5972
|
-
return ts29.factory.createBlock(defaultScope.render());
|
|
5973
|
-
}
|
|
5974
|
-
return void 0;
|
|
5975
|
-
}
|
|
5976
|
-
const current = this.block.cases[index];
|
|
5977
|
-
if (current.expression === null) {
|
|
5978
|
-
return this.generateCase(index + 1, switchValue, current);
|
|
5979
|
-
}
|
|
5980
|
-
const caseScope = Scope.forNodes(this.tcb, this.scope, null, current.children, this.generateGuard(current, switchValue));
|
|
5981
|
-
const caseValue = tcbExpression(current.expression, this.tcb, caseScope);
|
|
5982
|
-
return ts29.factory.createIfStatement(ts29.factory.createBinaryExpression(switchValue, ts29.SyntaxKind.EqualsEqualsEqualsToken, caseValue), ts29.factory.createBlock(caseScope.render()), this.generateCase(index + 1, switchValue, defaultCase));
|
|
5983
|
-
}
|
|
5984
6132
|
generateGuard(node, switchValue) {
|
|
5985
6133
|
if (node.expression !== null) {
|
|
5986
6134
|
const expression = tcbExpression(node.expression, this.tcb, this.scope);
|
|
5987
6135
|
markIgnoreDiagnostics(expression);
|
|
5988
|
-
return
|
|
6136
|
+
return ts31.factory.createBinaryExpression(switchValue, ts31.SyntaxKind.EqualsEqualsEqualsToken, expression);
|
|
5989
6137
|
}
|
|
5990
6138
|
let guard = null;
|
|
5991
6139
|
for (const current of this.block.cases) {
|
|
@@ -5994,11 +6142,11 @@ var TcbSwitchOp = class extends TcbOp {
|
|
|
5994
6142
|
}
|
|
5995
6143
|
const expression = tcbExpression(current.expression, this.tcb, this.scope);
|
|
5996
6144
|
markIgnoreDiagnostics(expression);
|
|
5997
|
-
const comparison =
|
|
6145
|
+
const comparison = ts31.factory.createBinaryExpression(switchValue, ts31.SyntaxKind.ExclamationEqualsEqualsToken, expression);
|
|
5998
6146
|
if (guard === null) {
|
|
5999
6147
|
guard = comparison;
|
|
6000
6148
|
} else {
|
|
6001
|
-
guard =
|
|
6149
|
+
guard = ts31.factory.createBinaryExpression(guard, ts31.SyntaxKind.AmpersandAmpersandToken, comparison);
|
|
6002
6150
|
}
|
|
6003
6151
|
}
|
|
6004
6152
|
return guard;
|
|
@@ -6017,23 +6165,23 @@ var TcbForOfOp = class extends TcbOp {
|
|
|
6017
6165
|
execute() {
|
|
6018
6166
|
const loopScope = Scope.forNodes(this.tcb, this.scope, this.block, this.block.children, null);
|
|
6019
6167
|
const initializerId = loopScope.resolve(this.block.item);
|
|
6020
|
-
if (!
|
|
6168
|
+
if (!ts31.isIdentifier(initializerId)) {
|
|
6021
6169
|
throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
|
|
6022
6170
|
}
|
|
6023
|
-
const initializer =
|
|
6171
|
+
const initializer = ts31.factory.createVariableDeclarationList([ts31.factory.createVariableDeclaration(initializerId)], ts31.NodeFlags.Const);
|
|
6024
6172
|
addParseSpanInfo(initializer, this.block.item.keySpan);
|
|
6025
|
-
const expression =
|
|
6173
|
+
const expression = ts31.factory.createNonNullExpression(tcbExpression(this.block.expression, this.tcb, loopScope));
|
|
6026
6174
|
const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
|
|
6027
6175
|
const trackExpression = trackTranslator.translate(this.block.trackBy);
|
|
6028
6176
|
const statements = [
|
|
6029
6177
|
...loopScope.render(),
|
|
6030
|
-
|
|
6178
|
+
ts31.factory.createExpressionStatement(trackExpression)
|
|
6031
6179
|
];
|
|
6032
|
-
this.scope.addStatement(
|
|
6180
|
+
this.scope.addStatement(ts31.factory.createForOfStatement(void 0, initializer, expression, ts31.factory.createBlock(statements)));
|
|
6033
6181
|
return null;
|
|
6034
6182
|
}
|
|
6035
6183
|
};
|
|
6036
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
6184
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts31.factory.createNonNullExpression(ts31.factory.createNull());
|
|
6037
6185
|
var Context = class {
|
|
6038
6186
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
|
|
6039
6187
|
this.env = env;
|
|
@@ -6048,7 +6196,7 @@ var Context = class {
|
|
|
6048
6196
|
this.nextId = 1;
|
|
6049
6197
|
}
|
|
6050
6198
|
allocateId() {
|
|
6051
|
-
return
|
|
6199
|
+
return ts31.factory.createIdentifier(`_t${this.nextId++}`);
|
|
6052
6200
|
}
|
|
6053
6201
|
getPipeByName(name) {
|
|
6054
6202
|
if (!this.pipes.has(name)) {
|
|
@@ -6091,15 +6239,15 @@ var _Scope = class {
|
|
|
6091
6239
|
if (expression !== null && expressionAlias !== null) {
|
|
6092
6240
|
this.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
|
|
6093
6241
|
}
|
|
6094
|
-
} else if (scopedNode instanceof
|
|
6242
|
+
} else if (scopedNode instanceof TmplAstForLoopBlock) {
|
|
6095
6243
|
const loopInitializer = tcb.allocateId();
|
|
6096
6244
|
addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
|
|
6097
6245
|
scope.varMap.set(scopedNode.item, loopInitializer);
|
|
6098
|
-
for (const
|
|
6099
|
-
if (!this.forLoopContextVariableTypes.has(
|
|
6100
|
-
throw new Error(`Unrecognized for loop context variable ${name}`);
|
|
6246
|
+
for (const variable of scopedNode.contextVariables) {
|
|
6247
|
+
if (!this.forLoopContextVariableTypes.has(variable.value)) {
|
|
6248
|
+
throw new Error(`Unrecognized for loop context variable ${variable.name}`);
|
|
6101
6249
|
}
|
|
6102
|
-
const type =
|
|
6250
|
+
const type = ts31.factory.createKeywordTypeNode(this.forLoopContextVariableTypes.get(variable.value));
|
|
6103
6251
|
this.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
|
|
6104
6252
|
}
|
|
6105
6253
|
}
|
|
@@ -6116,16 +6264,16 @@ var _Scope = class {
|
|
|
6116
6264
|
const res = this.resolveLocal(node, directive);
|
|
6117
6265
|
if (res !== null) {
|
|
6118
6266
|
let clone;
|
|
6119
|
-
if (
|
|
6120
|
-
clone =
|
|
6121
|
-
} else if (
|
|
6122
|
-
clone =
|
|
6267
|
+
if (ts31.isIdentifier(res)) {
|
|
6268
|
+
clone = ts31.factory.createIdentifier(res.text);
|
|
6269
|
+
} else if (ts31.isNonNullExpression(res)) {
|
|
6270
|
+
clone = ts31.factory.createNonNullExpression(res.expression);
|
|
6123
6271
|
} else {
|
|
6124
6272
|
throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
|
|
6125
6273
|
}
|
|
6126
|
-
|
|
6274
|
+
ts31.setOriginalNode(clone, res);
|
|
6127
6275
|
clone.parent = clone.parent;
|
|
6128
|
-
return
|
|
6276
|
+
return ts31.setSyntheticTrailingComments(clone, []);
|
|
6129
6277
|
} else if (this.parent !== null) {
|
|
6130
6278
|
return this.parent.resolve(node, directive);
|
|
6131
6279
|
} else {
|
|
@@ -6152,7 +6300,7 @@ var _Scope = class {
|
|
|
6152
6300
|
} else if (parentGuards === null) {
|
|
6153
6301
|
return this.guard;
|
|
6154
6302
|
} else {
|
|
6155
|
-
return
|
|
6303
|
+
return ts31.factory.createBinaryExpression(parentGuards, ts31.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
6156
6304
|
}
|
|
6157
6305
|
}
|
|
6158
6306
|
resolveLocal(ref, directive) {
|
|
@@ -6223,14 +6371,16 @@ var _Scope = class {
|
|
|
6223
6371
|
} else if (node instanceof TmplAstIfBlock) {
|
|
6224
6372
|
this.opQueue.push(new TcbIfOp(this.tcb, this, node));
|
|
6225
6373
|
} else if (node instanceof TmplAstSwitchBlock) {
|
|
6226
|
-
this.opQueue.push(new
|
|
6227
|
-
} else if (node instanceof
|
|
6374
|
+
this.opQueue.push(new TcbSwitchOp(this.tcb, this, node));
|
|
6375
|
+
} else if (node instanceof TmplAstForLoopBlock) {
|
|
6228
6376
|
this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
|
|
6229
6377
|
node.empty && this.appendChildren(node.empty);
|
|
6230
6378
|
} else if (node instanceof TmplAstBoundText) {
|
|
6231
6379
|
this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.value));
|
|
6232
6380
|
} else if (node instanceof TmplAstIcu) {
|
|
6233
6381
|
this.appendIcuExpressions(node);
|
|
6382
|
+
} else if (node instanceof TmplAstContent) {
|
|
6383
|
+
this.appendChildren(node);
|
|
6234
6384
|
}
|
|
6235
6385
|
}
|
|
6236
6386
|
appendChildren(node) {
|
|
@@ -6400,21 +6550,21 @@ var _Scope = class {
|
|
|
6400
6550
|
var Scope = _Scope;
|
|
6401
6551
|
(() => {
|
|
6402
6552
|
_Scope.forLoopContextVariableTypes = /* @__PURE__ */ new Map([
|
|
6403
|
-
["$first",
|
|
6404
|
-
["$last",
|
|
6405
|
-
["$even",
|
|
6406
|
-
["$odd",
|
|
6407
|
-
["$index",
|
|
6408
|
-
["$count",
|
|
6553
|
+
["$first", ts31.SyntaxKind.BooleanKeyword],
|
|
6554
|
+
["$last", ts31.SyntaxKind.BooleanKeyword],
|
|
6555
|
+
["$even", ts31.SyntaxKind.BooleanKeyword],
|
|
6556
|
+
["$odd", ts31.SyntaxKind.BooleanKeyword],
|
|
6557
|
+
["$index", ts31.SyntaxKind.NumberKeyword],
|
|
6558
|
+
["$count", ts31.SyntaxKind.NumberKeyword]
|
|
6409
6559
|
]);
|
|
6410
6560
|
})();
|
|
6411
6561
|
function tcbThisParam(name, typeArguments) {
|
|
6412
|
-
return
|
|
6562
|
+
return ts31.factory.createParameterDeclaration(
|
|
6413
6563
|
void 0,
|
|
6414
6564
|
void 0,
|
|
6415
6565
|
"this",
|
|
6416
6566
|
void 0,
|
|
6417
|
-
|
|
6567
|
+
ts31.factory.createTypeReferenceNode(name, typeArguments),
|
|
6418
6568
|
void 0
|
|
6419
6569
|
);
|
|
6420
6570
|
}
|
|
@@ -6439,11 +6589,11 @@ var TcbExpressionTranslator = class {
|
|
|
6439
6589
|
return null;
|
|
6440
6590
|
}
|
|
6441
6591
|
const expr = this.translate(ast.value);
|
|
6442
|
-
const result =
|
|
6592
|
+
const result = ts31.factory.createParenthesizedExpression(ts31.factory.createBinaryExpression(target, ts31.SyntaxKind.EqualsToken, expr));
|
|
6443
6593
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
6444
6594
|
return result;
|
|
6445
6595
|
} else if (ast instanceof ImplicitReceiver3) {
|
|
6446
|
-
return
|
|
6596
|
+
return ts31.factory.createThis();
|
|
6447
6597
|
} else if (ast instanceof BindingPipe) {
|
|
6448
6598
|
const expr = this.translate(ast.exp);
|
|
6449
6599
|
const pipeMeta = this.tcb.getPipeByName(ast.name);
|
|
@@ -6458,12 +6608,12 @@ var TcbExpressionTranslator = class {
|
|
|
6458
6608
|
pipe = this.tcb.env.pipeInst(pipeMeta.ref);
|
|
6459
6609
|
}
|
|
6460
6610
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
6461
|
-
let methodAccess =
|
|
6611
|
+
let methodAccess = ts31.factory.createPropertyAccessExpression(pipe, "transform");
|
|
6462
6612
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
6463
6613
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
6464
|
-
methodAccess =
|
|
6614
|
+
methodAccess = ts31.factory.createAsExpression(methodAccess, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
6465
6615
|
}
|
|
6466
|
-
const result =
|
|
6616
|
+
const result = ts31.factory.createCallExpression(
|
|
6467
6617
|
methodAccess,
|
|
6468
6618
|
void 0,
|
|
6469
6619
|
[expr, ...args]
|
|
@@ -6473,8 +6623,8 @@ var TcbExpressionTranslator = class {
|
|
|
6473
6623
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
6474
6624
|
if (ast.receiver.receiver instanceof ImplicitReceiver3 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
6475
6625
|
const expr = this.translate(ast.args[0]);
|
|
6476
|
-
const exprAsAny =
|
|
6477
|
-
const result =
|
|
6626
|
+
const exprAsAny = ts31.factory.createAsExpression(expr, ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword));
|
|
6627
|
+
const result = ts31.factory.createParenthesizedExpression(exprAsAny);
|
|
6478
6628
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
6479
6629
|
return result;
|
|
6480
6630
|
}
|
|
@@ -6485,7 +6635,7 @@ var TcbExpressionTranslator = class {
|
|
|
6485
6635
|
const method = wrapForDiagnostics(receiver);
|
|
6486
6636
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
6487
6637
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
6488
|
-
const node =
|
|
6638
|
+
const node = ts31.factory.createCallExpression(method, void 0, args);
|
|
6489
6639
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
6490
6640
|
return node;
|
|
6491
6641
|
} else {
|
|
@@ -6505,23 +6655,23 @@ var TcbExpressionTranslator = class {
|
|
|
6505
6655
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
6506
6656
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
6507
6657
|
const members = inputs.map((input) => {
|
|
6508
|
-
const propertyName =
|
|
6658
|
+
const propertyName = ts31.factory.createStringLiteral(input.field);
|
|
6509
6659
|
if (input.type === "binding") {
|
|
6510
6660
|
let expr = widenBinding(input.expression, tcb);
|
|
6511
6661
|
if (input.isTwoWayBinding && tcb.env.config.allowSignalsInTwoWayBindings) {
|
|
6512
6662
|
expr = unwrapWritableSignal(expr, tcb);
|
|
6513
6663
|
}
|
|
6514
|
-
const assignment =
|
|
6664
|
+
const assignment = ts31.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
6515
6665
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
6516
6666
|
return assignment;
|
|
6517
6667
|
} else {
|
|
6518
|
-
return
|
|
6668
|
+
return ts31.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
6519
6669
|
}
|
|
6520
6670
|
});
|
|
6521
|
-
return
|
|
6671
|
+
return ts31.factory.createCallExpression(
|
|
6522
6672
|
typeCtor,
|
|
6523
6673
|
void 0,
|
|
6524
|
-
[
|
|
6674
|
+
[ts31.factory.createObjectLiteralExpression(members)]
|
|
6525
6675
|
);
|
|
6526
6676
|
}
|
|
6527
6677
|
function getBoundAttributes(directive, node) {
|
|
@@ -6558,17 +6708,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
6558
6708
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
6559
6709
|
return tcbExpression(attr.value, tcb, scope);
|
|
6560
6710
|
} else {
|
|
6561
|
-
return
|
|
6711
|
+
return ts31.factory.createStringLiteral(attr.value);
|
|
6562
6712
|
}
|
|
6563
6713
|
}
|
|
6564
6714
|
function widenBinding(expr, tcb) {
|
|
6565
6715
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
6566
6716
|
return tsCastToAny(expr);
|
|
6567
6717
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
6568
|
-
if (
|
|
6718
|
+
if (ts31.isObjectLiteralExpression(expr) || ts31.isArrayLiteralExpression(expr)) {
|
|
6569
6719
|
return expr;
|
|
6570
6720
|
} else {
|
|
6571
|
-
return
|
|
6721
|
+
return ts31.factory.createNonNullExpression(expr);
|
|
6572
6722
|
}
|
|
6573
6723
|
} else {
|
|
6574
6724
|
return expr;
|
|
@@ -6576,7 +6726,7 @@ function widenBinding(expr, tcb) {
|
|
|
6576
6726
|
}
|
|
6577
6727
|
function unwrapWritableSignal(expression, tcb) {
|
|
6578
6728
|
const unwrapRef = tcb.env.referenceExternalSymbol(R3Identifiers3.unwrapWritableSignal.moduleName, R3Identifiers3.unwrapWritableSignal.name);
|
|
6579
|
-
return
|
|
6729
|
+
return ts31.factory.createCallExpression(unwrapRef, void 0, [expression]);
|
|
6580
6730
|
}
|
|
6581
6731
|
var EVENT_PARAMETER = "$event";
|
|
6582
6732
|
function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
@@ -6585,16 +6735,16 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
6585
6735
|
if (eventType === 0) {
|
|
6586
6736
|
eventParamType = void 0;
|
|
6587
6737
|
} else if (eventType === 1) {
|
|
6588
|
-
eventParamType =
|
|
6738
|
+
eventParamType = ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword);
|
|
6589
6739
|
} else {
|
|
6590
6740
|
eventParamType = eventType;
|
|
6591
6741
|
}
|
|
6592
6742
|
const guards = scope.guards();
|
|
6593
|
-
let body =
|
|
6743
|
+
let body = ts31.factory.createExpressionStatement(handler);
|
|
6594
6744
|
if (guards !== null) {
|
|
6595
|
-
body =
|
|
6745
|
+
body = ts31.factory.createIfStatement(guards, body);
|
|
6596
6746
|
}
|
|
6597
|
-
const eventParam =
|
|
6747
|
+
const eventParam = ts31.factory.createParameterDeclaration(
|
|
6598
6748
|
void 0,
|
|
6599
6749
|
void 0,
|
|
6600
6750
|
EVENT_PARAMETER,
|
|
@@ -6602,13 +6752,13 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
6602
6752
|
eventParamType
|
|
6603
6753
|
);
|
|
6604
6754
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
6605
|
-
return
|
|
6755
|
+
return ts31.factory.createArrowFunction(
|
|
6606
6756
|
void 0,
|
|
6607
6757
|
void 0,
|
|
6608
6758
|
[eventParam],
|
|
6609
|
-
|
|
6759
|
+
ts31.factory.createKeywordTypeNode(ts31.SyntaxKind.AnyKeyword),
|
|
6610
6760
|
void 0,
|
|
6611
|
-
|
|
6761
|
+
ts31.factory.createBlock([body])
|
|
6612
6762
|
);
|
|
6613
6763
|
}
|
|
6614
6764
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
@@ -6637,7 +6787,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
6637
6787
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
6638
6788
|
resolve(ast) {
|
|
6639
6789
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
6640
|
-
const event =
|
|
6790
|
+
const event = ts31.factory.createIdentifier(EVENT_PARAMETER);
|
|
6641
6791
|
addParseSpanInfo(event, ast.nameSpan);
|
|
6642
6792
|
return event;
|
|
6643
6793
|
}
|
|
@@ -6648,11 +6798,17 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
|
6648
6798
|
constructor(tcb, scope, block) {
|
|
6649
6799
|
super(tcb, scope);
|
|
6650
6800
|
this.block = block;
|
|
6801
|
+
this.allowedVariables = /* @__PURE__ */ new Set([block.item]);
|
|
6802
|
+
for (const variable of block.contextVariables) {
|
|
6803
|
+
if (variable.value === "$index") {
|
|
6804
|
+
this.allowedVariables.add(variable);
|
|
6805
|
+
}
|
|
6806
|
+
}
|
|
6651
6807
|
}
|
|
6652
6808
|
resolve(ast) {
|
|
6653
6809
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3) {
|
|
6654
6810
|
const target = this.tcb.boundTarget.getExpressionTarget(ast);
|
|
6655
|
-
if (target !== null &&
|
|
6811
|
+
if (target !== null && !this.allowedVariables.has(target)) {
|
|
6656
6812
|
this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
|
|
6657
6813
|
}
|
|
6658
6814
|
}
|
|
@@ -6660,20 +6816,20 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
|
6660
6816
|
}
|
|
6661
6817
|
};
|
|
6662
6818
|
|
|
6663
|
-
// bazel-out/
|
|
6664
|
-
import
|
|
6819
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
6820
|
+
import ts32 from "typescript";
|
|
6665
6821
|
var TypeCheckFile = class extends Environment {
|
|
6666
6822
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
6667
6823
|
super(config, new ImportManager({
|
|
6668
6824
|
forceGenerateNamespacesForNewImports: true,
|
|
6669
6825
|
shouldUseSingleQuotes: () => true
|
|
6670
|
-
}), refEmitter, reflector,
|
|
6826
|
+
}), refEmitter, reflector, ts32.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts32.ScriptTarget.Latest, true));
|
|
6671
6827
|
this.fileName = fileName;
|
|
6672
6828
|
this.nextTcbId = 1;
|
|
6673
6829
|
this.tcbStatements = [];
|
|
6674
6830
|
}
|
|
6675
6831
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
6676
|
-
const fnId =
|
|
6832
|
+
const fnId = ts32.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
6677
6833
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
6678
6834
|
this.tcbStatements.push(fn);
|
|
6679
6835
|
}
|
|
@@ -6683,22 +6839,22 @@ var TypeCheckFile = class extends Environment {
|
|
|
6683
6839
|
if (importChanges.updatedImports.size > 0) {
|
|
6684
6840
|
throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
|
|
6685
6841
|
}
|
|
6686
|
-
const printer =
|
|
6842
|
+
const printer = ts32.createPrinter({ removeComments });
|
|
6687
6843
|
let source = "";
|
|
6688
6844
|
const newImports = importChanges.newImports.get(this.contextFile.fileName);
|
|
6689
6845
|
if (newImports !== void 0) {
|
|
6690
|
-
source += newImports.map((i) => printer.printNode(
|
|
6846
|
+
source += newImports.map((i) => printer.printNode(ts32.EmitHint.Unspecified, i, this.contextFile)).join("\n");
|
|
6691
6847
|
}
|
|
6692
6848
|
source += "\n";
|
|
6693
6849
|
for (const stmt of this.pipeInstStatements) {
|
|
6694
|
-
source += printer.printNode(
|
|
6850
|
+
source += printer.printNode(ts32.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
6695
6851
|
}
|
|
6696
6852
|
for (const stmt of this.typeCtorStatements) {
|
|
6697
|
-
source += printer.printNode(
|
|
6853
|
+
source += printer.printNode(ts32.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
6698
6854
|
}
|
|
6699
6855
|
source += "\n";
|
|
6700
6856
|
for (const stmt of this.tcbStatements) {
|
|
6701
|
-
source += printer.printNode(
|
|
6857
|
+
source += printer.printNode(ts32.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
6702
6858
|
}
|
|
6703
6859
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
6704
6860
|
return source;
|
|
@@ -6708,7 +6864,7 @@ var TypeCheckFile = class extends Environment {
|
|
|
6708
6864
|
}
|
|
6709
6865
|
};
|
|
6710
6866
|
|
|
6711
|
-
// bazel-out/
|
|
6867
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
6712
6868
|
var InliningMode;
|
|
6713
6869
|
(function(InliningMode2) {
|
|
6714
6870
|
InliningMode2[InliningMode2["InlineOps"] = 0] = "InlineOps";
|
|
@@ -6811,7 +6967,7 @@ var TypeCheckContextImpl = class {
|
|
|
6811
6967
|
if (!this.opMap.has(sf)) {
|
|
6812
6968
|
return null;
|
|
6813
6969
|
}
|
|
6814
|
-
const printer =
|
|
6970
|
+
const printer = ts33.createPrinter({ omitTrailingSemicolon: true });
|
|
6815
6971
|
const importManager = new ImportManager({
|
|
6816
6972
|
forceGenerateNamespacesForNewImports: true,
|
|
6817
6973
|
shouldUseSingleQuotes: () => true
|
|
@@ -6827,7 +6983,7 @@ var TypeCheckContextImpl = class {
|
|
|
6827
6983
|
newImports.get(sf.fileName).forEach((newImport) => {
|
|
6828
6984
|
updates.push({
|
|
6829
6985
|
pos: 0,
|
|
6830
|
-
text: printer.printNode(
|
|
6986
|
+
text: printer.printNode(ts33.EmitHint.Unspecified, newImport, sf)
|
|
6831
6987
|
});
|
|
6832
6988
|
});
|
|
6833
6989
|
}
|
|
@@ -6838,7 +6994,7 @@ var TypeCheckContextImpl = class {
|
|
|
6838
6994
|
updates.push({
|
|
6839
6995
|
pos: oldBindings.getStart(),
|
|
6840
6996
|
deletePos: oldBindings.getEnd(),
|
|
6841
|
-
text: printer.printNode(
|
|
6997
|
+
text: printer.printNode(ts33.EmitHint.Unspecified, newBindings, sf)
|
|
6842
6998
|
});
|
|
6843
6999
|
}
|
|
6844
7000
|
const result = new MagicString(sf.text, { filename: sf.fileName });
|
|
@@ -6921,7 +7077,7 @@ var TypeCheckContextImpl = class {
|
|
|
6921
7077
|
if (span.start.offset === span.end.offset) {
|
|
6922
7078
|
span.end.offset++;
|
|
6923
7079
|
}
|
|
6924
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
7080
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts33.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
6925
7081
|
});
|
|
6926
7082
|
}
|
|
6927
7083
|
};
|
|
@@ -6939,9 +7095,9 @@ var InlineTcbOp = class {
|
|
|
6939
7095
|
}
|
|
6940
7096
|
execute(im, sf, refEmitter, printer) {
|
|
6941
7097
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
6942
|
-
const fnName =
|
|
7098
|
+
const fnName = ts33.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
6943
7099
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
6944
|
-
return printer.printNode(
|
|
7100
|
+
return printer.printNode(ts33.EmitHint.Unspecified, fn, sf);
|
|
6945
7101
|
}
|
|
6946
7102
|
};
|
|
6947
7103
|
var TypeCtorOp = class {
|
|
@@ -6956,14 +7112,14 @@ var TypeCtorOp = class {
|
|
|
6956
7112
|
execute(im, sf, refEmitter, printer) {
|
|
6957
7113
|
const emitEnv = new ReferenceEmitEnvironment(im, refEmitter, this.reflector, sf);
|
|
6958
7114
|
const tcb = generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
|
|
6959
|
-
return printer.printNode(
|
|
7115
|
+
return printer.printNode(ts33.EmitHint.Unspecified, tcb, sf);
|
|
6960
7116
|
}
|
|
6961
7117
|
};
|
|
6962
7118
|
|
|
6963
|
-
// bazel-out/
|
|
7119
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
6964
7120
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
6965
7121
|
|
|
6966
|
-
// bazel-out/
|
|
7122
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/line_mappings.mjs
|
|
6967
7123
|
var LF_CHAR = 10;
|
|
6968
7124
|
var CR_CHAR = 13;
|
|
6969
7125
|
var LINE_SEP_CHAR = 8232;
|
|
@@ -7004,7 +7160,7 @@ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesM
|
|
|
7004
7160
|
return low - 1;
|
|
7005
7161
|
}
|
|
7006
7162
|
|
|
7007
|
-
// bazel-out/
|
|
7163
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
7008
7164
|
var TemplateSource = class {
|
|
7009
7165
|
constructor(mapping, file) {
|
|
7010
7166
|
this.mapping = mapping;
|
|
@@ -7055,9 +7211,9 @@ var TemplateSourceManager = class {
|
|
|
7055
7211
|
}
|
|
7056
7212
|
};
|
|
7057
7213
|
|
|
7058
|
-
// bazel-out/
|
|
7214
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
7059
7215
|
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, PropertyWrite as PropertyWrite4, R3Identifiers as R3Identifiers4, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
7060
|
-
import
|
|
7216
|
+
import ts34 from "typescript";
|
|
7061
7217
|
var SymbolBuilder = class {
|
|
7062
7218
|
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
7063
7219
|
this.tcbPath = tcbPath;
|
|
@@ -7101,7 +7257,7 @@ var SymbolBuilder = class {
|
|
|
7101
7257
|
getSymbolOfElement(element) {
|
|
7102
7258
|
var _a;
|
|
7103
7259
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
7104
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
7260
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts34.isVariableDeclaration });
|
|
7105
7261
|
if (node === null) {
|
|
7106
7262
|
return null;
|
|
7107
7263
|
}
|
|
@@ -7121,12 +7277,12 @@ var SymbolBuilder = class {
|
|
|
7121
7277
|
var _a;
|
|
7122
7278
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
7123
7279
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
7124
|
-
const isDirectiveDeclaration = (node) => (
|
|
7280
|
+
const isDirectiveDeclaration = (node) => (ts34.isTypeNode(node) || ts34.isIdentifier(node)) && ts34.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
7125
7281
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
7126
7282
|
const symbols = [];
|
|
7127
7283
|
for (const node of nodes) {
|
|
7128
7284
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
7129
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
7285
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts34.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
7130
7286
|
continue;
|
|
7131
7287
|
}
|
|
7132
7288
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -7157,7 +7313,7 @@ var SymbolBuilder = class {
|
|
|
7157
7313
|
if (!isHostDirectiveMetaForGlobalMode(current)) {
|
|
7158
7314
|
throw new Error("Impossible state: typecheck code path in local compilation mode.");
|
|
7159
7315
|
}
|
|
7160
|
-
if (!
|
|
7316
|
+
if (!ts34.isClassDeclaration(current.directive.node)) {
|
|
7161
7317
|
continue;
|
|
7162
7318
|
}
|
|
7163
7319
|
const symbol = this.getSymbolOfTsNode(current.directive.node);
|
|
@@ -7230,17 +7386,17 @@ var SymbolBuilder = class {
|
|
|
7230
7386
|
if (!isAccessExpression(n2)) {
|
|
7231
7387
|
return false;
|
|
7232
7388
|
}
|
|
7233
|
-
if (
|
|
7389
|
+
if (ts34.isPropertyAccessExpression(n2)) {
|
|
7234
7390
|
return n2.name.getText() === expectedAccess;
|
|
7235
7391
|
} else {
|
|
7236
|
-
return
|
|
7392
|
+
return ts34.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
|
|
7237
7393
|
}
|
|
7238
7394
|
}
|
|
7239
7395
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
7240
7396
|
const bindings = [];
|
|
7241
7397
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
7242
7398
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
7243
|
-
if (!
|
|
7399
|
+
if (!ts34.isPropertyAccessExpression(outputFieldAccess)) {
|
|
7244
7400
|
continue;
|
|
7245
7401
|
}
|
|
7246
7402
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -7263,7 +7419,7 @@ var SymbolBuilder = class {
|
|
|
7263
7419
|
}
|
|
7264
7420
|
});
|
|
7265
7421
|
} else {
|
|
7266
|
-
if (!
|
|
7422
|
+
if (!ts34.isElementAccessExpression(outputFieldAccess)) {
|
|
7267
7423
|
continue;
|
|
7268
7424
|
}
|
|
7269
7425
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -7349,7 +7505,7 @@ var SymbolBuilder = class {
|
|
|
7349
7505
|
return null;
|
|
7350
7506
|
}
|
|
7351
7507
|
const [declaration] = tsSymbol.declarations;
|
|
7352
|
-
if (!
|
|
7508
|
+
if (!ts34.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
|
|
7353
7509
|
declaration.getSourceFile(),
|
|
7354
7510
|
(_a = declaration.type) != null ? _a : declaration.name,
|
|
7355
7511
|
ExpressionIdentifier.DIRECTIVE
|
|
@@ -7357,7 +7513,7 @@ var SymbolBuilder = class {
|
|
|
7357
7513
|
return null;
|
|
7358
7514
|
}
|
|
7359
7515
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
7360
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
7516
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts34.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
7361
7517
|
return null;
|
|
7362
7518
|
}
|
|
7363
7519
|
const ref = new Reference(symbol.tsSymbol.valueDeclaration);
|
|
@@ -7377,12 +7533,12 @@ var SymbolBuilder = class {
|
|
|
7377
7533
|
};
|
|
7378
7534
|
}
|
|
7379
7535
|
getSymbolOfVariable(variable) {
|
|
7380
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
7536
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts34.isVariableDeclaration });
|
|
7381
7537
|
if (node === null) {
|
|
7382
7538
|
return null;
|
|
7383
7539
|
}
|
|
7384
7540
|
let nodeValueSymbol = null;
|
|
7385
|
-
if (
|
|
7541
|
+
if (ts34.isForOfStatement(node.parent.parent)) {
|
|
7386
7542
|
nodeValueSymbol = this.getSymbolOfTsNode(node);
|
|
7387
7543
|
} else if (node.initializer !== void 0) {
|
|
7388
7544
|
nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
|
|
@@ -7405,11 +7561,11 @@ var SymbolBuilder = class {
|
|
|
7405
7561
|
}
|
|
7406
7562
|
getSymbolOfReference(ref) {
|
|
7407
7563
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
7408
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
7564
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts34.isVariableDeclaration });
|
|
7409
7565
|
if (node === null || target === null || node.initializer === void 0) {
|
|
7410
7566
|
return null;
|
|
7411
7567
|
}
|
|
7412
|
-
const originalDeclaration =
|
|
7568
|
+
const originalDeclaration = ts34.isParenthesizedExpression(node.initializer) && ts34.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
7413
7569
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
7414
7570
|
return null;
|
|
7415
7571
|
}
|
|
@@ -7433,7 +7589,7 @@ var SymbolBuilder = class {
|
|
|
7433
7589
|
referenceVarLocation: referenceVarTcbLocation
|
|
7434
7590
|
};
|
|
7435
7591
|
} else {
|
|
7436
|
-
if (!
|
|
7592
|
+
if (!ts34.isClassDeclaration(target.directive.ref.node)) {
|
|
7437
7593
|
return null;
|
|
7438
7594
|
}
|
|
7439
7595
|
return {
|
|
@@ -7448,7 +7604,7 @@ var SymbolBuilder = class {
|
|
|
7448
7604
|
}
|
|
7449
7605
|
}
|
|
7450
7606
|
getSymbolOfPipe(expression) {
|
|
7451
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
7607
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts34.isPropertyAccessExpression });
|
|
7452
7608
|
if (methodAccess === null) {
|
|
7453
7609
|
return null;
|
|
7454
7610
|
}
|
|
@@ -7488,7 +7644,7 @@ var SymbolBuilder = class {
|
|
|
7488
7644
|
}
|
|
7489
7645
|
let node = null;
|
|
7490
7646
|
if (expression instanceof PropertyRead5) {
|
|
7491
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
7647
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts34.isPropertyAccessExpression });
|
|
7492
7648
|
}
|
|
7493
7649
|
if (node === null) {
|
|
7494
7650
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -7496,10 +7652,10 @@ var SymbolBuilder = class {
|
|
|
7496
7652
|
if (node === null) {
|
|
7497
7653
|
return null;
|
|
7498
7654
|
}
|
|
7499
|
-
while (
|
|
7655
|
+
while (ts34.isParenthesizedExpression(node)) {
|
|
7500
7656
|
node = node.expression;
|
|
7501
7657
|
}
|
|
7502
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
7658
|
+
if (expression instanceof SafePropertyRead4 && ts34.isConditionalExpression(node)) {
|
|
7503
7659
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
7504
7660
|
if (whenTrueSymbol === null) {
|
|
7505
7661
|
return null;
|
|
@@ -7516,11 +7672,11 @@ var SymbolBuilder = class {
|
|
|
7516
7672
|
}
|
|
7517
7673
|
getSymbolOfTsNode(node) {
|
|
7518
7674
|
var _a;
|
|
7519
|
-
while (
|
|
7675
|
+
while (ts34.isParenthesizedExpression(node)) {
|
|
7520
7676
|
node = node.expression;
|
|
7521
7677
|
}
|
|
7522
7678
|
let tsSymbol;
|
|
7523
|
-
if (
|
|
7679
|
+
if (ts34.isPropertyAccessExpression(node)) {
|
|
7524
7680
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
7525
7681
|
} else {
|
|
7526
7682
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -7538,13 +7694,13 @@ var SymbolBuilder = class {
|
|
|
7538
7694
|
};
|
|
7539
7695
|
}
|
|
7540
7696
|
getTcbPositionForNode(node) {
|
|
7541
|
-
if (
|
|
7697
|
+
if (ts34.isTypeReferenceNode(node)) {
|
|
7542
7698
|
return this.getTcbPositionForNode(node.typeName);
|
|
7543
|
-
} else if (
|
|
7699
|
+
} else if (ts34.isQualifiedName(node)) {
|
|
7544
7700
|
return node.right.getStart();
|
|
7545
|
-
} else if (
|
|
7701
|
+
} else if (ts34.isPropertyAccessExpression(node)) {
|
|
7546
7702
|
return node.name.getStart();
|
|
7547
|
-
} else if (
|
|
7703
|
+
} else if (ts34.isElementAccessExpression(node)) {
|
|
7548
7704
|
return node.argumentExpression.getStart();
|
|
7549
7705
|
} else {
|
|
7550
7706
|
return node.getStart();
|
|
@@ -7558,13 +7714,13 @@ function sourceSpanEqual(a, b) {
|
|
|
7558
7714
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
7559
7715
|
}
|
|
7560
7716
|
function unwrapSignalInputWriteTAccessor(expr) {
|
|
7561
|
-
if (!
|
|
7717
|
+
if (!ts34.isElementAccessExpression(expr) || !ts34.isPropertyAccessExpression(expr.argumentExpression)) {
|
|
7562
7718
|
return null;
|
|
7563
7719
|
}
|
|
7564
|
-
if (!
|
|
7720
|
+
if (!ts34.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers4.InputSignalBrandWriteType.name) {
|
|
7565
7721
|
return null;
|
|
7566
7722
|
}
|
|
7567
|
-
if (!
|
|
7723
|
+
if (!ts34.isPropertyAccessExpression(expr.expression) && !ts34.isElementAccessExpression(expr.expression)) {
|
|
7568
7724
|
throw new Error("Unexpected expression for signal input write type.");
|
|
7569
7725
|
}
|
|
7570
7726
|
return {
|
|
@@ -7573,7 +7729,7 @@ function unwrapSignalInputWriteTAccessor(expr) {
|
|
|
7573
7729
|
};
|
|
7574
7730
|
}
|
|
7575
7731
|
|
|
7576
|
-
// bazel-out/
|
|
7732
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
7577
7733
|
var REGISTRY2 = new DomElementSchemaRegistry2();
|
|
7578
7734
|
var TemplateTypeCheckerImpl = class {
|
|
7579
7735
|
constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, metaReader, localMetaReader, ngModuleIndex, componentScopeReader, typeCheckScopeRegistry, perf) {
|
|
@@ -8274,11 +8430,11 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
8274
8430
|
}
|
|
8275
8431
|
};
|
|
8276
8432
|
|
|
8277
|
-
// bazel-out/
|
|
8433
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.mjs
|
|
8278
8434
|
import { Interpolation, PropertyRead as PropertyRead6 } from "@angular/compiler";
|
|
8279
8435
|
|
|
8280
|
-
// bazel-out/
|
|
8281
|
-
import
|
|
8436
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.mjs
|
|
8437
|
+
import ts35 from "typescript";
|
|
8282
8438
|
var SIGNAL_FNS = /* @__PURE__ */ new Set([
|
|
8283
8439
|
"WritableSignal",
|
|
8284
8440
|
"Signal",
|
|
@@ -8293,11 +8449,11 @@ function isSignalSymbol(symbol) {
|
|
|
8293
8449
|
const declarations = symbol.getDeclarations();
|
|
8294
8450
|
return declarations !== void 0 && declarations.some((decl) => {
|
|
8295
8451
|
const fileName = decl.getSourceFile().fileName;
|
|
8296
|
-
return (
|
|
8452
|
+
return (ts35.isInterfaceDeclaration(decl) || ts35.isTypeAliasDeclaration(decl)) && SIGNAL_FNS.has(decl.name.text) && (fileName.includes("@angular/core") || fileName.includes("angular2/rc/packages/core"));
|
|
8297
8453
|
});
|
|
8298
8454
|
}
|
|
8299
8455
|
|
|
8300
|
-
// bazel-out/
|
|
8456
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
8301
8457
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor2, TmplAstBoundDeferredTrigger as TmplAstBoundDeferredTrigger2 } from "@angular/compiler";
|
|
8302
8458
|
var TemplateCheckWithVisitor = class {
|
|
8303
8459
|
run(ctx, component, template) {
|
|
@@ -8347,6 +8503,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
8347
8503
|
this.visitAllNodes(template.children);
|
|
8348
8504
|
}
|
|
8349
8505
|
visitContent(content) {
|
|
8506
|
+
this.visitAllNodes(content.children);
|
|
8350
8507
|
}
|
|
8351
8508
|
visitVariable(variable) {
|
|
8352
8509
|
}
|
|
@@ -8397,7 +8554,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
8397
8554
|
visitForLoopBlock(block) {
|
|
8398
8555
|
var _a;
|
|
8399
8556
|
block.item.visit(this);
|
|
8400
|
-
this.visitAllNodes(
|
|
8557
|
+
this.visitAllNodes(block.contextVariables);
|
|
8401
8558
|
this.visitAst(block.expression);
|
|
8402
8559
|
this.visitAllNodes(block.children);
|
|
8403
8560
|
(_a = block.empty) == null ? void 0 : _a.visit(this);
|
|
@@ -8421,7 +8578,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
8421
8578
|
}
|
|
8422
8579
|
};
|
|
8423
8580
|
|
|
8424
|
-
// bazel-out/
|
|
8581
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.mjs
|
|
8425
8582
|
var SIGNAL_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["set", "update", "asReadonly"]);
|
|
8426
8583
|
var FUNCTION_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["name", "length", "prototype"]);
|
|
8427
8584
|
var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
|
|
@@ -8465,7 +8622,7 @@ var factory = {
|
|
|
8465
8622
|
create: () => new InterpolatedSignalCheck()
|
|
8466
8623
|
};
|
|
8467
8624
|
|
|
8468
|
-
// bazel-out/
|
|
8625
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
8469
8626
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
8470
8627
|
var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
8471
8628
|
constructor() {
|
|
@@ -8491,7 +8648,7 @@ var factory2 = {
|
|
|
8491
8648
|
create: () => new InvalidBananaInBoxCheck()
|
|
8492
8649
|
};
|
|
8493
8650
|
|
|
8494
|
-
// bazel-out/
|
|
8651
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_control_flow_directive/index.mjs
|
|
8495
8652
|
import { TmplAstTemplate as TmplAstTemplate4 } from "@angular/compiler";
|
|
8496
8653
|
var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([
|
|
8497
8654
|
["ngIf", { directive: "NgIf", builtIn: "@if" }],
|
|
@@ -8536,7 +8693,7 @@ var factory3 = {
|
|
|
8536
8693
|
}
|
|
8537
8694
|
};
|
|
8538
8695
|
|
|
8539
|
-
// bazel-out/
|
|
8696
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_ngforof_let/index.mjs
|
|
8540
8697
|
import { TmplAstTemplate as TmplAstTemplate5 } from "@angular/compiler";
|
|
8541
8698
|
var MissingNgForOfLetCheck = class extends TemplateCheckWithVisitor {
|
|
8542
8699
|
constructor() {
|
|
@@ -8569,9 +8726,9 @@ var factory4 = {
|
|
|
8569
8726
|
create: () => new MissingNgForOfLetCheck()
|
|
8570
8727
|
};
|
|
8571
8728
|
|
|
8572
|
-
// bazel-out/
|
|
8729
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
8573
8730
|
import { Binary } from "@angular/compiler";
|
|
8574
|
-
import
|
|
8731
|
+
import ts36 from "typescript";
|
|
8575
8732
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
8576
8733
|
constructor() {
|
|
8577
8734
|
super(...arguments);
|
|
@@ -8585,7 +8742,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
8585
8742
|
return [];
|
|
8586
8743
|
}
|
|
8587
8744
|
const typeLeft = symbolLeft.tsType;
|
|
8588
|
-
if (typeLeft.flags & (
|
|
8745
|
+
if (typeLeft.flags & (ts36.TypeFlags.Any | ts36.TypeFlags.Unknown)) {
|
|
8589
8746
|
return [];
|
|
8590
8747
|
}
|
|
8591
8748
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -8614,9 +8771,9 @@ var factory5 = {
|
|
|
8614
8771
|
}
|
|
8615
8772
|
};
|
|
8616
8773
|
|
|
8617
|
-
// bazel-out/
|
|
8774
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.mjs
|
|
8618
8775
|
import { SafeCall as SafeCall2, SafeKeyedRead as SafeKeyedRead2, SafePropertyRead as SafePropertyRead5 } from "@angular/compiler";
|
|
8619
|
-
import
|
|
8776
|
+
import ts37 from "typescript";
|
|
8620
8777
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
8621
8778
|
constructor() {
|
|
8622
8779
|
super(...arguments);
|
|
@@ -8630,7 +8787,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
8630
8787
|
return [];
|
|
8631
8788
|
}
|
|
8632
8789
|
const typeLeft = symbolLeft.tsType;
|
|
8633
|
-
if (typeLeft.flags & (
|
|
8790
|
+
if (typeLeft.flags & (ts37.TypeFlags.Any | ts37.TypeFlags.Unknown)) {
|
|
8634
8791
|
return [];
|
|
8635
8792
|
}
|
|
8636
8793
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -8660,7 +8817,7 @@ var factory6 = {
|
|
|
8660
8817
|
}
|
|
8661
8818
|
};
|
|
8662
8819
|
|
|
8663
|
-
// bazel-out/
|
|
8820
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/suffix_not_supported/index.mjs
|
|
8664
8821
|
import { TmplAstBoundAttribute as TmplAstBoundAttribute3 } from "@angular/compiler";
|
|
8665
8822
|
var STYLE_SUFFIXES = ["px", "%", "em"];
|
|
8666
8823
|
var SuffixNotSupportedCheck = class extends TemplateCheckWithVisitor {
|
|
@@ -8684,7 +8841,7 @@ var factory7 = {
|
|
|
8684
8841
|
create: () => new SuffixNotSupportedCheck()
|
|
8685
8842
|
};
|
|
8686
8843
|
|
|
8687
|
-
// bazel-out/
|
|
8844
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/text_attribute_not_binding/index.mjs
|
|
8688
8845
|
import { TmplAstTextAttribute as TmplAstTextAttribute4 } from "@angular/compiler";
|
|
8689
8846
|
var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
|
|
8690
8847
|
constructor() {
|
|
@@ -8723,10 +8880,10 @@ var factory8 = {
|
|
|
8723
8880
|
create: () => new TextAttributeNotBindingSpec()
|
|
8724
8881
|
};
|
|
8725
8882
|
|
|
8726
|
-
// bazel-out/
|
|
8727
|
-
import
|
|
8883
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
8884
|
+
import ts38 from "typescript";
|
|
8728
8885
|
|
|
8729
|
-
// bazel-out/
|
|
8886
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
8730
8887
|
var DiagnosticCategoryLabel;
|
|
8731
8888
|
(function(DiagnosticCategoryLabel2) {
|
|
8732
8889
|
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
@@ -8734,7 +8891,7 @@ var DiagnosticCategoryLabel;
|
|
|
8734
8891
|
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
8735
8892
|
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
8736
8893
|
|
|
8737
|
-
// bazel-out/
|
|
8894
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
8738
8895
|
var ExtendedTemplateCheckerImpl = class {
|
|
8739
8896
|
constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
|
|
8740
8897
|
var _a, _b, _c, _d, _e;
|
|
@@ -8773,9 +8930,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
8773
8930
|
function diagnosticLabelToCategory(label) {
|
|
8774
8931
|
switch (label) {
|
|
8775
8932
|
case DiagnosticCategoryLabel.Warning:
|
|
8776
|
-
return
|
|
8933
|
+
return ts38.DiagnosticCategory.Warning;
|
|
8777
8934
|
case DiagnosticCategoryLabel.Error:
|
|
8778
|
-
return
|
|
8935
|
+
return ts38.DiagnosticCategory.Error;
|
|
8779
8936
|
case DiagnosticCategoryLabel.Suppress:
|
|
8780
8937
|
return null;
|
|
8781
8938
|
default:
|
|
@@ -8787,7 +8944,7 @@ function assertNever(value) {
|
|
|
8787
8944
|
${value}`);
|
|
8788
8945
|
}
|
|
8789
8946
|
|
|
8790
|
-
// bazel-out/
|
|
8947
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.mjs
|
|
8791
8948
|
var ALL_DIAGNOSTIC_FACTORIES = [
|
|
8792
8949
|
factory2,
|
|
8793
8950
|
factory5,
|
|
@@ -8803,9 +8960,9 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
8803
8960
|
...ALL_DIAGNOSTIC_FACTORIES.map((factory9) => factory9.name)
|
|
8804
8961
|
]);
|
|
8805
8962
|
|
|
8806
|
-
// bazel-out/
|
|
8963
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.mjs
|
|
8807
8964
|
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver4, ParsedEventType as ParsedEventType2, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
8808
|
-
import
|
|
8965
|
+
import ts39 from "typescript";
|
|
8809
8966
|
var TemplateSemanticsCheckerImpl = class {
|
|
8810
8967
|
constructor(templateTypeChecker) {
|
|
8811
8968
|
this.templateTypeChecker = templateTypeChecker;
|
|
@@ -8873,7 +9030,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor3 {
|
|
|
8873
9030
|
}
|
|
8874
9031
|
makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
|
|
8875
9032
|
var _a, _b;
|
|
8876
|
-
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan,
|
|
9033
|
+
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, ts39.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [{
|
|
8877
9034
|
text: `The variable ${target.name} is declared here.`,
|
|
8878
9035
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
8879
9036
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -8885,7 +9042,96 @@ function unwrapAstWithSource(ast) {
|
|
|
8885
9042
|
return ast instanceof ASTWithSource5 ? ast.ast : ast;
|
|
8886
9043
|
}
|
|
8887
9044
|
|
|
8888
|
-
// bazel-out/
|
|
9045
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.mjs
|
|
9046
|
+
import ts40 from "typescript";
|
|
9047
|
+
var APIS_TO_CHECK = [
|
|
9048
|
+
INPUT_INITIALIZER_FN,
|
|
9049
|
+
MODEL_INITIALIZER_FN,
|
|
9050
|
+
...OUTPUT_INITIALIZER_FNS,
|
|
9051
|
+
...QUERY_INITIALIZER_FNS
|
|
9052
|
+
];
|
|
9053
|
+
var InitializerApiUsageRule = class {
|
|
9054
|
+
constructor(reflector, importedSymbolsTracker) {
|
|
9055
|
+
this.reflector = reflector;
|
|
9056
|
+
this.importedSymbolsTracker = importedSymbolsTracker;
|
|
9057
|
+
}
|
|
9058
|
+
shouldCheck(sourceFile) {
|
|
9059
|
+
return APIS_TO_CHECK.some(({ functionName, owningModule }) => {
|
|
9060
|
+
return this.importedSymbolsTracker.hasNamedImport(sourceFile, functionName, owningModule) || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, owningModule);
|
|
9061
|
+
});
|
|
9062
|
+
}
|
|
9063
|
+
checkNode(node) {
|
|
9064
|
+
if (!ts40.isCallExpression(node)) {
|
|
9065
|
+
return null;
|
|
9066
|
+
}
|
|
9067
|
+
while (node.parent && (ts40.isParenthesizedExpression(node.parent) || ts40.isAsExpression(node.parent))) {
|
|
9068
|
+
node = node.parent;
|
|
9069
|
+
}
|
|
9070
|
+
if (!node.parent || !ts40.isCallExpression(node)) {
|
|
9071
|
+
return null;
|
|
9072
|
+
}
|
|
9073
|
+
const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK, node, this.reflector, this.importedSymbolsTracker);
|
|
9074
|
+
if (identifiedInitializer === null) {
|
|
9075
|
+
return null;
|
|
9076
|
+
}
|
|
9077
|
+
const functionName = identifiedInitializer.api.functionName + (identifiedInitializer.isRequired ? ".required" : "");
|
|
9078
|
+
if (ts40.isPropertyDeclaration(node.parent) && node.parent.initializer === node) {
|
|
9079
|
+
let closestClass = node.parent;
|
|
9080
|
+
while (closestClass && !ts40.isClassDeclaration(closestClass)) {
|
|
9081
|
+
closestClass = closestClass.parent;
|
|
9082
|
+
}
|
|
9083
|
+
if (closestClass && ts40.isClassDeclaration(closestClass)) {
|
|
9084
|
+
const decorators = this.reflector.getDecoratorsOfDeclaration(closestClass);
|
|
9085
|
+
const isComponentOrDirective = decorators !== null && decorators.some((decorator) => {
|
|
9086
|
+
var _a;
|
|
9087
|
+
return ((_a = decorator.import) == null ? void 0 : _a.from) === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
9088
|
+
});
|
|
9089
|
+
return isComponentOrDirective ? null : makeDiagnostic(ErrorCode.UNSUPPORTED_INITIALIZER_API_USAGE, node, `Unsupported call to the ${functionName} function. This function can only be used as the initializer of a property on a @Component or @Directive class.`);
|
|
9090
|
+
}
|
|
9091
|
+
}
|
|
9092
|
+
return makeDiagnostic(ErrorCode.UNSUPPORTED_INITIALIZER_API_USAGE, node, `Unsupported call to the ${functionName} function. This function can only be called in the initializer of a class member.`);
|
|
9093
|
+
}
|
|
9094
|
+
};
|
|
9095
|
+
|
|
9096
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.mjs
|
|
9097
|
+
var SourceFileValidator = class {
|
|
9098
|
+
constructor(reflector, importedSymbolsTracker) {
|
|
9099
|
+
this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
|
|
9100
|
+
}
|
|
9101
|
+
getDiagnosticsForFile(sourceFile) {
|
|
9102
|
+
if (sourceFile.isDeclarationFile || sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
|
|
9103
|
+
return null;
|
|
9104
|
+
}
|
|
9105
|
+
let rulesToRun = null;
|
|
9106
|
+
for (const rule of this.rules) {
|
|
9107
|
+
if (rule.shouldCheck(sourceFile)) {
|
|
9108
|
+
rulesToRun != null ? rulesToRun : rulesToRun = [];
|
|
9109
|
+
rulesToRun.push(rule);
|
|
9110
|
+
}
|
|
9111
|
+
}
|
|
9112
|
+
if (rulesToRun === null) {
|
|
9113
|
+
return null;
|
|
9114
|
+
}
|
|
9115
|
+
let fileDiagnostics = null;
|
|
9116
|
+
sourceFile.forEachChild(function walk(node) {
|
|
9117
|
+
for (const rule of rulesToRun) {
|
|
9118
|
+
const nodeDiagnostics = rule.checkNode(node);
|
|
9119
|
+
if (nodeDiagnostics !== null) {
|
|
9120
|
+
fileDiagnostics != null ? fileDiagnostics : fileDiagnostics = [];
|
|
9121
|
+
if (Array.isArray(nodeDiagnostics)) {
|
|
9122
|
+
fileDiagnostics.push(...nodeDiagnostics);
|
|
9123
|
+
} else {
|
|
9124
|
+
fileDiagnostics.push(nodeDiagnostics);
|
|
9125
|
+
}
|
|
9126
|
+
}
|
|
9127
|
+
}
|
|
9128
|
+
node.forEachChild(walk);
|
|
9129
|
+
});
|
|
9130
|
+
return fileDiagnostics;
|
|
9131
|
+
}
|
|
9132
|
+
};
|
|
9133
|
+
|
|
9134
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/core_version.mjs
|
|
8889
9135
|
function coreHasSymbol(program, symbol) {
|
|
8890
9136
|
const checker = program.getTypeChecker();
|
|
8891
9137
|
for (const sf of program.getSourceFiles().filter(isMaybeCore)) {
|
|
@@ -8904,7 +9150,7 @@ function isMaybeCore(sf) {
|
|
|
8904
9150
|
return sf.isDeclarationFile && sf.fileName.includes("@angular/core") && sf.fileName.endsWith("index.d.ts");
|
|
8905
9151
|
}
|
|
8906
9152
|
|
|
8907
|
-
// bazel-out/
|
|
9153
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/feature_detection.mjs
|
|
8908
9154
|
import semver from "semver";
|
|
8909
9155
|
function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
8910
9156
|
if (coreVersion === `0.0.0-${"PLACEHOLDER"}`) {
|
|
@@ -8913,7 +9159,7 @@ function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
|
8913
9159
|
return semver.satisfies(coreVersion, minVersion);
|
|
8914
9160
|
}
|
|
8915
9161
|
|
|
8916
|
-
// bazel-out/
|
|
9162
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
8917
9163
|
var CompilationTicketKind;
|
|
8918
9164
|
(function(CompilationTicketKind2) {
|
|
8919
9165
|
CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -9005,7 +9251,7 @@ var NgCompiler = class {
|
|
|
9005
9251
|
this.currentProgram = inputProgram;
|
|
9006
9252
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
9007
9253
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
9008
|
-
const moduleResolutionCache =
|
|
9254
|
+
const moduleResolutionCache = ts41.createModuleResolutionCache(
|
|
9009
9255
|
this.adapter.getCurrentDirectory(),
|
|
9010
9256
|
this.adapter.getCanonicalFileName.bind(this.adapter)
|
|
9011
9257
|
);
|
|
@@ -9049,7 +9295,7 @@ var NgCompiler = class {
|
|
|
9049
9295
|
}
|
|
9050
9296
|
for (const clazz of classesToUpdate) {
|
|
9051
9297
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
9052
|
-
if (!
|
|
9298
|
+
if (!ts41.isClassDeclaration(clazz)) {
|
|
9053
9299
|
continue;
|
|
9054
9300
|
}
|
|
9055
9301
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -9394,9 +9640,15 @@ var NgCompiler = class {
|
|
|
9394
9640
|
runAdditionalChecks(sf) {
|
|
9395
9641
|
const diagnostics = [];
|
|
9396
9642
|
const compilation = this.ensureAnalyzed();
|
|
9397
|
-
const { extendedTemplateChecker, templateSemanticsChecker } = compilation;
|
|
9643
|
+
const { extendedTemplateChecker, templateSemanticsChecker, sourceFileValidator } = compilation;
|
|
9398
9644
|
const files = sf ? [sf] : this.inputProgram.getSourceFiles();
|
|
9399
9645
|
for (const sf2 of files) {
|
|
9646
|
+
if (sourceFileValidator !== null) {
|
|
9647
|
+
const sourceFileDiagnostics = sourceFileValidator.getDiagnosticsForFile(sf2);
|
|
9648
|
+
if (sourceFileDiagnostics !== null) {
|
|
9649
|
+
diagnostics.push(...sourceFileDiagnostics);
|
|
9650
|
+
}
|
|
9651
|
+
}
|
|
9400
9652
|
if (templateSemanticsChecker !== null) {
|
|
9401
9653
|
diagnostics.push(...compilation.traitCompiler.runAdditionalChecks(sf2, (clazz, handler) => {
|
|
9402
9654
|
var _a;
|
|
@@ -9518,6 +9770,7 @@ var NgCompiler = class {
|
|
|
9518
9770
|
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, metaReader, localMetaReader, ngModuleIndex, scopeReader, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
9519
9771
|
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
9520
9772
|
const templateSemanticsChecker = this.constructionDiagnostics.length === 0 ? new TemplateSemanticsCheckerImpl(templateTypeChecker) : null;
|
|
9773
|
+
const sourceFileValidator = this.constructionDiagnostics.length === 0 ? new SourceFileValidator(reflector, importTracker) : null;
|
|
9521
9774
|
return {
|
|
9522
9775
|
isCore,
|
|
9523
9776
|
traitCompiler,
|
|
@@ -9533,7 +9786,8 @@ var NgCompiler = class {
|
|
|
9533
9786
|
resourceRegistry,
|
|
9534
9787
|
extendedTemplateChecker,
|
|
9535
9788
|
localCompilationExtraImportsTracker,
|
|
9536
|
-
templateSemanticsChecker
|
|
9789
|
+
templateSemanticsChecker,
|
|
9790
|
+
sourceFileValidator
|
|
9537
9791
|
};
|
|
9538
9792
|
}
|
|
9539
9793
|
};
|
|
@@ -9543,18 +9797,18 @@ function isAngularCorePackage(program) {
|
|
|
9543
9797
|
return false;
|
|
9544
9798
|
}
|
|
9545
9799
|
return r3Symbols.statements.some((stmt) => {
|
|
9546
|
-
if (!
|
|
9800
|
+
if (!ts41.isVariableStatement(stmt)) {
|
|
9547
9801
|
return false;
|
|
9548
9802
|
}
|
|
9549
|
-
const modifiers =
|
|
9550
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
9803
|
+
const modifiers = ts41.getModifiers(stmt);
|
|
9804
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts41.SyntaxKind.ExportKeyword)) {
|
|
9551
9805
|
return false;
|
|
9552
9806
|
}
|
|
9553
9807
|
return stmt.declarationList.declarations.some((decl) => {
|
|
9554
|
-
if (!
|
|
9808
|
+
if (!ts41.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
9555
9809
|
return false;
|
|
9556
9810
|
}
|
|
9557
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
9811
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts41.SyntaxKind.TrueKeyword) {
|
|
9558
9812
|
return false;
|
|
9559
9813
|
}
|
|
9560
9814
|
return true;
|
|
@@ -9568,7 +9822,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
9568
9822
|
var _a, _b, _c;
|
|
9569
9823
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
9570
9824
|
yield makeConfigDiagnostic({
|
|
9571
|
-
category:
|
|
9825
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9572
9826
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
9573
9827
|
messageText: `
|
|
9574
9828
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -9587,7 +9841,7 @@ https://angular.io/guide/template-typecheck
|
|
|
9587
9841
|
}
|
|
9588
9842
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
9589
9843
|
yield makeConfigDiagnostic({
|
|
9590
|
-
category:
|
|
9844
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9591
9845
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
9592
9846
|
messageText: `
|
|
9593
9847
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -9604,7 +9858,7 @@ One of the following actions is required:
|
|
|
9604
9858
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
9605
9859
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
9606
9860
|
yield makeConfigDiagnostic({
|
|
9607
|
-
category:
|
|
9861
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9608
9862
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
9609
9863
|
messageText: `
|
|
9610
9864
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -9617,7 +9871,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
9617
9871
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
9618
9872
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
9619
9873
|
yield makeConfigDiagnostic({
|
|
9620
|
-
category:
|
|
9874
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9621
9875
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
9622
9876
|
messageText: `
|
|
9623
9877
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -9629,7 +9883,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
9629
9883
|
}
|
|
9630
9884
|
if (!allowedCategoryLabels.includes(category)) {
|
|
9631
9885
|
yield makeConfigDiagnostic({
|
|
9632
|
-
category:
|
|
9886
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9633
9887
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
9634
9888
|
messageText: `
|
|
9635
9889
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -9659,7 +9913,7 @@ var ReferenceGraphAdapter = class {
|
|
|
9659
9913
|
for (const { node } of references) {
|
|
9660
9914
|
let sourceFile = node.getSourceFile();
|
|
9661
9915
|
if (sourceFile === void 0) {
|
|
9662
|
-
sourceFile =
|
|
9916
|
+
sourceFile = ts41.getOriginalNode(node).getSourceFile();
|
|
9663
9917
|
}
|
|
9664
9918
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
9665
9919
|
this.graph.add(source, node);
|
|
@@ -9697,8 +9951,8 @@ function versionMapFromProgram(program, driver) {
|
|
|
9697
9951
|
return versions;
|
|
9698
9952
|
}
|
|
9699
9953
|
|
|
9700
|
-
// bazel-out/
|
|
9701
|
-
import
|
|
9954
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
9955
|
+
import ts42 from "typescript";
|
|
9702
9956
|
var DelegatingCompilerHost2 = class {
|
|
9703
9957
|
get jsDocParsingMode() {
|
|
9704
9958
|
return this.delegate.jsDocParsingMode;
|
|
@@ -9783,7 +10037,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
9783
10037
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
9784
10038
|
if (entryPoint === null) {
|
|
9785
10039
|
diagnostics.push({
|
|
9786
|
-
category:
|
|
10040
|
+
category: ts42.DiagnosticCategory.Error,
|
|
9787
10041
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
9788
10042
|
file: void 0,
|
|
9789
10043
|
start: void 0,
|
|
@@ -9826,17 +10080,17 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
9826
10080
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
9827
10081
|
}
|
|
9828
10082
|
createCachedResolveModuleNamesFunction() {
|
|
9829
|
-
const moduleResolutionCache =
|
|
10083
|
+
const moduleResolutionCache = ts42.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
9830
10084
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
9831
10085
|
return moduleNames.map((moduleName) => {
|
|
9832
|
-
const module =
|
|
10086
|
+
const module = ts42.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
9833
10087
|
return module.resolvedModule;
|
|
9834
10088
|
});
|
|
9835
10089
|
};
|
|
9836
10090
|
}
|
|
9837
10091
|
};
|
|
9838
10092
|
|
|
9839
|
-
// bazel-out/
|
|
10093
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
9840
10094
|
var NgtscProgram = class {
|
|
9841
10095
|
constructor(rootNames, options, delegateHost, oldProgram) {
|
|
9842
10096
|
this.options = options;
|
|
@@ -9853,7 +10107,7 @@ var NgtscProgram = class {
|
|
|
9853
10107
|
if (reuseProgram !== void 0) {
|
|
9854
10108
|
retagAllTsFiles(reuseProgram);
|
|
9855
10109
|
}
|
|
9856
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
10110
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts43.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
9857
10111
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
9858
10112
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
9859
10113
|
this.host.postProgramCreationCleanup();
|
|
@@ -10063,37 +10317,37 @@ function mergeEmitResults(emitResults) {
|
|
|
10063
10317
|
return { diagnostics, emitSkipped, emittedFiles };
|
|
10064
10318
|
}
|
|
10065
10319
|
|
|
10066
|
-
// bazel-out/
|
|
10320
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
10067
10321
|
function createProgram({ rootNames, options, host, oldProgram }) {
|
|
10068
10322
|
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
10069
10323
|
}
|
|
10070
10324
|
|
|
10071
|
-
// bazel-out/
|
|
10072
|
-
import
|
|
10325
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
10326
|
+
import ts45 from "typescript";
|
|
10073
10327
|
|
|
10074
|
-
// bazel-out/
|
|
10075
|
-
import
|
|
10328
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
10329
|
+
import ts44 from "typescript";
|
|
10076
10330
|
function createMessageDiagnostic(messageText) {
|
|
10077
10331
|
return {
|
|
10078
10332
|
file: void 0,
|
|
10079
10333
|
start: void 0,
|
|
10080
10334
|
length: void 0,
|
|
10081
|
-
category:
|
|
10335
|
+
category: ts44.DiagnosticCategory.Message,
|
|
10082
10336
|
messageText,
|
|
10083
10337
|
code: DEFAULT_ERROR_CODE,
|
|
10084
10338
|
source: SOURCE
|
|
10085
10339
|
};
|
|
10086
10340
|
}
|
|
10087
10341
|
|
|
10088
|
-
// bazel-out/
|
|
10342
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
10089
10343
|
var defaultFormatHost = {
|
|
10090
|
-
getCurrentDirectory: () =>
|
|
10344
|
+
getCurrentDirectory: () => ts45.sys.getCurrentDirectory(),
|
|
10091
10345
|
getCanonicalFileName: (fileName) => fileName,
|
|
10092
|
-
getNewLine: () =>
|
|
10346
|
+
getNewLine: () => ts45.sys.newLine
|
|
10093
10347
|
};
|
|
10094
10348
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
10095
10349
|
if (diags && diags.length) {
|
|
10096
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
10350
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts45.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
10097
10351
|
} else {
|
|
10098
10352
|
return "";
|
|
10099
10353
|
}
|
|
@@ -10110,7 +10364,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10110
10364
|
var _a;
|
|
10111
10365
|
try {
|
|
10112
10366
|
const fs = getFileSystem();
|
|
10113
|
-
const readConfigFile = (configFile) =>
|
|
10367
|
+
const readConfigFile = (configFile) => ts45.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
10114
10368
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
10115
10369
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
10116
10370
|
if (error2) {
|
|
@@ -10145,7 +10399,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10145
10399
|
...existingOptions
|
|
10146
10400
|
};
|
|
10147
10401
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
10148
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
10402
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts45.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
10149
10403
|
let emitFlags = EmitFlags.Default;
|
|
10150
10404
|
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
10151
10405
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -10156,7 +10410,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10156
10410
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
10157
10411
|
} catch (e) {
|
|
10158
10412
|
const errors = [{
|
|
10159
|
-
category:
|
|
10413
|
+
category: ts45.DiagnosticCategory.Error,
|
|
10160
10414
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
10161
10415
|
file: void 0,
|
|
10162
10416
|
start: void 0,
|
|
@@ -10170,7 +10424,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
10170
10424
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
10171
10425
|
return {
|
|
10172
10426
|
fileExists: host.exists.bind(host),
|
|
10173
|
-
readDirectory:
|
|
10427
|
+
readDirectory: ts45.sys.readDirectory,
|
|
10174
10428
|
readFile: host.readFile.bind(host),
|
|
10175
10429
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
10176
10430
|
};
|
|
@@ -10190,7 +10444,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
10190
10444
|
}
|
|
10191
10445
|
} else {
|
|
10192
10446
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
10193
|
-
const { resolvedModule } =
|
|
10447
|
+
const { resolvedModule } = ts45.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts45.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
|
|
10194
10448
|
if (resolvedModule) {
|
|
10195
10449
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
10196
10450
|
}
|
|
@@ -10200,7 +10454,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
10200
10454
|
function exitCodeFromResult(diags) {
|
|
10201
10455
|
if (!diags)
|
|
10202
10456
|
return 0;
|
|
10203
|
-
if (diags.every((diag) => diag.category !==
|
|
10457
|
+
if (diags.every((diag) => diag.category !== ts45.DiagnosticCategory.Error)) {
|
|
10204
10458
|
return 0;
|
|
10205
10459
|
}
|
|
10206
10460
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -10233,7 +10487,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
10233
10487
|
} catch (e) {
|
|
10234
10488
|
program = void 0;
|
|
10235
10489
|
allDiagnostics.push({
|
|
10236
|
-
category:
|
|
10490
|
+
category: ts45.DiagnosticCategory.Error,
|
|
10237
10491
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
10238
10492
|
code: UNKNOWN_ERROR_CODE,
|
|
10239
10493
|
file: void 0,
|
|
@@ -10260,7 +10514,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
10260
10514
|
return allDiagnostics;
|
|
10261
10515
|
}
|
|
10262
10516
|
function hasErrors(diags) {
|
|
10263
|
-
return diags.some((d) => d.category ===
|
|
10517
|
+
return diags.some((d) => d.category === ts45.DiagnosticCategory.Error);
|
|
10264
10518
|
}
|
|
10265
10519
|
|
|
10266
10520
|
export {
|
|
@@ -10274,6 +10528,7 @@ export {
|
|
|
10274
10528
|
MemberType,
|
|
10275
10529
|
DecoratorType,
|
|
10276
10530
|
MemberTags,
|
|
10531
|
+
DocsExtractor,
|
|
10277
10532
|
untagAllTsFiles,
|
|
10278
10533
|
TsCreateProgramDriver,
|
|
10279
10534
|
PatchedProgramIncrementalBuildStrategy,
|
|
@@ -10305,4 +10560,4 @@ export {
|
|
|
10305
10560
|
* Use of this source code is governed by an MIT-style license that can be
|
|
10306
10561
|
* found in the LICENSE file at https://angular.io/license
|
|
10307
10562
|
*/
|
|
10308
|
-
//# sourceMappingURL=chunk-
|
|
10563
|
+
//# sourceMappingURL=chunk-75Z2LUBT.js.map
|