@angular/compiler-cli 13.1.0-next.3 → 13.1.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-UMUIU7TE.js → chunk-7UHLQOIO.js} +4 -4
- package/bundles/{chunk-UMUIU7TE.js.map → chunk-7UHLQOIO.js.map} +0 -0
- package/bundles/{chunk-QDWL7SZJ.js → chunk-BPCUCINV.js} +2 -2
- package/bundles/{chunk-QDWL7SZJ.js.map → chunk-BPCUCINV.js.map} +0 -0
- package/bundles/{chunk-COAETSNP.js → chunk-CKZCKW5B.js} +785 -1129
- package/bundles/chunk-CKZCKW5B.js.map +6 -0
- package/bundles/{chunk-GLCRIILX.js → chunk-J6CW3T62.js} +5 -5
- package/bundles/{chunk-GLCRIILX.js.map → chunk-J6CW3T62.js.map} +0 -0
- package/bundles/{chunk-SKBLJA43.js → chunk-JTYUTYS2.js} +3 -3
- package/bundles/{chunk-SKBLJA43.js.map → chunk-JTYUTYS2.js.map} +0 -0
- package/bundles/{chunk-UIKTHF6Z.js → chunk-K5FPDA5B.js} +61 -63
- package/bundles/chunk-K5FPDA5B.js.map +6 -0
- package/bundles/{chunk-MFCLQBFK.js → chunk-KU4D2JVX.js} +39 -41
- package/bundles/chunk-KU4D2JVX.js.map +6 -0
- package/bundles/{chunk-7HVF6UHR.js → chunk-KXVQ4SSM.js} +24 -22
- package/bundles/chunk-KXVQ4SSM.js.map +6 -0
- package/bundles/{chunk-IESRH26X.js → chunk-L23I4NJT.js} +744 -434
- package/bundles/chunk-L23I4NJT.js.map +6 -0
- package/bundles/{chunk-QL6ZC3U3.js → chunk-RDTZZXLZ.js} +12 -12
- package/bundles/{chunk-QL6ZC3U3.js.map → chunk-RDTZZXLZ.js.map} +1 -1
- package/bundles/{chunk-EP5JHXG2.js → chunk-RGGJJ7ZZ.js} +39 -60
- package/bundles/chunk-RGGJJ7ZZ.js.map +6 -0
- package/bundles/{chunk-JJMLEEKA.js → chunk-RNVIUKDY.js} +9 -9
- package/bundles/chunk-RNVIUKDY.js.map +6 -0
- package/bundles/{chunk-HDZS2JG2.js → chunk-VUEDWBJP.js} +270 -100
- package/bundles/chunk-VUEDWBJP.js.map +6 -0
- package/bundles/{chunk-XA5IZLLC.js → chunk-WQ3TNYTD.js} +6 -6
- package/bundles/{chunk-XA5IZLLC.js.map → chunk-WQ3TNYTD.js.map} +0 -0
- package/bundles/{chunk-4EDYFHXN.js → chunk-XXMNTCYN.js} +9 -9
- package/bundles/chunk-XXMNTCYN.js.map +6 -0
- package/bundles/{chunk-7HBAJSZA.js → chunk-ZLL7BXGD.js} +228 -190
- package/bundles/chunk-ZLL7BXGD.js.map +6 -0
- package/bundles/index.js +16 -30
- package/bundles/index.js.map +2 -2
- package/bundles/linker/babel/index.js +85 -85
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +13 -13
- package/bundles/ngcc/main-ngcc.js +14 -14
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +14 -14
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +5 -5
- package/bundles/private/bazel.js +2 -2
- package/bundles/private/localize.js +4 -4
- package/bundles/private/migrations.js +6 -6
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +11 -11
- package/bundles/src/bin/ngc.js +11 -11
- package/bundles/src/bin/ngc.js.map +1 -1
- package/bundles_metadata.json +1 -1
- package/index.d.ts +2 -2
- package/ngcc/src/packages/adjust_cjs_umd_exports.d.ts +17 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/source_file_cache.d.ts +2 -1
- package/package.json +2 -2
- package/src/main.d.ts +3 -3
- package/src/ngtsc/annotations/src/util.d.ts +1 -1
- package/src/ngtsc/core/api/src/options.d.ts +3 -2
- package/src/ngtsc/core/api/src/public_options.d.ts +38 -0
- package/src/ngtsc/core/src/host.d.ts +1 -1
- package/src/ngtsc/diagnostics/index.d.ts +2 -1
- package/src/ngtsc/diagnostics/src/error.d.ts +1 -0
- package/src/ngtsc/diagnostics/src/error_code.d.ts +7 -0
- package/src/ngtsc/diagnostics/src/error_details_base_url.d.ts +1 -1
- package/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.d.ts +21 -0
- package/src/ngtsc/file_system/src/compiler_host.d.ts +1 -0
- package/src/ngtsc/imports/index.d.ts +1 -1
- package/src/ngtsc/imports/src/emitter.d.ts +40 -8
- package/src/ngtsc/program.d.ts +3 -6
- package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +1 -1
- package/src/ngtsc/translator/src/translator.d.ts +0 -5
- package/src/ngtsc/translator/src/type_translator.d.ts +0 -2
- package/src/ngtsc/typecheck/extended/api/api.d.ts +30 -10
- package/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.d.ts +3 -14
- package/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.d.ts +3 -15
- package/src/ngtsc/typecheck/extended/index.d.ts +3 -0
- package/src/ngtsc/typecheck/extended/src/extended_template_checker.d.ts +5 -4
- package/src/ngtsc/typecheck/src/environment.d.ts +3 -1
- package/src/ngtsc/typecheck/src/tcb_util.d.ts +10 -2
- package/src/ngtsc/typecheck/src/type_constructor.d.ts +3 -2
- package/src/ngtsc/typecheck/src/type_emitter.d.ts +7 -21
- package/src/ngtsc/typecheck/src/type_parameter_emitter.d.ts +2 -2
- package/src/ngtsc/util/src/typescript.d.ts +0 -5
- package/src/perform_compile.d.ts +5 -10
- package/src/perform_watch.d.ts +4 -4
- package/src/transformers/api.d.ts +3 -30
- package/src/transformers/util.d.ts +4 -6
- package/bundles/chunk-4EDYFHXN.js.map +0 -6
- package/bundles/chunk-7HBAJSZA.js.map +0 -6
- package/bundles/chunk-7HVF6UHR.js.map +0 -6
- package/bundles/chunk-COAETSNP.js.map +0 -6
- package/bundles/chunk-EP5JHXG2.js.map +0 -6
- package/bundles/chunk-HDZS2JG2.js.map +0 -6
- package/bundles/chunk-IESRH26X.js.map +0 -6
- package/bundles/chunk-JJMLEEKA.js.map +0 -6
- package/bundles/chunk-MFCLQBFK.js.map +0 -6
- package/bundles/chunk-UIKTHF6Z.js.map +0 -6
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
const __ESM_IMPORT_META_URL__ = import.meta.url;
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
COMPILER_ERRORS_WITH_GUIDES,
|
|
8
7
|
CompilationMode,
|
|
9
8
|
ComponentDecoratorHandler,
|
|
10
9
|
CompoundMetadataReader,
|
|
@@ -12,8 +11,7 @@ import {
|
|
|
12
11
|
DirectiveDecoratorHandler,
|
|
13
12
|
DtsMetadataReader,
|
|
14
13
|
DtsTransformRegistry,
|
|
15
|
-
|
|
16
|
-
ErrorCode,
|
|
14
|
+
FactoryGenerator,
|
|
17
15
|
InjectableClassRegistry,
|
|
18
16
|
InjectableDecoratorHandler,
|
|
19
17
|
LocalMetadataRegistry,
|
|
@@ -23,24 +21,32 @@ import {
|
|
|
23
21
|
PipeDecoratorHandler,
|
|
24
22
|
ResourceRegistry,
|
|
25
23
|
SemanticDepGraphUpdater,
|
|
24
|
+
ShimAdapter,
|
|
25
|
+
ShimReferenceTagger,
|
|
26
|
+
SummaryGenerator,
|
|
26
27
|
TraitCompiler,
|
|
27
28
|
aliasTransformFactory,
|
|
29
|
+
copyFileShimData,
|
|
28
30
|
declarationTransformFactory,
|
|
29
31
|
flattenInheritedDirectiveMetadata,
|
|
32
|
+
generatedFactoryTransform,
|
|
33
|
+
isShim,
|
|
30
34
|
ivyTransformFactory,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
replaceTsWithNgInErrors
|
|
35
|
-
} from "./chunk-IESRH26X.js";
|
|
35
|
+
retagAllTsFiles,
|
|
36
|
+
untagAllTsFiles
|
|
37
|
+
} from "./chunk-L23I4NJT.js";
|
|
36
38
|
import {
|
|
37
39
|
TypeScriptReflectionHost,
|
|
38
40
|
isNamedClassDeclaration
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-XXMNTCYN.js";
|
|
40
42
|
import {
|
|
41
43
|
AbsoluteModuleStrategy,
|
|
42
44
|
AliasStrategy,
|
|
45
|
+
COMPILER_ERRORS_WITH_GUIDES,
|
|
43
46
|
DefaultImportTracker,
|
|
47
|
+
ERROR_DETAILS_PAGE_BASE_URL,
|
|
48
|
+
ErrorCode,
|
|
49
|
+
ExtendedTemplateDiagnosticName,
|
|
44
50
|
ImportFlags,
|
|
45
51
|
ImportManager,
|
|
46
52
|
LocalIdentifierStrategy,
|
|
@@ -54,6 +60,7 @@ import {
|
|
|
54
60
|
RelativePathStrategy,
|
|
55
61
|
UnifiedModulesAliasingHost,
|
|
56
62
|
UnifiedModulesStrategy,
|
|
63
|
+
assertSuccessfulReferenceEmit,
|
|
57
64
|
getRootDirs,
|
|
58
65
|
getSourceFileOrNull,
|
|
59
66
|
getTokenAtPosition,
|
|
@@ -62,47 +69,46 @@ import {
|
|
|
62
69
|
isDtsPath,
|
|
63
70
|
isNonDeclarationTsPath,
|
|
64
71
|
isSymbolWithValueDeclaration,
|
|
72
|
+
makeDiagnostic,
|
|
73
|
+
makeRelatedInformation,
|
|
74
|
+
ngErrorCode,
|
|
65
75
|
nodeNameForError,
|
|
66
76
|
normalizeSeparators,
|
|
67
77
|
relativePathBetween,
|
|
78
|
+
replaceTsWithNgInErrors,
|
|
68
79
|
toUnredirectedSourceFile,
|
|
69
80
|
translateExpression,
|
|
70
81
|
translateType
|
|
71
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-VUEDWBJP.js";
|
|
72
83
|
import {
|
|
73
84
|
LogicalFileSystem,
|
|
74
85
|
absoluteFrom,
|
|
75
86
|
absoluteFromSourceFile,
|
|
76
|
-
basename,
|
|
77
87
|
dirname,
|
|
78
88
|
getFileSystem,
|
|
79
89
|
getSourceFileOrError,
|
|
80
90
|
join,
|
|
81
|
-
relative,
|
|
82
91
|
resolve
|
|
83
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-RGGJJ7ZZ.js";
|
|
84
93
|
import {
|
|
85
94
|
ActivePerfRecorder,
|
|
86
95
|
DelegatingPerfRecorder,
|
|
87
96
|
PerfCheckpoint,
|
|
88
97
|
PerfEvent,
|
|
89
98
|
PerfPhase
|
|
90
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-J6CW3T62.js";
|
|
91
100
|
import {
|
|
92
101
|
__spreadProps,
|
|
93
102
|
__spreadValues
|
|
94
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-WQ3TNYTD.js";
|
|
95
104
|
|
|
96
|
-
// bazel-out/
|
|
105
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
97
106
|
var DEFAULT_ERROR_CODE = 100;
|
|
98
107
|
var UNKNOWN_ERROR_CODE = 500;
|
|
99
108
|
var SOURCE = "angular";
|
|
100
109
|
function isTsDiagnostic(diagnostic) {
|
|
101
110
|
return diagnostic != null && diagnostic.source !== "angular";
|
|
102
111
|
}
|
|
103
|
-
function isNgDiagnostic(diagnostic) {
|
|
104
|
-
return diagnostic != null && diagnostic.source === "angular";
|
|
105
|
-
}
|
|
106
112
|
var EmitFlags;
|
|
107
113
|
(function(EmitFlags2) {
|
|
108
114
|
EmitFlags2[EmitFlags2["DTS"] = 1] = "DTS";
|
|
@@ -114,7 +120,7 @@ var EmitFlags;
|
|
|
114
120
|
EmitFlags2[EmitFlags2["All"] = 31] = "All";
|
|
115
121
|
})(EmitFlags || (EmitFlags = {}));
|
|
116
122
|
|
|
117
|
-
// bazel-out/
|
|
123
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/compiler_host.mjs
|
|
118
124
|
import ts from "typescript";
|
|
119
125
|
var wrapHostForTest = null;
|
|
120
126
|
function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, true) }) {
|
|
@@ -124,21 +130,21 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
|
|
|
124
130
|
return tsHost;
|
|
125
131
|
}
|
|
126
132
|
|
|
127
|
-
// bazel-out/
|
|
133
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/checker.mjs
|
|
128
134
|
var OptimizeFor;
|
|
129
135
|
(function(OptimizeFor2) {
|
|
130
136
|
OptimizeFor2[OptimizeFor2["SingleFile"] = 0] = "SingleFile";
|
|
131
137
|
OptimizeFor2[OptimizeFor2["WholeProgram"] = 1] = "WholeProgram";
|
|
132
138
|
})(OptimizeFor || (OptimizeFor = {}));
|
|
133
139
|
|
|
134
|
-
// bazel-out/
|
|
140
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/completion.mjs
|
|
135
141
|
var CompletionKind;
|
|
136
142
|
(function(CompletionKind2) {
|
|
137
143
|
CompletionKind2[CompletionKind2["Reference"] = 0] = "Reference";
|
|
138
144
|
CompletionKind2[CompletionKind2["Variable"] = 1] = "Variable";
|
|
139
145
|
})(CompletionKind || (CompletionKind = {}));
|
|
140
146
|
|
|
141
|
-
// bazel-out/
|
|
147
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.mjs
|
|
142
148
|
var SymbolKind;
|
|
143
149
|
(function(SymbolKind2) {
|
|
144
150
|
SymbolKind2[SymbolKind2["Input"] = 0] = "Input";
|
|
@@ -154,17 +160,13 @@ var SymbolKind;
|
|
|
154
160
|
SymbolKind2[SymbolKind2["Pipe"] = 10] = "Pipe";
|
|
155
161
|
})(SymbolKind || (SymbolKind = {}));
|
|
156
162
|
|
|
157
|
-
// bazel-out/
|
|
163
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
158
164
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
159
|
-
import
|
|
165
|
+
import ts31 from "typescript";
|
|
160
166
|
|
|
161
|
-
// bazel-out/
|
|
167
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
162
168
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
163
|
-
import
|
|
164
|
-
relative as relative2,
|
|
165
|
-
resolve as resolve2,
|
|
166
|
-
sep
|
|
167
|
-
} from "path";
|
|
169
|
+
import * as path from "path";
|
|
168
170
|
function i18nGetExtension(formatName) {
|
|
169
171
|
const format = formatName.toLowerCase();
|
|
170
172
|
switch (format) {
|
|
@@ -179,7 +181,7 @@ function i18nGetExtension(formatName) {
|
|
|
179
181
|
}
|
|
180
182
|
throw new Error(`Unsupported format "${formatName}"`);
|
|
181
183
|
}
|
|
182
|
-
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve =
|
|
184
|
+
function i18nExtract(formatName, outFile, host, options, bundle, pathResolve = path.resolve) {
|
|
183
185
|
formatName = formatName || "xlf";
|
|
184
186
|
const ext = i18nGetExtension(formatName);
|
|
185
187
|
const content = i18nSerialize(bundle, formatName, options);
|
|
@@ -208,15 +210,15 @@ function i18nSerialize(bundle, formatName, options) {
|
|
|
208
210
|
}
|
|
209
211
|
function getPathNormalizer(basePath) {
|
|
210
212
|
return (sourcePath) => {
|
|
211
|
-
sourcePath = basePath ?
|
|
212
|
-
return sourcePath.split(sep).join("/");
|
|
213
|
+
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
|
|
214
|
+
return sourcePath.split(path.sep).join("/");
|
|
213
215
|
};
|
|
214
216
|
}
|
|
215
217
|
|
|
216
|
-
// bazel-out/
|
|
218
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
217
219
|
import ts2 from "typescript";
|
|
218
220
|
|
|
219
|
-
// bazel-out/
|
|
221
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
220
222
|
function toNumbers(value) {
|
|
221
223
|
const suffixIndex = value.lastIndexOf("-");
|
|
222
224
|
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
@@ -251,7 +253,7 @@ function compareVersions(v1, v2) {
|
|
|
251
253
|
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
252
254
|
}
|
|
253
255
|
|
|
254
|
-
// bazel-out/
|
|
256
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
255
257
|
var MIN_TS_VERSION = "4.4.2";
|
|
256
258
|
var MAX_TS_VERSION = "4.6.0";
|
|
257
259
|
var tsVersion = ts2.version;
|
|
@@ -264,10 +266,10 @@ function verifySupportedTypeScriptVersion() {
|
|
|
264
266
|
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
265
267
|
}
|
|
266
268
|
|
|
267
|
-
// bazel-out/
|
|
268
|
-
import
|
|
269
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
270
|
+
import ts29 from "typescript";
|
|
269
271
|
|
|
270
|
-
// bazel-out/
|
|
272
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
271
273
|
var CycleAnalyzer = class {
|
|
272
274
|
constructor(importGraph) {
|
|
273
275
|
this.importGraph = importGraph;
|
|
@@ -338,13 +340,13 @@ var Cycle = class {
|
|
|
338
340
|
}
|
|
339
341
|
};
|
|
340
342
|
|
|
341
|
-
// bazel-out/
|
|
343
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
342
344
|
import ts3 from "typescript";
|
|
343
345
|
var ImportGraph = class {
|
|
344
346
|
constructor(checker, perf) {
|
|
345
347
|
this.checker = checker;
|
|
346
348
|
this.perf = perf;
|
|
347
|
-
this.imports = new Map();
|
|
349
|
+
this.imports = /* @__PURE__ */ new Map();
|
|
348
350
|
}
|
|
349
351
|
importsOf(sf) {
|
|
350
352
|
if (!this.imports.has(sf)) {
|
|
@@ -356,7 +358,7 @@ var ImportGraph = class {
|
|
|
356
358
|
if (start === end) {
|
|
357
359
|
return [start];
|
|
358
360
|
}
|
|
359
|
-
const found = new Set([start]);
|
|
361
|
+
const found = /* @__PURE__ */ new Set([start]);
|
|
360
362
|
const queue = [new Found(start, null)];
|
|
361
363
|
while (queue.length > 0) {
|
|
362
364
|
const current = queue.shift();
|
|
@@ -381,7 +383,7 @@ var ImportGraph = class {
|
|
|
381
383
|
}
|
|
382
384
|
scanImports(sf) {
|
|
383
385
|
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
384
|
-
const imports = new Set();
|
|
386
|
+
const imports = /* @__PURE__ */ new Set();
|
|
385
387
|
for (const stmt of sf.statements) {
|
|
386
388
|
if (!ts3.isImportDeclaration(stmt) && !ts3.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
387
389
|
continue;
|
|
@@ -430,7 +432,7 @@ var Found = class {
|
|
|
430
432
|
}
|
|
431
433
|
};
|
|
432
434
|
|
|
433
|
-
// bazel-out/
|
|
435
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
434
436
|
import ts4 from "typescript";
|
|
435
437
|
var FlatIndexGenerator = class {
|
|
436
438
|
constructor(entryPoint, relativeFlatIndexPath, moduleName) {
|
|
@@ -455,7 +457,7 @@ export * from '${relativeEntryPoint}';
|
|
|
455
457
|
}
|
|
456
458
|
};
|
|
457
459
|
|
|
458
|
-
// bazel-out/
|
|
460
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/logic.mjs
|
|
459
461
|
function findFlatIndexEntryPoint(rootFiles) {
|
|
460
462
|
const tsFiles = rootFiles.filter((file) => isNonDeclarationTsPath(file));
|
|
461
463
|
let resolvedEntryPoint = null;
|
|
@@ -471,11 +473,11 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
471
473
|
return resolvedEntryPoint;
|
|
472
474
|
}
|
|
473
475
|
|
|
474
|
-
// bazel-out/
|
|
476
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
475
477
|
import ts5 from "typescript";
|
|
476
478
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
477
479
|
const diagnostics = [];
|
|
478
|
-
const topLevelExports = new Set();
|
|
480
|
+
const topLevelExports = /* @__PURE__ */ new Set();
|
|
479
481
|
const moduleSymbol = checker.getSymbolAtLocation(entryPoint);
|
|
480
482
|
if (moduleSymbol === void 0) {
|
|
481
483
|
throw new Error(`Internal error: failed to get symbol for entrypoint`);
|
|
@@ -490,7 +492,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
490
492
|
topLevelExports.add(decl);
|
|
491
493
|
}
|
|
492
494
|
});
|
|
493
|
-
const checkedSet = new Set();
|
|
495
|
+
const checkedSet = /* @__PURE__ */ new Set();
|
|
494
496
|
topLevelExports.forEach((mainExport) => {
|
|
495
497
|
refGraph.transitiveReferencesOf(mainExport).forEach((transitiveReference) => {
|
|
496
498
|
if (checkedSet.has(transitiveReference)) {
|
|
@@ -551,24 +553,24 @@ function getDescriptorOfDeclaration(decl) {
|
|
|
551
553
|
}
|
|
552
554
|
}
|
|
553
555
|
|
|
554
|
-
// bazel-out/
|
|
556
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/reference_graph.mjs
|
|
555
557
|
var ReferenceGraph = class {
|
|
556
558
|
constructor() {
|
|
557
|
-
this.references = new Map();
|
|
559
|
+
this.references = /* @__PURE__ */ new Map();
|
|
558
560
|
}
|
|
559
561
|
add(from, to) {
|
|
560
562
|
if (!this.references.has(from)) {
|
|
561
|
-
this.references.set(from, new Set());
|
|
563
|
+
this.references.set(from, /* @__PURE__ */ new Set());
|
|
562
564
|
}
|
|
563
565
|
this.references.get(from).add(to);
|
|
564
566
|
}
|
|
565
567
|
transitiveReferencesOf(target) {
|
|
566
|
-
const set = new Set();
|
|
568
|
+
const set = /* @__PURE__ */ new Set();
|
|
567
569
|
this.collectTransitiveReferences(set, target);
|
|
568
570
|
return set;
|
|
569
571
|
}
|
|
570
572
|
pathFrom(source, target) {
|
|
571
|
-
return this.collectPathFrom(source, target, new Set());
|
|
573
|
+
return this.collectPathFrom(source, target, /* @__PURE__ */ new Set());
|
|
572
574
|
}
|
|
573
575
|
collectPathFrom(source, target, seen) {
|
|
574
576
|
if (source === target) {
|
|
@@ -605,7 +607,7 @@ var ReferenceGraph = class {
|
|
|
605
607
|
}
|
|
606
608
|
};
|
|
607
609
|
|
|
608
|
-
// bazel-out/
|
|
610
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/api.mjs
|
|
609
611
|
var NgOriginalFile = Symbol("NgOriginalFile");
|
|
610
612
|
var UpdateMode;
|
|
611
613
|
(function(UpdateMode2) {
|
|
@@ -613,408 +615,8 @@ var UpdateMode;
|
|
|
613
615
|
UpdateMode2[UpdateMode2["Incremental"] = 1] = "Incremental";
|
|
614
616
|
})(UpdateMode || (UpdateMode = {}));
|
|
615
617
|
|
|
616
|
-
// bazel-out/
|
|
617
|
-
import ts9 from "typescript";
|
|
618
|
-
|
|
619
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
618
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
620
619
|
import ts6 from "typescript";
|
|
621
|
-
|
|
622
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
623
|
-
var NgExtension = Symbol("NgExtension");
|
|
624
|
-
function isExtended(sf) {
|
|
625
|
-
return sf[NgExtension] !== void 0;
|
|
626
|
-
}
|
|
627
|
-
function sfExtensionData(sf) {
|
|
628
|
-
const extSf = sf;
|
|
629
|
-
if (extSf[NgExtension] !== void 0) {
|
|
630
|
-
return extSf[NgExtension];
|
|
631
|
-
}
|
|
632
|
-
const extension = {
|
|
633
|
-
isTopLevelShim: false,
|
|
634
|
-
fileShim: null,
|
|
635
|
-
originalReferencedFiles: null,
|
|
636
|
-
taggedReferenceFiles: null
|
|
637
|
-
};
|
|
638
|
-
extSf[NgExtension] = extension;
|
|
639
|
-
return extension;
|
|
640
|
-
}
|
|
641
|
-
function isFileShimSourceFile(sf) {
|
|
642
|
-
return isExtended(sf) && sf[NgExtension].fileShim !== null;
|
|
643
|
-
}
|
|
644
|
-
function isShim(sf) {
|
|
645
|
-
return isExtended(sf) && (sf[NgExtension].fileShim !== null || sf[NgExtension].isTopLevelShim);
|
|
646
|
-
}
|
|
647
|
-
function copyFileShimData(from, to) {
|
|
648
|
-
if (!isFileShimSourceFile(from)) {
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
sfExtensionData(to).fileShim = sfExtensionData(from).fileShim;
|
|
652
|
-
}
|
|
653
|
-
function untagAllTsFiles(program) {
|
|
654
|
-
for (const sf of program.getSourceFiles()) {
|
|
655
|
-
untagTsFile(sf);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
function retagAllTsFiles(program) {
|
|
659
|
-
for (const sf of program.getSourceFiles()) {
|
|
660
|
-
retagTsFile(sf);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
function untagTsFile(sf) {
|
|
664
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
const ext = sfExtensionData(sf);
|
|
668
|
-
if (ext.originalReferencedFiles !== null) {
|
|
669
|
-
sf.referencedFiles = ext.originalReferencedFiles;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
function retagTsFile(sf) {
|
|
673
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
const ext = sfExtensionData(sf);
|
|
677
|
-
if (ext.taggedReferenceFiles !== null) {
|
|
678
|
-
sf.referencedFiles = ext.taggedReferenceFiles;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/util.mjs
|
|
683
|
-
var TS_EXTENSIONS = /\.tsx?$/i;
|
|
684
|
-
function makeShimFileName(fileName, suffix) {
|
|
685
|
-
return absoluteFrom(fileName.replace(TS_EXTENSIONS, suffix));
|
|
686
|
-
}
|
|
687
|
-
function generatedModuleName(originalModuleName, originalFileName, genSuffix) {
|
|
688
|
-
let moduleName;
|
|
689
|
-
if (originalFileName.endsWith("/index.ts")) {
|
|
690
|
-
moduleName = originalModuleName + "/index" + genSuffix;
|
|
691
|
-
} else {
|
|
692
|
-
moduleName = originalModuleName + genSuffix;
|
|
693
|
-
}
|
|
694
|
-
return moduleName;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
698
|
-
var ShimAdapter = class {
|
|
699
|
-
constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
|
|
700
|
-
this.delegate = delegate;
|
|
701
|
-
this.shims = new Map();
|
|
702
|
-
this.priorShims = new Map();
|
|
703
|
-
this.notShims = new Set();
|
|
704
|
-
this.generators = [];
|
|
705
|
-
this.ignoreForEmit = new Set();
|
|
706
|
-
this.extensionPrefixes = [];
|
|
707
|
-
for (const gen of perFileGenerators) {
|
|
708
|
-
const pattern = `^(.*)\\.${gen.extensionPrefix}\\.ts$`;
|
|
709
|
-
const regexp = new RegExp(pattern, "i");
|
|
710
|
-
this.generators.push({
|
|
711
|
-
generator: gen,
|
|
712
|
-
test: regexp,
|
|
713
|
-
suffix: `.${gen.extensionPrefix}.ts`
|
|
714
|
-
});
|
|
715
|
-
this.extensionPrefixes.push(gen.extensionPrefix);
|
|
716
|
-
}
|
|
717
|
-
const extraInputFiles = [];
|
|
718
|
-
for (const gen of topLevelGenerators) {
|
|
719
|
-
const sf = gen.makeTopLevelShim();
|
|
720
|
-
sfExtensionData(sf).isTopLevelShim = true;
|
|
721
|
-
if (!gen.shouldEmit) {
|
|
722
|
-
this.ignoreForEmit.add(sf);
|
|
723
|
-
}
|
|
724
|
-
const fileName = absoluteFromSourceFile(sf);
|
|
725
|
-
this.shims.set(fileName, sf);
|
|
726
|
-
extraInputFiles.push(fileName);
|
|
727
|
-
}
|
|
728
|
-
for (const rootFile of tsRootFiles) {
|
|
729
|
-
for (const gen of this.generators) {
|
|
730
|
-
extraInputFiles.push(makeShimFileName(rootFile, gen.suffix));
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
this.extraInputFiles = extraInputFiles;
|
|
734
|
-
if (oldProgram !== null) {
|
|
735
|
-
for (const oldSf of oldProgram.getSourceFiles()) {
|
|
736
|
-
if (oldSf.isDeclarationFile || !isFileShimSourceFile(oldSf)) {
|
|
737
|
-
continue;
|
|
738
|
-
}
|
|
739
|
-
this.priorShims.set(absoluteFromSourceFile(oldSf), oldSf);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
maybeGenerate(fileName) {
|
|
744
|
-
if (this.notShims.has(fileName)) {
|
|
745
|
-
return null;
|
|
746
|
-
} else if (this.shims.has(fileName)) {
|
|
747
|
-
return this.shims.get(fileName);
|
|
748
|
-
}
|
|
749
|
-
if (isDtsPath(fileName)) {
|
|
750
|
-
this.notShims.add(fileName);
|
|
751
|
-
return null;
|
|
752
|
-
}
|
|
753
|
-
for (const record of this.generators) {
|
|
754
|
-
const match = record.test.exec(fileName);
|
|
755
|
-
if (match === null) {
|
|
756
|
-
continue;
|
|
757
|
-
}
|
|
758
|
-
const prefix = match[1];
|
|
759
|
-
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
760
|
-
if (!this.delegate.fileExists(baseFileName)) {
|
|
761
|
-
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
762
|
-
if (!this.delegate.fileExists(baseFileName)) {
|
|
763
|
-
return void 0;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
const inputFile = this.delegate.getSourceFile(baseFileName, ts6.ScriptTarget.Latest);
|
|
767
|
-
if (inputFile === void 0 || isShim(inputFile)) {
|
|
768
|
-
return void 0;
|
|
769
|
-
}
|
|
770
|
-
return this.generateSpecific(fileName, record.generator, inputFile);
|
|
771
|
-
}
|
|
772
|
-
this.notShims.add(fileName);
|
|
773
|
-
return null;
|
|
774
|
-
}
|
|
775
|
-
generateSpecific(fileName, generator, inputFile) {
|
|
776
|
-
let priorShimSf = null;
|
|
777
|
-
if (this.priorShims.has(fileName)) {
|
|
778
|
-
priorShimSf = this.priorShims.get(fileName);
|
|
779
|
-
this.priorShims.delete(fileName);
|
|
780
|
-
}
|
|
781
|
-
const shimSf = generator.generateShimForFile(inputFile, fileName, priorShimSf);
|
|
782
|
-
sfExtensionData(shimSf).fileShim = {
|
|
783
|
-
extension: generator.extensionPrefix,
|
|
784
|
-
generatedFrom: absoluteFromSourceFile(inputFile)
|
|
785
|
-
};
|
|
786
|
-
if (!generator.shouldEmit) {
|
|
787
|
-
this.ignoreForEmit.add(shimSf);
|
|
788
|
-
}
|
|
789
|
-
this.shims.set(fileName, shimSf);
|
|
790
|
-
return shimSf;
|
|
791
|
-
}
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.mjs
|
|
795
|
-
import ts7 from "typescript";
|
|
796
|
-
var TS_DTS_SUFFIX = /(\.d)?\.ts$/;
|
|
797
|
-
var STRIP_NG_FACTORY = /(.*)NgFactory$/;
|
|
798
|
-
var FactoryGenerator = class {
|
|
799
|
-
constructor() {
|
|
800
|
-
this.sourceInfo = new Map();
|
|
801
|
-
this.sourceToFactorySymbols = new Map();
|
|
802
|
-
this.shouldEmit = true;
|
|
803
|
-
this.extensionPrefix = "ngfactory";
|
|
804
|
-
}
|
|
805
|
-
generateShimForFile(sf, genFilePath) {
|
|
806
|
-
const absoluteSfPath = absoluteFromSourceFile(sf);
|
|
807
|
-
const relativePathToSource = "./" + basename(sf.fileName).replace(TS_DTS_SUFFIX, "");
|
|
808
|
-
const symbolNames = sf.statements.filter(ts7.isClassDeclaration).filter((decl) => isExported(decl) && decl.decorators !== void 0 && decl.name !== void 0).map((decl) => decl.name.text);
|
|
809
|
-
let sourceText = "";
|
|
810
|
-
const leadingComment = getFileoverviewComment(sf);
|
|
811
|
-
if (leadingComment !== null) {
|
|
812
|
-
sourceText = leadingComment + "\n\n";
|
|
813
|
-
}
|
|
814
|
-
if (symbolNames.length > 0) {
|
|
815
|
-
const varLines = symbolNames.map((name) => `export const ${name}NgFactory: i0.\u0275NgModuleFactory<any> = new i0.\u0275NgModuleFactory(${name});`);
|
|
816
|
-
sourceText += [
|
|
817
|
-
`import * as i0 from '@angular/core';`,
|
|
818
|
-
`import {${symbolNames.join(", ")}} from '${relativePathToSource}';`,
|
|
819
|
-
...varLines
|
|
820
|
-
].join("\n");
|
|
821
|
-
}
|
|
822
|
-
sourceText += "\nexport const \u0275NonEmptyModule = true;";
|
|
823
|
-
const genFile = ts7.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts7.ScriptKind.TS);
|
|
824
|
-
if (sf.moduleName !== void 0) {
|
|
825
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngfactory");
|
|
826
|
-
}
|
|
827
|
-
const moduleSymbols = new Map();
|
|
828
|
-
this.sourceToFactorySymbols.set(absoluteSfPath, moduleSymbols);
|
|
829
|
-
this.sourceInfo.set(genFilePath, {
|
|
830
|
-
sourceFilePath: absoluteSfPath,
|
|
831
|
-
moduleSymbols
|
|
832
|
-
});
|
|
833
|
-
return genFile;
|
|
834
|
-
}
|
|
835
|
-
track(sf, moduleInfo) {
|
|
836
|
-
if (this.sourceToFactorySymbols.has(sf.fileName)) {
|
|
837
|
-
this.sourceToFactorySymbols.get(sf.fileName).set(moduleInfo.name, moduleInfo);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
};
|
|
841
|
-
function isExported(decl) {
|
|
842
|
-
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts7.SyntaxKind.ExportKeyword);
|
|
843
|
-
}
|
|
844
|
-
function generatedFactoryTransform(factoryMap, importRewriter) {
|
|
845
|
-
return (context) => {
|
|
846
|
-
return (file) => {
|
|
847
|
-
return transformFactorySourceFile(factoryMap, context, importRewriter, file);
|
|
848
|
-
};
|
|
849
|
-
};
|
|
850
|
-
}
|
|
851
|
-
function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
|
|
852
|
-
if (!factoryMap.has(file.fileName)) {
|
|
853
|
-
return file;
|
|
854
|
-
}
|
|
855
|
-
const { moduleSymbols, sourceFilePath } = factoryMap.get(file.fileName);
|
|
856
|
-
const transformedStatements = [];
|
|
857
|
-
let nonEmptyExport = null;
|
|
858
|
-
const coreImportIdentifiers = new Set();
|
|
859
|
-
for (const stmt of file.statements) {
|
|
860
|
-
if (ts7.isImportDeclaration(stmt) && ts7.isStringLiteral(stmt.moduleSpecifier) && stmt.moduleSpecifier.text === "@angular/core") {
|
|
861
|
-
const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier("@angular/core", sourceFilePath);
|
|
862
|
-
if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
|
|
863
|
-
transformedStatements.push(ts7.updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts7.createStringLiteral(rewrittenModuleSpecifier), void 0));
|
|
864
|
-
if (stmt.importClause !== void 0 && stmt.importClause.namedBindings !== void 0 && ts7.isNamespaceImport(stmt.importClause.namedBindings)) {
|
|
865
|
-
coreImportIdentifiers.add(stmt.importClause.namedBindings.name.text);
|
|
866
|
-
}
|
|
867
|
-
} else {
|
|
868
|
-
transformedStatements.push(stmt);
|
|
869
|
-
}
|
|
870
|
-
} else if (ts7.isVariableStatement(stmt) && stmt.declarationList.declarations.length === 1) {
|
|
871
|
-
const decl = stmt.declarationList.declarations[0];
|
|
872
|
-
if (ts7.isIdentifier(decl.name)) {
|
|
873
|
-
if (decl.name.text === "\u0275NonEmptyModule") {
|
|
874
|
-
nonEmptyExport = stmt;
|
|
875
|
-
continue;
|
|
876
|
-
}
|
|
877
|
-
const match = STRIP_NG_FACTORY.exec(decl.name.text);
|
|
878
|
-
const module = match ? moduleSymbols.get(match[1]) : null;
|
|
879
|
-
if (module) {
|
|
880
|
-
const moduleIsTreeShakable = !module.hasId;
|
|
881
|
-
const newStmt = !moduleIsTreeShakable ? stmt : updateInitializers(stmt, (init) => init ? wrapInNoSideEffects(init) : void 0);
|
|
882
|
-
transformedStatements.push(newStmt);
|
|
883
|
-
}
|
|
884
|
-
} else {
|
|
885
|
-
transformedStatements.push(stmt);
|
|
886
|
-
}
|
|
887
|
-
} else {
|
|
888
|
-
transformedStatements.push(stmt);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
if (!transformedStatements.some(ts7.isVariableStatement) && nonEmptyExport !== null) {
|
|
892
|
-
transformedStatements.push(nonEmptyExport);
|
|
893
|
-
}
|
|
894
|
-
file = ts7.updateSourceFileNode(file, transformedStatements);
|
|
895
|
-
if (coreImportIdentifiers.size > 0) {
|
|
896
|
-
const visit = (node) => {
|
|
897
|
-
node = ts7.visitEachChild(node, (child) => visit(child), context);
|
|
898
|
-
if (ts7.isPropertyAccessExpression(node) && ts7.isIdentifier(node.expression) && coreImportIdentifiers.has(node.expression.text)) {
|
|
899
|
-
const rewrittenSymbol = importRewriter.rewriteSymbol(node.name.text, "@angular/core");
|
|
900
|
-
if (rewrittenSymbol !== node.name.text) {
|
|
901
|
-
const updated = ts7.updatePropertyAccess(node, node.expression, ts7.createIdentifier(rewrittenSymbol));
|
|
902
|
-
node = updated;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
return node;
|
|
906
|
-
};
|
|
907
|
-
file = visit(file);
|
|
908
|
-
}
|
|
909
|
-
return file;
|
|
910
|
-
}
|
|
911
|
-
function getFileoverviewComment(sourceFile) {
|
|
912
|
-
const text = sourceFile.getFullText();
|
|
913
|
-
const trivia = text.substring(0, sourceFile.getStart());
|
|
914
|
-
const leadingComments = ts7.getLeadingCommentRanges(trivia, 0);
|
|
915
|
-
if (!leadingComments || leadingComments.length === 0) {
|
|
916
|
-
return null;
|
|
917
|
-
}
|
|
918
|
-
const comment = leadingComments[0];
|
|
919
|
-
if (comment.kind !== ts7.SyntaxKind.MultiLineCommentTrivia) {
|
|
920
|
-
return null;
|
|
921
|
-
}
|
|
922
|
-
if (text.substring(comment.end, comment.end + 2) !== "\n\n") {
|
|
923
|
-
return null;
|
|
924
|
-
}
|
|
925
|
-
const commentText = text.substring(comment.pos, comment.end);
|
|
926
|
-
if (commentText.indexOf("@license") !== -1) {
|
|
927
|
-
return null;
|
|
928
|
-
}
|
|
929
|
-
return commentText;
|
|
930
|
-
}
|
|
931
|
-
function wrapInNoSideEffects(expr) {
|
|
932
|
-
const noSideEffects = ts7.createPropertyAccess(ts7.createIdentifier("i0"), "\u0275noSideEffects");
|
|
933
|
-
return ts7.createCall(noSideEffects, [], [
|
|
934
|
-
ts7.createFunctionExpression([], void 0, void 0, [], [], void 0, ts7.createBlock([
|
|
935
|
-
ts7.createReturn(expr)
|
|
936
|
-
]))
|
|
937
|
-
]);
|
|
938
|
-
}
|
|
939
|
-
function updateInitializers(stmt, update) {
|
|
940
|
-
return ts7.updateVariableStatement(stmt, stmt.modifiers, ts7.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts7.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
|
|
944
|
-
var ShimReferenceTagger = class {
|
|
945
|
-
constructor(shimExtensions) {
|
|
946
|
-
this.tagged = new Set();
|
|
947
|
-
this.enabled = true;
|
|
948
|
-
this.suffixes = shimExtensions.map((extension) => `.${extension}.ts`);
|
|
949
|
-
}
|
|
950
|
-
tag(sf) {
|
|
951
|
-
if (!this.enabled || sf.isDeclarationFile || isShim(sf) || this.tagged.has(sf) || !isNonDeclarationTsPath(sf.fileName)) {
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
|
-
const ext = sfExtensionData(sf);
|
|
955
|
-
if (ext.originalReferencedFiles === null) {
|
|
956
|
-
ext.originalReferencedFiles = sf.referencedFiles;
|
|
957
|
-
}
|
|
958
|
-
const referencedFiles = [...ext.originalReferencedFiles];
|
|
959
|
-
const sfPath = absoluteFromSourceFile(sf);
|
|
960
|
-
for (const suffix of this.suffixes) {
|
|
961
|
-
referencedFiles.push({
|
|
962
|
-
fileName: makeShimFileName(sfPath, suffix),
|
|
963
|
-
pos: 0,
|
|
964
|
-
end: 0
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
ext.taggedReferenceFiles = referencedFiles;
|
|
968
|
-
sf.referencedFiles = referencedFiles;
|
|
969
|
-
this.tagged.add(sf);
|
|
970
|
-
}
|
|
971
|
-
finalize() {
|
|
972
|
-
this.enabled = false;
|
|
973
|
-
this.tagged.clear();
|
|
974
|
-
}
|
|
975
|
-
};
|
|
976
|
-
|
|
977
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.mjs
|
|
978
|
-
import ts8 from "typescript";
|
|
979
|
-
var SummaryGenerator = class {
|
|
980
|
-
constructor() {
|
|
981
|
-
this.shouldEmit = true;
|
|
982
|
-
this.extensionPrefix = "ngsummary";
|
|
983
|
-
}
|
|
984
|
-
generateShimForFile(sf, genFilePath) {
|
|
985
|
-
const symbolNames = [];
|
|
986
|
-
for (const stmt of sf.statements) {
|
|
987
|
-
if (ts8.isClassDeclaration(stmt)) {
|
|
988
|
-
if (!isExported2(stmt) || stmt.decorators === void 0 || stmt.name === void 0) {
|
|
989
|
-
continue;
|
|
990
|
-
}
|
|
991
|
-
symbolNames.push(stmt.name.text);
|
|
992
|
-
} else if (ts8.isExportDeclaration(stmt)) {
|
|
993
|
-
if (stmt.exportClause === void 0 || stmt.moduleSpecifier !== void 0 || !ts8.isNamedExports(stmt.exportClause)) {
|
|
994
|
-
continue;
|
|
995
|
-
}
|
|
996
|
-
for (const specifier of stmt.exportClause.elements) {
|
|
997
|
-
symbolNames.push(specifier.name.text);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
const varLines = symbolNames.map((name) => `export const ${name}NgSummary: any = null;`);
|
|
1002
|
-
if (varLines.length === 0) {
|
|
1003
|
-
varLines.push(`export const \u0275empty = null;`);
|
|
1004
|
-
}
|
|
1005
|
-
const sourceText = varLines.join("\n");
|
|
1006
|
-
const genFile = ts8.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts8.ScriptKind.TS);
|
|
1007
|
-
if (sf.moduleName !== void 0) {
|
|
1008
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngsummary");
|
|
1009
|
-
}
|
|
1010
|
-
return genFile;
|
|
1011
|
-
}
|
|
1012
|
-
};
|
|
1013
|
-
function isExported2(decl) {
|
|
1014
|
-
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts8.SyntaxKind.ExportKeyword);
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
1018
620
|
var DelegatingCompilerHost = class {
|
|
1019
621
|
constructor(delegate) {
|
|
1020
622
|
this.delegate = delegate;
|
|
@@ -1086,7 +688,7 @@ var TsCreateProgramDriver = class {
|
|
|
1086
688
|
this.originalHost = originalHost;
|
|
1087
689
|
this.options = options;
|
|
1088
690
|
this.shimExtensionPrefixes = shimExtensionPrefixes;
|
|
1089
|
-
this.sfMap = new Map();
|
|
691
|
+
this.sfMap = /* @__PURE__ */ new Map();
|
|
1090
692
|
this.program = this.originalProgram;
|
|
1091
693
|
this.supportsInlineOperations = true;
|
|
1092
694
|
}
|
|
@@ -1103,7 +705,7 @@ var TsCreateProgramDriver = class {
|
|
|
1103
705
|
this.sfMap.clear();
|
|
1104
706
|
}
|
|
1105
707
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
1106
|
-
const sf =
|
|
708
|
+
const sf = ts6.createSourceFile(filePath, newText, ts6.ScriptTarget.Latest, true);
|
|
1107
709
|
if (originalFile !== null) {
|
|
1108
710
|
sf[NgOriginalFile] = originalFile;
|
|
1109
711
|
}
|
|
@@ -1112,7 +714,7 @@ var TsCreateProgramDriver = class {
|
|
|
1112
714
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
1113
715
|
const oldProgram = this.program;
|
|
1114
716
|
retagAllTsFiles(oldProgram);
|
|
1115
|
-
this.program =
|
|
717
|
+
this.program = ts6.createProgram({
|
|
1116
718
|
host,
|
|
1117
719
|
rootNames: this.program.getRootFileNames(),
|
|
1118
720
|
options: this.options,
|
|
@@ -1124,10 +726,10 @@ var TsCreateProgramDriver = class {
|
|
|
1124
726
|
}
|
|
1125
727
|
};
|
|
1126
728
|
|
|
1127
|
-
// bazel-out/
|
|
729
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/dependency_tracking.mjs
|
|
1128
730
|
var FileDependencyGraph = class {
|
|
1129
731
|
constructor() {
|
|
1130
|
-
this.nodes = new Map();
|
|
732
|
+
this.nodes = /* @__PURE__ */ new Map();
|
|
1131
733
|
}
|
|
1132
734
|
addDependency(from, on) {
|
|
1133
735
|
this.nodeFor(from).dependsOn.add(absoluteFromSourceFile(on));
|
|
@@ -1143,7 +745,7 @@ var FileDependencyGraph = class {
|
|
|
1143
745
|
return node ? [...node.usesResources] : [];
|
|
1144
746
|
}
|
|
1145
747
|
updateWithPhysicalChanges(previous, changedTsPaths, deletedTsPaths, changedResources) {
|
|
1146
|
-
const logicallyChanged = new Set();
|
|
748
|
+
const logicallyChanged = /* @__PURE__ */ new Set();
|
|
1147
749
|
for (const sf of previous.nodes.keys()) {
|
|
1148
750
|
const sfPath = absoluteFromSourceFile(sf);
|
|
1149
751
|
const node = previous.nodeFor(sf);
|
|
@@ -1162,8 +764,8 @@ var FileDependencyGraph = class {
|
|
|
1162
764
|
nodeFor(sf) {
|
|
1163
765
|
if (!this.nodes.has(sf)) {
|
|
1164
766
|
this.nodes.set(sf, {
|
|
1165
|
-
dependsOn: new Set(),
|
|
1166
|
-
usesResources: new Set(),
|
|
767
|
+
dependsOn: /* @__PURE__ */ new Set(),
|
|
768
|
+
usesResources: /* @__PURE__ */ new Set(),
|
|
1167
769
|
failedAnalysis: false
|
|
1168
770
|
});
|
|
1169
771
|
}
|
|
@@ -1191,7 +793,7 @@ function isLogicallyChanged(sf, node, changedTsPaths, deletedTsPaths, changedRes
|
|
|
1191
793
|
return false;
|
|
1192
794
|
}
|
|
1193
795
|
|
|
1194
|
-
// bazel-out/
|
|
796
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/state.mjs
|
|
1195
797
|
var IncrementalStateKind;
|
|
1196
798
|
(function(IncrementalStateKind2) {
|
|
1197
799
|
IncrementalStateKind2[IncrementalStateKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -1199,7 +801,7 @@ var IncrementalStateKind;
|
|
|
1199
801
|
IncrementalStateKind2[IncrementalStateKind2["Analyzed"] = 2] = "Analyzed";
|
|
1200
802
|
})(IncrementalStateKind || (IncrementalStateKind = {}));
|
|
1201
803
|
|
|
1202
|
-
// bazel-out/
|
|
804
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/incremental.mjs
|
|
1203
805
|
var PhaseKind;
|
|
1204
806
|
(function(PhaseKind2) {
|
|
1205
807
|
PhaseKind2[PhaseKind2["Analysis"] = 0] = "Analysis";
|
|
@@ -1224,7 +826,7 @@ var IncrementalCompilation = class {
|
|
|
1224
826
|
}
|
|
1225
827
|
static incremental(program, newVersions, oldProgram, oldState, modifiedResourceFiles, perf) {
|
|
1226
828
|
return perf.inPhase(PerfPhase.Reconciliation, () => {
|
|
1227
|
-
const physicallyChangedTsFiles = new Set();
|
|
829
|
+
const physicallyChangedTsFiles = /* @__PURE__ */ new Set();
|
|
1228
830
|
const changedResourceFiles = new Set(modifiedResourceFiles != null ? modifiedResourceFiles : []);
|
|
1229
831
|
let priorAnalysis;
|
|
1230
832
|
switch (oldState.kind) {
|
|
@@ -1300,7 +902,7 @@ var IncrementalCompilation = class {
|
|
|
1300
902
|
const { needsEmit, needsTypeCheckEmit, newGraph } = this.phase.semanticDepGraphUpdater.finalize();
|
|
1301
903
|
let emitted;
|
|
1302
904
|
if (this.step === null) {
|
|
1303
|
-
emitted = new Set();
|
|
905
|
+
emitted = /* @__PURE__ */ new Set();
|
|
1304
906
|
} else {
|
|
1305
907
|
emitted = new Set(this.step.priorState.emitted);
|
|
1306
908
|
for (const sfPath of this.step.logicallyChangedTsFiles) {
|
|
@@ -1400,7 +1002,7 @@ function toOriginalSourceFile(sf) {
|
|
|
1400
1002
|
}
|
|
1401
1003
|
}
|
|
1402
1004
|
|
|
1403
|
-
// bazel-out/
|
|
1005
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/strategy.mjs
|
|
1404
1006
|
var TrackedIncrementalBuildStrategy = class {
|
|
1405
1007
|
constructor() {
|
|
1406
1008
|
this.state = null;
|
|
@@ -1436,7 +1038,7 @@ var PatchedProgramIncrementalBuildStrategy = class {
|
|
|
1436
1038
|
};
|
|
1437
1039
|
var SYM_INCREMENTAL_STATE = Symbol("NgIncrementalState");
|
|
1438
1040
|
|
|
1439
|
-
// bazel-out/
|
|
1041
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/api.mjs
|
|
1440
1042
|
var IdentifierKind;
|
|
1441
1043
|
(function(IdentifierKind2) {
|
|
1442
1044
|
IdentifierKind2[IdentifierKind2["Property"] = 0] = "Property";
|
|
@@ -1454,21 +1056,21 @@ var AbsoluteSourceSpan = class {
|
|
|
1454
1056
|
}
|
|
1455
1057
|
};
|
|
1456
1058
|
|
|
1457
|
-
// bazel-out/
|
|
1059
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/context.mjs
|
|
1458
1060
|
var IndexingContext = class {
|
|
1459
1061
|
constructor() {
|
|
1460
|
-
this.components = new Set();
|
|
1062
|
+
this.components = /* @__PURE__ */ new Set();
|
|
1461
1063
|
}
|
|
1462
1064
|
addComponent(info) {
|
|
1463
1065
|
this.components.add(info);
|
|
1464
1066
|
}
|
|
1465
1067
|
};
|
|
1466
1068
|
|
|
1467
|
-
// bazel-out/
|
|
1069
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1468
1070
|
import { ParseSourceFile } from "@angular/compiler";
|
|
1469
1071
|
|
|
1470
|
-
// bazel-out/
|
|
1471
|
-
import { ASTWithSource, ImplicitReceiver, RecursiveAstVisitor, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
1072
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/template.mjs
|
|
1073
|
+
import { ASTWithSource, ImplicitReceiver, PropertyRead, PropertyWrite, RecursiveAstVisitor, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
1472
1074
|
var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
1473
1075
|
constructor(expressionStr, absoluteOffset, boundTemplate, targetToIdentifier) {
|
|
1474
1076
|
super();
|
|
@@ -1498,7 +1100,10 @@ var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
|
1498
1100
|
if (!(ast.receiver instanceof ImplicitReceiver)) {
|
|
1499
1101
|
return;
|
|
1500
1102
|
}
|
|
1501
|
-
|
|
1103
|
+
let identifierStart = ast.sourceSpan.start - this.absoluteOffset;
|
|
1104
|
+
if (ast instanceof PropertyRead || ast instanceof PropertyWrite) {
|
|
1105
|
+
identifierStart = ast.nameSpan.start - this.absoluteOffset;
|
|
1106
|
+
}
|
|
1502
1107
|
if (!this.expressionStr.substring(identifierStart).startsWith(ast.name)) {
|
|
1503
1108
|
throw new Error(`Impossible state: "${ast.name}" not found in "${this.expressionStr}" at location ${identifierStart}`);
|
|
1504
1109
|
}
|
|
@@ -1519,9 +1124,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1519
1124
|
constructor(boundTemplate) {
|
|
1520
1125
|
super();
|
|
1521
1126
|
this.boundTemplate = boundTemplate;
|
|
1522
|
-
this.identifiers = new Set();
|
|
1523
|
-
this.targetIdentifierCache = new Map();
|
|
1524
|
-
this.elementAndTemplateIdentifierCache = new Map();
|
|
1127
|
+
this.identifiers = /* @__PURE__ */ new Set();
|
|
1128
|
+
this.targetIdentifierCache = /* @__PURE__ */ new Map();
|
|
1129
|
+
this.elementAndTemplateIdentifierCache = /* @__PURE__ */ new Map();
|
|
1525
1130
|
}
|
|
1526
1131
|
visit(node) {
|
|
1527
1132
|
node.visit(this);
|
|
@@ -1578,7 +1183,11 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1578
1183
|
name = node.tagName;
|
|
1579
1184
|
kind = IdentifierKind.Template;
|
|
1580
1185
|
} else {
|
|
1581
|
-
|
|
1186
|
+
if (node.name.startsWith(":")) {
|
|
1187
|
+
name = node.name.split(":").pop();
|
|
1188
|
+
} else {
|
|
1189
|
+
name = node.name;
|
|
1190
|
+
}
|
|
1582
1191
|
kind = IdentifierKind.Element;
|
|
1583
1192
|
}
|
|
1584
1193
|
const sourceSpan = node.startSourceSpan;
|
|
@@ -1671,12 +1280,12 @@ function getTemplateIdentifiers(boundTemplate) {
|
|
|
1671
1280
|
return visitor.identifiers;
|
|
1672
1281
|
}
|
|
1673
1282
|
|
|
1674
|
-
// bazel-out/
|
|
1283
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1675
1284
|
function generateAnalysis(context) {
|
|
1676
|
-
const analysis = new Map();
|
|
1285
|
+
const analysis = /* @__PURE__ */ new Map();
|
|
1677
1286
|
context.components.forEach(({ declaration, selector, boundTemplate, templateMeta }) => {
|
|
1678
1287
|
const name = declaration.name.getText();
|
|
1679
|
-
const usedComponents = new Set();
|
|
1288
|
+
const usedComponents = /* @__PURE__ */ new Set();
|
|
1680
1289
|
const usedDirs = boundTemplate.getUsedDirectives();
|
|
1681
1290
|
usedDirs.forEach((dir) => {
|
|
1682
1291
|
if (dir.isComponent) {
|
|
@@ -1705,8 +1314,8 @@ function generateAnalysis(context) {
|
|
|
1705
1314
|
return analysis;
|
|
1706
1315
|
}
|
|
1707
1316
|
|
|
1708
|
-
// bazel-out/
|
|
1709
|
-
import
|
|
1317
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
1318
|
+
import ts7 from "typescript";
|
|
1710
1319
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
1711
1320
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
1712
1321
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -1714,8 +1323,8 @@ var AdapterResourceLoader = class {
|
|
|
1714
1323
|
constructor(adapter, options) {
|
|
1715
1324
|
this.adapter = adapter;
|
|
1716
1325
|
this.options = options;
|
|
1717
|
-
this.cache = new Map();
|
|
1718
|
-
this.fetching = new Map();
|
|
1326
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
1327
|
+
this.fetching = /* @__PURE__ */ new Map();
|
|
1719
1328
|
this.lookupResolutionHost = createLookupResolutionHost(this.adapter);
|
|
1720
1329
|
this.canPreload = !!this.adapter.readResource;
|
|
1721
1330
|
this.canPreprocess = !!this.adapter.transformResource;
|
|
@@ -1816,7 +1425,7 @@ var AdapterResourceLoader = class {
|
|
|
1816
1425
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
1817
1426
|
}
|
|
1818
1427
|
getResolvedCandidateLocations(url, fromFile) {
|
|
1819
|
-
const failedLookup =
|
|
1428
|
+
const failedLookup = ts7.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
1820
1429
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
1821
1430
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
1822
1431
|
}
|
|
@@ -1851,12 +1460,12 @@ function createLookupResolutionHost(adapter) {
|
|
|
1851
1460
|
};
|
|
1852
1461
|
}
|
|
1853
1462
|
|
|
1854
|
-
// bazel-out/
|
|
1463
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/dependency.mjs
|
|
1855
1464
|
var MetadataDtsModuleScopeResolver = class {
|
|
1856
1465
|
constructor(dtsMetaReader, aliasingHost) {
|
|
1857
1466
|
this.dtsMetaReader = dtsMetaReader;
|
|
1858
1467
|
this.aliasingHost = aliasingHost;
|
|
1859
|
-
this.cache = new Map();
|
|
1468
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
1860
1469
|
}
|
|
1861
1470
|
resolve(ref) {
|
|
1862
1471
|
const clazz = ref.node;
|
|
@@ -1869,13 +1478,13 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
1869
1478
|
}
|
|
1870
1479
|
const directives = [];
|
|
1871
1480
|
const pipes = [];
|
|
1872
|
-
const ngModules = new Set([clazz]);
|
|
1481
|
+
const ngModules = /* @__PURE__ */ new Set([clazz]);
|
|
1873
1482
|
const meta = this.dtsMetaReader.getNgModuleMetadata(ref);
|
|
1874
1483
|
if (meta === null) {
|
|
1875
1484
|
this.cache.set(clazz, null);
|
|
1876
1485
|
return null;
|
|
1877
1486
|
}
|
|
1878
|
-
const declarations = new Set();
|
|
1487
|
+
const declarations = /* @__PURE__ */ new Set();
|
|
1879
1488
|
for (const declRef of meta.declarations) {
|
|
1880
1489
|
declarations.add(declRef.node);
|
|
1881
1490
|
}
|
|
@@ -1937,9 +1546,9 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
1937
1546
|
}
|
|
1938
1547
|
};
|
|
1939
1548
|
|
|
1940
|
-
// bazel-out/
|
|
1549
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
1941
1550
|
import { ExternalExpr } from "@angular/compiler";
|
|
1942
|
-
import
|
|
1551
|
+
import ts8 from "typescript";
|
|
1943
1552
|
var LocalModuleScopeRegistry = class {
|
|
1944
1553
|
constructor(localReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
1945
1554
|
this.localReader = localReader;
|
|
@@ -1947,13 +1556,13 @@ var LocalModuleScopeRegistry = class {
|
|
|
1947
1556
|
this.refEmitter = refEmitter;
|
|
1948
1557
|
this.aliasingHost = aliasingHost;
|
|
1949
1558
|
this.sealed = false;
|
|
1950
|
-
this.declarationToModule = new Map();
|
|
1951
|
-
this.duplicateDeclarations = new Map();
|
|
1952
|
-
this.moduleToRef = new Map();
|
|
1953
|
-
this.cache = new Map();
|
|
1954
|
-
this.remoteScoping = new Map();
|
|
1955
|
-
this.scopeErrors = new Map();
|
|
1956
|
-
this.modulesWithStructuralErrors = new Set();
|
|
1559
|
+
this.declarationToModule = /* @__PURE__ */ new Map();
|
|
1560
|
+
this.duplicateDeclarations = /* @__PURE__ */ new Map();
|
|
1561
|
+
this.moduleToRef = /* @__PURE__ */ new Map();
|
|
1562
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
1563
|
+
this.remoteScoping = /* @__PURE__ */ new Map();
|
|
1564
|
+
this.scopeErrors = /* @__PURE__ */ new Map();
|
|
1565
|
+
this.modulesWithStructuralErrors = /* @__PURE__ */ new Set();
|
|
1957
1566
|
}
|
|
1958
1567
|
registerNgModuleMetadata(data) {
|
|
1959
1568
|
this.assertCollecting();
|
|
@@ -1997,7 +1606,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
1997
1606
|
if (this.duplicateDeclarations.has(decl.node)) {
|
|
1998
1607
|
this.duplicateDeclarations.get(decl.node).set(ngModule, declData);
|
|
1999
1608
|
} else if (this.declarationToModule.has(decl.node) && this.declarationToModule.get(decl.node).ngModule !== ngModule) {
|
|
2000
|
-
const duplicateDeclMap = new Map();
|
|
1609
|
+
const duplicateDeclMap = /* @__PURE__ */ new Map();
|
|
2001
1610
|
const firstDeclData = this.declarationToModule.get(decl.node);
|
|
2002
1611
|
this.modulesWithStructuralErrors.add(firstDeclData.ngModule);
|
|
2003
1612
|
this.modulesWithStructuralErrors.add(ngModule);
|
|
@@ -2019,14 +1628,14 @@ var LocalModuleScopeRegistry = class {
|
|
|
2019
1628
|
this.cache.set(ref.node, null);
|
|
2020
1629
|
return null;
|
|
2021
1630
|
}
|
|
2022
|
-
const compilationModules = new Set([ngModule.ref.node]);
|
|
2023
|
-
const exportedModules = new Set([ngModule.ref.node]);
|
|
1631
|
+
const compilationModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
1632
|
+
const exportedModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
2024
1633
|
const diagnostics = [];
|
|
2025
|
-
const compilationDirectives = new Map();
|
|
2026
|
-
const compilationPipes = new Map();
|
|
2027
|
-
const declared = new Set();
|
|
2028
|
-
const exportDirectives = new Map();
|
|
2029
|
-
const exportPipes = new Map();
|
|
1634
|
+
const compilationDirectives = /* @__PURE__ */ new Map();
|
|
1635
|
+
const compilationPipes = /* @__PURE__ */ new Map();
|
|
1636
|
+
const declared = /* @__PURE__ */ new Set();
|
|
1637
|
+
const exportDirectives = /* @__PURE__ */ new Map();
|
|
1638
|
+
const exportPipes = /* @__PURE__ */ new Map();
|
|
2030
1639
|
let isPoisoned = false;
|
|
2031
1640
|
if (this.modulesWithStructuralErrors.has(ngModule.ref.node)) {
|
|
2032
1641
|
isPoisoned = true;
|
|
@@ -2140,7 +1749,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
2140
1749
|
}
|
|
2141
1750
|
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
2142
1751
|
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
2143
|
-
if (!
|
|
1752
|
+
if (!ts8.isClassDeclaration(ref.node)) {
|
|
2144
1753
|
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
2145
1754
|
diagnostics.push(makeDiagnostic(code, identifierOfNode(ref.node) || ref.node, `Appears in the NgModule.${type}s of ${nodeNameForError(ownerForErrors)}, but could not be resolved to an NgModule`));
|
|
2146
1755
|
return "invalid";
|
|
@@ -2157,7 +1766,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
2157
1766
|
return null;
|
|
2158
1767
|
}
|
|
2159
1768
|
reexports = [];
|
|
2160
|
-
const reexportMap = new Map();
|
|
1769
|
+
const reexportMap = /* @__PURE__ */ new Map();
|
|
2161
1770
|
const ngModuleRef = ref;
|
|
2162
1771
|
const addReexport = (exportRef) => {
|
|
2163
1772
|
if (exportRef.node.getSourceFile() === sourceFile) {
|
|
@@ -2176,7 +1785,9 @@ var LocalModuleScopeRegistry = class {
|
|
|
2176
1785
|
asAlias: exportName
|
|
2177
1786
|
});
|
|
2178
1787
|
} else {
|
|
2179
|
-
const
|
|
1788
|
+
const emittedRef = this.refEmitter.emit(exportRef.cloneWithNoIdentifiers(), sourceFile);
|
|
1789
|
+
assertSuccessfulReferenceEmit(emittedRef, ngModuleRef.node.name, "class");
|
|
1790
|
+
const expr = emittedRef.expression;
|
|
2180
1791
|
if (!(expr instanceof ExternalExpr) || expr.value.moduleName === null || expr.value.name === null) {
|
|
2181
1792
|
throw new Error("Expected ExternalExpr");
|
|
2182
1793
|
}
|
|
@@ -2245,20 +1856,20 @@ function reexportCollision(module, refA, refB) {
|
|
|
2245
1856
|
]);
|
|
2246
1857
|
}
|
|
2247
1858
|
|
|
2248
|
-
// bazel-out/
|
|
1859
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
2249
1860
|
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
2250
|
-
import
|
|
1861
|
+
import ts9 from "typescript";
|
|
2251
1862
|
var TypeCheckScopeRegistry = class {
|
|
2252
1863
|
constructor(scopeReader, metaReader) {
|
|
2253
1864
|
this.scopeReader = scopeReader;
|
|
2254
1865
|
this.metaReader = metaReader;
|
|
2255
|
-
this.flattenedDirectiveMetaCache = new Map();
|
|
2256
|
-
this.scopeCache = new Map();
|
|
1866
|
+
this.flattenedDirectiveMetaCache = /* @__PURE__ */ new Map();
|
|
1867
|
+
this.scopeCache = /* @__PURE__ */ new Map();
|
|
2257
1868
|
}
|
|
2258
1869
|
getTypeCheckScope(node) {
|
|
2259
1870
|
const matcher = new SelectorMatcher();
|
|
2260
1871
|
const directives = [];
|
|
2261
|
-
const pipes = new Map();
|
|
1872
|
+
const pipes = /* @__PURE__ */ new Map();
|
|
2262
1873
|
const scope = this.scopeReader.getScopeForComponent(node);
|
|
2263
1874
|
if (scope === null) {
|
|
2264
1875
|
return {
|
|
@@ -2280,8 +1891,8 @@ var TypeCheckScopeRegistry = class {
|
|
|
2280
1891
|
}
|
|
2281
1892
|
}
|
|
2282
1893
|
for (const { name, ref } of scope.compilation.pipes) {
|
|
2283
|
-
if (!
|
|
2284
|
-
throw new Error(`Unexpected non-class declaration ${
|
|
1894
|
+
if (!ts9.isClassDeclaration(ref.node)) {
|
|
1895
|
+
throw new Error(`Unexpected non-class declaration ${ts9.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
|
|
2285
1896
|
}
|
|
2286
1897
|
pipes.set(name, ref);
|
|
2287
1898
|
}
|
|
@@ -2306,11 +1917,11 @@ var TypeCheckScopeRegistry = class {
|
|
|
2306
1917
|
}
|
|
2307
1918
|
};
|
|
2308
1919
|
|
|
2309
|
-
// bazel-out/
|
|
1920
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
2310
1921
|
import { CssSelector as CssSelector2, DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
2311
1922
|
|
|
2312
|
-
// bazel-out/
|
|
2313
|
-
import
|
|
1923
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
1924
|
+
import ts10 from "typescript";
|
|
2314
1925
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
2315
1926
|
if (mapping.type === "direct") {
|
|
2316
1927
|
let relatedInformation = void 0;
|
|
@@ -2318,7 +1929,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2318
1929
|
relatedInformation = [];
|
|
2319
1930
|
for (const relatedMessage of relatedMessages) {
|
|
2320
1931
|
relatedInformation.push({
|
|
2321
|
-
category:
|
|
1932
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2322
1933
|
code: 0,
|
|
2323
1934
|
file: relatedMessage.sourceFile,
|
|
2324
1935
|
start: relatedMessage.start,
|
|
@@ -2343,12 +1954,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2343
1954
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
2344
1955
|
const componentName = mapping.componentClass.name.text;
|
|
2345
1956
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
2346
|
-
const sf =
|
|
1957
|
+
const sf = ts10.createSourceFile(fileName, mapping.template, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.JSX);
|
|
2347
1958
|
let relatedInformation = [];
|
|
2348
1959
|
if (relatedMessages !== void 0) {
|
|
2349
1960
|
for (const relatedMessage of relatedMessages) {
|
|
2350
1961
|
relatedInformation.push({
|
|
2351
|
-
category:
|
|
1962
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2352
1963
|
code: 0,
|
|
2353
1964
|
file: relatedMessage.sourceFile,
|
|
2354
1965
|
start: relatedMessage.start,
|
|
@@ -2358,7 +1969,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2358
1969
|
}
|
|
2359
1970
|
}
|
|
2360
1971
|
relatedInformation.push({
|
|
2361
|
-
category:
|
|
1972
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2362
1973
|
code: 0,
|
|
2363
1974
|
file: componentSf,
|
|
2364
1975
|
start: mapping.node.getStart(),
|
|
@@ -2382,7 +1993,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2382
1993
|
}
|
|
2383
1994
|
}
|
|
2384
1995
|
|
|
2385
|
-
// bazel-out/
|
|
1996
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
2386
1997
|
var TEMPLATE_ID = Symbol("ngTemplateId");
|
|
2387
1998
|
var NEXT_TEMPLATE_ID = Symbol("ngNextTemplateId");
|
|
2388
1999
|
function getTemplateId(clazz) {
|
|
@@ -2399,17 +2010,17 @@ function allocateTemplateId(sf) {
|
|
|
2399
2010
|
return `tcb${sf[NEXT_TEMPLATE_ID]++}`;
|
|
2400
2011
|
}
|
|
2401
2012
|
|
|
2402
|
-
// bazel-out/
|
|
2403
|
-
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2404
|
-
import
|
|
2013
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2014
|
+
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2015
|
+
import ts12 from "typescript";
|
|
2405
2016
|
|
|
2406
|
-
// bazel-out/
|
|
2017
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2407
2018
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2408
|
-
import
|
|
2019
|
+
import ts11 from "typescript";
|
|
2409
2020
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2410
2021
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2411
|
-
return
|
|
2412
|
-
if (kind !==
|
|
2022
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2023
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2413
2024
|
return null;
|
|
2414
2025
|
}
|
|
2415
2026
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2432,15 +2043,15 @@ var ExpressionIdentifier;
|
|
|
2432
2043
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
2433
2044
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2434
2045
|
function addExpressionIdentifier(node, identifier) {
|
|
2435
|
-
|
|
2046
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
2436
2047
|
}
|
|
2437
2048
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2438
2049
|
function markIgnoreDiagnostics(node) {
|
|
2439
|
-
|
|
2050
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
2440
2051
|
}
|
|
2441
2052
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2442
|
-
return
|
|
2443
|
-
if (kind !==
|
|
2053
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2054
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2444
2055
|
return null;
|
|
2445
2056
|
}
|
|
2446
2057
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2514,8 +2125,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2514
2125
|
return results;
|
|
2515
2126
|
}
|
|
2516
2127
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2517
|
-
return
|
|
2518
|
-
if (kind !==
|
|
2128
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2129
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2519
2130
|
return false;
|
|
2520
2131
|
}
|
|
2521
2132
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2523,16 +2134,16 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
|
2523
2134
|
}) || false;
|
|
2524
2135
|
}
|
|
2525
2136
|
|
|
2526
|
-
// bazel-out/
|
|
2137
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2527
2138
|
var CompletionEngine = class {
|
|
2528
2139
|
constructor(tcb, data, shimPath) {
|
|
2529
2140
|
this.tcb = tcb;
|
|
2530
2141
|
this.data = data;
|
|
2531
2142
|
this.shimPath = shimPath;
|
|
2532
|
-
this.templateContextCache = new Map();
|
|
2533
|
-
this.expressionCompletionCache = new Map();
|
|
2143
|
+
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2144
|
+
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2534
2145
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2535
|
-
filter:
|
|
2146
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2536
2147
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2537
2148
|
});
|
|
2538
2149
|
if (globalRead !== null) {
|
|
@@ -2555,7 +2166,7 @@ var CompletionEngine = class {
|
|
|
2555
2166
|
let nodeContext = null;
|
|
2556
2167
|
if (node instanceof EmptyExpr) {
|
|
2557
2168
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2558
|
-
filter:
|
|
2169
|
+
filter: ts12.isIdentifier,
|
|
2559
2170
|
withSpan: node.sourceSpan
|
|
2560
2171
|
});
|
|
2561
2172
|
if (nodeLocation !== null) {
|
|
@@ -2565,9 +2176,9 @@ var CompletionEngine = class {
|
|
|
2565
2176
|
};
|
|
2566
2177
|
}
|
|
2567
2178
|
}
|
|
2568
|
-
if (node instanceof
|
|
2179
|
+
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2569
2180
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2570
|
-
filter:
|
|
2181
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2571
2182
|
withSpan: node.sourceSpan
|
|
2572
2183
|
});
|
|
2573
2184
|
if (nodeLocation) {
|
|
@@ -2588,23 +2199,23 @@ var CompletionEngine = class {
|
|
|
2588
2199
|
return this.expressionCompletionCache.get(expr);
|
|
2589
2200
|
}
|
|
2590
2201
|
let tsExpr = null;
|
|
2591
|
-
if (expr instanceof
|
|
2202
|
+
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2592
2203
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2593
|
-
filter:
|
|
2204
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2594
2205
|
withSpan: expr.nameSpan
|
|
2595
2206
|
});
|
|
2596
2207
|
} else if (expr instanceof SafePropertyRead) {
|
|
2597
2208
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2598
|
-
filter:
|
|
2209
|
+
filter: ts12.isParenthesizedExpression,
|
|
2599
2210
|
withSpan: expr.sourceSpan
|
|
2600
2211
|
});
|
|
2601
|
-
if (ternaryExpr === null || !
|
|
2212
|
+
if (ternaryExpr === null || !ts12.isConditionalExpression(ternaryExpr.expression)) {
|
|
2602
2213
|
return null;
|
|
2603
2214
|
}
|
|
2604
2215
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2605
|
-
if (
|
|
2216
|
+
if (ts12.isPropertyAccessExpression(whenTrue)) {
|
|
2606
2217
|
tsExpr = whenTrue;
|
|
2607
|
-
} else if (
|
|
2218
|
+
} else if (ts12.isCallExpression(whenTrue) && ts12.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2608
2219
|
tsExpr = whenTrue.expression;
|
|
2609
2220
|
}
|
|
2610
2221
|
}
|
|
@@ -2625,15 +2236,15 @@ var CompletionEngine = class {
|
|
|
2625
2236
|
let tsExpr = null;
|
|
2626
2237
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2627
2238
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2628
|
-
filter:
|
|
2239
|
+
filter: ts12.isParenthesizedExpression,
|
|
2629
2240
|
withSpan: expr.sourceSpan
|
|
2630
2241
|
});
|
|
2631
|
-
if (strNode !== null &&
|
|
2242
|
+
if (strNode !== null && ts12.isStringLiteral(strNode.expression)) {
|
|
2632
2243
|
tsExpr = strNode.expression;
|
|
2633
2244
|
}
|
|
2634
2245
|
} else {
|
|
2635
2246
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2636
|
-
filter: (n) =>
|
|
2247
|
+
filter: (n) => ts12.isStringLiteral(n) || ts12.isNumericLiteral(n),
|
|
2637
2248
|
withSpan: expr.sourceSpan
|
|
2638
2249
|
});
|
|
2639
2250
|
}
|
|
@@ -2641,7 +2252,7 @@ var CompletionEngine = class {
|
|
|
2641
2252
|
return null;
|
|
2642
2253
|
}
|
|
2643
2254
|
let positionInShimFile = tsExpr.getEnd();
|
|
2644
|
-
if (
|
|
2255
|
+
if (ts12.isStringLiteral(tsExpr)) {
|
|
2645
2256
|
positionInShimFile -= 1;
|
|
2646
2257
|
}
|
|
2647
2258
|
const res = {
|
|
@@ -2655,7 +2266,7 @@ var CompletionEngine = class {
|
|
|
2655
2266
|
if (this.templateContextCache.has(context)) {
|
|
2656
2267
|
return this.templateContextCache.get(context);
|
|
2657
2268
|
}
|
|
2658
|
-
const templateContext = new Map();
|
|
2269
|
+
const templateContext = /* @__PURE__ */ new Map();
|
|
2659
2270
|
for (const node of this.data.boundTarget.getEntitiesInTemplateScope(context)) {
|
|
2660
2271
|
if (node instanceof TmplAstReference2) {
|
|
2661
2272
|
templateContext.set(node.name, {
|
|
@@ -2674,12 +2285,12 @@ var CompletionEngine = class {
|
|
|
2674
2285
|
}
|
|
2675
2286
|
};
|
|
2676
2287
|
|
|
2677
|
-
// bazel-out/
|
|
2678
|
-
import
|
|
2288
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2289
|
+
import ts26 from "typescript";
|
|
2679
2290
|
|
|
2680
|
-
// bazel-out/
|
|
2291
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2681
2292
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
2682
|
-
import
|
|
2293
|
+
import ts13 from "typescript";
|
|
2683
2294
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
2684
2295
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
2685
2296
|
var RegistryDomSchemaChecker = class {
|
|
@@ -2703,7 +2314,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2703
2314
|
} else {
|
|
2704
2315
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2705
2316
|
}
|
|
2706
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
2317
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2707
2318
|
this._diagnostics.push(diag);
|
|
2708
2319
|
}
|
|
2709
2320
|
}
|
|
@@ -2721,70 +2332,70 @@ var RegistryDomSchemaChecker = class {
|
|
|
2721
2332
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
2722
2333
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2723
2334
|
}
|
|
2724
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
2335
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2725
2336
|
this._diagnostics.push(diag);
|
|
2726
2337
|
}
|
|
2727
2338
|
}
|
|
2728
2339
|
};
|
|
2729
2340
|
|
|
2730
|
-
// bazel-out/
|
|
2731
|
-
import { ExpressionType, ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
2732
|
-
import
|
|
2341
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2342
|
+
import { ExpressionType, ExternalExpr as ExternalExpr2, TypeModifier } from "@angular/compiler";
|
|
2343
|
+
import ts19 from "typescript";
|
|
2733
2344
|
|
|
2734
|
-
// bazel-out/
|
|
2735
|
-
import
|
|
2736
|
-
var SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2345
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2346
|
+
import ts14 from "typescript";
|
|
2347
|
+
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2348
|
+
ts14.SyntaxKind.ParenthesizedExpression,
|
|
2349
|
+
ts14.SyntaxKind.Identifier,
|
|
2350
|
+
ts14.SyntaxKind.CallExpression,
|
|
2351
|
+
ts14.SyntaxKind.NonNullExpression,
|
|
2352
|
+
ts14.SyntaxKind.ElementAccessExpression,
|
|
2353
|
+
ts14.SyntaxKind.PropertyAccessExpression,
|
|
2354
|
+
ts14.SyntaxKind.ArrayLiteralExpression,
|
|
2355
|
+
ts14.SyntaxKind.ObjectLiteralExpression,
|
|
2356
|
+
ts14.SyntaxKind.StringLiteral,
|
|
2357
|
+
ts14.SyntaxKind.NumericLiteral,
|
|
2358
|
+
ts14.SyntaxKind.TrueKeyword,
|
|
2359
|
+
ts14.SyntaxKind.FalseKeyword,
|
|
2360
|
+
ts14.SyntaxKind.NullKeyword,
|
|
2361
|
+
ts14.SyntaxKind.UndefinedKeyword
|
|
2751
2362
|
]);
|
|
2752
2363
|
function tsCastToAny(expr) {
|
|
2753
2364
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2754
|
-
expr =
|
|
2365
|
+
expr = ts14.createParen(expr);
|
|
2755
2366
|
}
|
|
2756
|
-
return
|
|
2367
|
+
return ts14.createParen(ts14.createAsExpression(expr, ts14.createKeywordTypeNode(ts14.SyntaxKind.AnyKeyword)));
|
|
2757
2368
|
}
|
|
2758
2369
|
function tsCreateElement(tagName) {
|
|
2759
|
-
const createElement =
|
|
2760
|
-
return
|
|
2370
|
+
const createElement = ts14.createPropertyAccess(ts14.createIdentifier("document"), "createElement");
|
|
2371
|
+
return ts14.createCall(createElement, void 0, [ts14.createLiteral(tagName)]);
|
|
2761
2372
|
}
|
|
2762
2373
|
function tsDeclareVariable(id, type) {
|
|
2763
|
-
const decl =
|
|
2764
|
-
return
|
|
2374
|
+
const decl = ts14.createVariableDeclaration(id, type, ts14.createNonNullExpression(ts14.createNull()));
|
|
2375
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2765
2376
|
}
|
|
2766
2377
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2767
|
-
return
|
|
2378
|
+
return ts14.createTypeQueryNode(ts14.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2768
2379
|
}
|
|
2769
2380
|
function tsCreateVariable(id, initializer) {
|
|
2770
|
-
const decl =
|
|
2771
|
-
return
|
|
2381
|
+
const decl = ts14.createVariableDeclaration(id, void 0, initializer);
|
|
2382
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2772
2383
|
}
|
|
2773
2384
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2774
|
-
const methodAccess =
|
|
2775
|
-
return
|
|
2385
|
+
const methodAccess = ts14.createPropertyAccess(receiver, methodName);
|
|
2386
|
+
return ts14.createCall(methodAccess, void 0, args);
|
|
2776
2387
|
}
|
|
2777
2388
|
function checkIfClassIsExported(node) {
|
|
2778
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
2389
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts14.SyntaxKind.ExportKeyword)) {
|
|
2779
2390
|
return true;
|
|
2780
|
-
} else if (node.parent !== void 0 &&
|
|
2391
|
+
} else if (node.parent !== void 0 && ts14.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
2781
2392
|
return true;
|
|
2782
2393
|
}
|
|
2783
2394
|
return false;
|
|
2784
2395
|
}
|
|
2785
2396
|
function checkIfFileHasExport(sf, name) {
|
|
2786
2397
|
for (const stmt of sf.statements) {
|
|
2787
|
-
if (
|
|
2398
|
+
if (ts14.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts14.isNamedExports(stmt.exportClause)) {
|
|
2788
2399
|
for (const element of stmt.exportClause.elements) {
|
|
2789
2400
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
2790
2401
|
return true;
|
|
@@ -2797,126 +2408,122 @@ function checkIfFileHasExport(sf, name) {
|
|
|
2797
2408
|
return false;
|
|
2798
2409
|
}
|
|
2799
2410
|
function isAccessExpression(node) {
|
|
2800
|
-
return
|
|
2411
|
+
return ts14.isPropertyAccessExpression(node) || ts14.isElementAccessExpression(node);
|
|
2801
2412
|
}
|
|
2802
2413
|
|
|
2803
|
-
// bazel-out/
|
|
2804
|
-
import
|
|
2414
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2415
|
+
import ts18 from "typescript";
|
|
2805
2416
|
|
|
2806
|
-
// bazel-out/
|
|
2807
|
-
import
|
|
2417
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2418
|
+
import ts17 from "typescript";
|
|
2808
2419
|
|
|
2809
|
-
// bazel-out/
|
|
2810
|
-
import
|
|
2420
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2421
|
+
import ts16 from "typescript";
|
|
2811
2422
|
|
|
2812
|
-
// bazel-out/
|
|
2813
|
-
import
|
|
2423
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2424
|
+
import ts15 from "typescript";
|
|
2814
2425
|
var INELIGIBLE = {};
|
|
2815
|
-
function canEmitType(type,
|
|
2426
|
+
function canEmitType(type, canEmit) {
|
|
2816
2427
|
return canEmitTypeWorker(type);
|
|
2817
2428
|
function canEmitTypeWorker(type2) {
|
|
2818
2429
|
return visitNode(type2) !== INELIGIBLE;
|
|
2819
2430
|
}
|
|
2820
2431
|
function visitNode(node) {
|
|
2821
|
-
if (
|
|
2432
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2822
2433
|
return INELIGIBLE;
|
|
2823
2434
|
}
|
|
2824
|
-
if (
|
|
2435
|
+
if (ts15.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2825
2436
|
return INELIGIBLE;
|
|
2826
2437
|
} else {
|
|
2827
|
-
return
|
|
2438
|
+
return ts15.forEachChild(node, visitNode);
|
|
2828
2439
|
}
|
|
2829
2440
|
}
|
|
2830
2441
|
function canEmitTypeReference(type2) {
|
|
2831
|
-
|
|
2832
|
-
if (reference === null) {
|
|
2442
|
+
if (!canEmit(type2)) {
|
|
2833
2443
|
return false;
|
|
2834
2444
|
}
|
|
2835
|
-
if (reference instanceof Reference) {
|
|
2836
|
-
return true;
|
|
2837
|
-
}
|
|
2838
2445
|
return type2.typeArguments === void 0 || type2.typeArguments.every(canEmitTypeWorker);
|
|
2839
2446
|
}
|
|
2840
2447
|
}
|
|
2841
2448
|
var TypeEmitter = class {
|
|
2842
|
-
constructor(
|
|
2843
|
-
this.
|
|
2844
|
-
this.emitReference = emitReference;
|
|
2449
|
+
constructor(translator) {
|
|
2450
|
+
this.translator = translator;
|
|
2845
2451
|
}
|
|
2846
2452
|
emitType(type) {
|
|
2847
2453
|
const typeReferenceTransformer = (context) => {
|
|
2848
2454
|
const visitNode = (node) => {
|
|
2849
|
-
if (
|
|
2455
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2850
2456
|
throw new Error("Unable to emit import type");
|
|
2851
2457
|
}
|
|
2852
|
-
if (
|
|
2458
|
+
if (ts15.isTypeReferenceNode(node)) {
|
|
2853
2459
|
return this.emitTypeReference(node);
|
|
2854
|
-
} else if (
|
|
2855
|
-
const clone =
|
|
2856
|
-
|
|
2460
|
+
} else if (ts15.isLiteralExpression(node)) {
|
|
2461
|
+
const clone = ts15.getMutableClone(node);
|
|
2462
|
+
ts15.setTextRange(clone, { pos: -1, end: -1 });
|
|
2857
2463
|
return clone;
|
|
2858
2464
|
} else {
|
|
2859
|
-
return
|
|
2465
|
+
return ts15.visitEachChild(node, visitNode, context);
|
|
2860
2466
|
}
|
|
2861
2467
|
};
|
|
2862
|
-
return (node) =>
|
|
2468
|
+
return (node) => ts15.visitNode(node, visitNode);
|
|
2863
2469
|
};
|
|
2864
|
-
return
|
|
2470
|
+
return ts15.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2865
2471
|
}
|
|
2866
2472
|
emitTypeReference(type) {
|
|
2867
|
-
const
|
|
2868
|
-
if (
|
|
2473
|
+
const translatedType = this.translator(type);
|
|
2474
|
+
if (translatedType === null) {
|
|
2869
2475
|
throw new Error("Unable to emit an unresolved reference");
|
|
2870
2476
|
}
|
|
2871
2477
|
let typeArguments = void 0;
|
|
2872
2478
|
if (type.typeArguments !== void 0) {
|
|
2873
|
-
typeArguments =
|
|
2479
|
+
typeArguments = ts15.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2874
2480
|
}
|
|
2875
|
-
|
|
2876
|
-
if (reference instanceof Reference) {
|
|
2877
|
-
const emittedType = this.emitReference(reference);
|
|
2878
|
-
if (!ts18.isTypeReferenceNode(emittedType)) {
|
|
2879
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts18.SyntaxKind[emittedType.kind]}`);
|
|
2880
|
-
}
|
|
2881
|
-
typeName = emittedType.typeName;
|
|
2882
|
-
}
|
|
2883
|
-
return ts18.updateTypeReferenceNode(type, typeName, typeArguments);
|
|
2481
|
+
return ts15.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2884
2482
|
}
|
|
2885
2483
|
};
|
|
2886
2484
|
|
|
2887
|
-
// bazel-out/
|
|
2485
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2888
2486
|
var TypeParameterEmitter = class {
|
|
2889
2487
|
constructor(typeParameters, reflector) {
|
|
2890
2488
|
this.typeParameters = typeParameters;
|
|
2891
2489
|
this.reflector = reflector;
|
|
2892
2490
|
}
|
|
2893
|
-
canEmit() {
|
|
2491
|
+
canEmit(canEmitReference) {
|
|
2894
2492
|
if (this.typeParameters === void 0) {
|
|
2895
2493
|
return true;
|
|
2896
2494
|
}
|
|
2897
2495
|
return this.typeParameters.every((typeParam) => {
|
|
2898
|
-
return this.canEmitType(typeParam.constraint) && this.canEmitType(typeParam.default);
|
|
2496
|
+
return this.canEmitType(typeParam.constraint, canEmitReference) && this.canEmitType(typeParam.default, canEmitReference);
|
|
2899
2497
|
});
|
|
2900
2498
|
}
|
|
2901
|
-
canEmitType(type) {
|
|
2499
|
+
canEmitType(type, canEmitReference) {
|
|
2902
2500
|
if (type === void 0) {
|
|
2903
2501
|
return true;
|
|
2904
2502
|
}
|
|
2905
|
-
return canEmitType(type, (typeReference) =>
|
|
2503
|
+
return canEmitType(type, (typeReference) => {
|
|
2504
|
+
const reference = this.resolveTypeReference(typeReference);
|
|
2505
|
+
if (reference === null) {
|
|
2506
|
+
return false;
|
|
2507
|
+
}
|
|
2508
|
+
if (reference instanceof Reference) {
|
|
2509
|
+
return canEmitReference(reference);
|
|
2510
|
+
}
|
|
2511
|
+
return true;
|
|
2512
|
+
});
|
|
2906
2513
|
}
|
|
2907
2514
|
emit(emitReference) {
|
|
2908
2515
|
if (this.typeParameters === void 0) {
|
|
2909
2516
|
return void 0;
|
|
2910
2517
|
}
|
|
2911
|
-
const emitter = new TypeEmitter((type) => this.
|
|
2518
|
+
const emitter = new TypeEmitter((type) => this.translateTypeReference(type, emitReference));
|
|
2912
2519
|
return this.typeParameters.map((typeParam) => {
|
|
2913
2520
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2914
2521
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2915
|
-
return
|
|
2522
|
+
return ts16.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2916
2523
|
});
|
|
2917
2524
|
}
|
|
2918
2525
|
resolveTypeReference(type) {
|
|
2919
|
-
const target =
|
|
2526
|
+
const target = ts16.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2920
2527
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2921
2528
|
if (declaration === null || declaration.node === null) {
|
|
2922
2529
|
return null;
|
|
@@ -2931,33 +2538,38 @@ var TypeParameterEmitter = class {
|
|
|
2931
2538
|
resolutionContext: type.getSourceFile().fileName
|
|
2932
2539
|
};
|
|
2933
2540
|
}
|
|
2934
|
-
if (!this.isTopLevelExport(declaration.node)) {
|
|
2935
|
-
return null;
|
|
2936
|
-
}
|
|
2937
2541
|
return new Reference(declaration.node, owningModule);
|
|
2938
2542
|
}
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2543
|
+
translateTypeReference(type, emitReference) {
|
|
2544
|
+
const reference = this.resolveTypeReference(type);
|
|
2545
|
+
if (!(reference instanceof Reference)) {
|
|
2546
|
+
return reference;
|
|
2942
2547
|
}
|
|
2943
|
-
|
|
2548
|
+
const typeNode = emitReference(reference);
|
|
2549
|
+
if (typeNode === null) {
|
|
2550
|
+
return null;
|
|
2551
|
+
}
|
|
2552
|
+
if (!ts16.isTypeReferenceNode(typeNode)) {
|
|
2553
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts16.SyntaxKind[typeNode.kind]}.`);
|
|
2554
|
+
}
|
|
2555
|
+
return typeNode;
|
|
2944
2556
|
}
|
|
2945
2557
|
isLocalTypeParameter(decl) {
|
|
2946
2558
|
return this.typeParameters.some((param) => param === decl);
|
|
2947
2559
|
}
|
|
2948
2560
|
};
|
|
2949
2561
|
|
|
2950
|
-
// bazel-out/
|
|
2562
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2951
2563
|
var TcbInliningRequirement;
|
|
2952
2564
|
(function(TcbInliningRequirement2) {
|
|
2953
2565
|
TcbInliningRequirement2[TcbInliningRequirement2["MustInline"] = 0] = "MustInline";
|
|
2954
2566
|
TcbInliningRequirement2[TcbInliningRequirement2["ShouldInlineForGenericBounds"] = 1] = "ShouldInlineForGenericBounds";
|
|
2955
2567
|
TcbInliningRequirement2[TcbInliningRequirement2["None"] = 2] = "None";
|
|
2956
2568
|
})(TcbInliningRequirement || (TcbInliningRequirement = {}));
|
|
2957
|
-
function requiresInlineTypeCheckBlock(node, usedPipes, reflector) {
|
|
2569
|
+
function requiresInlineTypeCheckBlock(node, env, usedPipes, reflector) {
|
|
2958
2570
|
if (!checkIfClassIsExported(node)) {
|
|
2959
2571
|
return TcbInliningRequirement.MustInline;
|
|
2960
|
-
} else if (!
|
|
2572
|
+
} else if (!checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env)) {
|
|
2961
2573
|
return TcbInliningRequirement.ShouldInlineForGenericBounds;
|
|
2962
2574
|
} else if (Array.from(usedPipes.values()).some((pipeRef) => !checkIfClassIsExported(pipeRef.node))) {
|
|
2963
2575
|
return TcbInliningRequirement.MustInline;
|
|
@@ -2980,14 +2592,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2980
2592
|
}
|
|
2981
2593
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2982
2594
|
for (const stmt of file.statements) {
|
|
2983
|
-
if (
|
|
2595
|
+
if (ts17.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2984
2596
|
return stmt;
|
|
2985
2597
|
}
|
|
2986
2598
|
}
|
|
2987
2599
|
return null;
|
|
2988
2600
|
}
|
|
2989
2601
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2990
|
-
while (node !== void 0 && !
|
|
2602
|
+
while (node !== void 0 && !ts17.isFunctionDeclaration(node)) {
|
|
2991
2603
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2992
2604
|
return null;
|
|
2993
2605
|
}
|
|
@@ -3004,7 +2616,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
3004
2616
|
return null;
|
|
3005
2617
|
}
|
|
3006
2618
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
3007
|
-
while (!
|
|
2619
|
+
while (!ts17.isFunctionDeclaration(node)) {
|
|
3008
2620
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
3009
2621
|
return null;
|
|
3010
2622
|
}
|
|
@@ -3014,47 +2626,45 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
3014
2626
|
}
|
|
3015
2627
|
}
|
|
3016
2628
|
const start = node.getFullStart();
|
|
3017
|
-
return
|
|
3018
|
-
if (kind !==
|
|
2629
|
+
return ts17.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2630
|
+
if (kind !== ts17.SyntaxKind.MultiLineCommentTrivia) {
|
|
3019
2631
|
return null;
|
|
3020
2632
|
}
|
|
3021
2633
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
3022
2634
|
return commentText;
|
|
3023
2635
|
}) || null;
|
|
3024
2636
|
}
|
|
3025
|
-
function
|
|
3026
|
-
|
|
2637
|
+
function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
2638
|
+
const emitter = new TypeParameterEmitter(node.typeParameters, reflector);
|
|
2639
|
+
return emitter.canEmit((ref) => env.canReferenceType(ref));
|
|
3027
2640
|
}
|
|
3028
2641
|
|
|
3029
|
-
// bazel-out/
|
|
3030
|
-
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams
|
|
3031
|
-
if (requiresInlineTypeCtor(node, reflector)) {
|
|
3032
|
-
throw new Error(`${node.name.text} requires an inline type constructor`);
|
|
3033
|
-
}
|
|
2642
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2643
|
+
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
3034
2644
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
3035
|
-
const rawType =
|
|
2645
|
+
const rawType = ts18.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
3036
2646
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3037
2647
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
3038
2648
|
if (meta.body) {
|
|
3039
|
-
const fnType =
|
|
3040
|
-
const decl =
|
|
3041
|
-
const declList =
|
|
3042
|
-
return
|
|
2649
|
+
const fnType = ts18.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2650
|
+
const decl = ts18.createVariableDeclaration(meta.fnName, fnType, ts18.createNonNullExpression(ts18.createNull()));
|
|
2651
|
+
const declList = ts18.createVariableDeclarationList([decl], ts18.NodeFlags.Const);
|
|
2652
|
+
return ts18.createVariableStatement(void 0, declList);
|
|
3043
2653
|
} else {
|
|
3044
|
-
return
|
|
2654
|
+
return ts18.createFunctionDeclaration(void 0, [ts18.createModifier(ts18.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
3045
2655
|
}
|
|
3046
2656
|
}
|
|
3047
2657
|
function generateInlineTypeCtor(node, meta) {
|
|
3048
2658
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
3049
|
-
const rawType =
|
|
2659
|
+
const rawType = ts18.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
3050
2660
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3051
2661
|
let body = void 0;
|
|
3052
2662
|
if (meta.body) {
|
|
3053
|
-
body =
|
|
3054
|
-
|
|
2663
|
+
body = ts18.createBlock([
|
|
2664
|
+
ts18.createReturn(ts18.createNonNullExpression(ts18.createNull()))
|
|
3055
2665
|
]);
|
|
3056
2666
|
}
|
|
3057
|
-
return
|
|
2667
|
+
return ts18.createMethod(void 0, [ts18.createModifier(ts18.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
3058
2668
|
}
|
|
3059
2669
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
3060
2670
|
let initType = null;
|
|
@@ -3063,29 +2673,29 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
3063
2673
|
const coercedKeys = [];
|
|
3064
2674
|
for (const key of keys) {
|
|
3065
2675
|
if (!meta.coercedInputFields.has(key)) {
|
|
3066
|
-
plainKeys.push(
|
|
2676
|
+
plainKeys.push(ts18.createLiteralTypeNode(ts18.createStringLiteral(key)));
|
|
3067
2677
|
} else {
|
|
3068
|
-
coercedKeys.push(
|
|
2678
|
+
coercedKeys.push(ts18.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key), void 0));
|
|
3069
2679
|
}
|
|
3070
2680
|
}
|
|
3071
2681
|
if (plainKeys.length > 0) {
|
|
3072
|
-
const keyTypeUnion =
|
|
3073
|
-
initType =
|
|
2682
|
+
const keyTypeUnion = ts18.createUnionTypeNode(plainKeys);
|
|
2683
|
+
initType = ts18.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
3074
2684
|
}
|
|
3075
2685
|
if (coercedKeys.length > 0) {
|
|
3076
|
-
const coercedLiteral =
|
|
3077
|
-
initType = initType !== null ?
|
|
2686
|
+
const coercedLiteral = ts18.createTypeLiteralNode(coercedKeys);
|
|
2687
|
+
initType = initType !== null ? ts18.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
3078
2688
|
}
|
|
3079
2689
|
if (initType === null) {
|
|
3080
|
-
initType =
|
|
2690
|
+
initType = ts18.createTypeLiteralNode([]);
|
|
3081
2691
|
}
|
|
3082
|
-
return
|
|
2692
|
+
return ts18.createParameter(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
3083
2693
|
}
|
|
3084
2694
|
function generateGenericArgs(params) {
|
|
3085
|
-
return params.map((param) =>
|
|
2695
|
+
return params.map((param) => ts18.createTypeReferenceNode(param.name, void 0));
|
|
3086
2696
|
}
|
|
3087
|
-
function requiresInlineTypeCtor(node, host) {
|
|
3088
|
-
return !
|
|
2697
|
+
function requiresInlineTypeCtor(node, host, env) {
|
|
2698
|
+
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
3089
2699
|
}
|
|
3090
2700
|
function typeParametersWithDefaultTypes(params) {
|
|
3091
2701
|
if (params === void 0) {
|
|
@@ -3093,14 +2703,14 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
3093
2703
|
}
|
|
3094
2704
|
return params.map((param) => {
|
|
3095
2705
|
if (param.default === void 0) {
|
|
3096
|
-
return
|
|
2706
|
+
return ts18.updateTypeParameterDeclaration(param, param.name, param.constraint, ts18.createKeywordTypeNode(ts18.SyntaxKind.AnyKeyword));
|
|
3097
2707
|
} else {
|
|
3098
2708
|
return param;
|
|
3099
2709
|
}
|
|
3100
2710
|
});
|
|
3101
2711
|
}
|
|
3102
2712
|
|
|
3103
|
-
// bazel-out/
|
|
2713
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
3104
2714
|
var Environment = class {
|
|
3105
2715
|
constructor(config, importManager, refEmitter, reflector, contextFile) {
|
|
3106
2716
|
this.config = config;
|
|
@@ -3112,9 +2722,9 @@ var Environment = class {
|
|
|
3112
2722
|
pipeInst: 1,
|
|
3113
2723
|
typeCtor: 1
|
|
3114
2724
|
};
|
|
3115
|
-
this.typeCtors = new Map();
|
|
2725
|
+
this.typeCtors = /* @__PURE__ */ new Map();
|
|
3116
2726
|
this.typeCtorStatements = [];
|
|
3117
|
-
this.pipeInsts = new Map();
|
|
2727
|
+
this.pipeInsts = /* @__PURE__ */ new Map();
|
|
3118
2728
|
this.pipeInstStatements = [];
|
|
3119
2729
|
}
|
|
3120
2730
|
typeCtorFor(dir) {
|
|
@@ -3123,15 +2733,15 @@ var Environment = class {
|
|
|
3123
2733
|
if (this.typeCtors.has(node)) {
|
|
3124
2734
|
return this.typeCtors.get(node);
|
|
3125
2735
|
}
|
|
3126
|
-
if (requiresInlineTypeCtor(node, this.reflector)) {
|
|
2736
|
+
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
3127
2737
|
const ref = this.reference(dirRef);
|
|
3128
|
-
const typeCtorExpr =
|
|
2738
|
+
const typeCtorExpr = ts19.createPropertyAccess(ref, "ngTypeCtor");
|
|
3129
2739
|
this.typeCtors.set(node, typeCtorExpr);
|
|
3130
2740
|
return typeCtorExpr;
|
|
3131
2741
|
} else {
|
|
3132
2742
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
3133
2743
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
3134
|
-
if (!
|
|
2744
|
+
if (!ts19.isTypeReferenceNode(nodeTypeRef)) {
|
|
3135
2745
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
3136
2746
|
}
|
|
3137
2747
|
const meta = {
|
|
@@ -3145,9 +2755,9 @@ var Environment = class {
|
|
|
3145
2755
|
coercedInputFields: dir.coercedInputFields
|
|
3146
2756
|
};
|
|
3147
2757
|
const typeParams = this.emitTypeParameters(node);
|
|
3148
|
-
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams
|
|
2758
|
+
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
3149
2759
|
this.typeCtorStatements.push(typeCtor);
|
|
3150
|
-
const fnId =
|
|
2760
|
+
const fnId = ts19.createIdentifier(fnName);
|
|
3151
2761
|
this.typeCtors.set(node, fnId);
|
|
3152
2762
|
return fnId;
|
|
3153
2763
|
}
|
|
@@ -3157,17 +2767,23 @@ var Environment = class {
|
|
|
3157
2767
|
return this.pipeInsts.get(ref.node);
|
|
3158
2768
|
}
|
|
3159
2769
|
const pipeType = this.referenceType(ref);
|
|
3160
|
-
const pipeInstId =
|
|
2770
|
+
const pipeInstId = ts19.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
3161
2771
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
3162
2772
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
3163
2773
|
return pipeInstId;
|
|
3164
2774
|
}
|
|
3165
2775
|
reference(ref) {
|
|
3166
2776
|
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
|
|
2777
|
+
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
|
|
3167
2778
|
return translateExpression(ngExpr.expression, this.importManager);
|
|
3168
2779
|
}
|
|
2780
|
+
canReferenceType(ref) {
|
|
2781
|
+
const result = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2782
|
+
return result.kind === 0;
|
|
2783
|
+
}
|
|
3169
2784
|
referenceType(ref) {
|
|
3170
2785
|
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2786
|
+
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
|
|
3171
2787
|
return translateType(new ExpressionType(ngExpr.expression), this.importManager);
|
|
3172
2788
|
}
|
|
3173
2789
|
emitTypeParameters(declaration) {
|
|
@@ -3176,7 +2792,7 @@ var Environment = class {
|
|
|
3176
2792
|
}
|
|
3177
2793
|
referenceExternalType(moduleName, name, typeParams) {
|
|
3178
2794
|
const external = new ExternalExpr2({ moduleName, name });
|
|
3179
|
-
return translateType(new ExpressionType(external,
|
|
2795
|
+
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.importManager);
|
|
3180
2796
|
}
|
|
3181
2797
|
getPreludeStatements() {
|
|
3182
2798
|
return [
|
|
@@ -3186,14 +2802,14 @@ var Environment = class {
|
|
|
3186
2802
|
}
|
|
3187
2803
|
};
|
|
3188
2804
|
|
|
3189
|
-
// bazel-out/
|
|
2805
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
3190
2806
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
3191
|
-
import
|
|
2807
|
+
import ts20 from "typescript";
|
|
3192
2808
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
3193
2809
|
constructor(resolver) {
|
|
3194
2810
|
this.resolver = resolver;
|
|
3195
2811
|
this._diagnostics = [];
|
|
3196
|
-
this.recordedPipes = new Set();
|
|
2812
|
+
this.recordedPipes = /* @__PURE__ */ new Set();
|
|
3197
2813
|
}
|
|
3198
2814
|
get diagnostics() {
|
|
3199
2815
|
return this._diagnostics;
|
|
@@ -3202,7 +2818,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3202
2818
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3203
2819
|
const value = ref.value.trim();
|
|
3204
2820
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
3205
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2821
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
3206
2822
|
}
|
|
3207
2823
|
missingPipe(templateId, ast) {
|
|
3208
2824
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -3214,7 +2830,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3214
2830
|
if (sourceSpan === null) {
|
|
3215
2831
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
3216
2832
|
}
|
|
3217
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2833
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
3218
2834
|
this.recordedPipes.add(ast);
|
|
3219
2835
|
}
|
|
3220
2836
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -3225,7 +2841,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3225
2841
|
if (sourceSpan === null) {
|
|
3226
2842
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
3227
2843
|
}
|
|
3228
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2844
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
3229
2845
|
text: `The variable ${assignment.name} is declared here.`,
|
|
3230
2846
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
3231
2847
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -3235,7 +2851,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3235
2851
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
3236
2852
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3237
2853
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
3238
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
2854
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
3239
2855
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
3240
2856
|
start: firstDecl.sourceSpan.start.offset,
|
|
3241
2857
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -3274,7 +2890,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3274
2890
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
3275
2891
|
|
|
3276
2892
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
3277
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
2893
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts20.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
3278
2894
|
}
|
|
3279
2895
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
3280
2896
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -3308,7 +2924,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
3308
2924
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
3309
2925
|
});
|
|
3310
2926
|
}
|
|
3311
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2927
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
3312
2928
|
}
|
|
3313
2929
|
};
|
|
3314
2930
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -3318,8 +2934,8 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
3318
2934
|
});
|
|
3319
2935
|
}
|
|
3320
2936
|
|
|
3321
|
-
// bazel-out/
|
|
3322
|
-
import
|
|
2937
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
2938
|
+
import ts21 from "typescript";
|
|
3323
2939
|
var TypeCheckShimGenerator = class {
|
|
3324
2940
|
constructor() {
|
|
3325
2941
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -3329,25 +2945,25 @@ var TypeCheckShimGenerator = class {
|
|
|
3329
2945
|
if (priorShimSf !== null) {
|
|
3330
2946
|
return priorShimSf;
|
|
3331
2947
|
}
|
|
3332
|
-
return
|
|
2948
|
+
return ts21.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts21.ScriptTarget.Latest, true, ts21.ScriptKind.TS);
|
|
3333
2949
|
}
|
|
3334
2950
|
static shimFor(fileName) {
|
|
3335
2951
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
3336
2952
|
}
|
|
3337
2953
|
};
|
|
3338
2954
|
|
|
3339
|
-
// bazel-out/
|
|
3340
|
-
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as
|
|
3341
|
-
import
|
|
2955
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
2956
|
+
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
2957
|
+
import ts24 from "typescript";
|
|
3342
2958
|
|
|
3343
|
-
// bazel-out/
|
|
2959
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
3344
2960
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
3345
|
-
import
|
|
2961
|
+
import ts22 from "typescript";
|
|
3346
2962
|
function wrapForDiagnostics(expr) {
|
|
3347
|
-
return
|
|
2963
|
+
return ts22.createParen(expr);
|
|
3348
2964
|
}
|
|
3349
2965
|
function wrapForTypeChecker(expr) {
|
|
3350
|
-
return
|
|
2966
|
+
return ts22.createParen(expr);
|
|
3351
2967
|
}
|
|
3352
2968
|
function addParseSpanInfo(node, span) {
|
|
3353
2969
|
let commentText;
|
|
@@ -3356,10 +2972,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3356
2972
|
} else {
|
|
3357
2973
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3358
2974
|
}
|
|
3359
|
-
|
|
2975
|
+
ts22.addSyntheticTrailingComment(node, ts22.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3360
2976
|
}
|
|
3361
2977
|
function addTemplateId(tcb, id) {
|
|
3362
|
-
|
|
2978
|
+
ts22.addSyntheticLeadingComment(tcb, ts22.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3363
2979
|
}
|
|
3364
2980
|
function shouldReportDiagnostic(diagnostic) {
|
|
3365
2981
|
const { code } = diagnostic;
|
|
@@ -3386,34 +3002,34 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3386
3002
|
return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
|
|
3387
3003
|
}
|
|
3388
3004
|
|
|
3389
|
-
// bazel-out/
|
|
3390
|
-
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3391
|
-
import
|
|
3392
|
-
var NULL_AS_ANY =
|
|
3393
|
-
var UNDEFINED =
|
|
3394
|
-
var UNARY_OPS = new Map([
|
|
3395
|
-
["+",
|
|
3396
|
-
["-",
|
|
3005
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3006
|
+
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3007
|
+
import ts23 from "typescript";
|
|
3008
|
+
var NULL_AS_ANY = ts23.createAsExpression(ts23.createNull(), ts23.createKeywordTypeNode(ts23.SyntaxKind.AnyKeyword));
|
|
3009
|
+
var UNDEFINED = ts23.createIdentifier("undefined");
|
|
3010
|
+
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3011
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3012
|
+
["-", ts23.SyntaxKind.MinusToken]
|
|
3397
3013
|
]);
|
|
3398
|
-
var BINARY_OPS = new Map([
|
|
3399
|
-
["+",
|
|
3400
|
-
["-",
|
|
3401
|
-
["<",
|
|
3402
|
-
[">",
|
|
3403
|
-
["<=",
|
|
3404
|
-
[">=",
|
|
3405
|
-
["==",
|
|
3406
|
-
["===",
|
|
3407
|
-
["*",
|
|
3408
|
-
["/",
|
|
3409
|
-
["%",
|
|
3410
|
-
["!=",
|
|
3411
|
-
["!==",
|
|
3412
|
-
["||",
|
|
3413
|
-
["&&",
|
|
3414
|
-
["&",
|
|
3415
|
-
["|",
|
|
3416
|
-
["??",
|
|
3014
|
+
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3015
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3016
|
+
["-", ts23.SyntaxKind.MinusToken],
|
|
3017
|
+
["<", ts23.SyntaxKind.LessThanToken],
|
|
3018
|
+
[">", ts23.SyntaxKind.GreaterThanToken],
|
|
3019
|
+
["<=", ts23.SyntaxKind.LessThanEqualsToken],
|
|
3020
|
+
[">=", ts23.SyntaxKind.GreaterThanEqualsToken],
|
|
3021
|
+
["==", ts23.SyntaxKind.EqualsEqualsToken],
|
|
3022
|
+
["===", ts23.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3023
|
+
["*", ts23.SyntaxKind.AsteriskToken],
|
|
3024
|
+
["/", ts23.SyntaxKind.SlashToken],
|
|
3025
|
+
["%", ts23.SyntaxKind.PercentToken],
|
|
3026
|
+
["!=", ts23.SyntaxKind.ExclamationEqualsToken],
|
|
3027
|
+
["!==", ts23.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3028
|
+
["||", ts23.SyntaxKind.BarBarToken],
|
|
3029
|
+
["&&", ts23.SyntaxKind.AmpersandAmpersandToken],
|
|
3030
|
+
["&", ts23.SyntaxKind.AmpersandToken],
|
|
3031
|
+
["|", ts23.SyntaxKind.BarToken],
|
|
3032
|
+
["??", ts23.SyntaxKind.QuestionQuestionToken]
|
|
3417
3033
|
]);
|
|
3418
3034
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3419
3035
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3429,7 +3045,7 @@ var AstTranslator = class {
|
|
|
3429
3045
|
ast = ast.ast;
|
|
3430
3046
|
}
|
|
3431
3047
|
if (ast instanceof EmptyExpr2) {
|
|
3432
|
-
const res =
|
|
3048
|
+
const res = ts23.factory.createIdentifier("undefined");
|
|
3433
3049
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3434
3050
|
return res;
|
|
3435
3051
|
}
|
|
@@ -3445,7 +3061,7 @@ var AstTranslator = class {
|
|
|
3445
3061
|
if (op === void 0) {
|
|
3446
3062
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3447
3063
|
}
|
|
3448
|
-
const node = wrapForDiagnostics(
|
|
3064
|
+
const node = wrapForDiagnostics(ts23.createPrefix(op, expr));
|
|
3449
3065
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3450
3066
|
return node;
|
|
3451
3067
|
}
|
|
@@ -3456,13 +3072,13 @@ var AstTranslator = class {
|
|
|
3456
3072
|
if (op === void 0) {
|
|
3457
3073
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3458
3074
|
}
|
|
3459
|
-
const node =
|
|
3075
|
+
const node = ts23.createBinary(lhs, op, rhs);
|
|
3460
3076
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3461
3077
|
return node;
|
|
3462
3078
|
}
|
|
3463
3079
|
visitChain(ast) {
|
|
3464
3080
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3465
|
-
const node = wrapForDiagnostics(
|
|
3081
|
+
const node = wrapForDiagnostics(ts23.createCommaList(elements));
|
|
3466
3082
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3467
3083
|
return node;
|
|
3468
3084
|
}
|
|
@@ -3470,7 +3086,7 @@ var AstTranslator = class {
|
|
|
3470
3086
|
const condExpr = this.translate(ast.condition);
|
|
3471
3087
|
const trueExpr = this.translate(ast.trueExp);
|
|
3472
3088
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3473
|
-
const node =
|
|
3089
|
+
const node = ts23.createParen(ts23.createConditional(condExpr, trueExpr, falseExpr));
|
|
3474
3090
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3475
3091
|
return node;
|
|
3476
3092
|
}
|
|
@@ -3481,26 +3097,26 @@ var AstTranslator = class {
|
|
|
3481
3097
|
throw new Error("Method not implemented.");
|
|
3482
3098
|
}
|
|
3483
3099
|
visitInterpolation(ast) {
|
|
3484
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3100
|
+
return ast.expressions.reduce((lhs, ast2) => ts23.createBinary(lhs, ts23.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts23.createLiteral(""));
|
|
3485
3101
|
}
|
|
3486
3102
|
visitKeyedRead(ast) {
|
|
3487
3103
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3488
3104
|
const key = this.translate(ast.key);
|
|
3489
|
-
const node =
|
|
3105
|
+
const node = ts23.createElementAccess(receiver, key);
|
|
3490
3106
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3491
3107
|
return node;
|
|
3492
3108
|
}
|
|
3493
3109
|
visitKeyedWrite(ast) {
|
|
3494
3110
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3495
|
-
const left =
|
|
3111
|
+
const left = ts23.createElementAccess(receiver, this.translate(ast.key));
|
|
3496
3112
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3497
|
-
const node = wrapForDiagnostics(
|
|
3113
|
+
const node = wrapForDiagnostics(ts23.createBinary(left, ts23.SyntaxKind.EqualsToken, right));
|
|
3498
3114
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3499
3115
|
return node;
|
|
3500
3116
|
}
|
|
3501
3117
|
visitLiteralArray(ast) {
|
|
3502
3118
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3503
|
-
const literal =
|
|
3119
|
+
const literal = ts23.createArrayLiteral(elements);
|
|
3504
3120
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3505
3121
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3506
3122
|
return node;
|
|
@@ -3508,9 +3124,9 @@ var AstTranslator = class {
|
|
|
3508
3124
|
visitLiteralMap(ast) {
|
|
3509
3125
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3510
3126
|
const value = this.translate(ast.values[idx]);
|
|
3511
|
-
return
|
|
3127
|
+
return ts23.createPropertyAssignment(ts23.createStringLiteral(key), value);
|
|
3512
3128
|
});
|
|
3513
|
-
const literal =
|
|
3129
|
+
const literal = ts23.createObjectLiteral(properties, true);
|
|
3514
3130
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3515
3131
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3516
3132
|
return node;
|
|
@@ -3518,18 +3134,18 @@ var AstTranslator = class {
|
|
|
3518
3134
|
visitLiteralPrimitive(ast) {
|
|
3519
3135
|
let node;
|
|
3520
3136
|
if (ast.value === void 0) {
|
|
3521
|
-
node =
|
|
3137
|
+
node = ts23.createIdentifier("undefined");
|
|
3522
3138
|
} else if (ast.value === null) {
|
|
3523
|
-
node =
|
|
3139
|
+
node = ts23.createNull();
|
|
3524
3140
|
} else {
|
|
3525
|
-
node =
|
|
3141
|
+
node = ts23.createLiteral(ast.value);
|
|
3526
3142
|
}
|
|
3527
3143
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3528
3144
|
return node;
|
|
3529
3145
|
}
|
|
3530
3146
|
visitNonNullAssert(ast) {
|
|
3531
3147
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3532
|
-
const node =
|
|
3148
|
+
const node = ts23.createNonNullExpression(expr);
|
|
3533
3149
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3534
3150
|
return node;
|
|
3535
3151
|
}
|
|
@@ -3538,13 +3154,13 @@ var AstTranslator = class {
|
|
|
3538
3154
|
}
|
|
3539
3155
|
visitPrefixNot(ast) {
|
|
3540
3156
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3541
|
-
const node =
|
|
3157
|
+
const node = ts23.createLogicalNot(expression);
|
|
3542
3158
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3543
3159
|
return node;
|
|
3544
3160
|
}
|
|
3545
3161
|
visitPropertyRead(ast) {
|
|
3546
3162
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3547
|
-
const name =
|
|
3163
|
+
const name = ts23.createPropertyAccess(receiver, ast.name);
|
|
3548
3164
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3549
3165
|
const node = wrapForDiagnostics(name);
|
|
3550
3166
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3552,12 +3168,12 @@ var AstTranslator = class {
|
|
|
3552
3168
|
}
|
|
3553
3169
|
visitPropertyWrite(ast) {
|
|
3554
3170
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3555
|
-
const left =
|
|
3171
|
+
const left = ts23.createPropertyAccess(receiver, ast.name);
|
|
3556
3172
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3557
3173
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3558
3174
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3559
3175
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3560
|
-
const node = wrapForDiagnostics(
|
|
3176
|
+
const node = wrapForDiagnostics(ts23.createBinary(leftWithPath, ts23.SyntaxKind.EqualsToken, right));
|
|
3561
3177
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3562
3178
|
return node;
|
|
3563
3179
|
}
|
|
@@ -3568,13 +3184,13 @@ var AstTranslator = class {
|
|
|
3568
3184
|
let node;
|
|
3569
3185
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3570
3186
|
if (this.config.strictSafeNavigationTypes) {
|
|
3571
|
-
const expr =
|
|
3187
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3572
3188
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3573
|
-
node =
|
|
3189
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3574
3190
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3575
|
-
node =
|
|
3191
|
+
node = ts23.createPropertyAccess(tsCastToAny(receiver), ast.name);
|
|
3576
3192
|
} else {
|
|
3577
|
-
const expr =
|
|
3193
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3578
3194
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3579
3195
|
node = tsCastToAny(expr);
|
|
3580
3196
|
}
|
|
@@ -3586,13 +3202,13 @@ var AstTranslator = class {
|
|
|
3586
3202
|
const key = this.translate(ast.key);
|
|
3587
3203
|
let node;
|
|
3588
3204
|
if (this.config.strictSafeNavigationTypes) {
|
|
3589
|
-
const expr =
|
|
3205
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3590
3206
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3591
|
-
node =
|
|
3207
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3592
3208
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3593
|
-
node =
|
|
3209
|
+
node = ts23.createElementAccess(tsCastToAny(receiver), key);
|
|
3594
3210
|
} else {
|
|
3595
|
-
const expr =
|
|
3211
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3596
3212
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3597
3213
|
node = tsCastToAny(expr);
|
|
3598
3214
|
}
|
|
@@ -3601,19 +3217,32 @@ var AstTranslator = class {
|
|
|
3601
3217
|
}
|
|
3602
3218
|
visitCall(ast) {
|
|
3603
3219
|
const args = ast.args.map((expr2) => this.translate(expr2));
|
|
3604
|
-
|
|
3220
|
+
let expr;
|
|
3221
|
+
const receiver = ast.receiver;
|
|
3222
|
+
if (receiver instanceof PropertyRead3) {
|
|
3223
|
+
const resolved = this.maybeResolve(receiver);
|
|
3224
|
+
if (resolved !== null) {
|
|
3225
|
+
expr = resolved;
|
|
3226
|
+
} else {
|
|
3227
|
+
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3228
|
+
expr = ts23.createPropertyAccess(propertyReceiver, receiver.name);
|
|
3229
|
+
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3230
|
+
}
|
|
3231
|
+
} else {
|
|
3232
|
+
expr = this.translate(receiver);
|
|
3233
|
+
}
|
|
3605
3234
|
let node;
|
|
3606
|
-
if (
|
|
3235
|
+
if (receiver instanceof SafePropertyRead2 || receiver instanceof SafeKeyedRead) {
|
|
3607
3236
|
if (this.config.strictSafeNavigationTypes) {
|
|
3608
|
-
const call =
|
|
3609
|
-
node =
|
|
3237
|
+
const call = ts23.createCall(ts23.createNonNullExpression(expr), void 0, args);
|
|
3238
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, call, UNDEFINED));
|
|
3610
3239
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3611
|
-
node =
|
|
3240
|
+
node = ts23.createCall(tsCastToAny(expr), void 0, args);
|
|
3612
3241
|
} else {
|
|
3613
|
-
node = tsCastToAny(
|
|
3242
|
+
node = tsCastToAny(ts23.createCall(ts23.createNonNullExpression(expr), void 0, args));
|
|
3614
3243
|
}
|
|
3615
3244
|
} else {
|
|
3616
|
-
node =
|
|
3245
|
+
node = ts23.createCall(expr, void 0, args);
|
|
3617
3246
|
}
|
|
3618
3247
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3619
3248
|
return node;
|
|
@@ -3690,7 +3319,7 @@ var VeSafeLhsInferenceBugDetector = class {
|
|
|
3690
3319
|
};
|
|
3691
3320
|
VeSafeLhsInferenceBugDetector.SINGLETON = new VeSafeLhsInferenceBugDetector();
|
|
3692
3321
|
|
|
3693
|
-
// bazel-out/
|
|
3322
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.mjs
|
|
3694
3323
|
import { ImplicitReceiver as ImplicitReceiver3, RecursiveAstVisitor as RecursiveAstVisitor2, TmplAstVariable } from "@angular/compiler";
|
|
3695
3324
|
var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
3696
3325
|
constructor(templateId, boundTarget, oob) {
|
|
@@ -3714,7 +3343,7 @@ var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
|
3714
3343
|
}
|
|
3715
3344
|
};
|
|
3716
3345
|
|
|
3717
|
-
// bazel-out/
|
|
3346
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3718
3347
|
var TcbGenericContextBehavior;
|
|
3719
3348
|
(function(TcbGenericContextBehavior2) {
|
|
3720
3349
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
@@ -3725,7 +3354,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3725
3354
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
3726
3355
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3727
3356
|
const ctxRawType = env.referenceType(ref);
|
|
3728
|
-
if (!
|
|
3357
|
+
if (!ts24.isTypeReferenceNode(ctxRawType)) {
|
|
3729
3358
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3730
3359
|
}
|
|
3731
3360
|
let typeParameters = void 0;
|
|
@@ -3737,25 +3366,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3737
3366
|
switch (genericContextBehavior) {
|
|
3738
3367
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3739
3368
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3740
|
-
typeArguments = typeParameters.map((param) =>
|
|
3369
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3741
3370
|
break;
|
|
3742
3371
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3743
3372
|
typeParameters = [...ref.node.typeParameters];
|
|
3744
|
-
typeArguments = typeParameters.map((param) =>
|
|
3373
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3745
3374
|
break;
|
|
3746
3375
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3747
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3376
|
+
typeArguments = ref.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3748
3377
|
break;
|
|
3749
3378
|
}
|
|
3750
3379
|
}
|
|
3751
3380
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3752
3381
|
const scopeStatements = scope.render();
|
|
3753
|
-
const innerBody =
|
|
3382
|
+
const innerBody = ts24.createBlock([
|
|
3754
3383
|
...env.getPreludeStatements(),
|
|
3755
3384
|
...scopeStatements
|
|
3756
3385
|
]);
|
|
3757
|
-
const body =
|
|
3758
|
-
const fnDecl =
|
|
3386
|
+
const body = ts24.createBlock([ts24.createIf(ts24.createTrue(), innerBody, void 0)]);
|
|
3387
|
+
const fnDecl = ts24.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3759
3388
|
addTemplateId(fnDecl, meta.id);
|
|
3760
3389
|
return fnDecl;
|
|
3761
3390
|
}
|
|
@@ -3796,7 +3425,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3796
3425
|
execute() {
|
|
3797
3426
|
const ctx = this.scope.resolve(this.template);
|
|
3798
3427
|
const id = this.tcb.allocateId();
|
|
3799
|
-
const initializer =
|
|
3428
|
+
const initializer = ts24.createPropertyAccess(ctx, this.variable.value || "$implicit");
|
|
3800
3429
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3801
3430
|
let variable;
|
|
3802
3431
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3819,7 +3448,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3819
3448
|
}
|
|
3820
3449
|
execute() {
|
|
3821
3450
|
const ctx = this.tcb.allocateId();
|
|
3822
|
-
const type =
|
|
3451
|
+
const type = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
3823
3452
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3824
3453
|
return ctx;
|
|
3825
3454
|
}
|
|
@@ -3872,16 +3501,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3872
3501
|
}
|
|
3873
3502
|
let guard = null;
|
|
3874
3503
|
if (directiveGuards.length > 0) {
|
|
3875
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3504
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts24.createBinary(expr, ts24.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3876
3505
|
}
|
|
3877
3506
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3878
3507
|
const statements = tmplScope.render();
|
|
3879
3508
|
if (statements.length === 0) {
|
|
3880
3509
|
return null;
|
|
3881
3510
|
}
|
|
3882
|
-
let tmplBlock =
|
|
3511
|
+
let tmplBlock = ts24.createBlock(statements);
|
|
3883
3512
|
if (guard !== null) {
|
|
3884
|
-
tmplBlock =
|
|
3513
|
+
tmplBlock = ts24.createIf(guard, tmplBlock);
|
|
3885
3514
|
}
|
|
3886
3515
|
this.scope.addStatement(tmplBlock);
|
|
3887
3516
|
return null;
|
|
@@ -3899,7 +3528,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3899
3528
|
}
|
|
3900
3529
|
execute() {
|
|
3901
3530
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3902
|
-
this.scope.addStatement(
|
|
3531
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
3903
3532
|
return null;
|
|
3904
3533
|
}
|
|
3905
3534
|
};
|
|
@@ -3921,11 +3550,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3921
3550
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3922
3551
|
type = rawType;
|
|
3923
3552
|
} else {
|
|
3924
|
-
if (!
|
|
3553
|
+
if (!ts24.isTypeReferenceNode(rawType)) {
|
|
3925
3554
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3926
3555
|
}
|
|
3927
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3928
|
-
type =
|
|
3556
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3557
|
+
type = ts24.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3929
3558
|
}
|
|
3930
3559
|
const id = this.tcb.allocateId();
|
|
3931
3560
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3966,11 +3595,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3966
3595
|
const id = this.tcb.allocateId();
|
|
3967
3596
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3968
3597
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3969
|
-
initializer =
|
|
3598
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3970
3599
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3971
|
-
initializer =
|
|
3972
|
-
initializer =
|
|
3973
|
-
initializer =
|
|
3600
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3601
|
+
initializer = ts24.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3602
|
+
initializer = ts24.createParen(initializer);
|
|
3974
3603
|
}
|
|
3975
3604
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3976
3605
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -4006,7 +3635,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
|
|
|
4006
3635
|
const id = this.tcb.allocateId();
|
|
4007
3636
|
addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
|
|
4008
3637
|
addParseSpanInfo(id, this.node.startSourceSpan || this.node.sourceSpan);
|
|
4009
|
-
const genericInputs = new Map();
|
|
3638
|
+
const genericInputs = /* @__PURE__ */ new Map();
|
|
4010
3639
|
const inputs = getBoundInputs(this.dir, this.node, this.tcb);
|
|
4011
3640
|
for (const input of inputs) {
|
|
4012
3641
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
@@ -4060,7 +3689,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4060
3689
|
let target;
|
|
4061
3690
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
4062
3691
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4063
|
-
if (!
|
|
3692
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4064
3693
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4065
3694
|
}
|
|
4066
3695
|
const id = this.tcb.allocateId();
|
|
@@ -4075,10 +3704,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4075
3704
|
}
|
|
4076
3705
|
const id = this.tcb.allocateId();
|
|
4077
3706
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4078
|
-
if (!
|
|
3707
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4079
3708
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4080
3709
|
}
|
|
4081
|
-
const type =
|
|
3710
|
+
const type = ts24.createIndexedAccessTypeNode(ts24.createTypeQueryNode(dirId), ts24.createLiteralTypeNode(ts24.createStringLiteral(fieldName)));
|
|
4082
3711
|
const temp = tsDeclareVariable(id, type);
|
|
4083
3712
|
this.scope.addStatement(temp);
|
|
4084
3713
|
target = id;
|
|
@@ -4086,18 +3715,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4086
3715
|
if (dirId === null) {
|
|
4087
3716
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4088
3717
|
}
|
|
4089
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3718
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts24.createElementAccess(dirId, ts24.createStringLiteral(fieldName)) : ts24.createPropertyAccess(dirId, ts24.createIdentifier(fieldName));
|
|
4090
3719
|
}
|
|
4091
3720
|
if (input.attribute.keySpan !== void 0) {
|
|
4092
3721
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
4093
3722
|
}
|
|
4094
|
-
assignment =
|
|
3723
|
+
assignment = ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, assignment);
|
|
4095
3724
|
}
|
|
4096
3725
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
4097
3726
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
4098
3727
|
markIgnoreDiagnostics(assignment);
|
|
4099
3728
|
}
|
|
4100
|
-
this.scope.addStatement(
|
|
3729
|
+
this.scope.addStatement(ts24.createExpressionStatement(assignment));
|
|
4101
3730
|
}
|
|
4102
3731
|
return null;
|
|
4103
3732
|
}
|
|
@@ -4116,7 +3745,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
4116
3745
|
execute() {
|
|
4117
3746
|
const id = this.tcb.allocateId();
|
|
4118
3747
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
4119
|
-
const circularPlaceholder =
|
|
3748
|
+
const circularPlaceholder = ts24.createCall(typeCtor, void 0, [ts24.createNonNullExpression(ts24.createNull())]);
|
|
4120
3749
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
4121
3750
|
return id;
|
|
4122
3751
|
}
|
|
@@ -4182,15 +3811,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
4182
3811
|
elId = this.scope.resolve(this.element);
|
|
4183
3812
|
}
|
|
4184
3813
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
4185
|
-
const prop =
|
|
4186
|
-
const stmt =
|
|
3814
|
+
const prop = ts24.createElementAccess(elId, ts24.createStringLiteral(propertyName));
|
|
3815
|
+
const stmt = ts24.createBinary(prop, ts24.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
4187
3816
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
4188
|
-
this.scope.addStatement(
|
|
3817
|
+
this.scope.addStatement(ts24.createExpressionStatement(stmt));
|
|
4189
3818
|
} else {
|
|
4190
|
-
this.scope.addStatement(
|
|
3819
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4191
3820
|
}
|
|
4192
3821
|
} else {
|
|
4193
|
-
this.scope.addStatement(
|
|
3822
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4194
3823
|
}
|
|
4195
3824
|
}
|
|
4196
3825
|
return null;
|
|
@@ -4222,18 +3851,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
4222
3851
|
if (dirId === null) {
|
|
4223
3852
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4224
3853
|
}
|
|
4225
|
-
const outputField =
|
|
3854
|
+
const outputField = ts24.createElementAccess(dirId, ts24.createStringLiteral(field));
|
|
4226
3855
|
addParseSpanInfo(outputField, output.keySpan);
|
|
4227
3856
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
4228
3857
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4229
|
-
const subscribeFn =
|
|
4230
|
-
const call =
|
|
3858
|
+
const subscribeFn = ts24.createPropertyAccess(outputField, "subscribe");
|
|
3859
|
+
const call = ts24.createCall(subscribeFn, void 0, [handler]);
|
|
4231
3860
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4232
|
-
this.scope.addStatement(
|
|
3861
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4233
3862
|
} else {
|
|
4234
|
-
this.scope.addStatement(
|
|
3863
|
+
this.scope.addStatement(ts24.createExpressionStatement(outputField));
|
|
4235
3864
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4236
|
-
this.scope.addStatement(
|
|
3865
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4237
3866
|
}
|
|
4238
3867
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4239
3868
|
}
|
|
@@ -4266,20 +3895,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
4266
3895
|
if (output.type === 1) {
|
|
4267
3896
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
4268
3897
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
4269
|
-
this.scope.addStatement(
|
|
3898
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4270
3899
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
4271
3900
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4272
3901
|
if (elId === null) {
|
|
4273
3902
|
elId = this.scope.resolve(this.element);
|
|
4274
3903
|
}
|
|
4275
|
-
const propertyAccess =
|
|
3904
|
+
const propertyAccess = ts24.createPropertyAccess(elId, "addEventListener");
|
|
4276
3905
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
4277
|
-
const call =
|
|
3906
|
+
const call = ts24.createCall(propertyAccess, void 0, [ts24.createStringLiteral(output.name), handler]);
|
|
4278
3907
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4279
|
-
this.scope.addStatement(
|
|
3908
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4280
3909
|
} else {
|
|
4281
3910
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4282
|
-
this.scope.addStatement(
|
|
3911
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4283
3912
|
}
|
|
4284
3913
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4285
3914
|
}
|
|
@@ -4293,15 +3922,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
4293
3922
|
this.optional = false;
|
|
4294
3923
|
}
|
|
4295
3924
|
execute() {
|
|
4296
|
-
const ctx =
|
|
4297
|
-
const ctxDot =
|
|
3925
|
+
const ctx = ts24.createIdentifier("ctx");
|
|
3926
|
+
const ctxDot = ts24.createPropertyAccess(ctx, "");
|
|
4298
3927
|
markIgnoreDiagnostics(ctxDot);
|
|
4299
3928
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
4300
|
-
this.scope.addStatement(
|
|
3929
|
+
this.scope.addStatement(ts24.createExpressionStatement(ctxDot));
|
|
4301
3930
|
return null;
|
|
4302
3931
|
}
|
|
4303
3932
|
};
|
|
4304
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3933
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts24.createNonNullExpression(ts24.createNull());
|
|
4305
3934
|
var Context = class {
|
|
4306
3935
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
4307
3936
|
this.env = env;
|
|
@@ -4314,7 +3943,7 @@ var Context = class {
|
|
|
4314
3943
|
this.nextId = 1;
|
|
4315
3944
|
}
|
|
4316
3945
|
allocateId() {
|
|
4317
|
-
return
|
|
3946
|
+
return ts24.createIdentifier(`_t${this.nextId++}`);
|
|
4318
3947
|
}
|
|
4319
3948
|
getPipeByName(name) {
|
|
4320
3949
|
if (!this.pipes.has(name)) {
|
|
@@ -4329,11 +3958,11 @@ var Scope = class {
|
|
|
4329
3958
|
this.parent = parent;
|
|
4330
3959
|
this.guard = guard;
|
|
4331
3960
|
this.opQueue = [];
|
|
4332
|
-
this.elementOpMap = new Map();
|
|
4333
|
-
this.directiveOpMap = new Map();
|
|
4334
|
-
this.referenceOpMap = new Map();
|
|
4335
|
-
this.templateCtxOpMap = new Map();
|
|
4336
|
-
this.varMap = new Map();
|
|
3961
|
+
this.elementOpMap = /* @__PURE__ */ new Map();
|
|
3962
|
+
this.directiveOpMap = /* @__PURE__ */ new Map();
|
|
3963
|
+
this.referenceOpMap = /* @__PURE__ */ new Map();
|
|
3964
|
+
this.templateCtxOpMap = /* @__PURE__ */ new Map();
|
|
3965
|
+
this.varMap = /* @__PURE__ */ new Map();
|
|
4337
3966
|
this.statements = [];
|
|
4338
3967
|
}
|
|
4339
3968
|
static forNodes(tcb, parent, templateOrNodes, guard) {
|
|
@@ -4343,7 +3972,7 @@ var Scope = class {
|
|
|
4343
3972
|
}
|
|
4344
3973
|
let children;
|
|
4345
3974
|
if (templateOrNodes instanceof TmplAstTemplate2) {
|
|
4346
|
-
const varMap = new Map();
|
|
3975
|
+
const varMap = /* @__PURE__ */ new Map();
|
|
4347
3976
|
for (const v of templateOrNodes.variables) {
|
|
4348
3977
|
if (!varMap.has(v.name)) {
|
|
4349
3978
|
varMap.set(v.name, v);
|
|
@@ -4366,8 +3995,8 @@ var Scope = class {
|
|
|
4366
3995
|
resolve(node, directive) {
|
|
4367
3996
|
const res = this.resolveLocal(node, directive);
|
|
4368
3997
|
if (res !== null) {
|
|
4369
|
-
const clone =
|
|
4370
|
-
|
|
3998
|
+
const clone = ts24.getMutableClone(res);
|
|
3999
|
+
ts24.setSyntheticTrailingComments(clone, []);
|
|
4371
4000
|
return clone;
|
|
4372
4001
|
} else if (this.parent !== null) {
|
|
4373
4002
|
return this.parent.resolve(node, directive);
|
|
@@ -4395,7 +4024,7 @@ var Scope = class {
|
|
|
4395
4024
|
} else if (parentGuards === null) {
|
|
4396
4025
|
return this.guard;
|
|
4397
4026
|
} else {
|
|
4398
|
-
return
|
|
4027
|
+
return ts24.createBinary(parentGuards, ts24.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4399
4028
|
}
|
|
4400
4029
|
}
|
|
4401
4030
|
resolveLocal(ref, directive) {
|
|
@@ -4481,7 +4110,7 @@ var Scope = class {
|
|
|
4481
4110
|
}
|
|
4482
4111
|
}
|
|
4483
4112
|
appendDirectivesAndInputsOfNode(node) {
|
|
4484
|
-
const claimedInputs = new Set();
|
|
4113
|
+
const claimedInputs = /* @__PURE__ */ new Set();
|
|
4485
4114
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
|
|
4486
4115
|
if (directives === null || directives.length === 0) {
|
|
4487
4116
|
if (node instanceof TmplAstElement3) {
|
|
@@ -4490,14 +4119,14 @@ var Scope = class {
|
|
|
4490
4119
|
}
|
|
4491
4120
|
return;
|
|
4492
4121
|
}
|
|
4493
|
-
const dirMap = new Map();
|
|
4122
|
+
const dirMap = /* @__PURE__ */ new Map();
|
|
4494
4123
|
for (const dir of directives) {
|
|
4495
4124
|
let directiveOp;
|
|
4496
4125
|
const host = this.tcb.env.reflector;
|
|
4497
4126
|
const dirRef = dir.ref;
|
|
4498
4127
|
if (!dir.isGeneric) {
|
|
4499
4128
|
directiveOp = new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir);
|
|
4500
|
-
} else if (!requiresInlineTypeCtor(dirRef.node, host) || this.tcb.env.config.useInlineTypeConstructors) {
|
|
4129
|
+
} else if (!requiresInlineTypeCtor(dirRef.node, host, this.tcb.env) || this.tcb.env.config.useInlineTypeConstructors) {
|
|
4501
4130
|
directiveOp = new TcbDirectiveCtorOp(this.tcb, this, node, dir);
|
|
4502
4131
|
} else {
|
|
4503
4132
|
directiveOp = new TcbGenericDirectiveTypeWithAnyParamsOp(this.tcb, this, node, dir);
|
|
@@ -4519,7 +4148,7 @@ var Scope = class {
|
|
|
4519
4148
|
}
|
|
4520
4149
|
}
|
|
4521
4150
|
appendOutputsOfNode(node) {
|
|
4522
|
-
const claimedOutputs = new Set();
|
|
4151
|
+
const claimedOutputs = /* @__PURE__ */ new Set();
|
|
4523
4152
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
|
|
4524
4153
|
if (directives === null || directives.length === 0) {
|
|
4525
4154
|
if (node instanceof TmplAstElement3) {
|
|
@@ -4545,7 +4174,7 @@ var Scope = class {
|
|
|
4545
4174
|
continue;
|
|
4546
4175
|
}
|
|
4547
4176
|
if (node instanceof TmplAstElement3) {
|
|
4548
|
-
const claimedInputs = new Set();
|
|
4177
|
+
const claimedInputs = /* @__PURE__ */ new Set();
|
|
4549
4178
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
|
|
4550
4179
|
let hasDirectives;
|
|
4551
4180
|
if (directives === null || directives.length === 0) {
|
|
@@ -4575,8 +4204,8 @@ var Scope = class {
|
|
|
4575
4204
|
}
|
|
4576
4205
|
};
|
|
4577
4206
|
function tcbCtxParam(node, name, typeArguments) {
|
|
4578
|
-
const type =
|
|
4579
|
-
return
|
|
4207
|
+
const type = ts24.factory.createTypeReferenceNode(name, typeArguments);
|
|
4208
|
+
return ts24.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
4580
4209
|
}
|
|
4581
4210
|
function tcbExpression(ast, tcb, scope) {
|
|
4582
4211
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -4591,19 +4220,19 @@ var TcbExpressionTranslator = class {
|
|
|
4591
4220
|
return astToTypescript(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
|
|
4592
4221
|
}
|
|
4593
4222
|
resolve(ast) {
|
|
4594
|
-
if (ast instanceof
|
|
4223
|
+
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4) {
|
|
4595
4224
|
return this.resolveTarget(ast);
|
|
4596
|
-
} else if (ast instanceof
|
|
4225
|
+
} else if (ast instanceof PropertyWrite3 && ast.receiver instanceof ImplicitReceiver4) {
|
|
4597
4226
|
const target = this.resolveTarget(ast);
|
|
4598
4227
|
if (target === null) {
|
|
4599
4228
|
return null;
|
|
4600
4229
|
}
|
|
4601
4230
|
const expr = this.translate(ast.value);
|
|
4602
|
-
const result =
|
|
4231
|
+
const result = ts24.createParen(ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, expr));
|
|
4603
4232
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4604
4233
|
return result;
|
|
4605
4234
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4606
|
-
return
|
|
4235
|
+
return ts24.createIdentifier("ctx");
|
|
4607
4236
|
} else if (ast instanceof BindingPipe) {
|
|
4608
4237
|
const expr = this.translate(ast.exp);
|
|
4609
4238
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4615,19 +4244,19 @@ var TcbExpressionTranslator = class {
|
|
|
4615
4244
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4616
4245
|
}
|
|
4617
4246
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4618
|
-
let methodAccess =
|
|
4247
|
+
let methodAccess = ts24.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4619
4248
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4620
4249
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4621
|
-
methodAccess =
|
|
4250
|
+
methodAccess = ts24.factory.createAsExpression(methodAccess, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4622
4251
|
}
|
|
4623
|
-
const result =
|
|
4252
|
+
const result = ts24.createCall(methodAccess, void 0, [expr, ...args]);
|
|
4624
4253
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4625
4254
|
return result;
|
|
4626
|
-
} else if (ast instanceof Call2 && (ast.receiver instanceof
|
|
4627
|
-
if (ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4255
|
+
} else if (ast instanceof Call2 && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4256
|
+
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4628
4257
|
const expr = this.translate(ast.args[0]);
|
|
4629
|
-
const exprAsAny =
|
|
4630
|
-
const result =
|
|
4258
|
+
const exprAsAny = ts24.createAsExpression(expr, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4259
|
+
const result = ts24.createParen(exprAsAny);
|
|
4631
4260
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4632
4261
|
return result;
|
|
4633
4262
|
}
|
|
@@ -4638,7 +4267,7 @@ var TcbExpressionTranslator = class {
|
|
|
4638
4267
|
const method = wrapForDiagnostics(receiver);
|
|
4639
4268
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4640
4269
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4641
|
-
const node =
|
|
4270
|
+
const node = ts24.createCall(method, void 0, args);
|
|
4642
4271
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4643
4272
|
return node;
|
|
4644
4273
|
} else {
|
|
@@ -4658,17 +4287,17 @@ var TcbExpressionTranslator = class {
|
|
|
4658
4287
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4659
4288
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4660
4289
|
const members = inputs.map((input) => {
|
|
4661
|
-
const propertyName =
|
|
4290
|
+
const propertyName = ts24.createStringLiteral(input.field);
|
|
4662
4291
|
if (input.type === "binding") {
|
|
4663
4292
|
const expr = widenBinding(input.expression, tcb);
|
|
4664
|
-
const assignment =
|
|
4293
|
+
const assignment = ts24.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4665
4294
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4666
4295
|
return assignment;
|
|
4667
4296
|
} else {
|
|
4668
|
-
return
|
|
4297
|
+
return ts24.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4669
4298
|
}
|
|
4670
4299
|
});
|
|
4671
|
-
return
|
|
4300
|
+
return ts24.createCall(typeCtor, void 0, [ts24.createObjectLiteral(members)]);
|
|
4672
4301
|
}
|
|
4673
4302
|
function getBoundInputs(directive, node, tcb) {
|
|
4674
4303
|
const boundInputs = [];
|
|
@@ -4694,17 +4323,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4694
4323
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4695
4324
|
return tcbExpression(attr.value, tcb, scope);
|
|
4696
4325
|
} else {
|
|
4697
|
-
return
|
|
4326
|
+
return ts24.createStringLiteral(attr.value);
|
|
4698
4327
|
}
|
|
4699
4328
|
}
|
|
4700
4329
|
function widenBinding(expr, tcb) {
|
|
4701
4330
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4702
4331
|
return tsCastToAny(expr);
|
|
4703
4332
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4704
|
-
if (
|
|
4333
|
+
if (ts24.isObjectLiteralExpression(expr) || ts24.isArrayLiteralExpression(expr)) {
|
|
4705
4334
|
return expr;
|
|
4706
4335
|
} else {
|
|
4707
|
-
return
|
|
4336
|
+
return ts24.createNonNullExpression(expr);
|
|
4708
4337
|
}
|
|
4709
4338
|
} else {
|
|
4710
4339
|
return expr;
|
|
@@ -4717,18 +4346,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4717
4346
|
if (eventType === 0) {
|
|
4718
4347
|
eventParamType = void 0;
|
|
4719
4348
|
} else if (eventType === 1) {
|
|
4720
|
-
eventParamType =
|
|
4349
|
+
eventParamType = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
4721
4350
|
} else {
|
|
4722
4351
|
eventParamType = eventType;
|
|
4723
4352
|
}
|
|
4724
4353
|
const guards = scope.guards();
|
|
4725
|
-
let body =
|
|
4354
|
+
let body = ts24.createExpressionStatement(handler);
|
|
4726
4355
|
if (guards !== null) {
|
|
4727
|
-
body =
|
|
4356
|
+
body = ts24.createIf(guards, body);
|
|
4728
4357
|
}
|
|
4729
|
-
const eventParam =
|
|
4358
|
+
const eventParam = ts24.createParameter(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4730
4359
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4731
|
-
return
|
|
4360
|
+
return ts24.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword), ts24.createBlock([body]));
|
|
4732
4361
|
}
|
|
4733
4362
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4734
4363
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4755,8 +4384,8 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4755
4384
|
}
|
|
4756
4385
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4757
4386
|
resolve(ast) {
|
|
4758
|
-
if (ast instanceof
|
|
4759
|
-
const event =
|
|
4387
|
+
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4388
|
+
const event = ts24.createIdentifier(EVENT_PARAMETER);
|
|
4760
4389
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4761
4390
|
return event;
|
|
4762
4391
|
}
|
|
@@ -4764,33 +4393,33 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4764
4393
|
}
|
|
4765
4394
|
};
|
|
4766
4395
|
|
|
4767
|
-
// bazel-out/
|
|
4768
|
-
import
|
|
4396
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4397
|
+
import ts25 from "typescript";
|
|
4769
4398
|
var TypeCheckFile = class extends Environment {
|
|
4770
4399
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4771
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
4400
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts25.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts25.ScriptTarget.Latest, true));
|
|
4772
4401
|
this.fileName = fileName;
|
|
4773
4402
|
this.nextTcbId = 1;
|
|
4774
4403
|
this.tcbStatements = [];
|
|
4775
4404
|
}
|
|
4776
4405
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4777
|
-
const fnId =
|
|
4406
|
+
const fnId = ts25.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4778
4407
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4779
4408
|
this.tcbStatements.push(fn);
|
|
4780
4409
|
}
|
|
4781
4410
|
render(removeComments) {
|
|
4782
4411
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
4783
|
-
const printer =
|
|
4412
|
+
const printer = ts25.createPrinter({ removeComments });
|
|
4784
4413
|
source += "\n";
|
|
4785
4414
|
for (const stmt of this.pipeInstStatements) {
|
|
4786
|
-
source += printer.printNode(
|
|
4415
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4787
4416
|
}
|
|
4788
4417
|
for (const stmt of this.typeCtorStatements) {
|
|
4789
|
-
source += printer.printNode(
|
|
4418
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4790
4419
|
}
|
|
4791
4420
|
source += "\n";
|
|
4792
4421
|
for (const stmt of this.tcbStatements) {
|
|
4793
|
-
source += printer.printNode(
|
|
4422
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4794
4423
|
}
|
|
4795
4424
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4796
4425
|
return source;
|
|
@@ -4800,7 +4429,7 @@ var TypeCheckFile = class extends Environment {
|
|
|
4800
4429
|
}
|
|
4801
4430
|
};
|
|
4802
4431
|
|
|
4803
|
-
// bazel-out/
|
|
4432
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
4804
4433
|
var InliningMode;
|
|
4805
4434
|
(function(InliningMode2) {
|
|
4806
4435
|
InliningMode2[InliningMode2["InlineOps"] = 0] = "InlineOps";
|
|
@@ -4815,9 +4444,9 @@ var TypeCheckContextImpl = class {
|
|
|
4815
4444
|
this.host = host;
|
|
4816
4445
|
this.inlining = inlining;
|
|
4817
4446
|
this.perf = perf;
|
|
4818
|
-
this.fileMap = new Map();
|
|
4819
|
-
this.opMap = new Map();
|
|
4820
|
-
this.typeCtorPending = new Set();
|
|
4447
|
+
this.fileMap = /* @__PURE__ */ new Map();
|
|
4448
|
+
this.opMap = /* @__PURE__ */ new Map();
|
|
4449
|
+
this.typeCtorPending = /* @__PURE__ */ new Set();
|
|
4821
4450
|
if (inlining === InliningMode.Error && config.useInlineTypeConstructors) {
|
|
4822
4451
|
throw new Error(`AssertionError: invalid inlining configuration.`);
|
|
4823
4452
|
}
|
|
@@ -4838,7 +4467,7 @@ var TypeCheckContextImpl = class {
|
|
|
4838
4467
|
for (const dir of boundTarget.getUsedDirectives()) {
|
|
4839
4468
|
const dirRef = dir.ref;
|
|
4840
4469
|
const dirNode = dirRef.node;
|
|
4841
|
-
if (!dir.isGeneric || !requiresInlineTypeCtor(dirNode, this.reflector)) {
|
|
4470
|
+
if (!dir.isGeneric || !requiresInlineTypeCtor(dirNode, this.reflector, shimData.file)) {
|
|
4842
4471
|
continue;
|
|
4843
4472
|
}
|
|
4844
4473
|
this.addInlineTypeCtor(fileData, dirNode.getSourceFile(), dirRef, {
|
|
@@ -4858,7 +4487,7 @@ var TypeCheckContextImpl = class {
|
|
|
4858
4487
|
boundTarget,
|
|
4859
4488
|
templateDiagnostics
|
|
4860
4489
|
});
|
|
4861
|
-
const inliningRequirement = requiresInlineTypeCheckBlock(ref.node, pipes, this.reflector);
|
|
4490
|
+
const inliningRequirement = requiresInlineTypeCheckBlock(ref.node, shimData.file, pipes, this.reflector);
|
|
4862
4491
|
if (this.inlining === InliningMode.Error && inliningRequirement === TcbInliningRequirement.MustInline) {
|
|
4863
4492
|
shimData.oobRecorder.requiresInlineTcb(templateId, ref.node);
|
|
4864
4493
|
this.perf.eventCount(PerfEvent.SkipGenerateTcbNoInline);
|
|
@@ -4898,7 +4527,7 @@ var TypeCheckContextImpl = class {
|
|
|
4898
4527
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4899
4528
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4900
4529
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4901
|
-
const printer =
|
|
4530
|
+
const printer = ts26.createPrinter({ omitTrailingSemicolon: true });
|
|
4902
4531
|
let code = textParts[0];
|
|
4903
4532
|
ops.forEach((op, idx) => {
|
|
4904
4533
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4909,7 +4538,7 @@ var TypeCheckContextImpl = class {
|
|
|
4909
4538
|
return code;
|
|
4910
4539
|
}
|
|
4911
4540
|
finalize() {
|
|
4912
|
-
const updates = new Map();
|
|
4541
|
+
const updates = /* @__PURE__ */ new Map();
|
|
4913
4542
|
for (const originalSf of this.opMap.keys()) {
|
|
4914
4543
|
const newText = this.transform(originalSf);
|
|
4915
4544
|
if (newText !== null) {
|
|
@@ -4956,7 +4585,7 @@ var TypeCheckContextImpl = class {
|
|
|
4956
4585
|
domSchemaChecker: new RegistryDomSchemaChecker(fileData.sourceManager),
|
|
4957
4586
|
oobRecorder: new OutOfBandDiagnosticRecorderImpl(fileData.sourceManager),
|
|
4958
4587
|
file: new TypeCheckFile(shimPath, this.config, this.refEmitter, this.reflector, this.compilerHost),
|
|
4959
|
-
templates: new Map()
|
|
4588
|
+
templates: /* @__PURE__ */ new Map()
|
|
4960
4589
|
});
|
|
4961
4590
|
}
|
|
4962
4591
|
return fileData.shimData.get(shimPath);
|
|
@@ -4967,7 +4596,7 @@ var TypeCheckContextImpl = class {
|
|
|
4967
4596
|
const data = {
|
|
4968
4597
|
hasInlines: false,
|
|
4969
4598
|
sourceManager: this.host.getSourceManager(sfPath),
|
|
4970
|
-
shimData: new Map()
|
|
4599
|
+
shimData: /* @__PURE__ */ new Map()
|
|
4971
4600
|
};
|
|
4972
4601
|
this.fileMap.set(sfPath, data);
|
|
4973
4602
|
}
|
|
@@ -4979,7 +4608,7 @@ var TypeCheckContextImpl = class {
|
|
|
4979
4608
|
if (span.start.offset === span.end.offset) {
|
|
4980
4609
|
span.end.offset++;
|
|
4981
4610
|
}
|
|
4982
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4611
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts26.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4983
4612
|
});
|
|
4984
4613
|
}
|
|
4985
4614
|
};
|
|
@@ -4997,9 +4626,9 @@ var InlineTcbOp = class {
|
|
|
4997
4626
|
}
|
|
4998
4627
|
execute(im, sf, refEmitter, printer) {
|
|
4999
4628
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
5000
|
-
const fnName =
|
|
4629
|
+
const fnName = ts26.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
5001
4630
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
5002
|
-
return printer.printNode(
|
|
4631
|
+
return printer.printNode(ts26.EmitHint.Unspecified, fn, sf);
|
|
5003
4632
|
}
|
|
5004
4633
|
};
|
|
5005
4634
|
var TypeCtorOp = class {
|
|
@@ -5012,7 +4641,7 @@ var TypeCtorOp = class {
|
|
|
5012
4641
|
}
|
|
5013
4642
|
execute(im, sf, refEmitter, printer) {
|
|
5014
4643
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
5015
|
-
return printer.printNode(
|
|
4644
|
+
return printer.printNode(ts26.EmitHint.Unspecified, tcb, sf);
|
|
5016
4645
|
}
|
|
5017
4646
|
};
|
|
5018
4647
|
function orderOps(op1, op2) {
|
|
@@ -5030,10 +4659,10 @@ function splitStringAtPoints(str, points) {
|
|
|
5030
4659
|
return splits;
|
|
5031
4660
|
}
|
|
5032
4661
|
|
|
5033
|
-
// bazel-out/
|
|
4662
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
5034
4663
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
5035
4664
|
|
|
5036
|
-
// bazel-out/
|
|
4665
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/line_mappings.mjs
|
|
5037
4666
|
var LF_CHAR = 10;
|
|
5038
4667
|
var CR_CHAR = 13;
|
|
5039
4668
|
var LINE_SEP_CHAR = 8232;
|
|
@@ -5074,7 +4703,7 @@ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesM
|
|
|
5074
4703
|
return low - 1;
|
|
5075
4704
|
}
|
|
5076
4705
|
|
|
5077
|
-
// bazel-out/
|
|
4706
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
5078
4707
|
var TemplateSource = class {
|
|
5079
4708
|
constructor(mapping, file) {
|
|
5080
4709
|
this.mapping = mapping;
|
|
@@ -5100,7 +4729,7 @@ var TemplateSource = class {
|
|
|
5100
4729
|
};
|
|
5101
4730
|
var TemplateSourceManager = class {
|
|
5102
4731
|
constructor() {
|
|
5103
|
-
this.templateSources = new Map();
|
|
4732
|
+
this.templateSources = /* @__PURE__ */ new Map();
|
|
5104
4733
|
}
|
|
5105
4734
|
getTemplateId(node) {
|
|
5106
4735
|
return getTemplateId(node);
|
|
@@ -5125,9 +4754,9 @@ var TemplateSourceManager = class {
|
|
|
5125
4754
|
}
|
|
5126
4755
|
};
|
|
5127
4756
|
|
|
5128
|
-
// bazel-out/
|
|
5129
|
-
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as
|
|
5130
|
-
import
|
|
4757
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4758
|
+
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, PropertyWrite as PropertyWrite4, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
4759
|
+
import ts27 from "typescript";
|
|
5131
4760
|
var SymbolBuilder = class {
|
|
5132
4761
|
constructor(shimPath, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
5133
4762
|
this.shimPath = shimPath;
|
|
@@ -5135,7 +4764,7 @@ var SymbolBuilder = class {
|
|
|
5135
4764
|
this.templateData = templateData;
|
|
5136
4765
|
this.componentScopeReader = componentScopeReader;
|
|
5137
4766
|
this.getTypeChecker = getTypeChecker;
|
|
5138
|
-
this.symbolCache = new Map();
|
|
4767
|
+
this.symbolCache = /* @__PURE__ */ new Map();
|
|
5139
4768
|
}
|
|
5140
4769
|
getSymbol(node) {
|
|
5141
4770
|
if (this.symbolCache.has(node)) {
|
|
@@ -5170,7 +4799,7 @@ var SymbolBuilder = class {
|
|
|
5170
4799
|
getSymbolOfElement(element) {
|
|
5171
4800
|
var _a;
|
|
5172
4801
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5173
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4802
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts27.isVariableDeclaration });
|
|
5174
4803
|
if (node === null) {
|
|
5175
4804
|
return null;
|
|
5176
4805
|
}
|
|
@@ -5189,12 +4818,12 @@ var SymbolBuilder = class {
|
|
|
5189
4818
|
var _a;
|
|
5190
4819
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5191
4820
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
5192
|
-
const isDirectiveDeclaration = (node) => (
|
|
4821
|
+
const isDirectiveDeclaration = (node) => (ts27.isTypeNode(node) || ts27.isIdentifier(node)) && ts27.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
5193
4822
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
5194
4823
|
return nodes.map((node) => {
|
|
5195
4824
|
var _a2;
|
|
5196
4825
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
5197
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4826
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5198
4827
|
return null;
|
|
5199
4828
|
}
|
|
5200
4829
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -5263,17 +4892,17 @@ var SymbolBuilder = class {
|
|
|
5263
4892
|
if (!isAccessExpression(n)) {
|
|
5264
4893
|
return false;
|
|
5265
4894
|
}
|
|
5266
|
-
if (
|
|
4895
|
+
if (ts27.isPropertyAccessExpression(n)) {
|
|
5267
4896
|
return n.name.getText() === expectedAccess;
|
|
5268
4897
|
} else {
|
|
5269
|
-
return
|
|
4898
|
+
return ts27.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
5270
4899
|
}
|
|
5271
4900
|
}
|
|
5272
4901
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
5273
4902
|
const bindings = [];
|
|
5274
4903
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
5275
4904
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
5276
|
-
if (!
|
|
4905
|
+
if (!ts27.isPropertyAccessExpression(outputFieldAccess)) {
|
|
5277
4906
|
continue;
|
|
5278
4907
|
}
|
|
5279
4908
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -5292,7 +4921,7 @@ var SymbolBuilder = class {
|
|
|
5292
4921
|
shimLocation: { shimPath: this.shimPath, positionInShimFile }
|
|
5293
4922
|
});
|
|
5294
4923
|
} else {
|
|
5295
|
-
if (!
|
|
4924
|
+
if (!ts27.isElementAccessExpression(outputFieldAccess)) {
|
|
5296
4925
|
continue;
|
|
5297
4926
|
}
|
|
5298
4927
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -5360,11 +4989,11 @@ var SymbolBuilder = class {
|
|
|
5360
4989
|
return null;
|
|
5361
4990
|
}
|
|
5362
4991
|
const [declaration] = tsSymbol.declarations;
|
|
5363
|
-
if (!
|
|
4992
|
+
if (!ts27.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
5364
4993
|
return null;
|
|
5365
4994
|
}
|
|
5366
4995
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5367
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4996
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5368
4997
|
return null;
|
|
5369
4998
|
}
|
|
5370
4999
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5380,7 +5009,7 @@ var SymbolBuilder = class {
|
|
|
5380
5009
|
};
|
|
5381
5010
|
}
|
|
5382
5011
|
getSymbolOfVariable(variable) {
|
|
5383
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5012
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5384
5013
|
if (node === null || node.initializer === void 0) {
|
|
5385
5014
|
return null;
|
|
5386
5015
|
}
|
|
@@ -5402,11 +5031,11 @@ var SymbolBuilder = class {
|
|
|
5402
5031
|
}
|
|
5403
5032
|
getSymbolOfReference(ref) {
|
|
5404
5033
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5405
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5034
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5406
5035
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5407
5036
|
return null;
|
|
5408
5037
|
}
|
|
5409
|
-
const originalDeclaration =
|
|
5038
|
+
const originalDeclaration = ts27.isParenthesizedExpression(node.initializer) && ts27.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5410
5039
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5411
5040
|
return null;
|
|
5412
5041
|
}
|
|
@@ -5429,7 +5058,7 @@ var SymbolBuilder = class {
|
|
|
5429
5058
|
referenceVarLocation: referenceVarShimLocation
|
|
5430
5059
|
};
|
|
5431
5060
|
} else {
|
|
5432
|
-
if (!
|
|
5061
|
+
if (!ts27.isClassDeclaration(target.directive.ref.node)) {
|
|
5433
5062
|
return null;
|
|
5434
5063
|
}
|
|
5435
5064
|
return {
|
|
@@ -5444,7 +5073,7 @@ var SymbolBuilder = class {
|
|
|
5444
5073
|
}
|
|
5445
5074
|
}
|
|
5446
5075
|
getSymbolOfPipe(expression) {
|
|
5447
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5076
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts27.isPropertyAccessExpression });
|
|
5448
5077
|
if (methodAccess === null) {
|
|
5449
5078
|
return null;
|
|
5450
5079
|
}
|
|
@@ -5478,12 +5107,12 @@ var SymbolBuilder = class {
|
|
|
5478
5107
|
return this.getSymbol(expressionTarget);
|
|
5479
5108
|
}
|
|
5480
5109
|
let withSpan = expression.sourceSpan;
|
|
5481
|
-
if (expression instanceof
|
|
5110
|
+
if (expression instanceof PropertyWrite4) {
|
|
5482
5111
|
withSpan = expression.nameSpan;
|
|
5483
5112
|
}
|
|
5484
5113
|
let node = null;
|
|
5485
|
-
if (expression instanceof
|
|
5486
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5114
|
+
if (expression instanceof PropertyRead5) {
|
|
5115
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts27.isPropertyAccessExpression });
|
|
5487
5116
|
}
|
|
5488
5117
|
if (node === null) {
|
|
5489
5118
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5491,10 +5120,10 @@ var SymbolBuilder = class {
|
|
|
5491
5120
|
if (node === null) {
|
|
5492
5121
|
return null;
|
|
5493
5122
|
}
|
|
5494
|
-
while (
|
|
5123
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5495
5124
|
node = node.expression;
|
|
5496
5125
|
}
|
|
5497
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5126
|
+
if (expression instanceof SafePropertyRead4 && ts27.isConditionalExpression(node)) {
|
|
5498
5127
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5499
5128
|
if (whenTrueSymbol === null) {
|
|
5500
5129
|
return null;
|
|
@@ -5510,13 +5139,13 @@ var SymbolBuilder = class {
|
|
|
5510
5139
|
}
|
|
5511
5140
|
getSymbolOfTsNode(node) {
|
|
5512
5141
|
var _a;
|
|
5513
|
-
while (
|
|
5142
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5514
5143
|
node = node.expression;
|
|
5515
5144
|
}
|
|
5516
5145
|
let tsSymbol;
|
|
5517
|
-
if (
|
|
5146
|
+
if (ts27.isPropertyAccessExpression(node)) {
|
|
5518
5147
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5519
|
-
} else if (
|
|
5148
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5520
5149
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5521
5150
|
} else {
|
|
5522
5151
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -5530,13 +5159,13 @@ var SymbolBuilder = class {
|
|
|
5530
5159
|
};
|
|
5531
5160
|
}
|
|
5532
5161
|
getShimPositionForNode(node) {
|
|
5533
|
-
if (
|
|
5162
|
+
if (ts27.isTypeReferenceNode(node)) {
|
|
5534
5163
|
return this.getShimPositionForNode(node.typeName);
|
|
5535
|
-
} else if (
|
|
5164
|
+
} else if (ts27.isQualifiedName(node)) {
|
|
5536
5165
|
return node.right.getStart();
|
|
5537
|
-
} else if (
|
|
5166
|
+
} else if (ts27.isPropertyAccessExpression(node)) {
|
|
5538
5167
|
return node.name.getStart();
|
|
5539
|
-
} else if (
|
|
5168
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5540
5169
|
return node.argumentExpression.getStart();
|
|
5541
5170
|
} else {
|
|
5542
5171
|
return node.getStart();
|
|
@@ -5550,7 +5179,7 @@ function sourceSpanEqual(a, b) {
|
|
|
5550
5179
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
5551
5180
|
}
|
|
5552
5181
|
|
|
5553
|
-
// bazel-out/
|
|
5182
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
5554
5183
|
var REGISTRY2 = new DomElementSchemaRegistry2();
|
|
5555
5184
|
var TemplateTypeCheckerImpl = class {
|
|
5556
5185
|
constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, componentScopeReader, typeCheckScopeRegistry, perf) {
|
|
@@ -5565,11 +5194,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5565
5194
|
this.componentScopeReader = componentScopeReader;
|
|
5566
5195
|
this.typeCheckScopeRegistry = typeCheckScopeRegistry;
|
|
5567
5196
|
this.perf = perf;
|
|
5568
|
-
this.state = new Map();
|
|
5569
|
-
this.completionCache = new Map();
|
|
5570
|
-
this.symbolBuilderCache = new Map();
|
|
5571
|
-
this.scopeCache = new Map();
|
|
5572
|
-
this.elementTagCache = new Map();
|
|
5197
|
+
this.state = /* @__PURE__ */ new Map();
|
|
5198
|
+
this.completionCache = /* @__PURE__ */ new Map();
|
|
5199
|
+
this.symbolBuilderCache = /* @__PURE__ */ new Map();
|
|
5200
|
+
this.scopeCache = /* @__PURE__ */ new Map();
|
|
5201
|
+
this.elementTagCache = /* @__PURE__ */ new Map();
|
|
5573
5202
|
this.isComplete = false;
|
|
5574
5203
|
}
|
|
5575
5204
|
getTemplate(component) {
|
|
@@ -5852,7 +5481,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5852
5481
|
hasInlines: false,
|
|
5853
5482
|
sourceManager: new TemplateSourceManager(),
|
|
5854
5483
|
isComplete: false,
|
|
5855
|
-
shimData: new Map()
|
|
5484
|
+
shimData: /* @__PURE__ */ new Map()
|
|
5856
5485
|
});
|
|
5857
5486
|
}
|
|
5858
5487
|
return this.state.get(path2);
|
|
@@ -5900,7 +5529,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5900
5529
|
if (this.elementTagCache.has(component)) {
|
|
5901
5530
|
return this.elementTagCache.get(component);
|
|
5902
5531
|
}
|
|
5903
|
-
const tagMap = new Map();
|
|
5532
|
+
const tagMap = /* @__PURE__ */ new Map();
|
|
5904
5533
|
for (const tag of REGISTRY2.allKnownElementNames()) {
|
|
5905
5534
|
tagMap.set(tag, null);
|
|
5906
5535
|
}
|
|
@@ -6066,30 +5695,10 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
6066
5695
|
}
|
|
6067
5696
|
};
|
|
6068
5697
|
|
|
6069
|
-
// bazel-out/
|
|
6070
|
-
var ExtendedTemplateCheckerImpl = class {
|
|
6071
|
-
constructor(templateTypeChecker, typeChecker, templateChecks) {
|
|
6072
|
-
this.templateChecks = templateChecks;
|
|
6073
|
-
this.ctx = { templateTypeChecker, typeChecker };
|
|
6074
|
-
}
|
|
6075
|
-
getDiagnosticsForComponent(component) {
|
|
6076
|
-
const template = this.ctx.templateTypeChecker.getTemplate(component);
|
|
6077
|
-
if (template === null) {
|
|
6078
|
-
return [];
|
|
6079
|
-
}
|
|
6080
|
-
const diagnostics = [];
|
|
6081
|
-
for (const check of this.templateChecks) {
|
|
6082
|
-
diagnostics.push(...check.run(this.ctx, component, template));
|
|
6083
|
-
}
|
|
6084
|
-
return diagnostics;
|
|
6085
|
-
}
|
|
6086
|
-
};
|
|
6087
|
-
|
|
6088
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
5698
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6089
5699
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
6090
|
-
import ts31 from "typescript";
|
|
6091
5700
|
|
|
6092
|
-
// bazel-out/
|
|
5701
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
6093
5702
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
6094
5703
|
var TemplateCheckWithVisitor = class {
|
|
6095
5704
|
run(ctx, component, template) {
|
|
@@ -6166,7 +5775,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6166
5775
|
}
|
|
6167
5776
|
};
|
|
6168
5777
|
|
|
6169
|
-
// bazel-out/
|
|
5778
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6170
5779
|
var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
6171
5780
|
constructor() {
|
|
6172
5781
|
super(...arguments);
|
|
@@ -6180,15 +5789,19 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
6180
5789
|
return [];
|
|
6181
5790
|
const boundSyntax = node.sourceSpan.toString();
|
|
6182
5791
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
6183
|
-
const diagnostic = ctx.
|
|
5792
|
+
const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'.
|
|
6184
5793
|
Find more at https://angular.io/guide/two-way-binding`);
|
|
6185
5794
|
return [diagnostic];
|
|
6186
5795
|
}
|
|
6187
5796
|
};
|
|
5797
|
+
var factory = {
|
|
5798
|
+
code: ErrorCode.INVALID_BANANA_IN_BOX,
|
|
5799
|
+
name: ExtendedTemplateDiagnosticName.INVALID_BANANA_IN_BOX,
|
|
5800
|
+
create: () => new InvalidBananaInBoxCheck()
|
|
5801
|
+
};
|
|
6188
5802
|
|
|
6189
|
-
// bazel-out/
|
|
5803
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
6190
5804
|
import { Binary } from "@angular/compiler";
|
|
6191
|
-
import ts32 from "typescript";
|
|
6192
5805
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6193
5806
|
constructor() {
|
|
6194
5807
|
super(...arguments);
|
|
@@ -6209,12 +5822,91 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6209
5822
|
return [];
|
|
6210
5823
|
}
|
|
6211
5824
|
const span = ctx.templateTypeChecker.getTemplateMappingAtShimLocation(symbol.shimLocation).span;
|
|
6212
|
-
const diagnostic = ctx.
|
|
5825
|
+
const diagnostic = ctx.makeTemplateDiagnostic(span, `The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.`);
|
|
6213
5826
|
return [diagnostic];
|
|
6214
5827
|
}
|
|
6215
5828
|
};
|
|
5829
|
+
var factory2 = {
|
|
5830
|
+
code: ErrorCode.NULLISH_COALESCING_NOT_NULLABLE,
|
|
5831
|
+
name: ExtendedTemplateDiagnosticName.NULLISH_COALESCING_NOT_NULLABLE,
|
|
5832
|
+
create: (options) => {
|
|
5833
|
+
if (options.strictNullChecks === false) {
|
|
5834
|
+
return null;
|
|
5835
|
+
}
|
|
5836
|
+
return new NullishCoalescingNotNullableCheck();
|
|
5837
|
+
}
|
|
5838
|
+
};
|
|
6216
5839
|
|
|
6217
|
-
// bazel-out/
|
|
5840
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5841
|
+
import ts28 from "typescript";
|
|
5842
|
+
|
|
5843
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
5844
|
+
var DiagnosticCategoryLabel;
|
|
5845
|
+
(function(DiagnosticCategoryLabel2) {
|
|
5846
|
+
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
5847
|
+
DiagnosticCategoryLabel2["Error"] = "error";
|
|
5848
|
+
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
5849
|
+
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
5850
|
+
|
|
5851
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5852
|
+
var ExtendedTemplateCheckerImpl = class {
|
|
5853
|
+
constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
|
|
5854
|
+
var _a, _b, _c, _d, _e;
|
|
5855
|
+
this.partialCtx = { templateTypeChecker, typeChecker };
|
|
5856
|
+
this.templateChecks = /* @__PURE__ */ new Map();
|
|
5857
|
+
for (const factory3 of templateCheckFactories) {
|
|
5858
|
+
const category = diagnosticLabelToCategory((_e = (_d = (_b = (_a = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _a.checks) == null ? void 0 : _b[factory3.name]) != null ? _d : (_c = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _c.defaultCategory) != null ? _e : DiagnosticCategoryLabel.Warning);
|
|
5859
|
+
if (category === null) {
|
|
5860
|
+
continue;
|
|
5861
|
+
}
|
|
5862
|
+
const check = factory3.create(options);
|
|
5863
|
+
if (check === null) {
|
|
5864
|
+
continue;
|
|
5865
|
+
}
|
|
5866
|
+
this.templateChecks.set(check, category);
|
|
5867
|
+
}
|
|
5868
|
+
}
|
|
5869
|
+
getDiagnosticsForComponent(component) {
|
|
5870
|
+
const template = this.partialCtx.templateTypeChecker.getTemplate(component);
|
|
5871
|
+
if (template === null) {
|
|
5872
|
+
return [];
|
|
5873
|
+
}
|
|
5874
|
+
const diagnostics = [];
|
|
5875
|
+
for (const [check, category] of this.templateChecks.entries()) {
|
|
5876
|
+
const ctx = __spreadProps(__spreadValues({}, this.partialCtx), {
|
|
5877
|
+
makeTemplateDiagnostic: (span, message, relatedInformation) => {
|
|
5878
|
+
return this.partialCtx.templateTypeChecker.makeTemplateDiagnostic(component, span, category, check.code, message, relatedInformation);
|
|
5879
|
+
}
|
|
5880
|
+
});
|
|
5881
|
+
diagnostics.push(...check.run(ctx, component, template));
|
|
5882
|
+
}
|
|
5883
|
+
return diagnostics;
|
|
5884
|
+
}
|
|
5885
|
+
};
|
|
5886
|
+
function diagnosticLabelToCategory(label) {
|
|
5887
|
+
switch (label) {
|
|
5888
|
+
case DiagnosticCategoryLabel.Warning:
|
|
5889
|
+
return ts28.DiagnosticCategory.Warning;
|
|
5890
|
+
case DiagnosticCategoryLabel.Error:
|
|
5891
|
+
return ts28.DiagnosticCategory.Error;
|
|
5892
|
+
case DiagnosticCategoryLabel.Suppress:
|
|
5893
|
+
return null;
|
|
5894
|
+
default:
|
|
5895
|
+
return assertNever(label);
|
|
5896
|
+
}
|
|
5897
|
+
}
|
|
5898
|
+
function assertNever(value) {
|
|
5899
|
+
throw new Error(`Unexpected call to 'assertNever()' with value:
|
|
5900
|
+
${value}`);
|
|
5901
|
+
}
|
|
5902
|
+
|
|
5903
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.mjs
|
|
5904
|
+
var ALL_DIAGNOSTIC_FACTORIES = [
|
|
5905
|
+
factory,
|
|
5906
|
+
factory2
|
|
5907
|
+
];
|
|
5908
|
+
|
|
5909
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
6218
5910
|
var CompilationTicketKind;
|
|
6219
5911
|
(function(CompilationTicketKind2) {
|
|
6220
5912
|
CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -6290,15 +5982,11 @@ var NgCompiler = class {
|
|
|
6290
5982
|
if (this.options._extendedTemplateDiagnostics === true && this.options.strictTemplates === false) {
|
|
6291
5983
|
throw new Error("The '_extendedTemplateDiagnostics' option requires 'strictTemplates' to also be enabled.");
|
|
6292
5984
|
}
|
|
6293
|
-
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics);
|
|
6294
|
-
const incompatibleTypeCheckOptionsDiagnostic = verifyCompatibleTypeCheckOptions(this.options);
|
|
6295
|
-
if (incompatibleTypeCheckOptionsDiagnostic !== null) {
|
|
6296
|
-
this.constructionDiagnostics.push(incompatibleTypeCheckOptionsDiagnostic);
|
|
6297
|
-
}
|
|
5985
|
+
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
|
|
6298
5986
|
this.currentProgram = inputProgram;
|
|
6299
5987
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6300
5988
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6301
|
-
const moduleResolutionCache =
|
|
5989
|
+
const moduleResolutionCache = ts29.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
6302
5990
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
6303
5991
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
6304
5992
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -6343,7 +6031,7 @@ var NgCompiler = class {
|
|
|
6343
6031
|
return;
|
|
6344
6032
|
}
|
|
6345
6033
|
this.resourceManager.invalidate();
|
|
6346
|
-
const classesToUpdate = new Set();
|
|
6034
|
+
const classesToUpdate = /* @__PURE__ */ new Set();
|
|
6347
6035
|
for (const resourceFile of changedResources) {
|
|
6348
6036
|
for (const templateClass of this.getComponentsWithTemplateFile(resourceFile)) {
|
|
6349
6037
|
classesToUpdate.add(templateClass);
|
|
@@ -6354,7 +6042,7 @@ var NgCompiler = class {
|
|
|
6354
6042
|
}
|
|
6355
6043
|
for (const clazz of classesToUpdate) {
|
|
6356
6044
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6357
|
-
if (!
|
|
6045
|
+
if (!ts29.isClassDeclaration(clazz)) {
|
|
6358
6046
|
continue;
|
|
6359
6047
|
}
|
|
6360
6048
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6735,11 +6423,7 @@ var NgCompiler = class {
|
|
|
6735
6423
|
this.currentProgram = program;
|
|
6736
6424
|
});
|
|
6737
6425
|
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, scopeRegistry, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
6738
|
-
const
|
|
6739
|
-
if (this.options.strictNullChecks) {
|
|
6740
|
-
templateChecks.push(new NullishCoalescingNotNullableCheck());
|
|
6741
|
-
}
|
|
6742
|
-
const extendedTemplateChecker = new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, templateChecks);
|
|
6426
|
+
const extendedTemplateChecker = new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options);
|
|
6743
6427
|
return {
|
|
6744
6428
|
isCore,
|
|
6745
6429
|
traitCompiler,
|
|
@@ -6763,17 +6447,17 @@ function isAngularCorePackage(program) {
|
|
|
6763
6447
|
return false;
|
|
6764
6448
|
}
|
|
6765
6449
|
return r3Symbols.statements.some((stmt) => {
|
|
6766
|
-
if (!
|
|
6450
|
+
if (!ts29.isVariableStatement(stmt)) {
|
|
6767
6451
|
return false;
|
|
6768
6452
|
}
|
|
6769
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
6453
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts29.SyntaxKind.ExportKeyword)) {
|
|
6770
6454
|
return false;
|
|
6771
6455
|
}
|
|
6772
6456
|
return stmt.declarationList.declarations.some((decl) => {
|
|
6773
|
-
if (!
|
|
6457
|
+
if (!ts29.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
6774
6458
|
return false;
|
|
6775
6459
|
}
|
|
6776
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
6460
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts29.SyntaxKind.TrueKeyword) {
|
|
6777
6461
|
return false;
|
|
6778
6462
|
}
|
|
6779
6463
|
return true;
|
|
@@ -6783,15 +6467,14 @@ function isAngularCorePackage(program) {
|
|
|
6783
6467
|
function getR3SymbolsFile(program) {
|
|
6784
6468
|
return program.getSourceFiles().find((file) => file.fileName.indexOf("r3_symbols.ts") >= 0) || null;
|
|
6785
6469
|
}
|
|
6786
|
-
function verifyCompatibleTypeCheckOptions(options) {
|
|
6470
|
+
function* verifyCompatibleTypeCheckOptions(options) {
|
|
6471
|
+
var _a, _b, _c;
|
|
6787
6472
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
6788
|
-
|
|
6789
|
-
category:
|
|
6790
|
-
code:
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
length: void 0,
|
|
6794
|
-
messageText: `Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
6473
|
+
yield makeConfigDiagnostic({
|
|
6474
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6475
|
+
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
6476
|
+
messageText: `
|
|
6477
|
+
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
6795
6478
|
|
|
6796
6479
|
Having the "strictTemplates" flag enabled implies that "fullTemplateTypeCheck" is also enabled, so
|
|
6797
6480
|
the latter can not be explicitly disabled.
|
|
@@ -6801,10 +6484,76 @@ One of the following actions is required:
|
|
|
6801
6484
|
2. Remove "strictTemplates" or set it to 'false'.
|
|
6802
6485
|
|
|
6803
6486
|
More information about the template type checking compiler options can be found in the documentation:
|
|
6804
|
-
https://
|
|
6805
|
-
|
|
6487
|
+
https://angular.io/guide/template-typecheck
|
|
6488
|
+
`.trim()
|
|
6489
|
+
});
|
|
6806
6490
|
}
|
|
6807
|
-
|
|
6491
|
+
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
6492
|
+
yield makeConfigDiagnostic({
|
|
6493
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6494
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
6495
|
+
messageText: `
|
|
6496
|
+
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
6497
|
+
|
|
6498
|
+
Using "extendedDiagnostics" requires that "strictTemplates" is also enabled.
|
|
6499
|
+
|
|
6500
|
+
One of the following actions is required:
|
|
6501
|
+
1. Remove "strictTemplates: false" to enable it.
|
|
6502
|
+
2. Remove "extendedDiagnostics" configuration to disable them.
|
|
6503
|
+
`.trim()
|
|
6504
|
+
});
|
|
6505
|
+
}
|
|
6506
|
+
const allowedCategoryLabels = Array.from(Object.values(DiagnosticCategoryLabel));
|
|
6507
|
+
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
6508
|
+
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
6509
|
+
yield makeConfigDiagnostic({
|
|
6510
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6511
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6512
|
+
messageText: `
|
|
6513
|
+
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
6514
|
+
|
|
6515
|
+
Allowed diagnostic categories are:
|
|
6516
|
+
${allowedCategoryLabels.join("\n")}
|
|
6517
|
+
`.trim()
|
|
6518
|
+
});
|
|
6519
|
+
}
|
|
6520
|
+
const allExtendedDiagnosticNames = ALL_DIAGNOSTIC_FACTORIES.map((factory3) => factory3.name);
|
|
6521
|
+
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
6522
|
+
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
6523
|
+
yield makeConfigDiagnostic({
|
|
6524
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6525
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
6526
|
+
messageText: `
|
|
6527
|
+
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
6528
|
+
|
|
6529
|
+
Allowed check names are:
|
|
6530
|
+
${allExtendedDiagnosticNames.join("\n")}
|
|
6531
|
+
`.trim()
|
|
6532
|
+
});
|
|
6533
|
+
}
|
|
6534
|
+
if (!allowedCategoryLabels.includes(category)) {
|
|
6535
|
+
yield makeConfigDiagnostic({
|
|
6536
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6537
|
+
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6538
|
+
messageText: `
|
|
6539
|
+
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
6540
|
+
|
|
6541
|
+
Allowed diagnostic categories are:
|
|
6542
|
+
${allowedCategoryLabels.join("\n")}
|
|
6543
|
+
`.trim()
|
|
6544
|
+
});
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
function makeConfigDiagnostic({ category, code, messageText }) {
|
|
6549
|
+
return {
|
|
6550
|
+
category,
|
|
6551
|
+
code: ngErrorCode(code),
|
|
6552
|
+
file: void 0,
|
|
6553
|
+
start: void 0,
|
|
6554
|
+
length: void 0,
|
|
6555
|
+
messageText
|
|
6556
|
+
};
|
|
6808
6557
|
}
|
|
6809
6558
|
var ReferenceGraphAdapter = class {
|
|
6810
6559
|
constructor(graph) {
|
|
@@ -6814,7 +6563,7 @@ var ReferenceGraphAdapter = class {
|
|
|
6814
6563
|
for (const { node } of references) {
|
|
6815
6564
|
let sourceFile = node.getSourceFile();
|
|
6816
6565
|
if (sourceFile === void 0) {
|
|
6817
|
-
sourceFile =
|
|
6566
|
+
sourceFile = ts29.getOriginalNode(node).getSourceFile();
|
|
6818
6567
|
}
|
|
6819
6568
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
6820
6569
|
this.graph.add(source, node);
|
|
@@ -6844,7 +6593,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
6844
6593
|
if (driver.getSourceFileVersion === void 0) {
|
|
6845
6594
|
return null;
|
|
6846
6595
|
}
|
|
6847
|
-
const versions = new Map();
|
|
6596
|
+
const versions = /* @__PURE__ */ new Map();
|
|
6848
6597
|
for (const possiblyRedirectedSourceFile of program.getSourceFiles()) {
|
|
6849
6598
|
const sf = toUnredirectedSourceFile(possiblyRedirectedSourceFile);
|
|
6850
6599
|
versions.set(absoluteFromSourceFile(sf), driver.getSourceFileVersion(sf));
|
|
@@ -6852,8 +6601,8 @@ function versionMapFromProgram(program, driver) {
|
|
|
6852
6601
|
return versions;
|
|
6853
6602
|
}
|
|
6854
6603
|
|
|
6855
|
-
// bazel-out/
|
|
6856
|
-
import
|
|
6604
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
6605
|
+
import ts30 from "typescript";
|
|
6857
6606
|
var DelegatingCompilerHost2 = class {
|
|
6858
6607
|
constructor(delegate) {
|
|
6859
6608
|
this.delegate = delegate;
|
|
@@ -6943,7 +6692,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6943
6692
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
6944
6693
|
if (entryPoint === null) {
|
|
6945
6694
|
diagnostics.push({
|
|
6946
|
-
category:
|
|
6695
|
+
category: ts30.DiagnosticCategory.Error,
|
|
6947
6696
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
6948
6697
|
file: void 0,
|
|
6949
6698
|
start: void 0,
|
|
@@ -6983,17 +6732,17 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6983
6732
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
6984
6733
|
}
|
|
6985
6734
|
createCachedResolveModuleNamesFunction() {
|
|
6986
|
-
const moduleResolutionCache =
|
|
6735
|
+
const moduleResolutionCache = ts30.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
6987
6736
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
6988
6737
|
return moduleNames.map((moduleName) => {
|
|
6989
|
-
const module =
|
|
6738
|
+
const module = ts30.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
6990
6739
|
return module.resolvedModule;
|
|
6991
6740
|
});
|
|
6992
6741
|
};
|
|
6993
6742
|
}
|
|
6994
6743
|
};
|
|
6995
6744
|
|
|
6996
|
-
// bazel-out/
|
|
6745
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
6997
6746
|
var NgtscProgram = class {
|
|
6998
6747
|
constructor(rootNames, options, delegateHost, oldProgram) {
|
|
6999
6748
|
this.options = options;
|
|
@@ -7007,14 +6756,14 @@ var NgtscProgram = class {
|
|
|
7007
6756
|
if (reuseProgram !== void 0) {
|
|
7008
6757
|
retagAllTsFiles(reuseProgram);
|
|
7009
6758
|
}
|
|
7010
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
6759
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts31.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
7011
6760
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
7012
6761
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
7013
6762
|
this.host.postProgramCreationCleanup();
|
|
7014
6763
|
untagAllTsFiles(this.tsProgram);
|
|
7015
6764
|
const programDriver = new TsCreateProgramDriver(this.tsProgram, this.host, this.options, this.host.shimExtensionPrefixes);
|
|
7016
6765
|
this.incrementalStrategy = oldProgram !== void 0 ? oldProgram.incrementalStrategy.toNextBuildStrategy() : new TrackedIncrementalBuildStrategy();
|
|
7017
|
-
const modifiedResourceFiles = new Set();
|
|
6766
|
+
const modifiedResourceFiles = /* @__PURE__ */ new Set();
|
|
7018
6767
|
if (this.host.getModifiedResourceFiles !== void 0) {
|
|
7019
6768
|
const strings = this.host.getModifiedResourceFiles();
|
|
7020
6769
|
if (strings !== void 0) {
|
|
@@ -7183,12 +6932,6 @@ var NgtscProgram = class {
|
|
|
7183
6932
|
getIndexedComponents() {
|
|
7184
6933
|
return this.compiler.getIndexedComponents();
|
|
7185
6934
|
}
|
|
7186
|
-
getLibrarySummaries() {
|
|
7187
|
-
throw new Error("Method not implemented.");
|
|
7188
|
-
}
|
|
7189
|
-
getEmittedGeneratedFiles() {
|
|
7190
|
-
throw new Error("Method not implemented.");
|
|
7191
|
-
}
|
|
7192
6935
|
getEmittedSourceFiles() {
|
|
7193
6936
|
throw new Error("Method not implemented.");
|
|
7194
6937
|
}
|
|
@@ -7206,116 +6949,38 @@ function mergeEmitResults(emitResults) {
|
|
|
7206
6949
|
return { diagnostics, emitSkipped, emittedFiles };
|
|
7207
6950
|
}
|
|
7208
6951
|
|
|
7209
|
-
// bazel-out/
|
|
7210
|
-
var VE_DISABLED_MESSAGE = `
|
|
7211
|
-
This compilation is using the View Engine compiler which is no longer supported by the Angular team
|
|
7212
|
-
and is being removed. Please upgrade to the Ivy compiler by switching to \`NgtscProgram\`. See
|
|
7213
|
-
https://angular.io/guide/ivy for more information.
|
|
7214
|
-
`.trim().split("\n").join(" ");
|
|
6952
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
7215
6953
|
function createProgram({ rootNames, options, host, oldProgram }) {
|
|
7216
|
-
|
|
7217
|
-
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
7218
|
-
} else {
|
|
7219
|
-
throw new Error(VE_DISABLED_MESSAGE);
|
|
7220
|
-
}
|
|
6954
|
+
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
7221
6955
|
}
|
|
7222
6956
|
|
|
7223
|
-
// bazel-out/
|
|
7224
|
-
import
|
|
6957
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
6958
|
+
import ts33 from "typescript";
|
|
6959
|
+
|
|
6960
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
6961
|
+
import ts32 from "typescript";
|
|
7225
6962
|
var GENERATED_FILES = /(.*?)\.(ngfactory|shim\.ngstyle|ngstyle|ngsummary)\.(js|d\.ts|ts)$/;
|
|
7226
6963
|
function createMessageDiagnostic(messageText) {
|
|
7227
6964
|
return {
|
|
7228
6965
|
file: void 0,
|
|
7229
6966
|
start: void 0,
|
|
7230
6967
|
length: void 0,
|
|
7231
|
-
category:
|
|
6968
|
+
category: ts32.DiagnosticCategory.Message,
|
|
7232
6969
|
messageText,
|
|
7233
6970
|
code: DEFAULT_ERROR_CODE,
|
|
7234
6971
|
source: SOURCE
|
|
7235
6972
|
};
|
|
7236
6973
|
}
|
|
7237
|
-
function ngToTsDiagnostic(ng2) {
|
|
7238
|
-
let file;
|
|
7239
|
-
let start;
|
|
7240
|
-
let length;
|
|
7241
|
-
if (ng2.span) {
|
|
7242
|
-
file = { fileName: ng2.span.start.file.url, text: ng2.span.start.file.content };
|
|
7243
|
-
start = ng2.span.start.offset;
|
|
7244
|
-
length = ng2.span.end.offset - start;
|
|
7245
|
-
}
|
|
7246
|
-
return {
|
|
7247
|
-
file,
|
|
7248
|
-
messageText: ng2.messageText,
|
|
7249
|
-
category: ng2.category,
|
|
7250
|
-
code: ng2.code,
|
|
7251
|
-
start,
|
|
7252
|
-
length
|
|
7253
|
-
};
|
|
7254
|
-
}
|
|
7255
6974
|
|
|
7256
|
-
// bazel-out/
|
|
7257
|
-
import { isSyntaxError } from "@angular/compiler";
|
|
7258
|
-
import ts37 from "typescript";
|
|
6975
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7259
6976
|
var defaultFormatHost = {
|
|
7260
|
-
getCurrentDirectory: () =>
|
|
6977
|
+
getCurrentDirectory: () => ts33.sys.getCurrentDirectory(),
|
|
7261
6978
|
getCanonicalFileName: (fileName) => fileName,
|
|
7262
|
-
getNewLine: () =>
|
|
6979
|
+
getNewLine: () => ts33.sys.newLine
|
|
7263
6980
|
};
|
|
7264
|
-
function displayFileName(fileName, host) {
|
|
7265
|
-
return relative(resolve(host.getCurrentDirectory()), resolve(host.getCanonicalFileName(fileName)));
|
|
7266
|
-
}
|
|
7267
|
-
function formatDiagnosticPosition(position, host = defaultFormatHost) {
|
|
7268
|
-
return `${displayFileName(position.fileName, host)}(${position.line + 1},${position.column + 1})`;
|
|
7269
|
-
}
|
|
7270
|
-
function flattenDiagnosticMessageChain(chain, host = defaultFormatHost, indent = 0) {
|
|
7271
|
-
const newLine = host.getNewLine();
|
|
7272
|
-
let result = "";
|
|
7273
|
-
if (indent) {
|
|
7274
|
-
result += newLine;
|
|
7275
|
-
for (let i = 0; i < indent; i++) {
|
|
7276
|
-
result += " ";
|
|
7277
|
-
}
|
|
7278
|
-
}
|
|
7279
|
-
result += chain.messageText;
|
|
7280
|
-
const position = chain.position;
|
|
7281
|
-
if (position && indent !== 0) {
|
|
7282
|
-
result += ` at ${formatDiagnosticPosition(position, host)}`;
|
|
7283
|
-
}
|
|
7284
|
-
indent++;
|
|
7285
|
-
if (chain.next) {
|
|
7286
|
-
for (const kid of chain.next) {
|
|
7287
|
-
result += flattenDiagnosticMessageChain(kid, host, indent);
|
|
7288
|
-
}
|
|
7289
|
-
}
|
|
7290
|
-
return result;
|
|
7291
|
-
}
|
|
7292
|
-
function formatDiagnostic(diagnostic, host = defaultFormatHost) {
|
|
7293
|
-
let result = "";
|
|
7294
|
-
const newLine = host.getNewLine();
|
|
7295
|
-
const span = diagnostic.span;
|
|
7296
|
-
if (span) {
|
|
7297
|
-
result += `${formatDiagnosticPosition({ fileName: span.start.file.url, line: span.start.line, column: span.start.col }, host)}: `;
|
|
7298
|
-
} else if (diagnostic.position) {
|
|
7299
|
-
result += `${formatDiagnosticPosition(diagnostic.position, host)}: `;
|
|
7300
|
-
}
|
|
7301
|
-
if (diagnostic.span && diagnostic.span.details) {
|
|
7302
|
-
result += `${diagnostic.span.details}, ${diagnostic.messageText}${newLine}`;
|
|
7303
|
-
} else if (diagnostic.chain) {
|
|
7304
|
-
result += `${flattenDiagnosticMessageChain(diagnostic.chain, host)}.${newLine}`;
|
|
7305
|
-
} else {
|
|
7306
|
-
result += `${diagnostic.messageText}${newLine}`;
|
|
7307
|
-
}
|
|
7308
|
-
return result;
|
|
7309
|
-
}
|
|
7310
6981
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7311
6982
|
if (diags && diags.length) {
|
|
7312
|
-
return diags.map((diagnostic) =>
|
|
7313
|
-
if (isTsDiagnostic(diagnostic)) {
|
|
7314
|
-
return replaceTsWithNgInErrors(ts37.formatDiagnosticsWithColorAndContext([diagnostic], host));
|
|
7315
|
-
} else {
|
|
7316
|
-
return formatDiagnostic(diagnostic, host);
|
|
7317
|
-
}
|
|
7318
|
-
}).join("");
|
|
6983
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts33.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7319
6984
|
} else {
|
|
7320
6985
|
return "";
|
|
7321
6986
|
}
|
|
@@ -7332,7 +6997,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7332
6997
|
var _a;
|
|
7333
6998
|
try {
|
|
7334
6999
|
const fs = getFileSystem();
|
|
7335
|
-
const readConfigFile = (configFile) =>
|
|
7000
|
+
const readConfigFile = (configFile) => ts33.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7336
7001
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7337
7002
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7338
7003
|
if (error2) {
|
|
@@ -7364,7 +7029,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7364
7029
|
basePath
|
|
7365
7030
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
7366
7031
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7367
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
7032
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts33.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7368
7033
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
7369
7034
|
let emitFlags = EmitFlags.Default;
|
|
7370
7035
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -7376,7 +7041,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7376
7041
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7377
7042
|
} catch (e) {
|
|
7378
7043
|
const errors = [{
|
|
7379
|
-
category:
|
|
7044
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7380
7045
|
messageText: e.stack,
|
|
7381
7046
|
file: void 0,
|
|
7382
7047
|
start: void 0,
|
|
@@ -7390,7 +7055,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7390
7055
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7391
7056
|
return {
|
|
7392
7057
|
fileExists: host.exists.bind(host),
|
|
7393
|
-
readDirectory:
|
|
7058
|
+
readDirectory: ts33.sys.readDirectory,
|
|
7394
7059
|
readFile: host.readFile.bind(host),
|
|
7395
7060
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7396
7061
|
};
|
|
@@ -7410,7 +7075,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7410
7075
|
}
|
|
7411
7076
|
} else {
|
|
7412
7077
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7413
|
-
const { resolvedModule } =
|
|
7078
|
+
const { resolvedModule } = ts33.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts33.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
7414
7079
|
if (resolvedModule) {
|
|
7415
7080
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
7416
7081
|
}
|
|
@@ -7420,7 +7085,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7420
7085
|
function exitCodeFromResult(diags) {
|
|
7421
7086
|
if (!diags)
|
|
7422
7087
|
return 0;
|
|
7423
|
-
if (diags.every((diag) => diag.category !==
|
|
7088
|
+
if (diags.every((diag) => diag.category !== ts33.DiagnosticCategory.Error)) {
|
|
7424
7089
|
return 0;
|
|
7425
7090
|
}
|
|
7426
7091
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7450,17 +7115,15 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7450
7115
|
}
|
|
7451
7116
|
return { diagnostics: allDiagnostics, program };
|
|
7452
7117
|
} catch (e) {
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
code
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
}
|
|
7463
|
-
allDiagnostics.push({ category: ts37.DiagnosticCategory.Error, messageText: errMsg, code, source: SOURCE });
|
|
7118
|
+
program = void 0;
|
|
7119
|
+
allDiagnostics.push({
|
|
7120
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7121
|
+
messageText: e.stack,
|
|
7122
|
+
code: UNKNOWN_ERROR_CODE,
|
|
7123
|
+
file: void 0,
|
|
7124
|
+
start: void 0,
|
|
7125
|
+
length: void 0
|
|
7126
|
+
});
|
|
7464
7127
|
return { diagnostics: allDiagnostics, program };
|
|
7465
7128
|
}
|
|
7466
7129
|
}
|
|
@@ -7481,7 +7144,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7481
7144
|
return allDiagnostics;
|
|
7482
7145
|
}
|
|
7483
7146
|
function hasErrors(diags) {
|
|
7484
|
-
return diags.some((d) => d.category ===
|
|
7147
|
+
return diags.some((d) => d.category === ts33.DiagnosticCategory.Error);
|
|
7485
7148
|
}
|
|
7486
7149
|
|
|
7487
7150
|
export {
|
|
@@ -7489,12 +7152,10 @@ export {
|
|
|
7489
7152
|
UNKNOWN_ERROR_CODE,
|
|
7490
7153
|
SOURCE,
|
|
7491
7154
|
isTsDiagnostic,
|
|
7492
|
-
isNgDiagnostic,
|
|
7493
7155
|
EmitFlags,
|
|
7494
7156
|
createCompilerHost,
|
|
7495
7157
|
CycleAnalyzer,
|
|
7496
7158
|
ImportGraph,
|
|
7497
|
-
untagAllTsFiles,
|
|
7498
7159
|
TsCreateProgramDriver,
|
|
7499
7160
|
PatchedProgramIncrementalBuildStrategy,
|
|
7500
7161
|
MetadataDtsModuleScopeResolver,
|
|
@@ -7509,10 +7170,6 @@ export {
|
|
|
7509
7170
|
createProgram,
|
|
7510
7171
|
GENERATED_FILES,
|
|
7511
7172
|
createMessageDiagnostic,
|
|
7512
|
-
ngToTsDiagnostic,
|
|
7513
|
-
formatDiagnosticPosition,
|
|
7514
|
-
flattenDiagnosticMessageChain,
|
|
7515
|
-
formatDiagnostic,
|
|
7516
7173
|
formatDiagnostics,
|
|
7517
7174
|
calcProjectFileAndBasePath,
|
|
7518
7175
|
readConfiguration,
|
|
@@ -7527,5 +7184,4 @@ export {
|
|
|
7527
7184
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7528
7185
|
* found in the LICENSE file at https://angular.io/license
|
|
7529
7186
|
*/
|
|
7530
|
-
|
|
7531
|
-
//# sourceMappingURL=chunk-COAETSNP.js.map
|
|
7187
|
+
//# sourceMappingURL=chunk-CKZCKW5B.js.map
|