@angular/compiler-cli 14.0.0-next.9 → 14.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-LX5Q27EF.js → chunk-7J66ZDC5.js} +3 -3
- package/bundles/{chunk-LX5Q27EF.js.map → chunk-7J66ZDC5.js.map} +0 -0
- package/bundles/{chunk-W6KM7BUM.js → chunk-AKU7LV22.js} +6 -6
- package/bundles/{chunk-W6KM7BUM.js.map → chunk-AKU7LV22.js.map} +0 -0
- package/bundles/{chunk-WGBFSDVQ.js → chunk-BFPVXDJN.js} +7 -7
- package/bundles/{chunk-WGBFSDVQ.js.map → chunk-BFPVXDJN.js.map} +0 -0
- package/bundles/{chunk-SNAJD4VP.js → chunk-GGBQTGO6.js} +52 -41
- package/bundles/chunk-GGBQTGO6.js.map +6 -0
- package/bundles/{chunk-R3C7RFJ4.js → chunk-HMWNYAAE.js} +2 -2
- package/bundles/{chunk-R3C7RFJ4.js.map → chunk-HMWNYAAE.js.map} +0 -0
- package/bundles/{chunk-T7MYRXIE.js → chunk-MURZUYM7.js} +7 -7
- package/bundles/{chunk-T7MYRXIE.js.map → chunk-MURZUYM7.js.map} +0 -0
- package/bundles/{chunk-R4NY3TJC.js → chunk-QK4SXRQA.js} +5 -5
- package/bundles/{chunk-R4NY3TJC.js.map → chunk-QK4SXRQA.js.map} +0 -0
- package/bundles/{chunk-34QUU6SJ.js → chunk-RV5PLZZB.js} +130 -85
- package/bundles/chunk-RV5PLZZB.js.map +6 -0
- package/bundles/{chunk-UMDDHI5B.js → chunk-SFACRVMZ.js} +27 -26
- package/bundles/chunk-SFACRVMZ.js.map +6 -0
- package/bundles/{chunk-AGDZS4UG.js → chunk-SYV2KBTF.js} +5 -5
- package/bundles/{chunk-AGDZS4UG.js.map → chunk-SYV2KBTF.js.map} +0 -0
- package/bundles/{chunk-OLGEBPBY.js → chunk-U2VFXNL7.js} +4 -4
- package/bundles/{chunk-OLGEBPBY.js.map → chunk-U2VFXNL7.js.map} +0 -0
- package/bundles/{chunk-FJDIFR5C.js → chunk-VEAB5CR7.js} +97 -61
- package/bundles/chunk-VEAB5CR7.js.map +6 -0
- package/bundles/{chunk-M3IOYIU5.js → chunk-VLER5B3O.js} +1051 -982
- package/bundles/chunk-VLER5B3O.js.map +6 -0
- package/bundles/{chunk-GYVY4Y2L.js → chunk-VSZPIAX6.js} +1173 -881
- package/bundles/chunk-VSZPIAX6.js.map +6 -0
- package/bundles/{chunk-2IMT6JFI.js → chunk-ZJCM37WF.js} +6 -6
- package/bundles/{chunk-2IMT6JFI.js.map → chunk-ZJCM37WF.js.map} +0 -0
- package/bundles/index.js +13 -14
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +16 -16
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +4 -4
- package/bundles/ngcc/index.js +12 -12
- package/bundles/ngcc/main-ngcc.js +13 -13
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +13 -13
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +4 -4
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +5 -5
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +10 -10
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles_metadata.json +1 -1
- package/ngcc/src/dependencies/module_resolver.d.ts +5 -2
- package/ngcc/src/execution/cluster/api.d.ts +1 -1
- package/ngcc/src/execution/cluster/package_json_updater.d.ts +1 -1
- package/ngcc/src/execution/tasks/api.d.ts +2 -2
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/entry_point.d.ts +1 -7
- package/ngcc/src/utils.d.ts +26 -0
- package/ngcc/src/writing/package_json_updater.d.ts +2 -1
- package/package.json +4 -4
- package/src/ngtsc/annotations/common/index.d.ts +1 -0
- package/src/ngtsc/annotations/common/src/schema.d.ts +12 -0
- package/src/ngtsc/annotations/common/src/util.d.ts +7 -1
- package/src/ngtsc/annotations/component/src/handler.d.ts +1 -1
- package/src/ngtsc/annotations/component/src/metadata.d.ts +7 -8
- package/src/ngtsc/annotations/component/src/resources.d.ts +1 -1
- package/src/ngtsc/annotations/ng_module/index.d.ts +1 -0
- package/src/ngtsc/annotations/ng_module/src/handler.d.ts +10 -26
- package/src/ngtsc/annotations/ng_module/src/module_with_providers.d.ts +26 -0
- package/src/ngtsc/core/api/src/adapter.d.ts +12 -1
- package/src/ngtsc/core/src/host.d.ts +9 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
- package/src/ngtsc/metadata/src/api.d.ts +32 -5
- package/src/ngtsc/metadata/src/util.d.ts +1 -0
- package/src/ngtsc/partial_evaluator/index.d.ts +1 -0
- package/src/ngtsc/partial_evaluator/src/dynamic.d.ts +9 -1
- package/src/ngtsc/partial_evaluator/src/interface.d.ts +2 -1
- package/src/ngtsc/partial_evaluator/src/result.d.ts +2 -1
- package/src/ngtsc/partial_evaluator/src/synthetic.d.ts +19 -0
- package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +2 -2
- package/src/ngtsc/scope/index.d.ts +4 -3
- package/src/ngtsc/scope/src/api.d.ts +36 -14
- package/src/ngtsc/scope/src/component_scope.d.ts +2 -16
- package/src/ngtsc/scope/src/local.d.ts +4 -11
- package/src/ngtsc/scope/src/standalone.d.ts +26 -0
- package/src/ngtsc/scope/src/typecheck.d.ts +1 -1
- package/src/ngtsc/scope/src/util.d.ts +15 -0
- package/src/ngtsc/transform/src/compilation.d.ts +3 -1
- package/src/ngtsc/typecheck/api/api.d.ts +1 -0
- package/src/ngtsc/typecheck/api/checker.d.ts +6 -6
- package/src/ngtsc/typecheck/api/completion.d.ts +3 -3
- package/src/ngtsc/typecheck/api/context.d.ts +2 -1
- package/src/ngtsc/typecheck/api/symbols.d.ts +23 -16
- package/src/ngtsc/typecheck/src/checker.d.ts +5 -4
- package/src/ngtsc/typecheck/src/completion.d.ts +6 -5
- package/src/ngtsc/typecheck/src/context.d.ts +1 -1
- package/src/ngtsc/typecheck/src/dom.d.ts +4 -2
- package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +4 -3
- package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -1
- package/bundles/chunk-34QUU6SJ.js.map +0 -6
- package/bundles/chunk-FJDIFR5C.js.map +0 -6
- package/bundles/chunk-GYVY4Y2L.js.map +0 -6
- package/bundles/chunk-M3IOYIU5.js.map +0 -6
- package/bundles/chunk-SNAJD4VP.js.map +0 -6
- package/bundles/chunk-UMDDHI5B.js.map +0 -6
- package/src/ngtsc/annotations/component/src/scope.d.ts +0 -20
|
@@ -6,39 +6,35 @@
|
|
|
6
6
|
import {
|
|
7
7
|
CompilationMode,
|
|
8
8
|
ComponentDecoratorHandler,
|
|
9
|
+
ComponentScopeKind,
|
|
10
|
+
CompoundComponentScopeReader,
|
|
9
11
|
CompoundMetadataReader,
|
|
10
12
|
CompoundMetadataRegistry,
|
|
11
13
|
DirectiveDecoratorHandler,
|
|
12
14
|
DtsMetadataReader,
|
|
13
15
|
DtsTransformRegistry,
|
|
14
|
-
FactoryGenerator,
|
|
15
16
|
InjectableClassRegistry,
|
|
16
17
|
InjectableDecoratorHandler,
|
|
17
18
|
LocalMetadataRegistry,
|
|
19
|
+
LocalModuleScopeRegistry,
|
|
20
|
+
MetaKind,
|
|
21
|
+
MetadataDtsModuleScopeResolver,
|
|
18
22
|
NgModuleDecoratorHandler,
|
|
19
23
|
NoopReferencesRegistry,
|
|
20
24
|
PartialEvaluator,
|
|
21
25
|
PipeDecoratorHandler,
|
|
22
26
|
ResourceRegistry,
|
|
23
27
|
SemanticDepGraphUpdater,
|
|
24
|
-
ShimAdapter,
|
|
25
|
-
ShimReferenceTagger,
|
|
26
|
-
SummaryGenerator,
|
|
27
28
|
TraitCompiler,
|
|
29
|
+
TypeCheckScopeRegistry,
|
|
28
30
|
aliasTransformFactory,
|
|
29
|
-
copyFileShimData,
|
|
30
31
|
declarationTransformFactory,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
isShim,
|
|
34
|
-
ivyTransformFactory,
|
|
35
|
-
retagAllTsFiles,
|
|
36
|
-
untagAllTsFiles
|
|
37
|
-
} from "./chunk-GYVY4Y2L.js";
|
|
32
|
+
ivyTransformFactory
|
|
33
|
+
} from "./chunk-VSZPIAX6.js";
|
|
38
34
|
import {
|
|
39
35
|
TypeScriptReflectionHost,
|
|
40
36
|
isNamedClassDeclaration
|
|
41
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-ZJCM37WF.js";
|
|
42
38
|
import {
|
|
43
39
|
AbsoluteModuleStrategy,
|
|
44
40
|
AliasStrategy,
|
|
@@ -64,7 +60,6 @@ import {
|
|
|
64
60
|
getRootDirs,
|
|
65
61
|
getSourceFileOrNull,
|
|
66
62
|
getTokenAtPosition,
|
|
67
|
-
identifierOfNode,
|
|
68
63
|
isAssignment,
|
|
69
64
|
isDtsPath,
|
|
70
65
|
isNonDeclarationTsPath,
|
|
@@ -72,37 +67,37 @@ import {
|
|
|
72
67
|
makeDiagnostic,
|
|
73
68
|
makeRelatedInformation,
|
|
74
69
|
ngErrorCode,
|
|
75
|
-
nodeNameForError,
|
|
76
70
|
normalizeSeparators,
|
|
77
71
|
relativePathBetween,
|
|
78
72
|
replaceTsWithNgInErrors,
|
|
79
73
|
toUnredirectedSourceFile,
|
|
80
74
|
translateExpression,
|
|
81
75
|
translateType
|
|
82
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-SFACRVMZ.js";
|
|
83
77
|
import {
|
|
84
78
|
LogicalFileSystem,
|
|
85
79
|
absoluteFrom,
|
|
86
80
|
absoluteFromSourceFile,
|
|
81
|
+
basename,
|
|
87
82
|
dirname,
|
|
88
83
|
getFileSystem,
|
|
89
84
|
getSourceFileOrError,
|
|
90
85
|
join,
|
|
91
86
|
resolve
|
|
92
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-MURZUYM7.js";
|
|
93
88
|
import {
|
|
94
89
|
ActivePerfRecorder,
|
|
95
90
|
DelegatingPerfRecorder,
|
|
96
91
|
PerfCheckpoint,
|
|
97
92
|
PerfEvent,
|
|
98
93
|
PerfPhase
|
|
99
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-QK4SXRQA.js";
|
|
100
95
|
import {
|
|
101
96
|
__spreadProps,
|
|
102
97
|
__spreadValues
|
|
103
98
|
} from "./chunk-GMSUYBZP.js";
|
|
104
99
|
|
|
105
|
-
// bazel-out/
|
|
100
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
106
101
|
var DEFAULT_ERROR_CODE = 100;
|
|
107
102
|
var UNKNOWN_ERROR_CODE = 500;
|
|
108
103
|
var SOURCE = "angular";
|
|
@@ -120,7 +115,7 @@ var EmitFlags;
|
|
|
120
115
|
EmitFlags2[EmitFlags2["All"] = 31] = "All";
|
|
121
116
|
})(EmitFlags || (EmitFlags = {}));
|
|
122
117
|
|
|
123
|
-
// bazel-out/
|
|
118
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/compiler_host.mjs
|
|
124
119
|
import ts from "typescript";
|
|
125
120
|
var wrapHostForTest = null;
|
|
126
121
|
function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, true) }) {
|
|
@@ -130,21 +125,21 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
|
|
|
130
125
|
return tsHost;
|
|
131
126
|
}
|
|
132
127
|
|
|
133
|
-
// bazel-out/
|
|
128
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/checker.mjs
|
|
134
129
|
var OptimizeFor;
|
|
135
130
|
(function(OptimizeFor2) {
|
|
136
131
|
OptimizeFor2[OptimizeFor2["SingleFile"] = 0] = "SingleFile";
|
|
137
132
|
OptimizeFor2[OptimizeFor2["WholeProgram"] = 1] = "WholeProgram";
|
|
138
133
|
})(OptimizeFor || (OptimizeFor = {}));
|
|
139
134
|
|
|
140
|
-
// bazel-out/
|
|
135
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/completion.mjs
|
|
141
136
|
var CompletionKind;
|
|
142
137
|
(function(CompletionKind2) {
|
|
143
138
|
CompletionKind2[CompletionKind2["Reference"] = 0] = "Reference";
|
|
144
139
|
CompletionKind2[CompletionKind2["Variable"] = 1] = "Variable";
|
|
145
140
|
})(CompletionKind || (CompletionKind = {}));
|
|
146
141
|
|
|
147
|
-
// bazel-out/
|
|
142
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.mjs
|
|
148
143
|
var SymbolKind;
|
|
149
144
|
(function(SymbolKind2) {
|
|
150
145
|
SymbolKind2[SymbolKind2["Input"] = 0] = "Input";
|
|
@@ -160,11 +155,11 @@ var SymbolKind;
|
|
|
160
155
|
SymbolKind2[SymbolKind2["Pipe"] = 10] = "Pipe";
|
|
161
156
|
})(SymbolKind || (SymbolKind = {}));
|
|
162
157
|
|
|
163
|
-
// bazel-out/
|
|
158
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
164
159
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
165
|
-
import
|
|
160
|
+
import ts33 from "typescript";
|
|
166
161
|
|
|
167
|
-
// bazel-out/
|
|
162
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
168
163
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
169
164
|
import * as path from "path";
|
|
170
165
|
function i18nGetExtension(formatName) {
|
|
@@ -215,10 +210,10 @@ function getPathNormalizer(basePath) {
|
|
|
215
210
|
};
|
|
216
211
|
}
|
|
217
212
|
|
|
218
|
-
// bazel-out/
|
|
213
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
219
214
|
import ts2 from "typescript";
|
|
220
215
|
|
|
221
|
-
// bazel-out/
|
|
216
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
222
217
|
function toNumbers(value) {
|
|
223
218
|
const suffixIndex = value.lastIndexOf("-");
|
|
224
219
|
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
@@ -253,9 +248,9 @@ function compareVersions(v1, v2) {
|
|
|
253
248
|
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
254
249
|
}
|
|
255
250
|
|
|
256
|
-
// bazel-out/
|
|
251
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
257
252
|
var MIN_TS_VERSION = "4.6.2";
|
|
258
|
-
var MAX_TS_VERSION = "4.
|
|
253
|
+
var MAX_TS_VERSION = "4.8.0";
|
|
259
254
|
var tsVersion = ts2.version;
|
|
260
255
|
function checkVersion(version, minVersion, maxVersion) {
|
|
261
256
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
@@ -266,10 +261,10 @@ function verifySupportedTypeScriptVersion() {
|
|
|
266
261
|
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
267
262
|
}
|
|
268
263
|
|
|
269
|
-
// bazel-out/
|
|
270
|
-
import
|
|
264
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
265
|
+
import ts31 from "typescript";
|
|
271
266
|
|
|
272
|
-
// bazel-out/
|
|
267
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
273
268
|
var CycleAnalyzer = class {
|
|
274
269
|
constructor(importGraph) {
|
|
275
270
|
this.importGraph = importGraph;
|
|
@@ -340,7 +335,7 @@ var Cycle = class {
|
|
|
340
335
|
}
|
|
341
336
|
};
|
|
342
337
|
|
|
343
|
-
// bazel-out/
|
|
338
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
344
339
|
import ts3 from "typescript";
|
|
345
340
|
var ImportGraph = class {
|
|
346
341
|
constructor(checker, perf) {
|
|
@@ -432,7 +427,7 @@ var Found = class {
|
|
|
432
427
|
}
|
|
433
428
|
};
|
|
434
429
|
|
|
435
|
-
// bazel-out/
|
|
430
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
436
431
|
import ts4 from "typescript";
|
|
437
432
|
var FlatIndexGenerator = class {
|
|
438
433
|
constructor(entryPoint, relativeFlatIndexPath, moduleName) {
|
|
@@ -457,7 +452,7 @@ export * from '${relativeEntryPoint}';
|
|
|
457
452
|
}
|
|
458
453
|
};
|
|
459
454
|
|
|
460
|
-
// bazel-out/
|
|
455
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/logic.mjs
|
|
461
456
|
function findFlatIndexEntryPoint(rootFiles) {
|
|
462
457
|
const tsFiles = rootFiles.filter((file) => isNonDeclarationTsPath(file));
|
|
463
458
|
let resolvedEntryPoint = null;
|
|
@@ -473,7 +468,7 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
473
468
|
return resolvedEntryPoint;
|
|
474
469
|
}
|
|
475
470
|
|
|
476
|
-
// bazel-out/
|
|
471
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
477
472
|
import ts5 from "typescript";
|
|
478
473
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
479
474
|
const diagnostics = [];
|
|
@@ -553,7 +548,7 @@ function getDescriptorOfDeclaration(decl) {
|
|
|
553
548
|
}
|
|
554
549
|
}
|
|
555
550
|
|
|
556
|
-
// bazel-out/
|
|
551
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/reference_graph.mjs
|
|
557
552
|
var ReferenceGraph = class {
|
|
558
553
|
constructor() {
|
|
559
554
|
this.references = /* @__PURE__ */ new Map();
|
|
@@ -607,7 +602,7 @@ var ReferenceGraph = class {
|
|
|
607
602
|
}
|
|
608
603
|
};
|
|
609
604
|
|
|
610
|
-
// bazel-out/
|
|
605
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/api.mjs
|
|
611
606
|
var NgOriginalFile = Symbol("NgOriginalFile");
|
|
612
607
|
var UpdateMode;
|
|
613
608
|
(function(UpdateMode2) {
|
|
@@ -615,8 +610,406 @@ var UpdateMode;
|
|
|
615
610
|
UpdateMode2[UpdateMode2["Incremental"] = 1] = "Incremental";
|
|
616
611
|
})(UpdateMode || (UpdateMode = {}));
|
|
617
612
|
|
|
618
|
-
// bazel-out/
|
|
613
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
614
|
+
import ts9 from "typescript";
|
|
615
|
+
|
|
616
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
619
617
|
import ts6 from "typescript";
|
|
618
|
+
|
|
619
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
620
|
+
var NgExtension = Symbol("NgExtension");
|
|
621
|
+
function isExtended(sf) {
|
|
622
|
+
return sf[NgExtension] !== void 0;
|
|
623
|
+
}
|
|
624
|
+
function sfExtensionData(sf) {
|
|
625
|
+
const extSf = sf;
|
|
626
|
+
if (extSf[NgExtension] !== void 0) {
|
|
627
|
+
return extSf[NgExtension];
|
|
628
|
+
}
|
|
629
|
+
const extension = {
|
|
630
|
+
isTopLevelShim: false,
|
|
631
|
+
fileShim: null,
|
|
632
|
+
originalReferencedFiles: null,
|
|
633
|
+
taggedReferenceFiles: null
|
|
634
|
+
};
|
|
635
|
+
extSf[NgExtension] = extension;
|
|
636
|
+
return extension;
|
|
637
|
+
}
|
|
638
|
+
function isFileShimSourceFile(sf) {
|
|
639
|
+
return isExtended(sf) && sf[NgExtension].fileShim !== null;
|
|
640
|
+
}
|
|
641
|
+
function isShim(sf) {
|
|
642
|
+
return isExtended(sf) && (sf[NgExtension].fileShim !== null || sf[NgExtension].isTopLevelShim);
|
|
643
|
+
}
|
|
644
|
+
function copyFileShimData(from, to) {
|
|
645
|
+
if (!isFileShimSourceFile(from)) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
sfExtensionData(to).fileShim = sfExtensionData(from).fileShim;
|
|
649
|
+
}
|
|
650
|
+
function untagAllTsFiles(program) {
|
|
651
|
+
for (const sf of program.getSourceFiles()) {
|
|
652
|
+
untagTsFile(sf);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
function retagAllTsFiles(program) {
|
|
656
|
+
for (const sf of program.getSourceFiles()) {
|
|
657
|
+
retagTsFile(sf);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function untagTsFile(sf) {
|
|
661
|
+
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
const ext = sfExtensionData(sf);
|
|
665
|
+
if (ext.originalReferencedFiles !== null) {
|
|
666
|
+
sf.referencedFiles = ext.originalReferencedFiles;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
function retagTsFile(sf) {
|
|
670
|
+
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
const ext = sfExtensionData(sf);
|
|
674
|
+
if (ext.taggedReferenceFiles !== null) {
|
|
675
|
+
sf.referencedFiles = ext.taggedReferenceFiles;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/util.mjs
|
|
680
|
+
var TS_EXTENSIONS = /\.tsx?$/i;
|
|
681
|
+
function makeShimFileName(fileName, suffix) {
|
|
682
|
+
return absoluteFrom(fileName.replace(TS_EXTENSIONS, suffix));
|
|
683
|
+
}
|
|
684
|
+
function generatedModuleName(originalModuleName, originalFileName, genSuffix) {
|
|
685
|
+
let moduleName;
|
|
686
|
+
if (originalFileName.endsWith("/index.ts")) {
|
|
687
|
+
moduleName = originalModuleName + "/index" + genSuffix;
|
|
688
|
+
} else {
|
|
689
|
+
moduleName = originalModuleName + genSuffix;
|
|
690
|
+
}
|
|
691
|
+
return moduleName;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
695
|
+
var ShimAdapter = class {
|
|
696
|
+
constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
|
|
697
|
+
this.delegate = delegate;
|
|
698
|
+
this.shims = /* @__PURE__ */ new Map();
|
|
699
|
+
this.priorShims = /* @__PURE__ */ new Map();
|
|
700
|
+
this.notShims = /* @__PURE__ */ new Set();
|
|
701
|
+
this.generators = [];
|
|
702
|
+
this.ignoreForEmit = /* @__PURE__ */ new Set();
|
|
703
|
+
this.extensionPrefixes = [];
|
|
704
|
+
for (const gen of perFileGenerators) {
|
|
705
|
+
const pattern = `^(.*)\\.${gen.extensionPrefix}\\.ts$`;
|
|
706
|
+
const regexp = new RegExp(pattern, "i");
|
|
707
|
+
this.generators.push({
|
|
708
|
+
generator: gen,
|
|
709
|
+
test: regexp,
|
|
710
|
+
suffix: `.${gen.extensionPrefix}.ts`
|
|
711
|
+
});
|
|
712
|
+
this.extensionPrefixes.push(gen.extensionPrefix);
|
|
713
|
+
}
|
|
714
|
+
const extraInputFiles = [];
|
|
715
|
+
for (const gen of topLevelGenerators) {
|
|
716
|
+
const sf = gen.makeTopLevelShim();
|
|
717
|
+
sfExtensionData(sf).isTopLevelShim = true;
|
|
718
|
+
if (!gen.shouldEmit) {
|
|
719
|
+
this.ignoreForEmit.add(sf);
|
|
720
|
+
}
|
|
721
|
+
const fileName = absoluteFromSourceFile(sf);
|
|
722
|
+
this.shims.set(fileName, sf);
|
|
723
|
+
extraInputFiles.push(fileName);
|
|
724
|
+
}
|
|
725
|
+
for (const rootFile of tsRootFiles) {
|
|
726
|
+
for (const gen of this.generators) {
|
|
727
|
+
extraInputFiles.push(makeShimFileName(rootFile, gen.suffix));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
this.extraInputFiles = extraInputFiles;
|
|
731
|
+
if (oldProgram !== null) {
|
|
732
|
+
for (const oldSf of oldProgram.getSourceFiles()) {
|
|
733
|
+
if (oldSf.isDeclarationFile || !isFileShimSourceFile(oldSf)) {
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
this.priorShims.set(absoluteFromSourceFile(oldSf), oldSf);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
maybeGenerate(fileName) {
|
|
741
|
+
if (this.notShims.has(fileName)) {
|
|
742
|
+
return null;
|
|
743
|
+
} else if (this.shims.has(fileName)) {
|
|
744
|
+
return this.shims.get(fileName);
|
|
745
|
+
}
|
|
746
|
+
if (isDtsPath(fileName)) {
|
|
747
|
+
this.notShims.add(fileName);
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
750
|
+
for (const record of this.generators) {
|
|
751
|
+
const match = record.test.exec(fileName);
|
|
752
|
+
if (match === null) {
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
const prefix = match[1];
|
|
756
|
+
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
757
|
+
if (!this.delegate.fileExists(baseFileName)) {
|
|
758
|
+
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
759
|
+
if (!this.delegate.fileExists(baseFileName)) {
|
|
760
|
+
return void 0;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
const inputFile = this.delegate.getSourceFile(baseFileName, ts6.ScriptTarget.Latest);
|
|
764
|
+
if (inputFile === void 0 || isShim(inputFile)) {
|
|
765
|
+
return void 0;
|
|
766
|
+
}
|
|
767
|
+
return this.generateSpecific(fileName, record.generator, inputFile);
|
|
768
|
+
}
|
|
769
|
+
this.notShims.add(fileName);
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
generateSpecific(fileName, generator, inputFile) {
|
|
773
|
+
let priorShimSf = null;
|
|
774
|
+
if (this.priorShims.has(fileName)) {
|
|
775
|
+
priorShimSf = this.priorShims.get(fileName);
|
|
776
|
+
this.priorShims.delete(fileName);
|
|
777
|
+
}
|
|
778
|
+
const shimSf = generator.generateShimForFile(inputFile, fileName, priorShimSf);
|
|
779
|
+
sfExtensionData(shimSf).fileShim = {
|
|
780
|
+
extension: generator.extensionPrefix,
|
|
781
|
+
generatedFrom: absoluteFromSourceFile(inputFile)
|
|
782
|
+
};
|
|
783
|
+
if (!generator.shouldEmit) {
|
|
784
|
+
this.ignoreForEmit.add(shimSf);
|
|
785
|
+
}
|
|
786
|
+
this.shims.set(fileName, shimSf);
|
|
787
|
+
return shimSf;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.mjs
|
|
792
|
+
import ts7 from "typescript";
|
|
793
|
+
var TS_DTS_SUFFIX = /(\.d)?\.ts$/;
|
|
794
|
+
var STRIP_NG_FACTORY = /(.*)NgFactory$/;
|
|
795
|
+
var FactoryGenerator = class {
|
|
796
|
+
constructor() {
|
|
797
|
+
this.sourceInfo = /* @__PURE__ */ new Map();
|
|
798
|
+
this.sourceToFactorySymbols = /* @__PURE__ */ new Map();
|
|
799
|
+
this.shouldEmit = true;
|
|
800
|
+
this.extensionPrefix = "ngfactory";
|
|
801
|
+
}
|
|
802
|
+
generateShimForFile(sf, genFilePath) {
|
|
803
|
+
const absoluteSfPath = absoluteFromSourceFile(sf);
|
|
804
|
+
const relativePathToSource = "./" + basename(sf.fileName).replace(TS_DTS_SUFFIX, "");
|
|
805
|
+
const symbolNames = sf.statements.filter(ts7.isClassDeclaration).filter((decl) => isExported(decl) && decl.decorators !== void 0 && decl.name !== void 0).map((decl) => decl.name.text);
|
|
806
|
+
let sourceText = "";
|
|
807
|
+
const leadingComment = getFileoverviewComment(sf);
|
|
808
|
+
if (leadingComment !== null) {
|
|
809
|
+
sourceText = leadingComment + "\n\n";
|
|
810
|
+
}
|
|
811
|
+
if (symbolNames.length > 0) {
|
|
812
|
+
const varLines = symbolNames.map((name) => `export const ${name}NgFactory: i0.\u0275NgModuleFactory<any> = new i0.\u0275NgModuleFactory(${name});`);
|
|
813
|
+
sourceText += [
|
|
814
|
+
`import * as i0 from '@angular/core';`,
|
|
815
|
+
`import {${symbolNames.join(", ")}} from '${relativePathToSource}';`,
|
|
816
|
+
...varLines
|
|
817
|
+
].join("\n");
|
|
818
|
+
}
|
|
819
|
+
sourceText += "\nexport const \u0275NonEmptyModule = true;";
|
|
820
|
+
const genFile = ts7.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts7.ScriptKind.TS);
|
|
821
|
+
if (sf.moduleName !== void 0) {
|
|
822
|
+
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngfactory");
|
|
823
|
+
}
|
|
824
|
+
const moduleSymbols = /* @__PURE__ */ new Map();
|
|
825
|
+
this.sourceToFactorySymbols.set(absoluteSfPath, moduleSymbols);
|
|
826
|
+
this.sourceInfo.set(genFilePath, {
|
|
827
|
+
sourceFilePath: absoluteSfPath,
|
|
828
|
+
moduleSymbols
|
|
829
|
+
});
|
|
830
|
+
return genFile;
|
|
831
|
+
}
|
|
832
|
+
track(sf, moduleInfo) {
|
|
833
|
+
if (this.sourceToFactorySymbols.has(sf.fileName)) {
|
|
834
|
+
this.sourceToFactorySymbols.get(sf.fileName).set(moduleInfo.name, moduleInfo);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
function isExported(decl) {
|
|
839
|
+
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts7.SyntaxKind.ExportKeyword);
|
|
840
|
+
}
|
|
841
|
+
function generatedFactoryTransform(factoryMap, importRewriter) {
|
|
842
|
+
return (context) => {
|
|
843
|
+
return (file) => {
|
|
844
|
+
return transformFactorySourceFile(factoryMap, context, importRewriter, file);
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
|
|
849
|
+
if (!factoryMap.has(file.fileName)) {
|
|
850
|
+
return file;
|
|
851
|
+
}
|
|
852
|
+
const { moduleSymbols, sourceFilePath } = factoryMap.get(file.fileName);
|
|
853
|
+
const transformedStatements = [];
|
|
854
|
+
let nonEmptyExport = null;
|
|
855
|
+
const coreImportIdentifiers = /* @__PURE__ */ new Set();
|
|
856
|
+
for (const stmt of file.statements) {
|
|
857
|
+
if (ts7.isImportDeclaration(stmt) && ts7.isStringLiteral(stmt.moduleSpecifier) && stmt.moduleSpecifier.text === "@angular/core") {
|
|
858
|
+
const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier("@angular/core", sourceFilePath);
|
|
859
|
+
if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
|
|
860
|
+
transformedStatements.push(ts7.factory.updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts7.factory.createStringLiteral(rewrittenModuleSpecifier), void 0));
|
|
861
|
+
if (stmt.importClause !== void 0 && stmt.importClause.namedBindings !== void 0 && ts7.isNamespaceImport(stmt.importClause.namedBindings)) {
|
|
862
|
+
coreImportIdentifiers.add(stmt.importClause.namedBindings.name.text);
|
|
863
|
+
}
|
|
864
|
+
} else {
|
|
865
|
+
transformedStatements.push(stmt);
|
|
866
|
+
}
|
|
867
|
+
} else if (ts7.isVariableStatement(stmt) && stmt.declarationList.declarations.length === 1) {
|
|
868
|
+
const decl = stmt.declarationList.declarations[0];
|
|
869
|
+
if (ts7.isIdentifier(decl.name)) {
|
|
870
|
+
if (decl.name.text === "\u0275NonEmptyModule") {
|
|
871
|
+
nonEmptyExport = stmt;
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
const match = STRIP_NG_FACTORY.exec(decl.name.text);
|
|
875
|
+
const module = match ? moduleSymbols.get(match[1]) : null;
|
|
876
|
+
if (module) {
|
|
877
|
+
transformedStatements.push(updateInitializers(stmt, (init) => init ? wrapInNoSideEffects(init) : void 0));
|
|
878
|
+
}
|
|
879
|
+
} else {
|
|
880
|
+
transformedStatements.push(stmt);
|
|
881
|
+
}
|
|
882
|
+
} else {
|
|
883
|
+
transformedStatements.push(stmt);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
if (!transformedStatements.some(ts7.isVariableStatement) && nonEmptyExport !== null) {
|
|
887
|
+
transformedStatements.push(nonEmptyExport);
|
|
888
|
+
}
|
|
889
|
+
file = ts7.factory.updateSourceFile(file, transformedStatements);
|
|
890
|
+
if (coreImportIdentifiers.size > 0) {
|
|
891
|
+
const visit = (node) => {
|
|
892
|
+
node = ts7.visitEachChild(node, (child) => visit(child), context);
|
|
893
|
+
if (ts7.isPropertyAccessExpression(node) && ts7.isIdentifier(node.expression) && coreImportIdentifiers.has(node.expression.text)) {
|
|
894
|
+
const rewrittenSymbol = importRewriter.rewriteSymbol(node.name.text, "@angular/core");
|
|
895
|
+
if (rewrittenSymbol !== node.name.text) {
|
|
896
|
+
const updated = ts7.factory.updatePropertyAccessExpression(node, node.expression, ts7.factory.createIdentifier(rewrittenSymbol));
|
|
897
|
+
node = updated;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return node;
|
|
901
|
+
};
|
|
902
|
+
file = visit(file);
|
|
903
|
+
}
|
|
904
|
+
return file;
|
|
905
|
+
}
|
|
906
|
+
function getFileoverviewComment(sourceFile) {
|
|
907
|
+
const text = sourceFile.getFullText();
|
|
908
|
+
const trivia = text.substring(0, sourceFile.getStart());
|
|
909
|
+
const leadingComments = ts7.getLeadingCommentRanges(trivia, 0);
|
|
910
|
+
if (!leadingComments || leadingComments.length === 0) {
|
|
911
|
+
return null;
|
|
912
|
+
}
|
|
913
|
+
const comment = leadingComments[0];
|
|
914
|
+
if (comment.kind !== ts7.SyntaxKind.MultiLineCommentTrivia) {
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
if (text.substring(comment.end, comment.end + 2) !== "\n\n") {
|
|
918
|
+
return null;
|
|
919
|
+
}
|
|
920
|
+
const commentText = text.substring(comment.pos, comment.end);
|
|
921
|
+
if (commentText.indexOf("@license") !== -1) {
|
|
922
|
+
return null;
|
|
923
|
+
}
|
|
924
|
+
return commentText;
|
|
925
|
+
}
|
|
926
|
+
function wrapInNoSideEffects(expr) {
|
|
927
|
+
const noSideEffects = ts7.factory.createPropertyAccessExpression(ts7.factory.createIdentifier("i0"), "\u0275noSideEffects");
|
|
928
|
+
return ts7.factory.createCallExpression(noSideEffects, [], [
|
|
929
|
+
ts7.factory.createFunctionExpression([], void 0, void 0, [], [], void 0, ts7.factory.createBlock([
|
|
930
|
+
ts7.factory.createReturnStatement(expr)
|
|
931
|
+
]))
|
|
932
|
+
]);
|
|
933
|
+
}
|
|
934
|
+
function updateInitializers(stmt, update) {
|
|
935
|
+
return ts7.factory.updateVariableStatement(stmt, stmt.modifiers, ts7.factory.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts7.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
|
|
939
|
+
var ShimReferenceTagger = class {
|
|
940
|
+
constructor(shimExtensions) {
|
|
941
|
+
this.tagged = /* @__PURE__ */ new Set();
|
|
942
|
+
this.enabled = true;
|
|
943
|
+
this.suffixes = shimExtensions.map((extension) => `.${extension}.ts`);
|
|
944
|
+
}
|
|
945
|
+
tag(sf) {
|
|
946
|
+
if (!this.enabled || sf.isDeclarationFile || isShim(sf) || this.tagged.has(sf) || !isNonDeclarationTsPath(sf.fileName)) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
const ext = sfExtensionData(sf);
|
|
950
|
+
if (ext.originalReferencedFiles === null) {
|
|
951
|
+
ext.originalReferencedFiles = sf.referencedFiles;
|
|
952
|
+
}
|
|
953
|
+
const referencedFiles = [...ext.originalReferencedFiles];
|
|
954
|
+
const sfPath = absoluteFromSourceFile(sf);
|
|
955
|
+
for (const suffix of this.suffixes) {
|
|
956
|
+
referencedFiles.push({
|
|
957
|
+
fileName: makeShimFileName(sfPath, suffix),
|
|
958
|
+
pos: 0,
|
|
959
|
+
end: 0
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
ext.taggedReferenceFiles = referencedFiles;
|
|
963
|
+
sf.referencedFiles = referencedFiles;
|
|
964
|
+
this.tagged.add(sf);
|
|
965
|
+
}
|
|
966
|
+
finalize() {
|
|
967
|
+
this.enabled = false;
|
|
968
|
+
this.tagged.clear();
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.mjs
|
|
973
|
+
import ts8 from "typescript";
|
|
974
|
+
var SummaryGenerator = class {
|
|
975
|
+
constructor() {
|
|
976
|
+
this.shouldEmit = true;
|
|
977
|
+
this.extensionPrefix = "ngsummary";
|
|
978
|
+
}
|
|
979
|
+
generateShimForFile(sf, genFilePath) {
|
|
980
|
+
const symbolNames = [];
|
|
981
|
+
for (const stmt of sf.statements) {
|
|
982
|
+
if (ts8.isClassDeclaration(stmt)) {
|
|
983
|
+
if (!isExported2(stmt) || stmt.decorators === void 0 || stmt.name === void 0) {
|
|
984
|
+
continue;
|
|
985
|
+
}
|
|
986
|
+
symbolNames.push(stmt.name.text);
|
|
987
|
+
} else if (ts8.isExportDeclaration(stmt)) {
|
|
988
|
+
if (stmt.exportClause === void 0 || stmt.moduleSpecifier !== void 0 || !ts8.isNamedExports(stmt.exportClause)) {
|
|
989
|
+
continue;
|
|
990
|
+
}
|
|
991
|
+
for (const specifier of stmt.exportClause.elements) {
|
|
992
|
+
symbolNames.push(specifier.name.text);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
const varLines = symbolNames.map((name) => `export const ${name}NgSummary: any = null;`);
|
|
997
|
+
if (varLines.length === 0) {
|
|
998
|
+
varLines.push(`export const \u0275empty = null;`);
|
|
999
|
+
}
|
|
1000
|
+
const sourceText = varLines.join("\n");
|
|
1001
|
+
const genFile = ts8.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts8.ScriptKind.TS);
|
|
1002
|
+
if (sf.moduleName !== void 0) {
|
|
1003
|
+
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngsummary");
|
|
1004
|
+
}
|
|
1005
|
+
return genFile;
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
function isExported2(decl) {
|
|
1009
|
+
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts8.SyntaxKind.ExportKeyword);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
620
1013
|
var DelegatingCompilerHost = class {
|
|
621
1014
|
constructor(delegate) {
|
|
622
1015
|
this.delegate = delegate;
|
|
@@ -705,7 +1098,7 @@ var TsCreateProgramDriver = class {
|
|
|
705
1098
|
this.sfMap.clear();
|
|
706
1099
|
}
|
|
707
1100
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
708
|
-
const sf =
|
|
1101
|
+
const sf = ts9.createSourceFile(filePath, newText, ts9.ScriptTarget.Latest, true);
|
|
709
1102
|
if (originalFile !== null) {
|
|
710
1103
|
sf[NgOriginalFile] = originalFile;
|
|
711
1104
|
}
|
|
@@ -714,7 +1107,7 @@ var TsCreateProgramDriver = class {
|
|
|
714
1107
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
715
1108
|
const oldProgram = this.program;
|
|
716
1109
|
retagAllTsFiles(oldProgram);
|
|
717
|
-
this.program =
|
|
1110
|
+
this.program = ts9.createProgram({
|
|
718
1111
|
host,
|
|
719
1112
|
rootNames: this.program.getRootFileNames(),
|
|
720
1113
|
options: this.options,
|
|
@@ -726,7 +1119,7 @@ var TsCreateProgramDriver = class {
|
|
|
726
1119
|
}
|
|
727
1120
|
};
|
|
728
1121
|
|
|
729
|
-
// bazel-out/
|
|
1122
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/dependency_tracking.mjs
|
|
730
1123
|
var FileDependencyGraph = class {
|
|
731
1124
|
constructor() {
|
|
732
1125
|
this.nodes = /* @__PURE__ */ new Map();
|
|
@@ -793,7 +1186,7 @@ function isLogicallyChanged(sf, node, changedTsPaths, deletedTsPaths, changedRes
|
|
|
793
1186
|
return false;
|
|
794
1187
|
}
|
|
795
1188
|
|
|
796
|
-
// bazel-out/
|
|
1189
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/state.mjs
|
|
797
1190
|
var IncrementalStateKind;
|
|
798
1191
|
(function(IncrementalStateKind2) {
|
|
799
1192
|
IncrementalStateKind2[IncrementalStateKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -801,7 +1194,7 @@ var IncrementalStateKind;
|
|
|
801
1194
|
IncrementalStateKind2[IncrementalStateKind2["Analyzed"] = 2] = "Analyzed";
|
|
802
1195
|
})(IncrementalStateKind || (IncrementalStateKind = {}));
|
|
803
1196
|
|
|
804
|
-
// bazel-out/
|
|
1197
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/incremental.mjs
|
|
805
1198
|
var PhaseKind;
|
|
806
1199
|
(function(PhaseKind2) {
|
|
807
1200
|
PhaseKind2[PhaseKind2["Analysis"] = 0] = "Analysis";
|
|
@@ -1002,7 +1395,7 @@ function toOriginalSourceFile(sf) {
|
|
|
1002
1395
|
}
|
|
1003
1396
|
}
|
|
1004
1397
|
|
|
1005
|
-
// bazel-out/
|
|
1398
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/strategy.mjs
|
|
1006
1399
|
var TrackedIncrementalBuildStrategy = class {
|
|
1007
1400
|
constructor() {
|
|
1008
1401
|
this.state = null;
|
|
@@ -1038,7 +1431,7 @@ var PatchedProgramIncrementalBuildStrategy = class {
|
|
|
1038
1431
|
};
|
|
1039
1432
|
var SYM_INCREMENTAL_STATE = Symbol("NgIncrementalState");
|
|
1040
1433
|
|
|
1041
|
-
// bazel-out/
|
|
1434
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/api.mjs
|
|
1042
1435
|
var IdentifierKind;
|
|
1043
1436
|
(function(IdentifierKind2) {
|
|
1044
1437
|
IdentifierKind2[IdentifierKind2["Property"] = 0] = "Property";
|
|
@@ -1056,7 +1449,7 @@ var AbsoluteSourceSpan = class {
|
|
|
1056
1449
|
}
|
|
1057
1450
|
};
|
|
1058
1451
|
|
|
1059
|
-
// bazel-out/
|
|
1452
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/context.mjs
|
|
1060
1453
|
var IndexingContext = class {
|
|
1061
1454
|
constructor() {
|
|
1062
1455
|
this.components = /* @__PURE__ */ new Set();
|
|
@@ -1066,10 +1459,10 @@ var IndexingContext = class {
|
|
|
1066
1459
|
}
|
|
1067
1460
|
};
|
|
1068
1461
|
|
|
1069
|
-
// bazel-out/
|
|
1462
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1070
1463
|
import { ParseSourceFile } from "@angular/compiler";
|
|
1071
1464
|
|
|
1072
|
-
// bazel-out/
|
|
1465
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/template.mjs
|
|
1073
1466
|
import { ASTWithSource, ImplicitReceiver, PropertyRead, PropertyWrite, RecursiveAstVisitor, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
1074
1467
|
var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
1075
1468
|
constructor(expressionStr, absoluteOffset, boundTemplate, targetToIdentifier) {
|
|
@@ -1306,7 +1699,7 @@ function getTemplateIdentifiers(boundTemplate) {
|
|
|
1306
1699
|
return { identifiers: visitor.identifiers, errors: visitor.errors };
|
|
1307
1700
|
}
|
|
1308
1701
|
|
|
1309
|
-
// bazel-out/
|
|
1702
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1310
1703
|
function generateAnalysis(context) {
|
|
1311
1704
|
const analysis = /* @__PURE__ */ new Map();
|
|
1312
1705
|
context.components.forEach(({ declaration, selector, boundTemplate, templateMeta }) => {
|
|
@@ -1342,8 +1735,8 @@ function generateAnalysis(context) {
|
|
|
1342
1735
|
return analysis;
|
|
1343
1736
|
}
|
|
1344
1737
|
|
|
1345
|
-
// bazel-out/
|
|
1346
|
-
import
|
|
1738
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
1739
|
+
import ts10 from "typescript";
|
|
1347
1740
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
1348
1741
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
1349
1742
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -1453,7 +1846,7 @@ var AdapterResourceLoader = class {
|
|
|
1453
1846
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
1454
1847
|
}
|
|
1455
1848
|
getResolvedCandidateLocations(url, fromFile) {
|
|
1456
|
-
const failedLookup =
|
|
1849
|
+
const failedLookup = ts10.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
1457
1850
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
1458
1851
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
1459
1852
|
}
|
|
@@ -1488,468 +1881,89 @@ function createLookupResolutionHost(adapter) {
|
|
|
1488
1881
|
};
|
|
1489
1882
|
}
|
|
1490
1883
|
|
|
1491
|
-
// bazel-out/
|
|
1492
|
-
var
|
|
1493
|
-
constructor(
|
|
1494
|
-
this.
|
|
1495
|
-
this.
|
|
1884
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/standalone.mjs
|
|
1885
|
+
var StandaloneComponentScopeReader = class {
|
|
1886
|
+
constructor(metaReader, localModuleReader, dtsModuleReader) {
|
|
1887
|
+
this.metaReader = metaReader;
|
|
1888
|
+
this.localModuleReader = localModuleReader;
|
|
1889
|
+
this.dtsModuleReader = dtsModuleReader;
|
|
1496
1890
|
this.cache = /* @__PURE__ */ new Map();
|
|
1497
1891
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
}
|
|
1507
|
-
const directives = [];
|
|
1508
|
-
const pipes = [];
|
|
1509
|
-
const ngModules = /* @__PURE__ */ new Set([clazz]);
|
|
1510
|
-
const meta = this.dtsMetaReader.getNgModuleMetadata(ref);
|
|
1511
|
-
if (meta === null) {
|
|
1512
|
-
this.cache.set(clazz, null);
|
|
1513
|
-
return null;
|
|
1514
|
-
}
|
|
1515
|
-
const declarations = /* @__PURE__ */ new Set();
|
|
1516
|
-
for (const declRef of meta.declarations) {
|
|
1517
|
-
declarations.add(declRef.node);
|
|
1518
|
-
}
|
|
1519
|
-
for (const exportRef of meta.exports) {
|
|
1520
|
-
const directive = this.dtsMetaReader.getDirectiveMetadata(exportRef);
|
|
1521
|
-
if (directive !== null) {
|
|
1522
|
-
const isReExport = !declarations.has(exportRef.node);
|
|
1523
|
-
directives.push(this.maybeAlias(directive, sourceFile, isReExport));
|
|
1524
|
-
continue;
|
|
1525
|
-
}
|
|
1526
|
-
const pipe = this.dtsMetaReader.getPipeMetadata(exportRef);
|
|
1527
|
-
if (pipe !== null) {
|
|
1528
|
-
const isReExport = !declarations.has(exportRef.node);
|
|
1529
|
-
pipes.push(this.maybeAlias(pipe, sourceFile, isReExport));
|
|
1530
|
-
continue;
|
|
1892
|
+
getScopeForComponent(clazz) {
|
|
1893
|
+
var _a;
|
|
1894
|
+
if (!this.cache.has(clazz)) {
|
|
1895
|
+
const clazzRef = new Reference(clazz);
|
|
1896
|
+
const clazzMeta = this.metaReader.getDirectiveMetadata(clazzRef);
|
|
1897
|
+
if (clazzMeta === null || !clazzMeta.isComponent || !clazzMeta.isStandalone) {
|
|
1898
|
+
this.cache.set(clazz, null);
|
|
1899
|
+
return null;
|
|
1531
1900
|
}
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
directives.push(this.maybeAlias(directive2, sourceFile, true));
|
|
1901
|
+
const dependencies = /* @__PURE__ */ new Set([clazzMeta]);
|
|
1902
|
+
const seen = /* @__PURE__ */ new Set([clazz]);
|
|
1903
|
+
let isPoisoned = clazzMeta.isPoisoned;
|
|
1904
|
+
if (clazzMeta.imports !== null) {
|
|
1905
|
+
for (const ref of clazzMeta.imports) {
|
|
1906
|
+
if (seen.has(ref.node)) {
|
|
1907
|
+
continue;
|
|
1540
1908
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1909
|
+
seen.add(ref.node);
|
|
1910
|
+
const dirMeta = this.metaReader.getDirectiveMetadata(ref);
|
|
1911
|
+
if (dirMeta !== null) {
|
|
1912
|
+
dependencies.add(__spreadProps(__spreadValues({}, dirMeta), { ref }));
|
|
1913
|
+
isPoisoned = isPoisoned || dirMeta.isPoisoned || !dirMeta.isStandalone;
|
|
1914
|
+
continue;
|
|
1543
1915
|
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1916
|
+
const pipeMeta = this.metaReader.getPipeMetadata(ref);
|
|
1917
|
+
if (pipeMeta !== null) {
|
|
1918
|
+
dependencies.add(__spreadProps(__spreadValues({}, pipeMeta), { ref }));
|
|
1919
|
+
isPoisoned = isPoisoned || !pipeMeta.isStandalone;
|
|
1920
|
+
continue;
|
|
1546
1921
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
if (alias === null) {
|
|
1569
|
-
return dirOrPipe;
|
|
1570
|
-
}
|
|
1571
|
-
return __spreadProps(__spreadValues({}, dirOrPipe), {
|
|
1572
|
-
ref: ref.cloneWithAlias(alias)
|
|
1573
|
-
});
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
|
|
1577
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
1578
|
-
import { ExternalExpr } from "@angular/compiler";
|
|
1579
|
-
import ts8 from "typescript";
|
|
1580
|
-
var LocalModuleScopeRegistry = class {
|
|
1581
|
-
constructor(localReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
1582
|
-
this.localReader = localReader;
|
|
1583
|
-
this.dependencyScopeReader = dependencyScopeReader;
|
|
1584
|
-
this.refEmitter = refEmitter;
|
|
1585
|
-
this.aliasingHost = aliasingHost;
|
|
1586
|
-
this.sealed = false;
|
|
1587
|
-
this.declarationToModule = /* @__PURE__ */ new Map();
|
|
1588
|
-
this.duplicateDeclarations = /* @__PURE__ */ new Map();
|
|
1589
|
-
this.moduleToRef = /* @__PURE__ */ new Map();
|
|
1590
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
1591
|
-
this.remoteScoping = /* @__PURE__ */ new Map();
|
|
1592
|
-
this.scopeErrors = /* @__PURE__ */ new Map();
|
|
1593
|
-
this.modulesWithStructuralErrors = /* @__PURE__ */ new Set();
|
|
1594
|
-
}
|
|
1595
|
-
registerNgModuleMetadata(data) {
|
|
1596
|
-
this.assertCollecting();
|
|
1597
|
-
const ngModule = data.ref.node;
|
|
1598
|
-
this.moduleToRef.set(data.ref.node, data.ref);
|
|
1599
|
-
for (const decl of data.declarations) {
|
|
1600
|
-
this.registerDeclarationOfModule(ngModule, decl, data.rawDeclarations);
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
registerDirectiveMetadata(directive) {
|
|
1604
|
-
}
|
|
1605
|
-
registerPipeMetadata(pipe) {
|
|
1606
|
-
}
|
|
1607
|
-
getScopeForComponent(clazz) {
|
|
1608
|
-
const scope = !this.declarationToModule.has(clazz) ? null : this.getScopeOfModule(this.declarationToModule.get(clazz).ngModule);
|
|
1609
|
-
return scope;
|
|
1610
|
-
}
|
|
1611
|
-
getDuplicateDeclarations(node) {
|
|
1612
|
-
if (!this.duplicateDeclarations.has(node)) {
|
|
1613
|
-
return null;
|
|
1614
|
-
}
|
|
1615
|
-
return Array.from(this.duplicateDeclarations.get(node).values());
|
|
1616
|
-
}
|
|
1617
|
-
getScopeOfModule(clazz) {
|
|
1618
|
-
return this.moduleToRef.has(clazz) ? this.getScopeOfModuleReference(this.moduleToRef.get(clazz)) : null;
|
|
1619
|
-
}
|
|
1620
|
-
getDiagnosticsOfModule(clazz) {
|
|
1621
|
-
this.getScopeOfModule(clazz);
|
|
1622
|
-
if (this.scopeErrors.has(clazz)) {
|
|
1623
|
-
return this.scopeErrors.get(clazz);
|
|
1624
|
-
} else {
|
|
1625
|
-
return null;
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
registerDeclarationOfModule(ngModule, decl, rawDeclarations) {
|
|
1629
|
-
const declData = {
|
|
1630
|
-
ngModule,
|
|
1631
|
-
ref: decl,
|
|
1632
|
-
rawDeclarations
|
|
1633
|
-
};
|
|
1634
|
-
if (this.duplicateDeclarations.has(decl.node)) {
|
|
1635
|
-
this.duplicateDeclarations.get(decl.node).set(ngModule, declData);
|
|
1636
|
-
} else if (this.declarationToModule.has(decl.node) && this.declarationToModule.get(decl.node).ngModule !== ngModule) {
|
|
1637
|
-
const duplicateDeclMap = /* @__PURE__ */ new Map();
|
|
1638
|
-
const firstDeclData = this.declarationToModule.get(decl.node);
|
|
1639
|
-
this.modulesWithStructuralErrors.add(firstDeclData.ngModule);
|
|
1640
|
-
this.modulesWithStructuralErrors.add(ngModule);
|
|
1641
|
-
duplicateDeclMap.set(firstDeclData.ngModule, firstDeclData);
|
|
1642
|
-
duplicateDeclMap.set(ngModule, declData);
|
|
1643
|
-
this.duplicateDeclarations.set(decl.node, duplicateDeclMap);
|
|
1644
|
-
this.declarationToModule.delete(decl.node);
|
|
1645
|
-
} else {
|
|
1646
|
-
this.declarationToModule.set(decl.node, declData);
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
getScopeOfModuleReference(ref) {
|
|
1650
|
-
if (this.cache.has(ref.node)) {
|
|
1651
|
-
return this.cache.get(ref.node);
|
|
1652
|
-
}
|
|
1653
|
-
this.sealed = true;
|
|
1654
|
-
const ngModule = this.localReader.getNgModuleMetadata(ref);
|
|
1655
|
-
if (ngModule === null) {
|
|
1656
|
-
this.cache.set(ref.node, null);
|
|
1657
|
-
return null;
|
|
1658
|
-
}
|
|
1659
|
-
const compilationModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
1660
|
-
const exportedModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
1661
|
-
const diagnostics = [];
|
|
1662
|
-
const compilationDirectives = /* @__PURE__ */ new Map();
|
|
1663
|
-
const compilationPipes = /* @__PURE__ */ new Map();
|
|
1664
|
-
const declared = /* @__PURE__ */ new Set();
|
|
1665
|
-
const exportDirectives = /* @__PURE__ */ new Map();
|
|
1666
|
-
const exportPipes = /* @__PURE__ */ new Map();
|
|
1667
|
-
let isPoisoned = false;
|
|
1668
|
-
if (this.modulesWithStructuralErrors.has(ngModule.ref.node)) {
|
|
1669
|
-
isPoisoned = true;
|
|
1670
|
-
}
|
|
1671
|
-
for (const decl of ngModule.imports) {
|
|
1672
|
-
const importScope = this.getExportedScope(decl, diagnostics, ref.node, "import");
|
|
1673
|
-
if (importScope === null) {
|
|
1674
|
-
diagnostics.push(invalidRef(ref.node, decl, "import"));
|
|
1675
|
-
isPoisoned = true;
|
|
1676
|
-
continue;
|
|
1677
|
-
} else if (importScope === "invalid" || importScope.exported.isPoisoned) {
|
|
1678
|
-
diagnostics.push(invalidTransitiveNgModuleRef(ref.node, decl, "import"));
|
|
1679
|
-
isPoisoned = true;
|
|
1680
|
-
if (importScope === "invalid") {
|
|
1681
|
-
continue;
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
for (const directive of importScope.exported.directives) {
|
|
1685
|
-
compilationDirectives.set(directive.ref.node, directive);
|
|
1686
|
-
}
|
|
1687
|
-
for (const pipe of importScope.exported.pipes) {
|
|
1688
|
-
compilationPipes.set(pipe.ref.node, pipe);
|
|
1689
|
-
}
|
|
1690
|
-
for (const importedModule of importScope.exported.ngModules) {
|
|
1691
|
-
compilationModules.add(importedModule);
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
for (const decl of ngModule.declarations) {
|
|
1695
|
-
const directive = this.localReader.getDirectiveMetadata(decl);
|
|
1696
|
-
const pipe = this.localReader.getPipeMetadata(decl);
|
|
1697
|
-
if (directive !== null) {
|
|
1698
|
-
compilationDirectives.set(decl.node, __spreadProps(__spreadValues({}, directive), { ref: decl }));
|
|
1699
|
-
if (directive.isPoisoned) {
|
|
1700
|
-
isPoisoned = true;
|
|
1701
|
-
}
|
|
1702
|
-
} else if (pipe !== null) {
|
|
1703
|
-
compilationPipes.set(decl.node, __spreadProps(__spreadValues({}, pipe), { ref: decl }));
|
|
1704
|
-
} else {
|
|
1705
|
-
const errorNode = decl.getOriginForDiagnostics(ngModule.rawDeclarations);
|
|
1706
|
-
diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_INVALID_DECLARATION, errorNode, `The class '${decl.node.name.text}' is listed in the declarations of the NgModule '${ngModule.ref.node.name.text}', but is not a directive, a component, or a pipe. Either remove it from the NgModule's declarations, or add an appropriate Angular decorator.`, [makeRelatedInformation(decl.node.name, `'${decl.node.name.text}' is declared here.`)]));
|
|
1707
|
-
isPoisoned = true;
|
|
1708
|
-
continue;
|
|
1709
|
-
}
|
|
1710
|
-
declared.add(decl.node);
|
|
1711
|
-
}
|
|
1712
|
-
for (const decl of ngModule.exports) {
|
|
1713
|
-
const exportScope = this.getExportedScope(decl, diagnostics, ref.node, "export");
|
|
1714
|
-
if (exportScope === "invalid" || exportScope !== null && exportScope.exported.isPoisoned) {
|
|
1715
|
-
diagnostics.push(invalidTransitiveNgModuleRef(ref.node, decl, "export"));
|
|
1716
|
-
isPoisoned = true;
|
|
1717
|
-
if (exportScope === "invalid") {
|
|
1718
|
-
continue;
|
|
1719
|
-
}
|
|
1720
|
-
} else if (exportScope !== null) {
|
|
1721
|
-
for (const directive of exportScope.exported.directives) {
|
|
1722
|
-
exportDirectives.set(directive.ref.node, directive);
|
|
1723
|
-
}
|
|
1724
|
-
for (const pipe of exportScope.exported.pipes) {
|
|
1725
|
-
exportPipes.set(pipe.ref.node, pipe);
|
|
1726
|
-
}
|
|
1727
|
-
for (const exportedModule of exportScope.exported.ngModules) {
|
|
1728
|
-
exportedModules.add(exportedModule);
|
|
1729
|
-
}
|
|
1730
|
-
} else if (compilationDirectives.has(decl.node)) {
|
|
1731
|
-
const directive = compilationDirectives.get(decl.node);
|
|
1732
|
-
exportDirectives.set(decl.node, directive);
|
|
1733
|
-
} else if (compilationPipes.has(decl.node)) {
|
|
1734
|
-
const pipe = compilationPipes.get(decl.node);
|
|
1735
|
-
exportPipes.set(decl.node, pipe);
|
|
1736
|
-
} else {
|
|
1737
|
-
if (this.localReader.getDirectiveMetadata(decl) !== null || this.localReader.getPipeMetadata(decl) !== null) {
|
|
1738
|
-
diagnostics.push(invalidReexport(ref.node, decl));
|
|
1739
|
-
} else {
|
|
1740
|
-
diagnostics.push(invalidRef(ref.node, decl, "export"));
|
|
1741
|
-
}
|
|
1742
|
-
isPoisoned = true;
|
|
1743
|
-
continue;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
const exported = {
|
|
1747
|
-
directives: Array.from(exportDirectives.values()),
|
|
1748
|
-
pipes: Array.from(exportPipes.values()),
|
|
1749
|
-
ngModules: Array.from(exportedModules),
|
|
1750
|
-
isPoisoned
|
|
1751
|
-
};
|
|
1752
|
-
const reexports = this.getReexports(ngModule, ref, declared, exported, diagnostics);
|
|
1753
|
-
const scope = {
|
|
1754
|
-
ngModule: ngModule.ref.node,
|
|
1755
|
-
compilation: {
|
|
1756
|
-
directives: Array.from(compilationDirectives.values()),
|
|
1757
|
-
pipes: Array.from(compilationPipes.values()),
|
|
1758
|
-
ngModules: Array.from(compilationModules),
|
|
1759
|
-
isPoisoned
|
|
1760
|
-
},
|
|
1761
|
-
exported,
|
|
1762
|
-
reexports,
|
|
1763
|
-
schemas: ngModule.schemas
|
|
1764
|
-
};
|
|
1765
|
-
if (diagnostics.length > 0) {
|
|
1766
|
-
this.scopeErrors.set(ref.node, diagnostics);
|
|
1767
|
-
this.modulesWithStructuralErrors.add(ref.node);
|
|
1768
|
-
}
|
|
1769
|
-
this.cache.set(ref.node, scope);
|
|
1770
|
-
return scope;
|
|
1771
|
-
}
|
|
1772
|
-
getRemoteScope(node) {
|
|
1773
|
-
return this.remoteScoping.has(node) ? this.remoteScoping.get(node) : null;
|
|
1774
|
-
}
|
|
1775
|
-
setComponentRemoteScope(node, directives, pipes) {
|
|
1776
|
-
this.remoteScoping.set(node, { directives, pipes });
|
|
1777
|
-
}
|
|
1778
|
-
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
1779
|
-
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
1780
|
-
if (!ts8.isClassDeclaration(ref.node)) {
|
|
1781
|
-
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
1782
|
-
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`));
|
|
1783
|
-
return "invalid";
|
|
1784
|
-
}
|
|
1785
|
-
return this.dependencyScopeReader.resolve(ref);
|
|
1786
|
-
} else {
|
|
1787
|
-
return this.getScopeOfModuleReference(ref);
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
getReexports(ngModule, ref, declared, exported, diagnostics) {
|
|
1791
|
-
let reexports = null;
|
|
1792
|
-
const sourceFile = ref.node.getSourceFile();
|
|
1793
|
-
if (this.aliasingHost === null) {
|
|
1794
|
-
return null;
|
|
1795
|
-
}
|
|
1796
|
-
reexports = [];
|
|
1797
|
-
const reexportMap = /* @__PURE__ */ new Map();
|
|
1798
|
-
const ngModuleRef = ref;
|
|
1799
|
-
const addReexport = (exportRef) => {
|
|
1800
|
-
if (exportRef.node.getSourceFile() === sourceFile) {
|
|
1801
|
-
return;
|
|
1802
|
-
}
|
|
1803
|
-
const isReExport = !declared.has(exportRef.node);
|
|
1804
|
-
const exportName = this.aliasingHost.maybeAliasSymbolAs(exportRef, sourceFile, ngModule.ref.node.name.text, isReExport);
|
|
1805
|
-
if (exportName === null) {
|
|
1806
|
-
return;
|
|
1807
|
-
}
|
|
1808
|
-
if (!reexportMap.has(exportName)) {
|
|
1809
|
-
if (exportRef.alias && exportRef.alias instanceof ExternalExpr) {
|
|
1810
|
-
reexports.push({
|
|
1811
|
-
fromModule: exportRef.alias.value.moduleName,
|
|
1812
|
-
symbolName: exportRef.alias.value.name,
|
|
1813
|
-
asAlias: exportName
|
|
1814
|
-
});
|
|
1815
|
-
} else {
|
|
1816
|
-
const emittedRef = this.refEmitter.emit(exportRef.cloneWithNoIdentifiers(), sourceFile);
|
|
1817
|
-
assertSuccessfulReferenceEmit(emittedRef, ngModuleRef.node.name, "class");
|
|
1818
|
-
const expr = emittedRef.expression;
|
|
1819
|
-
if (!(expr instanceof ExternalExpr) || expr.value.moduleName === null || expr.value.name === null) {
|
|
1820
|
-
throw new Error("Expected ExternalExpr");
|
|
1922
|
+
const ngModuleMeta = this.metaReader.getNgModuleMetadata(ref);
|
|
1923
|
+
if (ngModuleMeta !== null) {
|
|
1924
|
+
dependencies.add(__spreadProps(__spreadValues({}, ngModuleMeta), { ref }));
|
|
1925
|
+
let ngModuleScope;
|
|
1926
|
+
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
1927
|
+
ngModuleScope = this.dtsModuleReader.resolve(ref);
|
|
1928
|
+
} else {
|
|
1929
|
+
ngModuleScope = this.localModuleReader.getScopeOfModule(ref.node);
|
|
1930
|
+
}
|
|
1931
|
+
if (ngModuleScope === null) {
|
|
1932
|
+
isPoisoned = true;
|
|
1933
|
+
continue;
|
|
1934
|
+
}
|
|
1935
|
+
isPoisoned = isPoisoned || ngModuleScope.exported.isPoisoned;
|
|
1936
|
+
for (const dep of ngModuleScope.exported.dependencies) {
|
|
1937
|
+
if (!seen.has(dep.ref.node)) {
|
|
1938
|
+
seen.add(dep.ref.node);
|
|
1939
|
+
dependencies.add(dep);
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
continue;
|
|
1821
1943
|
}
|
|
1822
|
-
|
|
1823
|
-
fromModule: expr.value.moduleName,
|
|
1824
|
-
symbolName: expr.value.name,
|
|
1825
|
-
asAlias: exportName
|
|
1826
|
-
});
|
|
1944
|
+
isPoisoned = true;
|
|
1827
1945
|
}
|
|
1828
|
-
reexportMap.set(exportName, exportRef);
|
|
1829
|
-
} else {
|
|
1830
|
-
const prevRef = reexportMap.get(exportName);
|
|
1831
|
-
diagnostics.push(reexportCollision(ngModuleRef.node, prevRef, exportRef));
|
|
1832
|
-
}
|
|
1833
|
-
};
|
|
1834
|
-
for (const { ref: ref2 } of exported.directives) {
|
|
1835
|
-
addReexport(ref2);
|
|
1836
|
-
}
|
|
1837
|
-
for (const { ref: ref2 } of exported.pipes) {
|
|
1838
|
-
addReexport(ref2);
|
|
1839
|
-
}
|
|
1840
|
-
return reexports;
|
|
1841
|
-
}
|
|
1842
|
-
assertCollecting() {
|
|
1843
|
-
if (this.sealed) {
|
|
1844
|
-
throw new Error(`Assertion: LocalModuleScopeRegistry is not COLLECTING`);
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
};
|
|
1848
|
-
function invalidRef(clazz, decl, type) {
|
|
1849
|
-
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
1850
|
-
const resolveTarget = type === "import" ? "NgModule" : "NgModule, Component, Directive, or Pipe";
|
|
1851
|
-
let message = `Appears in the NgModule.${type}s of ${nodeNameForError(clazz)}, but could not be resolved to an ${resolveTarget} class.
|
|
1852
|
-
|
|
1853
|
-
`;
|
|
1854
|
-
const library = decl.ownedByModuleGuess !== null ? ` (${decl.ownedByModuleGuess})` : "";
|
|
1855
|
-
const sf = decl.node.getSourceFile();
|
|
1856
|
-
if (!sf.isDeclarationFile) {
|
|
1857
|
-
const annotationType = type === "import" ? "@NgModule" : "Angular";
|
|
1858
|
-
message += `Is it missing an ${annotationType} annotation?`;
|
|
1859
|
-
} else if (sf.fileName.indexOf("node_modules") !== -1) {
|
|
1860
|
-
message += `This likely means that the library${library} which declares ${decl.debugName} has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.`;
|
|
1861
|
-
} else {
|
|
1862
|
-
message += `This likely means that the dependency${library} which declares ${decl.debugName} has not been processed correctly by ngcc.`;
|
|
1863
|
-
}
|
|
1864
|
-
return makeDiagnostic(code, identifierOfNode(decl.node) || decl.node, message);
|
|
1865
|
-
}
|
|
1866
|
-
function invalidTransitiveNgModuleRef(clazz, decl, type) {
|
|
1867
|
-
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
1868
|
-
return makeDiagnostic(code, identifierOfNode(decl.node) || decl.node, `Appears in the NgModule.${type}s of ${nodeNameForError(clazz)}, but itself has errors`);
|
|
1869
|
-
}
|
|
1870
|
-
function invalidReexport(clazz, decl) {
|
|
1871
|
-
return makeDiagnostic(ErrorCode.NGMODULE_INVALID_REEXPORT, identifierOfNode(decl.node) || decl.node, `Present in the NgModule.exports of ${nodeNameForError(clazz)} but neither declared nor imported`);
|
|
1872
|
-
}
|
|
1873
|
-
function reexportCollision(module, refA, refB) {
|
|
1874
|
-
const childMessageText = `This directive/pipe is part of the exports of '${module.name.text}' and shares the same name as another exported directive/pipe.`;
|
|
1875
|
-
return makeDiagnostic(ErrorCode.NGMODULE_REEXPORT_NAME_COLLISION, module.name, `
|
|
1876
|
-
There was a name collision between two classes named '${refA.node.name.text}', which are both part of the exports of '${module.name.text}'.
|
|
1877
|
-
|
|
1878
|
-
Angular generates re-exports of an NgModule's exported directives/pipes from the module's source file in certain cases, using the declared name of the class. If two classes of the same name are exported, this automatic naming does not work.
|
|
1879
|
-
|
|
1880
|
-
To fix this problem please re-export one or both classes directly from this file.
|
|
1881
|
-
`.trim(), [
|
|
1882
|
-
makeRelatedInformation(refA.node.name, childMessageText),
|
|
1883
|
-
makeRelatedInformation(refB.node.name, childMessageText)
|
|
1884
|
-
]);
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
1888
|
-
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
1889
|
-
import ts9 from "typescript";
|
|
1890
|
-
var TypeCheckScopeRegistry = class {
|
|
1891
|
-
constructor(scopeReader, metaReader) {
|
|
1892
|
-
this.scopeReader = scopeReader;
|
|
1893
|
-
this.metaReader = metaReader;
|
|
1894
|
-
this.flattenedDirectiveMetaCache = /* @__PURE__ */ new Map();
|
|
1895
|
-
this.scopeCache = /* @__PURE__ */ new Map();
|
|
1896
|
-
}
|
|
1897
|
-
getTypeCheckScope(node) {
|
|
1898
|
-
const matcher = new SelectorMatcher();
|
|
1899
|
-
const directives = [];
|
|
1900
|
-
const pipes = /* @__PURE__ */ new Map();
|
|
1901
|
-
const scope = this.scopeReader.getScopeForComponent(node);
|
|
1902
|
-
if (scope === null) {
|
|
1903
|
-
return {
|
|
1904
|
-
matcher,
|
|
1905
|
-
directives,
|
|
1906
|
-
pipes,
|
|
1907
|
-
schemas: [],
|
|
1908
|
-
isPoisoned: false
|
|
1909
|
-
};
|
|
1910
|
-
}
|
|
1911
|
-
if (this.scopeCache.has(scope.ngModule)) {
|
|
1912
|
-
return this.scopeCache.get(scope.ngModule);
|
|
1913
|
-
}
|
|
1914
|
-
for (const meta of scope.compilation.directives) {
|
|
1915
|
-
if (meta.selector !== null) {
|
|
1916
|
-
const extMeta = this.getTypeCheckDirectiveMetadata(meta.ref);
|
|
1917
|
-
matcher.addSelectables(CssSelector.parse(meta.selector), extMeta);
|
|
1918
|
-
directives.push(extMeta);
|
|
1919
1946
|
}
|
|
1947
|
+
this.cache.set(clazz, {
|
|
1948
|
+
kind: ComponentScopeKind.Standalone,
|
|
1949
|
+
component: clazz,
|
|
1950
|
+
dependencies: Array.from(dependencies),
|
|
1951
|
+
isPoisoned,
|
|
1952
|
+
schemas: (_a = clazzMeta.schemas) != null ? _a : []
|
|
1953
|
+
});
|
|
1920
1954
|
}
|
|
1921
|
-
|
|
1922
|
-
if (!ts9.isClassDeclaration(ref.node)) {
|
|
1923
|
-
throw new Error(`Unexpected non-class declaration ${ts9.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
|
|
1924
|
-
}
|
|
1925
|
-
pipes.set(name, ref);
|
|
1926
|
-
}
|
|
1927
|
-
const typeCheckScope = {
|
|
1928
|
-
matcher,
|
|
1929
|
-
directives,
|
|
1930
|
-
pipes,
|
|
1931
|
-
schemas: scope.schemas,
|
|
1932
|
-
isPoisoned: scope.compilation.isPoisoned || scope.exported.isPoisoned
|
|
1933
|
-
};
|
|
1934
|
-
this.scopeCache.set(scope.ngModule, typeCheckScope);
|
|
1935
|
-
return typeCheckScope;
|
|
1955
|
+
return this.cache.get(clazz);
|
|
1936
1956
|
}
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
if (this.flattenedDirectiveMetaCache.has(clazz)) {
|
|
1940
|
-
return this.flattenedDirectiveMetaCache.get(clazz);
|
|
1941
|
-
}
|
|
1942
|
-
const meta = flattenInheritedDirectiveMetadata(this.metaReader, ref);
|
|
1943
|
-
this.flattenedDirectiveMetaCache.set(clazz, meta);
|
|
1944
|
-
return meta;
|
|
1957
|
+
getRemoteScope() {
|
|
1958
|
+
return null;
|
|
1945
1959
|
}
|
|
1946
1960
|
};
|
|
1947
1961
|
|
|
1948
|
-
// bazel-out/
|
|
1949
|
-
import { CssSelector
|
|
1962
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
1963
|
+
import { CssSelector, DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
1950
1964
|
|
|
1951
|
-
// bazel-out/
|
|
1952
|
-
import
|
|
1965
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
1966
|
+
import ts11 from "typescript";
|
|
1953
1967
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
1954
1968
|
if (mapping.type === "direct") {
|
|
1955
1969
|
let relatedInformation = void 0;
|
|
@@ -1957,7 +1971,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1957
1971
|
relatedInformation = [];
|
|
1958
1972
|
for (const relatedMessage of relatedMessages) {
|
|
1959
1973
|
relatedInformation.push({
|
|
1960
|
-
category:
|
|
1974
|
+
category: ts11.DiagnosticCategory.Message,
|
|
1961
1975
|
code: 0,
|
|
1962
1976
|
file: relatedMessage.sourceFile,
|
|
1963
1977
|
start: relatedMessage.start,
|
|
@@ -1982,12 +1996,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1982
1996
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
1983
1997
|
const componentName = mapping.componentClass.name.text;
|
|
1984
1998
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
1985
|
-
const sf =
|
|
1999
|
+
const sf = ts11.createSourceFile(fileName, mapping.template, ts11.ScriptTarget.Latest, false, ts11.ScriptKind.JSX);
|
|
1986
2000
|
let relatedInformation = [];
|
|
1987
2001
|
if (relatedMessages !== void 0) {
|
|
1988
2002
|
for (const relatedMessage of relatedMessages) {
|
|
1989
2003
|
relatedInformation.push({
|
|
1990
|
-
category:
|
|
2004
|
+
category: ts11.DiagnosticCategory.Message,
|
|
1991
2005
|
code: 0,
|
|
1992
2006
|
file: relatedMessage.sourceFile,
|
|
1993
2007
|
start: relatedMessage.start,
|
|
@@ -1997,7 +2011,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1997
2011
|
}
|
|
1998
2012
|
}
|
|
1999
2013
|
relatedInformation.push({
|
|
2000
|
-
category:
|
|
2014
|
+
category: ts11.DiagnosticCategory.Message,
|
|
2001
2015
|
code: 0,
|
|
2002
2016
|
file: componentSf,
|
|
2003
2017
|
start: mapping.node.getStart(),
|
|
@@ -2021,7 +2035,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2021
2035
|
}
|
|
2022
2036
|
}
|
|
2023
2037
|
|
|
2024
|
-
// bazel-out/
|
|
2038
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
2025
2039
|
var TEMPLATE_ID = Symbol("ngTemplateId");
|
|
2026
2040
|
var NEXT_TEMPLATE_ID = Symbol("ngNextTemplateId");
|
|
2027
2041
|
function getTemplateId(clazz) {
|
|
@@ -2038,17 +2052,17 @@ function allocateTemplateId(sf) {
|
|
|
2038
2052
|
return `tcb${sf[NEXT_TEMPLATE_ID]++}`;
|
|
2039
2053
|
}
|
|
2040
2054
|
|
|
2041
|
-
// bazel-out/
|
|
2055
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2042
2056
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2043
|
-
import
|
|
2057
|
+
import ts13 from "typescript";
|
|
2044
2058
|
|
|
2045
|
-
// bazel-out/
|
|
2059
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2046
2060
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2047
|
-
import
|
|
2061
|
+
import ts12 from "typescript";
|
|
2048
2062
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2049
2063
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2050
|
-
return
|
|
2051
|
-
if (kind !==
|
|
2064
|
+
return ts12.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2065
|
+
if (kind !== ts12.SyntaxKind.MultiLineCommentTrivia) {
|
|
2052
2066
|
return null;
|
|
2053
2067
|
}
|
|
2054
2068
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2071,15 +2085,15 @@ var ExpressionIdentifier;
|
|
|
2071
2085
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
2072
2086
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2073
2087
|
function addExpressionIdentifier(node, identifier) {
|
|
2074
|
-
|
|
2088
|
+
ts12.addSyntheticTrailingComment(node, ts12.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
2075
2089
|
}
|
|
2076
2090
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2077
2091
|
function markIgnoreDiagnostics(node) {
|
|
2078
|
-
|
|
2092
|
+
ts12.addSyntheticTrailingComment(node, ts12.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
2079
2093
|
}
|
|
2080
2094
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2081
|
-
return
|
|
2082
|
-
if (kind !==
|
|
2095
|
+
return ts12.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2096
|
+
if (kind !== ts12.SyntaxKind.MultiLineCommentTrivia) {
|
|
2083
2097
|
return null;
|
|
2084
2098
|
}
|
|
2085
2099
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2153,8 +2167,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2153
2167
|
return results;
|
|
2154
2168
|
}
|
|
2155
2169
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2156
|
-
return
|
|
2157
|
-
if (kind !==
|
|
2170
|
+
return ts12.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2171
|
+
if (kind !== ts12.SyntaxKind.MultiLineCommentTrivia) {
|
|
2158
2172
|
return false;
|
|
2159
2173
|
}
|
|
2160
2174
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2162,22 +2176,24 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
|
2162
2176
|
}) || false;
|
|
2163
2177
|
}
|
|
2164
2178
|
|
|
2165
|
-
// bazel-out/
|
|
2179
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2166
2180
|
var CompletionEngine = class {
|
|
2167
|
-
constructor(tcb, data,
|
|
2181
|
+
constructor(tcb, data, tcbPath, tcbIsShim) {
|
|
2168
2182
|
this.tcb = tcb;
|
|
2169
2183
|
this.data = data;
|
|
2170
|
-
this.
|
|
2184
|
+
this.tcbPath = tcbPath;
|
|
2185
|
+
this.tcbIsShim = tcbIsShim;
|
|
2171
2186
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2172
2187
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2173
2188
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2174
|
-
filter:
|
|
2189
|
+
filter: ts13.isPropertyAccessExpression,
|
|
2175
2190
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2176
2191
|
});
|
|
2177
2192
|
if (globalRead !== null) {
|
|
2178
2193
|
this.componentContext = {
|
|
2179
|
-
|
|
2180
|
-
|
|
2194
|
+
tcbPath: this.tcbPath,
|
|
2195
|
+
isShimFile: this.tcbIsShim,
|
|
2196
|
+
positionInFile: globalRead.name.getStart()
|
|
2181
2197
|
};
|
|
2182
2198
|
} else {
|
|
2183
2199
|
this.componentContext = null;
|
|
@@ -2194,25 +2210,27 @@ var CompletionEngine = class {
|
|
|
2194
2210
|
let nodeContext = null;
|
|
2195
2211
|
if (node instanceof EmptyExpr) {
|
|
2196
2212
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2197
|
-
filter:
|
|
2213
|
+
filter: ts13.isIdentifier,
|
|
2198
2214
|
withSpan: node.sourceSpan
|
|
2199
2215
|
});
|
|
2200
2216
|
if (nodeLocation !== null) {
|
|
2201
2217
|
nodeContext = {
|
|
2202
|
-
|
|
2203
|
-
|
|
2218
|
+
tcbPath: this.tcbPath,
|
|
2219
|
+
isShimFile: this.tcbIsShim,
|
|
2220
|
+
positionInFile: nodeLocation.getStart()
|
|
2204
2221
|
};
|
|
2205
2222
|
}
|
|
2206
2223
|
}
|
|
2207
2224
|
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2208
2225
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2209
|
-
filter:
|
|
2226
|
+
filter: ts13.isPropertyAccessExpression,
|
|
2210
2227
|
withSpan: node.sourceSpan
|
|
2211
2228
|
});
|
|
2212
2229
|
if (nodeLocation) {
|
|
2213
2230
|
nodeContext = {
|
|
2214
|
-
|
|
2215
|
-
|
|
2231
|
+
tcbPath: this.tcbPath,
|
|
2232
|
+
isShimFile: this.tcbIsShim,
|
|
2233
|
+
positionInFile: nodeLocation.getStart()
|
|
2216
2234
|
};
|
|
2217
2235
|
}
|
|
2218
2236
|
}
|
|
@@ -2229,21 +2247,21 @@ var CompletionEngine = class {
|
|
|
2229
2247
|
let tsExpr = null;
|
|
2230
2248
|
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2231
2249
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2232
|
-
filter:
|
|
2250
|
+
filter: ts13.isPropertyAccessExpression,
|
|
2233
2251
|
withSpan: expr.nameSpan
|
|
2234
2252
|
});
|
|
2235
2253
|
} else if (expr instanceof SafePropertyRead) {
|
|
2236
2254
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2237
|
-
filter:
|
|
2255
|
+
filter: ts13.isParenthesizedExpression,
|
|
2238
2256
|
withSpan: expr.sourceSpan
|
|
2239
2257
|
});
|
|
2240
|
-
if (ternaryExpr === null || !
|
|
2258
|
+
if (ternaryExpr === null || !ts13.isConditionalExpression(ternaryExpr.expression)) {
|
|
2241
2259
|
return null;
|
|
2242
2260
|
}
|
|
2243
2261
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2244
|
-
if (
|
|
2262
|
+
if (ts13.isPropertyAccessExpression(whenTrue)) {
|
|
2245
2263
|
tsExpr = whenTrue;
|
|
2246
|
-
} else if (
|
|
2264
|
+
} else if (ts13.isCallExpression(whenTrue) && ts13.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2247
2265
|
tsExpr = whenTrue.expression;
|
|
2248
2266
|
}
|
|
2249
2267
|
}
|
|
@@ -2251,8 +2269,9 @@ var CompletionEngine = class {
|
|
|
2251
2269
|
return null;
|
|
2252
2270
|
}
|
|
2253
2271
|
const res = {
|
|
2254
|
-
|
|
2255
|
-
|
|
2272
|
+
tcbPath: this.tcbPath,
|
|
2273
|
+
isShimFile: this.tcbIsShim,
|
|
2274
|
+
positionInFile: tsExpr.name.getEnd()
|
|
2256
2275
|
};
|
|
2257
2276
|
this.expressionCompletionCache.set(expr, res);
|
|
2258
2277
|
return res;
|
|
@@ -2264,15 +2283,15 @@ var CompletionEngine = class {
|
|
|
2264
2283
|
let tsExpr = null;
|
|
2265
2284
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2266
2285
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2267
|
-
filter:
|
|
2286
|
+
filter: ts13.isParenthesizedExpression,
|
|
2268
2287
|
withSpan: expr.sourceSpan
|
|
2269
2288
|
});
|
|
2270
|
-
if (strNode !== null &&
|
|
2289
|
+
if (strNode !== null && ts13.isStringLiteral(strNode.expression)) {
|
|
2271
2290
|
tsExpr = strNode.expression;
|
|
2272
2291
|
}
|
|
2273
2292
|
} else {
|
|
2274
2293
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2275
|
-
filter: (n) =>
|
|
2294
|
+
filter: (n) => ts13.isStringLiteral(n) || ts13.isNumericLiteral(n),
|
|
2276
2295
|
withSpan: expr.sourceSpan
|
|
2277
2296
|
});
|
|
2278
2297
|
}
|
|
@@ -2280,12 +2299,13 @@ var CompletionEngine = class {
|
|
|
2280
2299
|
return null;
|
|
2281
2300
|
}
|
|
2282
2301
|
let positionInShimFile = tsExpr.getEnd();
|
|
2283
|
-
if (
|
|
2302
|
+
if (ts13.isStringLiteral(tsExpr)) {
|
|
2284
2303
|
positionInShimFile -= 1;
|
|
2285
2304
|
}
|
|
2286
2305
|
const res = {
|
|
2287
|
-
|
|
2288
|
-
|
|
2306
|
+
tcbPath: this.tcbPath,
|
|
2307
|
+
isShimFile: this.tcbIsShim,
|
|
2308
|
+
positionInFile: positionInShimFile
|
|
2289
2309
|
};
|
|
2290
2310
|
this.expressionCompletionCache.set(expr, res);
|
|
2291
2311
|
return res;
|
|
@@ -2313,12 +2333,12 @@ var CompletionEngine = class {
|
|
|
2313
2333
|
}
|
|
2314
2334
|
};
|
|
2315
2335
|
|
|
2316
|
-
// bazel-out/
|
|
2317
|
-
import
|
|
2336
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2337
|
+
import ts27 from "typescript";
|
|
2318
2338
|
|
|
2319
|
-
// bazel-out/
|
|
2339
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2320
2340
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
2321
|
-
import
|
|
2341
|
+
import ts14 from "typescript";
|
|
2322
2342
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
2323
2343
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
2324
2344
|
var RegistryDomSchemaChecker = class {
|
|
@@ -2329,20 +2349,21 @@ var RegistryDomSchemaChecker = class {
|
|
|
2329
2349
|
get diagnostics() {
|
|
2330
2350
|
return this._diagnostics;
|
|
2331
2351
|
}
|
|
2332
|
-
checkElement(id, element, schemas) {
|
|
2352
|
+
checkElement(id, element, schemas, hostIsStandalone) {
|
|
2333
2353
|
const name = element.name.replace(REMOVE_XHTML_REGEX, "");
|
|
2334
2354
|
if (!REGISTRY.hasElement(name, schemas)) {
|
|
2335
2355
|
const mapping = this.resolver.getSourceMapping(id);
|
|
2356
|
+
const schemas2 = `'${hostIsStandalone ? "@Component" : "@NgModule"}.schemas'`;
|
|
2336
2357
|
let errorMsg = `'${name}' is not a known element:
|
|
2337
2358
|
`;
|
|
2338
|
-
errorMsg += `1. If '${name}' is an Angular component, then verify that it is part of this module.
|
|
2359
|
+
errorMsg += `1. If '${name}' is an Angular component, then verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "part of this module"}.
|
|
2339
2360
|
`;
|
|
2340
2361
|
if (name.indexOf("-") > -1) {
|
|
2341
|
-
errorMsg += `2. If '${name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the
|
|
2362
|
+
errorMsg += `2. If '${name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.`;
|
|
2342
2363
|
} else {
|
|
2343
|
-
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the
|
|
2364
|
+
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
2344
2365
|
}
|
|
2345
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
2366
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts14.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2346
2367
|
this._diagnostics.push(diag);
|
|
2347
2368
|
}
|
|
2348
2369
|
}
|
|
@@ -2360,70 +2381,74 @@ var RegistryDomSchemaChecker = class {
|
|
|
2360
2381
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
2361
2382
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2362
2383
|
}
|
|
2363
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
2384
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts14.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2364
2385
|
this._diagnostics.push(diag);
|
|
2365
2386
|
}
|
|
2366
2387
|
}
|
|
2367
2388
|
};
|
|
2368
2389
|
|
|
2369
|
-
// bazel-out/
|
|
2370
|
-
import { ExpressionType, ExternalExpr
|
|
2371
|
-
import
|
|
2390
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2391
|
+
import { ExpressionType, ExternalExpr, TypeModifier } from "@angular/compiler";
|
|
2392
|
+
import ts20 from "typescript";
|
|
2372
2393
|
|
|
2373
|
-
// bazel-out/
|
|
2374
|
-
import
|
|
2394
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2395
|
+
import ts15 from "typescript";
|
|
2396
|
+
var PARSED_TS_VERSION = parseFloat(ts15.versionMajorMinor);
|
|
2375
2397
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2398
|
+
ts15.SyntaxKind.ParenthesizedExpression,
|
|
2399
|
+
ts15.SyntaxKind.Identifier,
|
|
2400
|
+
ts15.SyntaxKind.CallExpression,
|
|
2401
|
+
ts15.SyntaxKind.NonNullExpression,
|
|
2402
|
+
ts15.SyntaxKind.ElementAccessExpression,
|
|
2403
|
+
ts15.SyntaxKind.PropertyAccessExpression,
|
|
2404
|
+
ts15.SyntaxKind.ArrayLiteralExpression,
|
|
2405
|
+
ts15.SyntaxKind.ObjectLiteralExpression,
|
|
2406
|
+
ts15.SyntaxKind.StringLiteral,
|
|
2407
|
+
ts15.SyntaxKind.NumericLiteral,
|
|
2408
|
+
ts15.SyntaxKind.TrueKeyword,
|
|
2409
|
+
ts15.SyntaxKind.FalseKeyword,
|
|
2410
|
+
ts15.SyntaxKind.NullKeyword,
|
|
2411
|
+
ts15.SyntaxKind.UndefinedKeyword
|
|
2390
2412
|
]);
|
|
2391
2413
|
function tsCastToAny(expr) {
|
|
2392
2414
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2393
|
-
expr =
|
|
2415
|
+
expr = ts15.factory.createParenthesizedExpression(expr);
|
|
2394
2416
|
}
|
|
2395
|
-
return
|
|
2417
|
+
return ts15.factory.createParenthesizedExpression(ts15.factory.createAsExpression(expr, ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.AnyKeyword)));
|
|
2396
2418
|
}
|
|
2397
2419
|
function tsCreateElement(tagName) {
|
|
2398
|
-
const createElement =
|
|
2399
|
-
return
|
|
2420
|
+
const createElement = ts15.factory.createPropertyAccessExpression(ts15.factory.createIdentifier("document"), "createElement");
|
|
2421
|
+
return ts15.factory.createCallExpression(createElement, void 0, [ts15.factory.createStringLiteral(tagName)]);
|
|
2400
2422
|
}
|
|
2401
2423
|
function tsDeclareVariable(id, type) {
|
|
2402
|
-
const decl =
|
|
2403
|
-
return
|
|
2424
|
+
const decl = ts15.factory.createVariableDeclaration(id, void 0, type, ts15.factory.createNonNullExpression(ts15.factory.createNull()));
|
|
2425
|
+
return ts15.factory.createVariableStatement(void 0, [decl]);
|
|
2404
2426
|
}
|
|
2405
2427
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2406
|
-
return
|
|
2428
|
+
return ts15.factory.createTypeQueryNode(ts15.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2407
2429
|
}
|
|
2408
2430
|
function tsCreateVariable(id, initializer) {
|
|
2409
|
-
const decl =
|
|
2410
|
-
return
|
|
2431
|
+
const decl = ts15.factory.createVariableDeclaration(id, void 0, void 0, initializer);
|
|
2432
|
+
return ts15.factory.createVariableStatement(void 0, [decl]);
|
|
2411
2433
|
}
|
|
2412
2434
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2413
|
-
const methodAccess =
|
|
2414
|
-
return
|
|
2435
|
+
const methodAccess = ts15.factory.createPropertyAccessExpression(receiver, methodName);
|
|
2436
|
+
return ts15.factory.createCallExpression(methodAccess, void 0, args);
|
|
2437
|
+
}
|
|
2438
|
+
function tsUpdateTypeParameterDeclaration(node, name, constraint, defaultType) {
|
|
2439
|
+
return PARSED_TS_VERSION < 4.7 ? ts15.factory.updateTypeParameterDeclaration(node, name, constraint, defaultType) : ts15.factory.updateTypeParameterDeclaration(node, [], name, constraint, defaultType);
|
|
2415
2440
|
}
|
|
2416
2441
|
function checkIfClassIsExported(node) {
|
|
2417
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
2442
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts15.SyntaxKind.ExportKeyword)) {
|
|
2418
2443
|
return true;
|
|
2419
|
-
} else if (node.parent !== void 0 &&
|
|
2444
|
+
} else if (node.parent !== void 0 && ts15.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
2420
2445
|
return true;
|
|
2421
2446
|
}
|
|
2422
2447
|
return false;
|
|
2423
2448
|
}
|
|
2424
2449
|
function checkIfFileHasExport(sf, name) {
|
|
2425
2450
|
for (const stmt of sf.statements) {
|
|
2426
|
-
if (
|
|
2451
|
+
if (ts15.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts15.isNamedExports(stmt.exportClause)) {
|
|
2427
2452
|
for (const element of stmt.exportClause.elements) {
|
|
2428
2453
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
2429
2454
|
return true;
|
|
@@ -2436,20 +2461,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
2436
2461
|
return false;
|
|
2437
2462
|
}
|
|
2438
2463
|
function isAccessExpression(node) {
|
|
2439
|
-
return
|
|
2464
|
+
return ts15.isPropertyAccessExpression(node) || ts15.isElementAccessExpression(node);
|
|
2440
2465
|
}
|
|
2441
2466
|
|
|
2442
|
-
// bazel-out/
|
|
2467
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2468
|
+
import ts19 from "typescript";
|
|
2469
|
+
|
|
2470
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2443
2471
|
import ts18 from "typescript";
|
|
2444
2472
|
|
|
2445
|
-
// bazel-out/
|
|
2473
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2446
2474
|
import ts17 from "typescript";
|
|
2447
2475
|
|
|
2448
|
-
// bazel-out/
|
|
2476
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2449
2477
|
import ts16 from "typescript";
|
|
2450
|
-
|
|
2451
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2452
|
-
import ts15 from "typescript";
|
|
2453
2478
|
var INELIGIBLE = {};
|
|
2454
2479
|
function canEmitType(type, canEmit) {
|
|
2455
2480
|
return canEmitTypeWorker(type);
|
|
@@ -2457,13 +2482,13 @@ function canEmitType(type, canEmit) {
|
|
|
2457
2482
|
return visitNode(type2) !== INELIGIBLE;
|
|
2458
2483
|
}
|
|
2459
2484
|
function visitNode(node) {
|
|
2460
|
-
if (
|
|
2485
|
+
if (ts16.isImportTypeNode(node)) {
|
|
2461
2486
|
return INELIGIBLE;
|
|
2462
2487
|
}
|
|
2463
|
-
if (
|
|
2488
|
+
if (ts16.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2464
2489
|
return INELIGIBLE;
|
|
2465
2490
|
} else {
|
|
2466
|
-
return
|
|
2491
|
+
return ts16.forEachChild(node, visitNode);
|
|
2467
2492
|
}
|
|
2468
2493
|
}
|
|
2469
2494
|
function canEmitTypeReference(type2) {
|
|
@@ -2480,22 +2505,22 @@ var TypeEmitter = class {
|
|
|
2480
2505
|
emitType(type) {
|
|
2481
2506
|
const typeReferenceTransformer = (context) => {
|
|
2482
2507
|
const visitNode = (node) => {
|
|
2483
|
-
if (
|
|
2508
|
+
if (ts16.isImportTypeNode(node)) {
|
|
2484
2509
|
throw new Error("Unable to emit import type");
|
|
2485
2510
|
}
|
|
2486
|
-
if (
|
|
2511
|
+
if (ts16.isTypeReferenceNode(node)) {
|
|
2487
2512
|
return this.emitTypeReference(node);
|
|
2488
|
-
} else if (
|
|
2489
|
-
const clone =
|
|
2490
|
-
|
|
2513
|
+
} else if (ts16.isLiteralExpression(node)) {
|
|
2514
|
+
const clone = ts16.getMutableClone(node);
|
|
2515
|
+
ts16.setTextRange(clone, { pos: -1, end: -1 });
|
|
2491
2516
|
return clone;
|
|
2492
2517
|
} else {
|
|
2493
|
-
return
|
|
2518
|
+
return ts16.visitEachChild(node, visitNode, context);
|
|
2494
2519
|
}
|
|
2495
2520
|
};
|
|
2496
|
-
return (node) =>
|
|
2521
|
+
return (node) => ts16.visitNode(node, visitNode);
|
|
2497
2522
|
};
|
|
2498
|
-
return
|
|
2523
|
+
return ts16.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2499
2524
|
}
|
|
2500
2525
|
emitTypeReference(type) {
|
|
2501
2526
|
const translatedType = this.translator(type);
|
|
@@ -2504,13 +2529,13 @@ var TypeEmitter = class {
|
|
|
2504
2529
|
}
|
|
2505
2530
|
let typeArguments = void 0;
|
|
2506
2531
|
if (type.typeArguments !== void 0) {
|
|
2507
|
-
typeArguments =
|
|
2532
|
+
typeArguments = ts16.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2508
2533
|
}
|
|
2509
|
-
return
|
|
2534
|
+
return ts16.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2510
2535
|
}
|
|
2511
2536
|
};
|
|
2512
2537
|
|
|
2513
|
-
// bazel-out/
|
|
2538
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2514
2539
|
var TypeParameterEmitter = class {
|
|
2515
2540
|
constructor(typeParameters, reflector) {
|
|
2516
2541
|
this.typeParameters = typeParameters;
|
|
@@ -2547,11 +2572,11 @@ var TypeParameterEmitter = class {
|
|
|
2547
2572
|
return this.typeParameters.map((typeParam) => {
|
|
2548
2573
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2549
2574
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2550
|
-
return
|
|
2575
|
+
return tsUpdateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2551
2576
|
});
|
|
2552
2577
|
}
|
|
2553
2578
|
resolveTypeReference(type) {
|
|
2554
|
-
const target =
|
|
2579
|
+
const target = ts17.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2555
2580
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2556
2581
|
if (declaration === null || declaration.node === null) {
|
|
2557
2582
|
return null;
|
|
@@ -2577,8 +2602,8 @@ var TypeParameterEmitter = class {
|
|
|
2577
2602
|
if (typeNode === null) {
|
|
2578
2603
|
return null;
|
|
2579
2604
|
}
|
|
2580
|
-
if (!
|
|
2581
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2605
|
+
if (!ts17.isTypeReferenceNode(typeNode)) {
|
|
2606
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts17.SyntaxKind[typeNode.kind]}.`);
|
|
2582
2607
|
}
|
|
2583
2608
|
return typeNode;
|
|
2584
2609
|
}
|
|
@@ -2587,7 +2612,7 @@ var TypeParameterEmitter = class {
|
|
|
2587
2612
|
}
|
|
2588
2613
|
};
|
|
2589
2614
|
|
|
2590
|
-
// bazel-out/
|
|
2615
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2591
2616
|
var TcbInliningRequirement;
|
|
2592
2617
|
(function(TcbInliningRequirement2) {
|
|
2593
2618
|
TcbInliningRequirement2[TcbInliningRequirement2["MustInline"] = 0] = "MustInline";
|
|
@@ -2620,14 +2645,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2620
2645
|
}
|
|
2621
2646
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2622
2647
|
for (const stmt of file.statements) {
|
|
2623
|
-
if (
|
|
2648
|
+
if (ts18.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2624
2649
|
return stmt;
|
|
2625
2650
|
}
|
|
2626
2651
|
}
|
|
2627
2652
|
return null;
|
|
2628
2653
|
}
|
|
2629
2654
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2630
|
-
while (node !== void 0 && !
|
|
2655
|
+
while (node !== void 0 && !ts18.isFunctionDeclaration(node)) {
|
|
2631
2656
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2632
2657
|
return null;
|
|
2633
2658
|
}
|
|
@@ -2644,7 +2669,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
2644
2669
|
return null;
|
|
2645
2670
|
}
|
|
2646
2671
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
2647
|
-
while (!
|
|
2672
|
+
while (!ts18.isFunctionDeclaration(node)) {
|
|
2648
2673
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
2649
2674
|
return null;
|
|
2650
2675
|
}
|
|
@@ -2654,8 +2679,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
2654
2679
|
}
|
|
2655
2680
|
}
|
|
2656
2681
|
const start = node.getFullStart();
|
|
2657
|
-
return
|
|
2658
|
-
if (kind !==
|
|
2682
|
+
return ts18.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2683
|
+
if (kind !== ts18.SyntaxKind.MultiLineCommentTrivia) {
|
|
2659
2684
|
return null;
|
|
2660
2685
|
}
|
|
2661
2686
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2667,32 +2692,32 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
2667
2692
|
return emitter.canEmit((ref) => env.canReferenceType(ref));
|
|
2668
2693
|
}
|
|
2669
2694
|
|
|
2670
|
-
// bazel-out/
|
|
2695
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2671
2696
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
2672
2697
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
2673
|
-
const rawType =
|
|
2698
|
+
const rawType = ts19.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
2674
2699
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2675
2700
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
2676
2701
|
if (meta.body) {
|
|
2677
|
-
const fnType =
|
|
2678
|
-
const decl =
|
|
2679
|
-
const declList =
|
|
2680
|
-
return
|
|
2702
|
+
const fnType = ts19.factory.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2703
|
+
const decl = ts19.factory.createVariableDeclaration(meta.fnName, void 0, fnType, ts19.factory.createNonNullExpression(ts19.factory.createNull()));
|
|
2704
|
+
const declList = ts19.factory.createVariableDeclarationList([decl], ts19.NodeFlags.Const);
|
|
2705
|
+
return ts19.factory.createVariableStatement(void 0, declList);
|
|
2681
2706
|
} else {
|
|
2682
|
-
return
|
|
2707
|
+
return ts19.factory.createFunctionDeclaration(void 0, [ts19.factory.createModifier(ts19.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
2683
2708
|
}
|
|
2684
2709
|
}
|
|
2685
2710
|
function generateInlineTypeCtor(node, meta) {
|
|
2686
2711
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
2687
|
-
const rawType =
|
|
2712
|
+
const rawType = ts19.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
2688
2713
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2689
2714
|
let body = void 0;
|
|
2690
2715
|
if (meta.body) {
|
|
2691
|
-
body =
|
|
2692
|
-
|
|
2716
|
+
body = ts19.factory.createBlock([
|
|
2717
|
+
ts19.factory.createReturnStatement(ts19.factory.createNonNullExpression(ts19.factory.createNull()))
|
|
2693
2718
|
]);
|
|
2694
2719
|
}
|
|
2695
|
-
return
|
|
2720
|
+
return ts19.factory.createMethodDeclaration(void 0, [ts19.factory.createModifier(ts19.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
2696
2721
|
}
|
|
2697
2722
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
2698
2723
|
let initType = null;
|
|
@@ -2701,26 +2726,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2701
2726
|
const coercedKeys = [];
|
|
2702
2727
|
for (const key of keys) {
|
|
2703
2728
|
if (!meta.coercedInputFields.has(key)) {
|
|
2704
|
-
plainKeys.push(
|
|
2729
|
+
plainKeys.push(ts19.factory.createLiteralTypeNode(ts19.factory.createStringLiteral(key)));
|
|
2705
2730
|
} else {
|
|
2706
|
-
coercedKeys.push(
|
|
2731
|
+
coercedKeys.push(ts19.factory.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key)));
|
|
2707
2732
|
}
|
|
2708
2733
|
}
|
|
2709
2734
|
if (plainKeys.length > 0) {
|
|
2710
|
-
const keyTypeUnion =
|
|
2711
|
-
initType =
|
|
2735
|
+
const keyTypeUnion = ts19.factory.createUnionTypeNode(plainKeys);
|
|
2736
|
+
initType = ts19.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
2712
2737
|
}
|
|
2713
2738
|
if (coercedKeys.length > 0) {
|
|
2714
|
-
const coercedLiteral =
|
|
2715
|
-
initType = initType !== null ?
|
|
2739
|
+
const coercedLiteral = ts19.factory.createTypeLiteralNode(coercedKeys);
|
|
2740
|
+
initType = initType !== null ? ts19.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
2716
2741
|
}
|
|
2717
2742
|
if (initType === null) {
|
|
2718
|
-
initType =
|
|
2743
|
+
initType = ts19.factory.createTypeLiteralNode([]);
|
|
2719
2744
|
}
|
|
2720
|
-
return
|
|
2745
|
+
return ts19.factory.createParameterDeclaration(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
2721
2746
|
}
|
|
2722
2747
|
function generateGenericArgs(params) {
|
|
2723
|
-
return params.map((param) =>
|
|
2748
|
+
return params.map((param) => ts19.factory.createTypeReferenceNode(param.name, void 0));
|
|
2724
2749
|
}
|
|
2725
2750
|
function requiresInlineTypeCtor(node, host, env) {
|
|
2726
2751
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -2731,14 +2756,14 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
2731
2756
|
}
|
|
2732
2757
|
return params.map((param) => {
|
|
2733
2758
|
if (param.default === void 0) {
|
|
2734
|
-
return
|
|
2759
|
+
return tsUpdateTypeParameterDeclaration(param, param.name, param.constraint, ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.AnyKeyword));
|
|
2735
2760
|
} else {
|
|
2736
2761
|
return param;
|
|
2737
2762
|
}
|
|
2738
2763
|
});
|
|
2739
2764
|
}
|
|
2740
2765
|
|
|
2741
|
-
// bazel-out/
|
|
2766
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2742
2767
|
var Environment = class {
|
|
2743
2768
|
constructor(config, importManager, refEmitter, reflector, contextFile) {
|
|
2744
2769
|
this.config = config;
|
|
@@ -2763,13 +2788,13 @@ var Environment = class {
|
|
|
2763
2788
|
}
|
|
2764
2789
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
2765
2790
|
const ref = this.reference(dirRef);
|
|
2766
|
-
const typeCtorExpr =
|
|
2791
|
+
const typeCtorExpr = ts20.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
2767
2792
|
this.typeCtors.set(node, typeCtorExpr);
|
|
2768
2793
|
return typeCtorExpr;
|
|
2769
2794
|
} else {
|
|
2770
2795
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
2771
2796
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
2772
|
-
if (!
|
|
2797
|
+
if (!ts20.isTypeReferenceNode(nodeTypeRef)) {
|
|
2773
2798
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
2774
2799
|
}
|
|
2775
2800
|
const meta = {
|
|
@@ -2785,7 +2810,7 @@ var Environment = class {
|
|
|
2785
2810
|
const typeParams = this.emitTypeParameters(node);
|
|
2786
2811
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
2787
2812
|
this.typeCtorStatements.push(typeCtor);
|
|
2788
|
-
const fnId =
|
|
2813
|
+
const fnId = ts20.factory.createIdentifier(fnName);
|
|
2789
2814
|
this.typeCtors.set(node, fnId);
|
|
2790
2815
|
return fnId;
|
|
2791
2816
|
}
|
|
@@ -2795,7 +2820,7 @@ var Environment = class {
|
|
|
2795
2820
|
return this.pipeInsts.get(ref.node);
|
|
2796
2821
|
}
|
|
2797
2822
|
const pipeType = this.referenceType(ref);
|
|
2798
|
-
const pipeInstId =
|
|
2823
|
+
const pipeInstId = ts20.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
2799
2824
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
2800
2825
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
2801
2826
|
return pipeInstId;
|
|
@@ -2819,7 +2844,7 @@ var Environment = class {
|
|
|
2819
2844
|
return emitter.emit((ref) => this.referenceType(ref));
|
|
2820
2845
|
}
|
|
2821
2846
|
referenceExternalType(moduleName, name, typeParams) {
|
|
2822
|
-
const external = new
|
|
2847
|
+
const external = new ExternalExpr({ moduleName, name });
|
|
2823
2848
|
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.importManager);
|
|
2824
2849
|
}
|
|
2825
2850
|
getPreludeStatements() {
|
|
@@ -2830,9 +2855,9 @@ var Environment = class {
|
|
|
2830
2855
|
}
|
|
2831
2856
|
};
|
|
2832
2857
|
|
|
2833
|
-
// bazel-out/
|
|
2858
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
2834
2859
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
2835
|
-
import
|
|
2860
|
+
import ts21 from "typescript";
|
|
2836
2861
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
2837
2862
|
constructor(resolver) {
|
|
2838
2863
|
this.resolver = resolver;
|
|
@@ -2846,7 +2871,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2846
2871
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2847
2872
|
const value = ref.value.trim();
|
|
2848
2873
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
2849
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2874
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
2850
2875
|
}
|
|
2851
2876
|
missingPipe(templateId, ast) {
|
|
2852
2877
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -2858,7 +2883,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2858
2883
|
if (sourceSpan === null) {
|
|
2859
2884
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
2860
2885
|
}
|
|
2861
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2886
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
2862
2887
|
this.recordedPipes.add(ast);
|
|
2863
2888
|
}
|
|
2864
2889
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -2869,7 +2894,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2869
2894
|
if (sourceSpan === null) {
|
|
2870
2895
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
2871
2896
|
}
|
|
2872
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2897
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
2873
2898
|
text: `The variable ${assignment.name} is declared here.`,
|
|
2874
2899
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
2875
2900
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -2879,7 +2904,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2879
2904
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
2880
2905
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2881
2906
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
2882
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
2907
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
2883
2908
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
2884
2909
|
start: firstDecl.sourceSpan.start.offset,
|
|
2885
2910
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -2918,7 +2943,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2918
2943
|
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.
|
|
2919
2944
|
|
|
2920
2945
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
2921
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
2946
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts21.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
2922
2947
|
}
|
|
2923
2948
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
2924
2949
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -2952,7 +2977,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
2952
2977
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
2953
2978
|
});
|
|
2954
2979
|
}
|
|
2955
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2980
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
2956
2981
|
}
|
|
2957
2982
|
};
|
|
2958
2983
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -2962,8 +2987,8 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
2962
2987
|
});
|
|
2963
2988
|
}
|
|
2964
2989
|
|
|
2965
|
-
// bazel-out/
|
|
2966
|
-
import
|
|
2990
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
2991
|
+
import ts22 from "typescript";
|
|
2967
2992
|
var TypeCheckShimGenerator = class {
|
|
2968
2993
|
constructor() {
|
|
2969
2994
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -2973,25 +2998,25 @@ var TypeCheckShimGenerator = class {
|
|
|
2973
2998
|
if (priorShimSf !== null) {
|
|
2974
2999
|
return priorShimSf;
|
|
2975
3000
|
}
|
|
2976
|
-
return
|
|
3001
|
+
return ts22.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts22.ScriptTarget.Latest, true, ts22.ScriptKind.TS);
|
|
2977
3002
|
}
|
|
2978
3003
|
static shimFor(fileName) {
|
|
2979
3004
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
2980
3005
|
}
|
|
2981
3006
|
};
|
|
2982
3007
|
|
|
2983
|
-
// bazel-out/
|
|
3008
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
2984
3009
|
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, SafeCall, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
2985
|
-
import
|
|
3010
|
+
import ts25 from "typescript";
|
|
2986
3011
|
|
|
2987
|
-
// bazel-out/
|
|
3012
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
2988
3013
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
2989
|
-
import
|
|
3014
|
+
import ts23 from "typescript";
|
|
2990
3015
|
function wrapForDiagnostics(expr) {
|
|
2991
|
-
return
|
|
3016
|
+
return ts23.factory.createParenthesizedExpression(expr);
|
|
2992
3017
|
}
|
|
2993
3018
|
function wrapForTypeChecker(expr) {
|
|
2994
|
-
return
|
|
3019
|
+
return ts23.factory.createParenthesizedExpression(expr);
|
|
2995
3020
|
}
|
|
2996
3021
|
function addParseSpanInfo(node, span) {
|
|
2997
3022
|
let commentText;
|
|
@@ -3000,10 +3025,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3000
3025
|
} else {
|
|
3001
3026
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3002
3027
|
}
|
|
3003
|
-
|
|
3028
|
+
ts23.addSyntheticTrailingComment(node, ts23.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3004
3029
|
}
|
|
3005
3030
|
function addTemplateId(tcb, id) {
|
|
3006
|
-
|
|
3031
|
+
ts23.addSyntheticLeadingComment(tcb, ts23.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3007
3032
|
}
|
|
3008
3033
|
function shouldReportDiagnostic(diagnostic) {
|
|
3009
3034
|
const { code } = diagnostic;
|
|
@@ -3030,34 +3055,34 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3030
3055
|
return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
|
|
3031
3056
|
}
|
|
3032
3057
|
|
|
3033
|
-
// bazel-out/
|
|
3058
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3034
3059
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3035
|
-
import
|
|
3036
|
-
var NULL_AS_ANY =
|
|
3037
|
-
var UNDEFINED =
|
|
3060
|
+
import ts24 from "typescript";
|
|
3061
|
+
var NULL_AS_ANY = ts24.factory.createAsExpression(ts24.factory.createNull(), ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3062
|
+
var UNDEFINED = ts24.factory.createIdentifier("undefined");
|
|
3038
3063
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3039
|
-
["+",
|
|
3040
|
-
["-",
|
|
3064
|
+
["+", ts24.SyntaxKind.PlusToken],
|
|
3065
|
+
["-", ts24.SyntaxKind.MinusToken]
|
|
3041
3066
|
]);
|
|
3042
3067
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3043
|
-
["+",
|
|
3044
|
-
["-",
|
|
3045
|
-
["<",
|
|
3046
|
-
[">",
|
|
3047
|
-
["<=",
|
|
3048
|
-
[">=",
|
|
3049
|
-
["==",
|
|
3050
|
-
["===",
|
|
3051
|
-
["*",
|
|
3052
|
-
["/",
|
|
3053
|
-
["%",
|
|
3054
|
-
["!=",
|
|
3055
|
-
["!==",
|
|
3056
|
-
["||",
|
|
3057
|
-
["&&",
|
|
3058
|
-
["&",
|
|
3059
|
-
["|",
|
|
3060
|
-
["??",
|
|
3068
|
+
["+", ts24.SyntaxKind.PlusToken],
|
|
3069
|
+
["-", ts24.SyntaxKind.MinusToken],
|
|
3070
|
+
["<", ts24.SyntaxKind.LessThanToken],
|
|
3071
|
+
[">", ts24.SyntaxKind.GreaterThanToken],
|
|
3072
|
+
["<=", ts24.SyntaxKind.LessThanEqualsToken],
|
|
3073
|
+
[">=", ts24.SyntaxKind.GreaterThanEqualsToken],
|
|
3074
|
+
["==", ts24.SyntaxKind.EqualsEqualsToken],
|
|
3075
|
+
["===", ts24.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3076
|
+
["*", ts24.SyntaxKind.AsteriskToken],
|
|
3077
|
+
["/", ts24.SyntaxKind.SlashToken],
|
|
3078
|
+
["%", ts24.SyntaxKind.PercentToken],
|
|
3079
|
+
["!=", ts24.SyntaxKind.ExclamationEqualsToken],
|
|
3080
|
+
["!==", ts24.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3081
|
+
["||", ts24.SyntaxKind.BarBarToken],
|
|
3082
|
+
["&&", ts24.SyntaxKind.AmpersandAmpersandToken],
|
|
3083
|
+
["&", ts24.SyntaxKind.AmpersandToken],
|
|
3084
|
+
["|", ts24.SyntaxKind.BarToken],
|
|
3085
|
+
["??", ts24.SyntaxKind.QuestionQuestionToken]
|
|
3061
3086
|
]);
|
|
3062
3087
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3063
3088
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3073,7 +3098,7 @@ var AstTranslator = class {
|
|
|
3073
3098
|
ast = ast.ast;
|
|
3074
3099
|
}
|
|
3075
3100
|
if (ast instanceof EmptyExpr2) {
|
|
3076
|
-
const res =
|
|
3101
|
+
const res = ts24.factory.createIdentifier("undefined");
|
|
3077
3102
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3078
3103
|
return res;
|
|
3079
3104
|
}
|
|
@@ -3089,7 +3114,7 @@ var AstTranslator = class {
|
|
|
3089
3114
|
if (op === void 0) {
|
|
3090
3115
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3091
3116
|
}
|
|
3092
|
-
const node = wrapForDiagnostics(
|
|
3117
|
+
const node = wrapForDiagnostics(ts24.factory.createPrefixUnaryExpression(op, expr));
|
|
3093
3118
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3094
3119
|
return node;
|
|
3095
3120
|
}
|
|
@@ -3100,13 +3125,13 @@ var AstTranslator = class {
|
|
|
3100
3125
|
if (op === void 0) {
|
|
3101
3126
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3102
3127
|
}
|
|
3103
|
-
const node =
|
|
3128
|
+
const node = ts24.factory.createBinaryExpression(lhs, op, rhs);
|
|
3104
3129
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3105
3130
|
return node;
|
|
3106
3131
|
}
|
|
3107
3132
|
visitChain(ast) {
|
|
3108
3133
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3109
|
-
const node = wrapForDiagnostics(
|
|
3134
|
+
const node = wrapForDiagnostics(ts24.factory.createCommaListExpression(elements));
|
|
3110
3135
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3111
3136
|
return node;
|
|
3112
3137
|
}
|
|
@@ -3114,7 +3139,7 @@ var AstTranslator = class {
|
|
|
3114
3139
|
const condExpr = this.translate(ast.condition);
|
|
3115
3140
|
const trueExpr = this.translate(ast.trueExp);
|
|
3116
3141
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3117
|
-
const node =
|
|
3142
|
+
const node = ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
3118
3143
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3119
3144
|
return node;
|
|
3120
3145
|
}
|
|
@@ -3125,26 +3150,26 @@ var AstTranslator = class {
|
|
|
3125
3150
|
throw new Error("Method not implemented.");
|
|
3126
3151
|
}
|
|
3127
3152
|
visitInterpolation(ast) {
|
|
3128
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3153
|
+
return ast.expressions.reduce((lhs, ast2) => ts24.factory.createBinaryExpression(lhs, ts24.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts24.factory.createStringLiteral(""));
|
|
3129
3154
|
}
|
|
3130
3155
|
visitKeyedRead(ast) {
|
|
3131
3156
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3132
3157
|
const key = this.translate(ast.key);
|
|
3133
|
-
const node =
|
|
3158
|
+
const node = ts24.factory.createElementAccessExpression(receiver, key);
|
|
3134
3159
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3135
3160
|
return node;
|
|
3136
3161
|
}
|
|
3137
3162
|
visitKeyedWrite(ast) {
|
|
3138
3163
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3139
|
-
const left =
|
|
3164
|
+
const left = ts24.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
3140
3165
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3141
|
-
const node = wrapForDiagnostics(
|
|
3166
|
+
const node = wrapForDiagnostics(ts24.factory.createBinaryExpression(left, ts24.SyntaxKind.EqualsToken, right));
|
|
3142
3167
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3143
3168
|
return node;
|
|
3144
3169
|
}
|
|
3145
3170
|
visitLiteralArray(ast) {
|
|
3146
3171
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3147
|
-
const literal =
|
|
3172
|
+
const literal = ts24.factory.createArrayLiteralExpression(elements);
|
|
3148
3173
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3149
3174
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3150
3175
|
return node;
|
|
@@ -3152,9 +3177,9 @@ var AstTranslator = class {
|
|
|
3152
3177
|
visitLiteralMap(ast) {
|
|
3153
3178
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3154
3179
|
const value = this.translate(ast.values[idx]);
|
|
3155
|
-
return
|
|
3180
|
+
return ts24.factory.createPropertyAssignment(ts24.factory.createStringLiteral(key), value);
|
|
3156
3181
|
});
|
|
3157
|
-
const literal =
|
|
3182
|
+
const literal = ts24.factory.createObjectLiteralExpression(properties, true);
|
|
3158
3183
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3159
3184
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3160
3185
|
return node;
|
|
@@ -3162,15 +3187,15 @@ var AstTranslator = class {
|
|
|
3162
3187
|
visitLiteralPrimitive(ast) {
|
|
3163
3188
|
let node;
|
|
3164
3189
|
if (ast.value === void 0) {
|
|
3165
|
-
node =
|
|
3190
|
+
node = ts24.factory.createIdentifier("undefined");
|
|
3166
3191
|
} else if (ast.value === null) {
|
|
3167
|
-
node =
|
|
3192
|
+
node = ts24.factory.createNull();
|
|
3168
3193
|
} else if (typeof ast.value === "string") {
|
|
3169
|
-
node =
|
|
3194
|
+
node = ts24.factory.createStringLiteral(ast.value);
|
|
3170
3195
|
} else if (typeof ast.value === "number") {
|
|
3171
|
-
node =
|
|
3196
|
+
node = ts24.factory.createNumericLiteral(ast.value);
|
|
3172
3197
|
} else if (typeof ast.value === "boolean") {
|
|
3173
|
-
node = ast.value ?
|
|
3198
|
+
node = ast.value ? ts24.factory.createTrue() : ts24.factory.createFalse();
|
|
3174
3199
|
} else {
|
|
3175
3200
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
3176
3201
|
}
|
|
@@ -3179,7 +3204,7 @@ var AstTranslator = class {
|
|
|
3179
3204
|
}
|
|
3180
3205
|
visitNonNullAssert(ast) {
|
|
3181
3206
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3182
|
-
const node =
|
|
3207
|
+
const node = ts24.factory.createNonNullExpression(expr);
|
|
3183
3208
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3184
3209
|
return node;
|
|
3185
3210
|
}
|
|
@@ -3188,13 +3213,13 @@ var AstTranslator = class {
|
|
|
3188
3213
|
}
|
|
3189
3214
|
visitPrefixNot(ast) {
|
|
3190
3215
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3191
|
-
const node =
|
|
3216
|
+
const node = ts24.factory.createLogicalNot(expression);
|
|
3192
3217
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3193
3218
|
return node;
|
|
3194
3219
|
}
|
|
3195
3220
|
visitPropertyRead(ast) {
|
|
3196
3221
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3197
|
-
const name =
|
|
3222
|
+
const name = ts24.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3198
3223
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3199
3224
|
const node = wrapForDiagnostics(name);
|
|
3200
3225
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3202,12 +3227,12 @@ var AstTranslator = class {
|
|
|
3202
3227
|
}
|
|
3203
3228
|
visitPropertyWrite(ast) {
|
|
3204
3229
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3205
|
-
const left =
|
|
3230
|
+
const left = ts24.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3206
3231
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3207
3232
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3208
3233
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3209
3234
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3210
|
-
const node = wrapForDiagnostics(
|
|
3235
|
+
const node = wrapForDiagnostics(ts24.factory.createBinaryExpression(leftWithPath, ts24.SyntaxKind.EqualsToken, right));
|
|
3211
3236
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3212
3237
|
return node;
|
|
3213
3238
|
}
|
|
@@ -3215,13 +3240,13 @@ var AstTranslator = class {
|
|
|
3215
3240
|
let node;
|
|
3216
3241
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3217
3242
|
if (this.config.strictSafeNavigationTypes) {
|
|
3218
|
-
const expr =
|
|
3243
|
+
const expr = ts24.factory.createPropertyAccessExpression(ts24.factory.createNonNullExpression(receiver), ast.name);
|
|
3219
3244
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3220
|
-
node =
|
|
3245
|
+
node = ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3221
3246
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3222
|
-
node =
|
|
3247
|
+
node = ts24.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
3223
3248
|
} else {
|
|
3224
|
-
const expr =
|
|
3249
|
+
const expr = ts24.factory.createPropertyAccessExpression(ts24.factory.createNonNullExpression(receiver), ast.name);
|
|
3225
3250
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3226
3251
|
node = tsCastToAny(expr);
|
|
3227
3252
|
}
|
|
@@ -3233,13 +3258,13 @@ var AstTranslator = class {
|
|
|
3233
3258
|
const key = this.translate(ast.key);
|
|
3234
3259
|
let node;
|
|
3235
3260
|
if (this.config.strictSafeNavigationTypes) {
|
|
3236
|
-
const expr =
|
|
3261
|
+
const expr = ts24.factory.createElementAccessExpression(ts24.factory.createNonNullExpression(receiver), key);
|
|
3237
3262
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3238
|
-
node =
|
|
3263
|
+
node = ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3239
3264
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3240
|
-
node =
|
|
3265
|
+
node = ts24.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
3241
3266
|
} else {
|
|
3242
|
-
const expr =
|
|
3267
|
+
const expr = ts24.factory.createElementAccessExpression(ts24.factory.createNonNullExpression(receiver), key);
|
|
3243
3268
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3244
3269
|
node = tsCastToAny(expr);
|
|
3245
3270
|
}
|
|
@@ -3256,7 +3281,7 @@ var AstTranslator = class {
|
|
|
3256
3281
|
expr = resolved;
|
|
3257
3282
|
} else {
|
|
3258
3283
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3259
|
-
expr =
|
|
3284
|
+
expr = ts24.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
3260
3285
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3261
3286
|
}
|
|
3262
3287
|
} else {
|
|
@@ -3266,7 +3291,7 @@ var AstTranslator = class {
|
|
|
3266
3291
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3267
3292
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3268
3293
|
} else {
|
|
3269
|
-
node =
|
|
3294
|
+
node = ts24.factory.createCallExpression(expr, void 0, args);
|
|
3270
3295
|
}
|
|
3271
3296
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3272
3297
|
return node;
|
|
@@ -3280,13 +3305,13 @@ var AstTranslator = class {
|
|
|
3280
3305
|
}
|
|
3281
3306
|
convertToSafeCall(ast, expr, args) {
|
|
3282
3307
|
if (this.config.strictSafeNavigationTypes) {
|
|
3283
|
-
const call =
|
|
3284
|
-
return
|
|
3308
|
+
const call = ts24.factory.createCallExpression(ts24.factory.createNonNullExpression(expr), void 0, args);
|
|
3309
|
+
return ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
3285
3310
|
}
|
|
3286
3311
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3287
|
-
return
|
|
3312
|
+
return ts24.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
3288
3313
|
}
|
|
3289
|
-
return tsCastToAny(
|
|
3314
|
+
return tsCastToAny(ts24.factory.createCallExpression(ts24.factory.createNonNullExpression(expr), void 0, args));
|
|
3290
3315
|
}
|
|
3291
3316
|
};
|
|
3292
3317
|
var VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3360,7 +3385,7 @@ var VeSafeLhsInferenceBugDetector = class {
|
|
|
3360
3385
|
};
|
|
3361
3386
|
VeSafeLhsInferenceBugDetector.SINGLETON = new VeSafeLhsInferenceBugDetector();
|
|
3362
3387
|
|
|
3363
|
-
// bazel-out/
|
|
3388
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.mjs
|
|
3364
3389
|
import { ImplicitReceiver as ImplicitReceiver3, RecursiveAstVisitor as RecursiveAstVisitor2, TmplAstVariable } from "@angular/compiler";
|
|
3365
3390
|
var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
3366
3391
|
constructor(templateId, boundTarget, oob) {
|
|
@@ -3384,7 +3409,7 @@ var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
|
3384
3409
|
}
|
|
3385
3410
|
};
|
|
3386
3411
|
|
|
3387
|
-
// bazel-out/
|
|
3412
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3388
3413
|
var TcbGenericContextBehavior;
|
|
3389
3414
|
(function(TcbGenericContextBehavior2) {
|
|
3390
3415
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
@@ -3392,10 +3417,10 @@ var TcbGenericContextBehavior;
|
|
|
3392
3417
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
3393
3418
|
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
3394
3419
|
function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
3395
|
-
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
3420
|
+
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone);
|
|
3396
3421
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3397
3422
|
const ctxRawType = env.referenceType(ref);
|
|
3398
|
-
if (!
|
|
3423
|
+
if (!ts25.isTypeReferenceNode(ctxRawType)) {
|
|
3399
3424
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3400
3425
|
}
|
|
3401
3426
|
let typeParameters = void 0;
|
|
@@ -3407,25 +3432,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3407
3432
|
switch (genericContextBehavior) {
|
|
3408
3433
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3409
3434
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3410
|
-
typeArguments = typeParameters.map((param) =>
|
|
3435
|
+
typeArguments = typeParameters.map((param) => ts25.factory.createTypeReferenceNode(param.name));
|
|
3411
3436
|
break;
|
|
3412
3437
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3413
3438
|
typeParameters = [...ref.node.typeParameters];
|
|
3414
|
-
typeArguments = typeParameters.map((param) =>
|
|
3439
|
+
typeArguments = typeParameters.map((param) => ts25.factory.createTypeReferenceNode(param.name));
|
|
3415
3440
|
break;
|
|
3416
3441
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3417
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3442
|
+
typeArguments = ref.node.typeParameters.map(() => ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3418
3443
|
break;
|
|
3419
3444
|
}
|
|
3420
3445
|
}
|
|
3421
|
-
const paramList = [
|
|
3446
|
+
const paramList = [tcbThisParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3422
3447
|
const scopeStatements = scope.render();
|
|
3423
|
-
const innerBody =
|
|
3448
|
+
const innerBody = ts25.factory.createBlock([
|
|
3424
3449
|
...env.getPreludeStatements(),
|
|
3425
3450
|
...scopeStatements
|
|
3426
3451
|
]);
|
|
3427
|
-
const body =
|
|
3428
|
-
const fnDecl =
|
|
3452
|
+
const body = ts25.factory.createBlock([ts25.factory.createIfStatement(ts25.factory.createTrue(), innerBody, void 0)]);
|
|
3453
|
+
const fnDecl = ts25.factory.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3429
3454
|
addTemplateId(fnDecl, meta.id);
|
|
3430
3455
|
return fnDecl;
|
|
3431
3456
|
}
|
|
@@ -3466,7 +3491,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3466
3491
|
execute() {
|
|
3467
3492
|
const ctx = this.scope.resolve(this.template);
|
|
3468
3493
|
const id = this.tcb.allocateId();
|
|
3469
|
-
const initializer =
|
|
3494
|
+
const initializer = ts25.factory.createPropertyAccessExpression(ctx, this.variable.value || "$implicit");
|
|
3470
3495
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3471
3496
|
let variable;
|
|
3472
3497
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3489,7 +3514,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3489
3514
|
}
|
|
3490
3515
|
execute() {
|
|
3491
3516
|
const ctx = this.tcb.allocateId();
|
|
3492
|
-
const type =
|
|
3517
|
+
const type = ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword);
|
|
3493
3518
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3494
3519
|
return ctx;
|
|
3495
3520
|
}
|
|
@@ -3542,16 +3567,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3542
3567
|
}
|
|
3543
3568
|
let guard = null;
|
|
3544
3569
|
if (directiveGuards.length > 0) {
|
|
3545
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3570
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts25.factory.createBinaryExpression(expr, ts25.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3546
3571
|
}
|
|
3547
3572
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3548
3573
|
const statements = tmplScope.render();
|
|
3549
3574
|
if (statements.length === 0) {
|
|
3550
3575
|
return null;
|
|
3551
3576
|
}
|
|
3552
|
-
let tmplBlock =
|
|
3577
|
+
let tmplBlock = ts25.factory.createBlock(statements);
|
|
3553
3578
|
if (guard !== null) {
|
|
3554
|
-
tmplBlock =
|
|
3579
|
+
tmplBlock = ts25.factory.createIfStatement(guard, tmplBlock);
|
|
3555
3580
|
}
|
|
3556
3581
|
this.scope.addStatement(tmplBlock);
|
|
3557
3582
|
return null;
|
|
@@ -3569,7 +3594,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3569
3594
|
}
|
|
3570
3595
|
execute() {
|
|
3571
3596
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3572
|
-
this.scope.addStatement(
|
|
3597
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(expr));
|
|
3573
3598
|
return null;
|
|
3574
3599
|
}
|
|
3575
3600
|
};
|
|
@@ -3591,11 +3616,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3591
3616
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3592
3617
|
type = rawType;
|
|
3593
3618
|
} else {
|
|
3594
|
-
if (!
|
|
3619
|
+
if (!ts25.isTypeReferenceNode(rawType)) {
|
|
3595
3620
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3596
3621
|
}
|
|
3597
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3598
|
-
type =
|
|
3622
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3623
|
+
type = ts25.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3599
3624
|
}
|
|
3600
3625
|
const id = this.tcb.allocateId();
|
|
3601
3626
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3636,11 +3661,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3636
3661
|
const id = this.tcb.allocateId();
|
|
3637
3662
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3638
3663
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3639
|
-
initializer =
|
|
3664
|
+
initializer = ts25.factory.createAsExpression(initializer, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3640
3665
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3641
|
-
initializer =
|
|
3642
|
-
initializer =
|
|
3643
|
-
initializer =
|
|
3666
|
+
initializer = ts25.factory.createAsExpression(initializer, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3667
|
+
initializer = ts25.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3668
|
+
initializer = ts25.factory.createParenthesizedExpression(initializer);
|
|
3644
3669
|
}
|
|
3645
3670
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3646
3671
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -3730,7 +3755,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3730
3755
|
let target;
|
|
3731
3756
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
3732
3757
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3733
|
-
if (!
|
|
3758
|
+
if (!ts25.isTypeReferenceNode(dirTypeRef)) {
|
|
3734
3759
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3735
3760
|
}
|
|
3736
3761
|
const id = this.tcb.allocateId();
|
|
@@ -3745,10 +3770,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3745
3770
|
}
|
|
3746
3771
|
const id = this.tcb.allocateId();
|
|
3747
3772
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3748
|
-
if (!
|
|
3773
|
+
if (!ts25.isTypeReferenceNode(dirTypeRef)) {
|
|
3749
3774
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3750
3775
|
}
|
|
3751
|
-
const type =
|
|
3776
|
+
const type = ts25.factory.createIndexedAccessTypeNode(ts25.factory.createTypeQueryNode(dirId), ts25.factory.createLiteralTypeNode(ts25.factory.createStringLiteral(fieldName)));
|
|
3752
3777
|
const temp = tsDeclareVariable(id, type);
|
|
3753
3778
|
this.scope.addStatement(temp);
|
|
3754
3779
|
target = id;
|
|
@@ -3756,18 +3781,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3756
3781
|
if (dirId === null) {
|
|
3757
3782
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3758
3783
|
}
|
|
3759
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3784
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts25.factory.createElementAccessExpression(dirId, ts25.factory.createStringLiteral(fieldName)) : ts25.factory.createPropertyAccessExpression(dirId, ts25.factory.createIdentifier(fieldName));
|
|
3760
3785
|
}
|
|
3761
3786
|
if (input.attribute.keySpan !== void 0) {
|
|
3762
3787
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
3763
3788
|
}
|
|
3764
|
-
assignment =
|
|
3789
|
+
assignment = ts25.factory.createBinaryExpression(target, ts25.SyntaxKind.EqualsToken, assignment);
|
|
3765
3790
|
}
|
|
3766
3791
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
3767
3792
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
3768
3793
|
markIgnoreDiagnostics(assignment);
|
|
3769
3794
|
}
|
|
3770
|
-
this.scope.addStatement(
|
|
3795
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(assignment));
|
|
3771
3796
|
}
|
|
3772
3797
|
return null;
|
|
3773
3798
|
}
|
|
@@ -3786,7 +3811,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
3786
3811
|
execute() {
|
|
3787
3812
|
const id = this.tcb.allocateId();
|
|
3788
3813
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
3789
|
-
const circularPlaceholder =
|
|
3814
|
+
const circularPlaceholder = ts25.factory.createCallExpression(typeCtor, void 0, [ts25.factory.createNonNullExpression(ts25.factory.createNull())]);
|
|
3790
3815
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
3791
3816
|
return id;
|
|
3792
3817
|
}
|
|
@@ -3804,7 +3829,7 @@ var TcbDomSchemaCheckerOp = class extends TcbOp {
|
|
|
3804
3829
|
}
|
|
3805
3830
|
execute() {
|
|
3806
3831
|
if (this.checkElement) {
|
|
3807
|
-
this.tcb.domSchemaChecker.checkElement(this.tcb.id, this.element, this.tcb.schemas);
|
|
3832
|
+
this.tcb.domSchemaChecker.checkElement(this.tcb.id, this.element, this.tcb.schemas, this.tcb.hostIsStandalone);
|
|
3808
3833
|
}
|
|
3809
3834
|
for (const binding of this.element.inputs) {
|
|
3810
3835
|
if (binding.type === 0 && this.claimedInputs.has(binding.name)) {
|
|
@@ -3852,15 +3877,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
3852
3877
|
elId = this.scope.resolve(this.element);
|
|
3853
3878
|
}
|
|
3854
3879
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
3855
|
-
const prop =
|
|
3856
|
-
const stmt =
|
|
3880
|
+
const prop = ts25.factory.createElementAccessExpression(elId, ts25.factory.createStringLiteral(propertyName));
|
|
3881
|
+
const stmt = ts25.factory.createBinaryExpression(prop, ts25.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
3857
3882
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
3858
|
-
this.scope.addStatement(
|
|
3883
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(stmt));
|
|
3859
3884
|
} else {
|
|
3860
|
-
this.scope.addStatement(
|
|
3885
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(expr));
|
|
3861
3886
|
}
|
|
3862
3887
|
} else {
|
|
3863
|
-
this.scope.addStatement(
|
|
3888
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(expr));
|
|
3864
3889
|
}
|
|
3865
3890
|
}
|
|
3866
3891
|
return null;
|
|
@@ -3892,18 +3917,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
3892
3917
|
if (dirId === null) {
|
|
3893
3918
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3894
3919
|
}
|
|
3895
|
-
const outputField =
|
|
3920
|
+
const outputField = ts25.factory.createElementAccessExpression(dirId, ts25.factory.createStringLiteral(field));
|
|
3896
3921
|
addParseSpanInfo(outputField, output.keySpan);
|
|
3897
3922
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
3898
3923
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3899
|
-
const subscribeFn =
|
|
3900
|
-
const call =
|
|
3924
|
+
const subscribeFn = ts25.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
3925
|
+
const call = ts25.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
3901
3926
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3902
|
-
this.scope.addStatement(
|
|
3927
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(call));
|
|
3903
3928
|
} else {
|
|
3904
|
-
this.scope.addStatement(
|
|
3929
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(outputField));
|
|
3905
3930
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3906
|
-
this.scope.addStatement(
|
|
3931
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(handler));
|
|
3907
3932
|
}
|
|
3908
3933
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3909
3934
|
}
|
|
@@ -3936,20 +3961,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
3936
3961
|
if (output.type === 1) {
|
|
3937
3962
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
3938
3963
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
3939
|
-
this.scope.addStatement(
|
|
3964
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(handler));
|
|
3940
3965
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
3941
3966
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3942
3967
|
if (elId === null) {
|
|
3943
3968
|
elId = this.scope.resolve(this.element);
|
|
3944
3969
|
}
|
|
3945
|
-
const propertyAccess =
|
|
3970
|
+
const propertyAccess = ts25.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
3946
3971
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
3947
|
-
const call =
|
|
3972
|
+
const call = ts25.factory.createCallExpression(propertyAccess, void 0, [ts25.factory.createStringLiteral(output.name), handler]);
|
|
3948
3973
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3949
|
-
this.scope.addStatement(
|
|
3974
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(call));
|
|
3950
3975
|
} else {
|
|
3951
3976
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3952
|
-
this.scope.addStatement(
|
|
3977
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(handler));
|
|
3953
3978
|
}
|
|
3954
3979
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3955
3980
|
}
|
|
@@ -3963,17 +3988,17 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
3963
3988
|
this.optional = false;
|
|
3964
3989
|
}
|
|
3965
3990
|
execute() {
|
|
3966
|
-
const ctx =
|
|
3967
|
-
const ctxDot =
|
|
3991
|
+
const ctx = ts25.factory.createThis();
|
|
3992
|
+
const ctxDot = ts25.factory.createPropertyAccessExpression(ctx, "");
|
|
3968
3993
|
markIgnoreDiagnostics(ctxDot);
|
|
3969
3994
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
3970
|
-
this.scope.addStatement(
|
|
3995
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(ctxDot));
|
|
3971
3996
|
return null;
|
|
3972
3997
|
}
|
|
3973
3998
|
};
|
|
3974
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3999
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts25.factory.createNonNullExpression(ts25.factory.createNull());
|
|
3975
4000
|
var Context = class {
|
|
3976
|
-
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
4001
|
+
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone) {
|
|
3977
4002
|
this.env = env;
|
|
3978
4003
|
this.domSchemaChecker = domSchemaChecker;
|
|
3979
4004
|
this.oobRecorder = oobRecorder;
|
|
@@ -3981,10 +4006,11 @@ var Context = class {
|
|
|
3981
4006
|
this.boundTarget = boundTarget;
|
|
3982
4007
|
this.pipes = pipes;
|
|
3983
4008
|
this.schemas = schemas;
|
|
4009
|
+
this.hostIsStandalone = hostIsStandalone;
|
|
3984
4010
|
this.nextId = 1;
|
|
3985
4011
|
}
|
|
3986
4012
|
allocateId() {
|
|
3987
|
-
return
|
|
4013
|
+
return ts25.factory.createIdentifier(`_t${this.nextId++}`);
|
|
3988
4014
|
}
|
|
3989
4015
|
getPipeByName(name) {
|
|
3990
4016
|
if (!this.pipes.has(name)) {
|
|
@@ -4036,8 +4062,8 @@ var Scope = class {
|
|
|
4036
4062
|
resolve(node, directive) {
|
|
4037
4063
|
const res = this.resolveLocal(node, directive);
|
|
4038
4064
|
if (res !== null) {
|
|
4039
|
-
const clone =
|
|
4040
|
-
|
|
4065
|
+
const clone = ts25.getMutableClone(res);
|
|
4066
|
+
ts25.setSyntheticTrailingComments(clone, []);
|
|
4041
4067
|
return clone;
|
|
4042
4068
|
} else if (this.parent !== null) {
|
|
4043
4069
|
return this.parent.resolve(node, directive);
|
|
@@ -4065,7 +4091,7 @@ var Scope = class {
|
|
|
4065
4091
|
} else if (parentGuards === null) {
|
|
4066
4092
|
return this.guard;
|
|
4067
4093
|
} else {
|
|
4068
|
-
return
|
|
4094
|
+
return ts25.factory.createBinaryExpression(parentGuards, ts25.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4069
4095
|
}
|
|
4070
4096
|
}
|
|
4071
4097
|
resolveLocal(ref, directive) {
|
|
@@ -4244,9 +4270,9 @@ var Scope = class {
|
|
|
4244
4270
|
}
|
|
4245
4271
|
}
|
|
4246
4272
|
};
|
|
4247
|
-
function
|
|
4248
|
-
const type =
|
|
4249
|
-
return
|
|
4273
|
+
function tcbThisParam(node, name, typeArguments) {
|
|
4274
|
+
const type = ts25.factory.createTypeReferenceNode(name, typeArguments);
|
|
4275
|
+
return ts25.factory.createParameterDeclaration(void 0, void 0, void 0, "this", void 0, type, void 0);
|
|
4250
4276
|
}
|
|
4251
4277
|
function tcbExpression(ast, tcb, scope) {
|
|
4252
4278
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -4269,11 +4295,11 @@ var TcbExpressionTranslator = class {
|
|
|
4269
4295
|
return null;
|
|
4270
4296
|
}
|
|
4271
4297
|
const expr = this.translate(ast.value);
|
|
4272
|
-
const result =
|
|
4298
|
+
const result = ts25.factory.createParenthesizedExpression(ts25.factory.createBinaryExpression(target, ts25.SyntaxKind.EqualsToken, expr));
|
|
4273
4299
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4274
4300
|
return result;
|
|
4275
4301
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4276
|
-
return
|
|
4302
|
+
return ts25.factory.createThis();
|
|
4277
4303
|
} else if (ast instanceof BindingPipe) {
|
|
4278
4304
|
const expr = this.translate(ast.exp);
|
|
4279
4305
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4285,19 +4311,19 @@ var TcbExpressionTranslator = class {
|
|
|
4285
4311
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4286
4312
|
}
|
|
4287
4313
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4288
|
-
let methodAccess =
|
|
4314
|
+
let methodAccess = ts25.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4289
4315
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4290
4316
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4291
|
-
methodAccess =
|
|
4317
|
+
methodAccess = ts25.factory.createAsExpression(methodAccess, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
4292
4318
|
}
|
|
4293
|
-
const result =
|
|
4319
|
+
const result = ts25.factory.createCallExpression(methodAccess, void 0, [expr, ...args]);
|
|
4294
4320
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4295
4321
|
return result;
|
|
4296
4322
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4297
4323
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4298
4324
|
const expr = this.translate(ast.args[0]);
|
|
4299
|
-
const exprAsAny =
|
|
4300
|
-
const result =
|
|
4325
|
+
const exprAsAny = ts25.factory.createAsExpression(expr, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
4326
|
+
const result = ts25.factory.createParenthesizedExpression(exprAsAny);
|
|
4301
4327
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4302
4328
|
return result;
|
|
4303
4329
|
}
|
|
@@ -4308,7 +4334,7 @@ var TcbExpressionTranslator = class {
|
|
|
4308
4334
|
const method = wrapForDiagnostics(receiver);
|
|
4309
4335
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4310
4336
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4311
|
-
const node =
|
|
4337
|
+
const node = ts25.factory.createCallExpression(method, void 0, args);
|
|
4312
4338
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4313
4339
|
return node;
|
|
4314
4340
|
} else {
|
|
@@ -4328,17 +4354,17 @@ var TcbExpressionTranslator = class {
|
|
|
4328
4354
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4329
4355
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4330
4356
|
const members = inputs.map((input) => {
|
|
4331
|
-
const propertyName =
|
|
4357
|
+
const propertyName = ts25.factory.createStringLiteral(input.field);
|
|
4332
4358
|
if (input.type === "binding") {
|
|
4333
4359
|
const expr = widenBinding(input.expression, tcb);
|
|
4334
|
-
const assignment =
|
|
4360
|
+
const assignment = ts25.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4335
4361
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4336
4362
|
return assignment;
|
|
4337
4363
|
} else {
|
|
4338
|
-
return
|
|
4364
|
+
return ts25.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4339
4365
|
}
|
|
4340
4366
|
});
|
|
4341
|
-
return
|
|
4367
|
+
return ts25.factory.createCallExpression(typeCtor, void 0, [ts25.factory.createObjectLiteralExpression(members)]);
|
|
4342
4368
|
}
|
|
4343
4369
|
function getBoundInputs(directive, node, tcb) {
|
|
4344
4370
|
const boundInputs = [];
|
|
@@ -4364,17 +4390,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4364
4390
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4365
4391
|
return tcbExpression(attr.value, tcb, scope);
|
|
4366
4392
|
} else {
|
|
4367
|
-
return
|
|
4393
|
+
return ts25.factory.createStringLiteral(attr.value);
|
|
4368
4394
|
}
|
|
4369
4395
|
}
|
|
4370
4396
|
function widenBinding(expr, tcb) {
|
|
4371
4397
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4372
4398
|
return tsCastToAny(expr);
|
|
4373
4399
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4374
|
-
if (
|
|
4400
|
+
if (ts25.isObjectLiteralExpression(expr) || ts25.isArrayLiteralExpression(expr)) {
|
|
4375
4401
|
return expr;
|
|
4376
4402
|
} else {
|
|
4377
|
-
return
|
|
4403
|
+
return ts25.factory.createNonNullExpression(expr);
|
|
4378
4404
|
}
|
|
4379
4405
|
} else {
|
|
4380
4406
|
return expr;
|
|
@@ -4387,18 +4413,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4387
4413
|
if (eventType === 0) {
|
|
4388
4414
|
eventParamType = void 0;
|
|
4389
4415
|
} else if (eventType === 1) {
|
|
4390
|
-
eventParamType =
|
|
4416
|
+
eventParamType = ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword);
|
|
4391
4417
|
} else {
|
|
4392
4418
|
eventParamType = eventType;
|
|
4393
4419
|
}
|
|
4394
4420
|
const guards = scope.guards();
|
|
4395
|
-
let body =
|
|
4421
|
+
let body = ts25.factory.createExpressionStatement(handler);
|
|
4396
4422
|
if (guards !== null) {
|
|
4397
|
-
body =
|
|
4423
|
+
body = ts25.factory.createIfStatement(guards, body);
|
|
4398
4424
|
}
|
|
4399
|
-
const eventParam =
|
|
4425
|
+
const eventParam = ts25.factory.createParameterDeclaration(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4400
4426
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4401
|
-
return
|
|
4427
|
+
return ts25.factory.createArrowFunction(void 0, void 0, [eventParam], ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword), void 0, ts25.factory.createBlock([body]));
|
|
4402
4428
|
}
|
|
4403
4429
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4404
4430
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4426,7 +4452,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4426
4452
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4427
4453
|
resolve(ast) {
|
|
4428
4454
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4429
|
-
const event =
|
|
4455
|
+
const event = ts25.factory.createIdentifier(EVENT_PARAMETER);
|
|
4430
4456
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4431
4457
|
return event;
|
|
4432
4458
|
}
|
|
@@ -4434,33 +4460,33 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4434
4460
|
}
|
|
4435
4461
|
};
|
|
4436
4462
|
|
|
4437
|
-
// bazel-out/
|
|
4438
|
-
import
|
|
4463
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4464
|
+
import ts26 from "typescript";
|
|
4439
4465
|
var TypeCheckFile = class extends Environment {
|
|
4440
4466
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4441
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
4467
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts26.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts26.ScriptTarget.Latest, true));
|
|
4442
4468
|
this.fileName = fileName;
|
|
4443
4469
|
this.nextTcbId = 1;
|
|
4444
4470
|
this.tcbStatements = [];
|
|
4445
4471
|
}
|
|
4446
4472
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4447
|
-
const fnId =
|
|
4473
|
+
const fnId = ts26.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4448
4474
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4449
4475
|
this.tcbStatements.push(fn);
|
|
4450
4476
|
}
|
|
4451
4477
|
render(removeComments) {
|
|
4452
4478
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
4453
|
-
const printer =
|
|
4479
|
+
const printer = ts26.createPrinter({ removeComments });
|
|
4454
4480
|
source += "\n";
|
|
4455
4481
|
for (const stmt of this.pipeInstStatements) {
|
|
4456
|
-
source += printer.printNode(
|
|
4482
|
+
source += printer.printNode(ts26.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4457
4483
|
}
|
|
4458
4484
|
for (const stmt of this.typeCtorStatements) {
|
|
4459
|
-
source += printer.printNode(
|
|
4485
|
+
source += printer.printNode(ts26.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4460
4486
|
}
|
|
4461
4487
|
source += "\n";
|
|
4462
4488
|
for (const stmt of this.tcbStatements) {
|
|
4463
|
-
source += printer.printNode(
|
|
4489
|
+
source += printer.printNode(ts26.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4464
4490
|
}
|
|
4465
4491
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4466
4492
|
return source;
|
|
@@ -4470,7 +4496,7 @@ var TypeCheckFile = class extends Environment {
|
|
|
4470
4496
|
}
|
|
4471
4497
|
};
|
|
4472
4498
|
|
|
4473
|
-
// bazel-out/
|
|
4499
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
4474
4500
|
var InliningMode;
|
|
4475
4501
|
(function(InliningMode2) {
|
|
4476
4502
|
InliningMode2[InliningMode2["InlineOps"] = 0] = "InlineOps";
|
|
@@ -4492,7 +4518,7 @@ var TypeCheckContextImpl = class {
|
|
|
4492
4518
|
throw new Error(`AssertionError: invalid inlining configuration.`);
|
|
4493
4519
|
}
|
|
4494
4520
|
}
|
|
4495
|
-
addTemplate(ref, binder, template, pipes, schemas, sourceMapping, file, parseErrors) {
|
|
4521
|
+
addTemplate(ref, binder, template, pipes, schemas, sourceMapping, file, parseErrors, isStandalone) {
|
|
4496
4522
|
if (!this.host.shouldCheckComponent(ref.node)) {
|
|
4497
4523
|
return;
|
|
4498
4524
|
}
|
|
@@ -4538,7 +4564,8 @@ var TypeCheckContextImpl = class {
|
|
|
4538
4564
|
id: fileData.sourceManager.captureSource(ref.node, sourceMapping, file),
|
|
4539
4565
|
boundTarget,
|
|
4540
4566
|
pipes,
|
|
4541
|
-
schemas
|
|
4567
|
+
schemas,
|
|
4568
|
+
isStandalone
|
|
4542
4569
|
};
|
|
4543
4570
|
this.perf.eventCount(PerfEvent.GenerateTcb);
|
|
4544
4571
|
if (inliningRequirement !== TcbInliningRequirement.None && this.inlining === InliningMode.InlineOps) {
|
|
@@ -4568,7 +4595,7 @@ var TypeCheckContextImpl = class {
|
|
|
4568
4595
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4569
4596
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4570
4597
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4571
|
-
const printer =
|
|
4598
|
+
const printer = ts27.createPrinter({ omitTrailingSemicolon: true });
|
|
4572
4599
|
let code = textParts[0];
|
|
4573
4600
|
ops.forEach((op, idx) => {
|
|
4574
4601
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4649,7 +4676,7 @@ var TypeCheckContextImpl = class {
|
|
|
4649
4676
|
if (span.start.offset === span.end.offset) {
|
|
4650
4677
|
span.end.offset++;
|
|
4651
4678
|
}
|
|
4652
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4679
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4653
4680
|
});
|
|
4654
4681
|
}
|
|
4655
4682
|
};
|
|
@@ -4667,9 +4694,9 @@ var InlineTcbOp = class {
|
|
|
4667
4694
|
}
|
|
4668
4695
|
execute(im, sf, refEmitter, printer) {
|
|
4669
4696
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4670
|
-
const fnName =
|
|
4697
|
+
const fnName = ts27.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4671
4698
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4672
|
-
return printer.printNode(
|
|
4699
|
+
return printer.printNode(ts27.EmitHint.Unspecified, fn, sf);
|
|
4673
4700
|
}
|
|
4674
4701
|
};
|
|
4675
4702
|
var TypeCtorOp = class {
|
|
@@ -4682,7 +4709,7 @@ var TypeCtorOp = class {
|
|
|
4682
4709
|
}
|
|
4683
4710
|
execute(im, sf, refEmitter, printer) {
|
|
4684
4711
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
4685
|
-
return printer.printNode(
|
|
4712
|
+
return printer.printNode(ts27.EmitHint.Unspecified, tcb, sf);
|
|
4686
4713
|
}
|
|
4687
4714
|
};
|
|
4688
4715
|
function orderOps(op1, op2) {
|
|
@@ -4700,10 +4727,10 @@ function splitStringAtPoints(str, points) {
|
|
|
4700
4727
|
return splits;
|
|
4701
4728
|
}
|
|
4702
4729
|
|
|
4703
|
-
// bazel-out/
|
|
4730
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
4704
4731
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
4705
4732
|
|
|
4706
|
-
// bazel-out/
|
|
4733
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/line_mappings.mjs
|
|
4707
4734
|
var LF_CHAR = 10;
|
|
4708
4735
|
var CR_CHAR = 13;
|
|
4709
4736
|
var LINE_SEP_CHAR = 8232;
|
|
@@ -4744,7 +4771,7 @@ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesM
|
|
|
4744
4771
|
return low - 1;
|
|
4745
4772
|
}
|
|
4746
4773
|
|
|
4747
|
-
// bazel-out/
|
|
4774
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
4748
4775
|
var TemplateSource = class {
|
|
4749
4776
|
constructor(mapping, file) {
|
|
4750
4777
|
this.mapping = mapping;
|
|
@@ -4795,12 +4822,13 @@ var TemplateSourceManager = class {
|
|
|
4795
4822
|
}
|
|
4796
4823
|
};
|
|
4797
4824
|
|
|
4798
|
-
// bazel-out/
|
|
4825
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4799
4826
|
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";
|
|
4800
|
-
import
|
|
4827
|
+
import ts28 from "typescript";
|
|
4801
4828
|
var SymbolBuilder = class {
|
|
4802
|
-
constructor(
|
|
4803
|
-
this.
|
|
4829
|
+
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
4830
|
+
this.tcbPath = tcbPath;
|
|
4831
|
+
this.tcbIsShim = tcbIsShim;
|
|
4804
4832
|
this.typeCheckBlock = typeCheckBlock;
|
|
4805
4833
|
this.templateData = templateData;
|
|
4806
4834
|
this.componentScopeReader = componentScopeReader;
|
|
@@ -4840,7 +4868,7 @@ var SymbolBuilder = class {
|
|
|
4840
4868
|
getSymbolOfElement(element) {
|
|
4841
4869
|
var _a;
|
|
4842
4870
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4843
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4871
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts28.isVariableDeclaration });
|
|
4844
4872
|
if (node === null) {
|
|
4845
4873
|
return null;
|
|
4846
4874
|
}
|
|
@@ -4859,12 +4887,12 @@ var SymbolBuilder = class {
|
|
|
4859
4887
|
var _a;
|
|
4860
4888
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4861
4889
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
4862
|
-
const isDirectiveDeclaration = (node) => (
|
|
4890
|
+
const isDirectiveDeclaration = (node) => (ts28.isTypeNode(node) || ts28.isIdentifier(node)) && ts28.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
4863
4891
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
4864
4892
|
return nodes.map((node) => {
|
|
4865
4893
|
var _a2;
|
|
4866
4894
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
4867
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4895
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts28.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
4868
4896
|
return null;
|
|
4869
4897
|
}
|
|
4870
4898
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -4909,7 +4937,7 @@ var SymbolBuilder = class {
|
|
|
4909
4937
|
}
|
|
4910
4938
|
getDirectiveModule(declaration) {
|
|
4911
4939
|
const scope = this.componentScopeReader.getScopeForComponent(declaration);
|
|
4912
|
-
if (scope === null) {
|
|
4940
|
+
if (scope === null || scope.kind !== ComponentScopeKind.NgModule) {
|
|
4913
4941
|
return null;
|
|
4914
4942
|
}
|
|
4915
4943
|
return scope.ngModule;
|
|
@@ -4933,23 +4961,23 @@ var SymbolBuilder = class {
|
|
|
4933
4961
|
if (!isAccessExpression(n)) {
|
|
4934
4962
|
return false;
|
|
4935
4963
|
}
|
|
4936
|
-
if (
|
|
4964
|
+
if (ts28.isPropertyAccessExpression(n)) {
|
|
4937
4965
|
return n.name.getText() === expectedAccess;
|
|
4938
4966
|
} else {
|
|
4939
|
-
return
|
|
4967
|
+
return ts28.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
4940
4968
|
}
|
|
4941
4969
|
}
|
|
4942
4970
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
4943
4971
|
const bindings = [];
|
|
4944
4972
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
4945
4973
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
4946
|
-
if (!
|
|
4974
|
+
if (!ts28.isPropertyAccessExpression(outputFieldAccess)) {
|
|
4947
4975
|
continue;
|
|
4948
4976
|
}
|
|
4949
4977
|
const addEventListener = outputFieldAccess.name;
|
|
4950
4978
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(addEventListener);
|
|
4951
4979
|
const tsType = this.getTypeChecker().getTypeAtLocation(addEventListener);
|
|
4952
|
-
const
|
|
4980
|
+
const positionInFile = this.getTcbPositionForNode(addEventListener);
|
|
4953
4981
|
const target = this.getSymbol(consumer);
|
|
4954
4982
|
if (target === null || tsSymbol === void 0) {
|
|
4955
4983
|
continue;
|
|
@@ -4959,10 +4987,14 @@ var SymbolBuilder = class {
|
|
|
4959
4987
|
tsSymbol,
|
|
4960
4988
|
tsType,
|
|
4961
4989
|
target,
|
|
4962
|
-
|
|
4990
|
+
tcbLocation: {
|
|
4991
|
+
tcbPath: this.tcbPath,
|
|
4992
|
+
isShimFile: this.tcbIsShim,
|
|
4993
|
+
positionInFile
|
|
4994
|
+
}
|
|
4963
4995
|
});
|
|
4964
4996
|
} else {
|
|
4965
|
-
if (!
|
|
4997
|
+
if (!ts28.isElementAccessExpression(outputFieldAccess)) {
|
|
4966
4998
|
continue;
|
|
4967
4999
|
}
|
|
4968
5000
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -4973,14 +5005,18 @@ var SymbolBuilder = class {
|
|
|
4973
5005
|
if (target === null) {
|
|
4974
5006
|
continue;
|
|
4975
5007
|
}
|
|
4976
|
-
const
|
|
5008
|
+
const positionInFile = this.getTcbPositionForNode(outputFieldAccess);
|
|
4977
5009
|
const tsType = this.getTypeChecker().getTypeAtLocation(outputFieldAccess);
|
|
4978
5010
|
bindings.push({
|
|
4979
5011
|
kind: SymbolKind.Binding,
|
|
4980
5012
|
tsSymbol,
|
|
4981
5013
|
tsType,
|
|
4982
5014
|
target,
|
|
4983
|
-
|
|
5015
|
+
tcbLocation: {
|
|
5016
|
+
tcbPath: this.tcbPath,
|
|
5017
|
+
isShimFile: this.tcbIsShim,
|
|
5018
|
+
positionInFile
|
|
5019
|
+
}
|
|
4984
5020
|
});
|
|
4985
5021
|
}
|
|
4986
5022
|
}
|
|
@@ -5030,11 +5066,11 @@ var SymbolBuilder = class {
|
|
|
5030
5066
|
return null;
|
|
5031
5067
|
}
|
|
5032
5068
|
const [declaration] = tsSymbol.declarations;
|
|
5033
|
-
if (!
|
|
5069
|
+
if (!ts28.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
5034
5070
|
return null;
|
|
5035
5071
|
}
|
|
5036
5072
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5037
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5073
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts28.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5038
5074
|
return null;
|
|
5039
5075
|
}
|
|
5040
5076
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5042,7 +5078,7 @@ var SymbolBuilder = class {
|
|
|
5042
5078
|
kind: SymbolKind.Directive,
|
|
5043
5079
|
tsSymbol: symbol.tsSymbol,
|
|
5044
5080
|
tsType: symbol.tsType,
|
|
5045
|
-
|
|
5081
|
+
tcbLocation: symbol.tcbLocation,
|
|
5046
5082
|
isComponent,
|
|
5047
5083
|
isStructural,
|
|
5048
5084
|
selector,
|
|
@@ -5050,7 +5086,7 @@ var SymbolBuilder = class {
|
|
|
5050
5086
|
};
|
|
5051
5087
|
}
|
|
5052
5088
|
getSymbolOfVariable(variable) {
|
|
5053
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5089
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts28.isVariableDeclaration });
|
|
5054
5090
|
if (node === null || node.initializer === void 0) {
|
|
5055
5091
|
return null;
|
|
5056
5092
|
}
|
|
@@ -5061,22 +5097,23 @@ var SymbolBuilder = class {
|
|
|
5061
5097
|
return {
|
|
5062
5098
|
tsType: expressionSymbol.tsType,
|
|
5063
5099
|
tsSymbol: expressionSymbol.tsSymbol,
|
|
5064
|
-
initializerLocation: expressionSymbol.
|
|
5100
|
+
initializerLocation: expressionSymbol.tcbLocation,
|
|
5065
5101
|
kind: SymbolKind.Variable,
|
|
5066
5102
|
declaration: variable,
|
|
5067
5103
|
localVarLocation: {
|
|
5068
|
-
|
|
5069
|
-
|
|
5104
|
+
tcbPath: this.tcbPath,
|
|
5105
|
+
isShimFile: this.tcbIsShim,
|
|
5106
|
+
positionInFile: this.getTcbPositionForNode(node.name)
|
|
5070
5107
|
}
|
|
5071
5108
|
};
|
|
5072
5109
|
}
|
|
5073
5110
|
getSymbolOfReference(ref) {
|
|
5074
5111
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5075
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5112
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts28.isVariableDeclaration });
|
|
5076
5113
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5077
5114
|
return null;
|
|
5078
5115
|
}
|
|
5079
|
-
const originalDeclaration =
|
|
5116
|
+
const originalDeclaration = ts28.isParenthesizedExpression(node.initializer) && ts28.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5080
5117
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5081
5118
|
return null;
|
|
5082
5119
|
}
|
|
@@ -5084,9 +5121,10 @@ var SymbolBuilder = class {
|
|
|
5084
5121
|
if (symbol === null || symbol.tsSymbol === null) {
|
|
5085
5122
|
return null;
|
|
5086
5123
|
}
|
|
5087
|
-
const
|
|
5088
|
-
|
|
5089
|
-
|
|
5124
|
+
const referenceVarTcbLocation = {
|
|
5125
|
+
tcbPath: this.tcbPath,
|
|
5126
|
+
isShimFile: this.tcbIsShim,
|
|
5127
|
+
positionInFile: this.getTcbPositionForNode(node)
|
|
5090
5128
|
};
|
|
5091
5129
|
if (target instanceof TmplAstTemplate3 || target instanceof TmplAstElement4) {
|
|
5092
5130
|
return {
|
|
@@ -5095,11 +5133,11 @@ var SymbolBuilder = class {
|
|
|
5095
5133
|
tsType: symbol.tsType,
|
|
5096
5134
|
target,
|
|
5097
5135
|
declaration: ref,
|
|
5098
|
-
targetLocation: symbol.
|
|
5099
|
-
referenceVarLocation:
|
|
5136
|
+
targetLocation: symbol.tcbLocation,
|
|
5137
|
+
referenceVarLocation: referenceVarTcbLocation
|
|
5100
5138
|
};
|
|
5101
5139
|
} else {
|
|
5102
|
-
if (!
|
|
5140
|
+
if (!ts28.isClassDeclaration(target.directive.ref.node)) {
|
|
5103
5141
|
return null;
|
|
5104
5142
|
}
|
|
5105
5143
|
return {
|
|
@@ -5108,13 +5146,13 @@ var SymbolBuilder = class {
|
|
|
5108
5146
|
tsType: symbol.tsType,
|
|
5109
5147
|
declaration: ref,
|
|
5110
5148
|
target: target.directive.ref.node,
|
|
5111
|
-
targetLocation: symbol.
|
|
5112
|
-
referenceVarLocation:
|
|
5149
|
+
targetLocation: symbol.tcbLocation,
|
|
5150
|
+
referenceVarLocation: referenceVarTcbLocation
|
|
5113
5151
|
};
|
|
5114
5152
|
}
|
|
5115
5153
|
}
|
|
5116
5154
|
getSymbolOfPipe(expression) {
|
|
5117
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5155
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts28.isPropertyAccessExpression });
|
|
5118
5156
|
if (methodAccess === null) {
|
|
5119
5157
|
return null;
|
|
5120
5158
|
}
|
|
@@ -5153,7 +5191,7 @@ var SymbolBuilder = class {
|
|
|
5153
5191
|
}
|
|
5154
5192
|
let node = null;
|
|
5155
5193
|
if (expression instanceof PropertyRead5) {
|
|
5156
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5194
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts28.isPropertyAccessExpression });
|
|
5157
5195
|
}
|
|
5158
5196
|
if (node === null) {
|
|
5159
5197
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5161,10 +5199,10 @@ var SymbolBuilder = class {
|
|
|
5161
5199
|
if (node === null) {
|
|
5162
5200
|
return null;
|
|
5163
5201
|
}
|
|
5164
|
-
while (
|
|
5202
|
+
while (ts28.isParenthesizedExpression(node)) {
|
|
5165
5203
|
node = node.expression;
|
|
5166
5204
|
}
|
|
5167
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5205
|
+
if (expression instanceof SafePropertyRead4 && ts28.isConditionalExpression(node)) {
|
|
5168
5206
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5169
5207
|
if (whenTrueSymbol === null) {
|
|
5170
5208
|
return null;
|
|
@@ -5180,33 +5218,37 @@ var SymbolBuilder = class {
|
|
|
5180
5218
|
}
|
|
5181
5219
|
getSymbolOfTsNode(node) {
|
|
5182
5220
|
var _a;
|
|
5183
|
-
while (
|
|
5221
|
+
while (ts28.isParenthesizedExpression(node)) {
|
|
5184
5222
|
node = node.expression;
|
|
5185
5223
|
}
|
|
5186
5224
|
let tsSymbol;
|
|
5187
|
-
if (
|
|
5225
|
+
if (ts28.isPropertyAccessExpression(node)) {
|
|
5188
5226
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5189
|
-
} else if (
|
|
5227
|
+
} else if (ts28.isElementAccessExpression(node)) {
|
|
5190
5228
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5191
5229
|
} else {
|
|
5192
5230
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
5193
5231
|
}
|
|
5194
|
-
const
|
|
5232
|
+
const positionInFile = this.getTcbPositionForNode(node);
|
|
5195
5233
|
const type = this.getTypeChecker().getTypeAtLocation(node);
|
|
5196
5234
|
return {
|
|
5197
5235
|
tsSymbol: (_a = tsSymbol != null ? tsSymbol : type.symbol) != null ? _a : null,
|
|
5198
5236
|
tsType: type,
|
|
5199
|
-
|
|
5237
|
+
tcbLocation: {
|
|
5238
|
+
tcbPath: this.tcbPath,
|
|
5239
|
+
isShimFile: this.tcbIsShim,
|
|
5240
|
+
positionInFile
|
|
5241
|
+
}
|
|
5200
5242
|
};
|
|
5201
5243
|
}
|
|
5202
|
-
|
|
5203
|
-
if (
|
|
5204
|
-
return this.
|
|
5205
|
-
} else if (
|
|
5244
|
+
getTcbPositionForNode(node) {
|
|
5245
|
+
if (ts28.isTypeReferenceNode(node)) {
|
|
5246
|
+
return this.getTcbPositionForNode(node.typeName);
|
|
5247
|
+
} else if (ts28.isQualifiedName(node)) {
|
|
5206
5248
|
return node.right.getStart();
|
|
5207
|
-
} else if (
|
|
5249
|
+
} else if (ts28.isPropertyAccessExpression(node)) {
|
|
5208
5250
|
return node.name.getStart();
|
|
5209
|
-
} else if (
|
|
5251
|
+
} else if (ts28.isElementAccessExpression(node)) {
|
|
5210
5252
|
return node.argumentExpression.getStart();
|
|
5211
5253
|
} else {
|
|
5212
5254
|
return node.getStart();
|
|
@@ -5220,7 +5262,7 @@ function sourceSpanEqual(a, b) {
|
|
|
5220
5262
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
5221
5263
|
}
|
|
5222
5264
|
|
|
5223
|
-
// bazel-out/
|
|
5265
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
5224
5266
|
var REGISTRY2 = new DomElementSchemaRegistry2();
|
|
5225
5267
|
var TemplateTypeCheckerImpl = class {
|
|
5226
5268
|
constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, componentScopeReader, typeCheckScopeRegistry, perf) {
|
|
@@ -5256,7 +5298,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5256
5298
|
const shimPath = TypeCheckShimGenerator.shimFor(sfPath);
|
|
5257
5299
|
const fileRecord = this.getFileData(sfPath);
|
|
5258
5300
|
if (!fileRecord.shimData.has(shimPath)) {
|
|
5259
|
-
return { data: null, tcb: null, shimPath };
|
|
5301
|
+
return { data: null, tcb: null, tcbPath: shimPath, tcbIsShim: true };
|
|
5260
5302
|
}
|
|
5261
5303
|
const templateId = fileRecord.sourceManager.getTemplateId(component);
|
|
5262
5304
|
const shimRecord = fileRecord.shimData.get(shimPath);
|
|
@@ -5267,19 +5309,38 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5267
5309
|
throw new Error(`Error: no shim file in program: ${shimPath}`);
|
|
5268
5310
|
}
|
|
5269
5311
|
let tcb = findTypeCheckBlock(shimSf, id, false);
|
|
5312
|
+
let tcbPath = shimPath;
|
|
5270
5313
|
if (tcb === null) {
|
|
5271
5314
|
const inlineSf = getSourceFileOrError(program, sfPath);
|
|
5272
5315
|
tcb = findTypeCheckBlock(inlineSf, id, false);
|
|
5316
|
+
if (tcb !== null) {
|
|
5317
|
+
tcbPath = sfPath;
|
|
5318
|
+
}
|
|
5273
5319
|
}
|
|
5274
5320
|
let data = null;
|
|
5275
5321
|
if (shimRecord.templates.has(templateId)) {
|
|
5276
5322
|
data = shimRecord.templates.get(templateId);
|
|
5277
5323
|
}
|
|
5278
|
-
return { data, tcb, shimPath };
|
|
5324
|
+
return { data, tcb, tcbPath, tcbIsShim: tcbPath === shimPath };
|
|
5279
5325
|
}
|
|
5280
5326
|
isTrackedTypeCheckFile(filePath) {
|
|
5281
5327
|
return this.getFileAndShimRecordsForPath(filePath) !== null;
|
|
5282
5328
|
}
|
|
5329
|
+
getFileRecordForTcbLocation({ tcbPath, isShimFile }) {
|
|
5330
|
+
if (!isShimFile) {
|
|
5331
|
+
if (this.state.has(tcbPath)) {
|
|
5332
|
+
return this.state.get(tcbPath);
|
|
5333
|
+
} else {
|
|
5334
|
+
return null;
|
|
5335
|
+
}
|
|
5336
|
+
}
|
|
5337
|
+
const records = this.getFileAndShimRecordsForPath(tcbPath);
|
|
5338
|
+
if (records !== null) {
|
|
5339
|
+
return records.fileRecord;
|
|
5340
|
+
} else {
|
|
5341
|
+
return null;
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5283
5344
|
getFileAndShimRecordsForPath(shimPath) {
|
|
5284
5345
|
for (const fileRecord of this.state.values()) {
|
|
5285
5346
|
if (fileRecord.shimData.has(shimPath)) {
|
|
@@ -5288,17 +5349,16 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5288
5349
|
}
|
|
5289
5350
|
return null;
|
|
5290
5351
|
}
|
|
5291
|
-
|
|
5292
|
-
const
|
|
5293
|
-
if (
|
|
5352
|
+
getTemplateMappingAtTcbLocation(tcbLocation) {
|
|
5353
|
+
const fileRecord = this.getFileRecordForTcbLocation(tcbLocation);
|
|
5354
|
+
if (fileRecord === null) {
|
|
5294
5355
|
return null;
|
|
5295
5356
|
}
|
|
5296
|
-
const
|
|
5297
|
-
const shimSf = this.programDriver.getProgram().getSourceFile(absoluteFrom(shimPath));
|
|
5357
|
+
const shimSf = this.programDriver.getProgram().getSourceFile(tcbLocation.tcbPath);
|
|
5298
5358
|
if (shimSf === void 0) {
|
|
5299
5359
|
return null;
|
|
5300
5360
|
}
|
|
5301
|
-
return getTemplateMapping(shimSf,
|
|
5361
|
+
return getTemplateMapping(shimSf, tcbLocation.positionInFile, fileRecord.sourceManager, false);
|
|
5302
5362
|
}
|
|
5303
5363
|
generateAllTypeCheckBlocks() {
|
|
5304
5364
|
this.ensureAllShimsForAllFiles();
|
|
@@ -5410,11 +5470,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5410
5470
|
if (this.completionCache.has(component)) {
|
|
5411
5471
|
return this.completionCache.get(component);
|
|
5412
5472
|
}
|
|
5413
|
-
const { tcb, data,
|
|
5473
|
+
const { tcb, data, tcbPath, tcbIsShim } = this.getLatestComponentState(component);
|
|
5414
5474
|
if (tcb === null || data === null) {
|
|
5415
5475
|
return null;
|
|
5416
5476
|
}
|
|
5417
|
-
const engine = new CompletionEngine(tcb, data,
|
|
5477
|
+
const engine = new CompletionEngine(tcb, data, tcbPath, tcbIsShim);
|
|
5418
5478
|
this.completionCache.set(component, engine);
|
|
5419
5479
|
return engine;
|
|
5420
5480
|
}
|
|
@@ -5538,11 +5598,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5538
5598
|
if (this.symbolBuilderCache.has(component)) {
|
|
5539
5599
|
return this.symbolBuilderCache.get(component);
|
|
5540
5600
|
}
|
|
5541
|
-
const { tcb, data,
|
|
5601
|
+
const { tcb, data, tcbPath, tcbIsShim } = this.getLatestComponentState(component);
|
|
5542
5602
|
if (tcb === null || data === null) {
|
|
5543
5603
|
return null;
|
|
5544
5604
|
}
|
|
5545
|
-
const builder = new SymbolBuilder(
|
|
5605
|
+
const builder = new SymbolBuilder(tcbPath, tcbIsShim, tcb, data, this.componentScopeReader, () => this.programDriver.getProgram().getTypeChecker());
|
|
5546
5606
|
this.symbolBuilderCache.set(component, builder);
|
|
5547
5607
|
return builder;
|
|
5548
5608
|
}
|
|
@@ -5577,7 +5637,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5577
5637
|
const scope = this.getScopeData(component);
|
|
5578
5638
|
if (scope !== null) {
|
|
5579
5639
|
for (const directive of scope.directives) {
|
|
5580
|
-
for (const selector of
|
|
5640
|
+
for (const selector of CssSelector.parse(directive.selector)) {
|
|
5581
5641
|
if (selector.element === null || tagMap.has(selector.element)) {
|
|
5582
5642
|
continue;
|
|
5583
5643
|
}
|
|
@@ -5609,42 +5669,44 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5609
5669
|
if (scope === null) {
|
|
5610
5670
|
return null;
|
|
5611
5671
|
}
|
|
5672
|
+
const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
|
|
5612
5673
|
const data = {
|
|
5613
5674
|
directives: [],
|
|
5614
5675
|
pipes: [],
|
|
5615
|
-
isPoisoned: scope.compilation.isPoisoned
|
|
5676
|
+
isPoisoned: scope.kind === ComponentScopeKind.NgModule ? scope.compilation.isPoisoned : scope.isPoisoned
|
|
5616
5677
|
};
|
|
5617
5678
|
const typeChecker = this.programDriver.getProgram().getTypeChecker();
|
|
5618
|
-
for (const
|
|
5619
|
-
if (
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5679
|
+
for (const dep of dependencies) {
|
|
5680
|
+
if (dep.kind === MetaKind.Directive) {
|
|
5681
|
+
if (dep.selector === null) {
|
|
5682
|
+
continue;
|
|
5683
|
+
}
|
|
5684
|
+
const tsSymbol = typeChecker.getSymbolAtLocation(dep.ref.node.name);
|
|
5685
|
+
if (!isSymbolWithValueDeclaration(tsSymbol)) {
|
|
5686
|
+
continue;
|
|
5687
|
+
}
|
|
5688
|
+
let ngModule = null;
|
|
5689
|
+
const moduleScopeOfDir = this.componentScopeReader.getScopeForComponent(dep.ref.node);
|
|
5690
|
+
if (moduleScopeOfDir !== null && moduleScopeOfDir.kind === ComponentScopeKind.NgModule) {
|
|
5691
|
+
ngModule = moduleScopeOfDir.ngModule;
|
|
5692
|
+
}
|
|
5693
|
+
data.directives.push({
|
|
5694
|
+
isComponent: dep.isComponent,
|
|
5695
|
+
isStructural: dep.isStructural,
|
|
5696
|
+
selector: dep.selector,
|
|
5697
|
+
tsSymbol,
|
|
5698
|
+
ngModule
|
|
5699
|
+
});
|
|
5700
|
+
} else if (dep.kind === MetaKind.Pipe) {
|
|
5701
|
+
const tsSymbol = typeChecker.getSymbolAtLocation(dep.ref.node.name);
|
|
5702
|
+
if (tsSymbol === void 0) {
|
|
5703
|
+
continue;
|
|
5704
|
+
}
|
|
5705
|
+
data.pipes.push({
|
|
5706
|
+
name: dep.name,
|
|
5707
|
+
tsSymbol
|
|
5708
|
+
});
|
|
5643
5709
|
}
|
|
5644
|
-
data.pipes.push({
|
|
5645
|
-
name: pipe.name,
|
|
5646
|
-
tsSymbol
|
|
5647
|
-
});
|
|
5648
5710
|
}
|
|
5649
5711
|
this.scopeCache.set(component, data);
|
|
5650
5712
|
return data;
|
|
@@ -5736,10 +5798,10 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
5736
5798
|
}
|
|
5737
5799
|
};
|
|
5738
5800
|
|
|
5739
|
-
// bazel-out/
|
|
5801
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
5740
5802
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
5741
5803
|
|
|
5742
|
-
// bazel-out/
|
|
5804
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
5743
5805
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
5744
5806
|
var TemplateCheckWithVisitor = class {
|
|
5745
5807
|
run(ctx, component, template) {
|
|
@@ -5816,7 +5878,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
5816
5878
|
}
|
|
5817
5879
|
};
|
|
5818
5880
|
|
|
5819
|
-
// bazel-out/
|
|
5881
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
5820
5882
|
var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
5821
5883
|
constructor() {
|
|
5822
5884
|
super(...arguments);
|
|
@@ -5841,9 +5903,9 @@ var factory = {
|
|
|
5841
5903
|
create: () => new InvalidBananaInBoxCheck()
|
|
5842
5904
|
};
|
|
5843
5905
|
|
|
5844
|
-
// bazel-out/
|
|
5906
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
5845
5907
|
import { Binary } from "@angular/compiler";
|
|
5846
|
-
import
|
|
5908
|
+
import ts29 from "typescript";
|
|
5847
5909
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
5848
5910
|
constructor() {
|
|
5849
5911
|
super(...arguments);
|
|
@@ -5857,7 +5919,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
5857
5919
|
return [];
|
|
5858
5920
|
}
|
|
5859
5921
|
const typeLeft = symbolLeft.tsType;
|
|
5860
|
-
if (typeLeft.flags & (
|
|
5922
|
+
if (typeLeft.flags & (ts29.TypeFlags.Any | ts29.TypeFlags.Unknown)) {
|
|
5861
5923
|
return [];
|
|
5862
5924
|
}
|
|
5863
5925
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -5866,8 +5928,11 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
5866
5928
|
if (symbol.kind !== SymbolKind.Expression) {
|
|
5867
5929
|
return [];
|
|
5868
5930
|
}
|
|
5869
|
-
const
|
|
5870
|
-
|
|
5931
|
+
const templateMapping = ctx.templateTypeChecker.getTemplateMappingAtTcbLocation(symbol.tcbLocation);
|
|
5932
|
+
if (templateMapping === null) {
|
|
5933
|
+
return [];
|
|
5934
|
+
}
|
|
5935
|
+
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.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.`);
|
|
5871
5936
|
return [diagnostic];
|
|
5872
5937
|
}
|
|
5873
5938
|
};
|
|
@@ -5883,10 +5948,10 @@ var factory2 = {
|
|
|
5883
5948
|
}
|
|
5884
5949
|
};
|
|
5885
5950
|
|
|
5886
|
-
// bazel-out/
|
|
5887
|
-
import
|
|
5951
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5952
|
+
import ts30 from "typescript";
|
|
5888
5953
|
|
|
5889
|
-
// bazel-out/
|
|
5954
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
5890
5955
|
var DiagnosticCategoryLabel;
|
|
5891
5956
|
(function(DiagnosticCategoryLabel2) {
|
|
5892
5957
|
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
@@ -5894,7 +5959,7 @@ var DiagnosticCategoryLabel;
|
|
|
5894
5959
|
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
5895
5960
|
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
5896
5961
|
|
|
5897
|
-
// bazel-out/
|
|
5962
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5898
5963
|
var ExtendedTemplateCheckerImpl = class {
|
|
5899
5964
|
constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
|
|
5900
5965
|
var _a, _b, _c, _d, _e;
|
|
@@ -5932,9 +5997,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
5932
5997
|
function diagnosticLabelToCategory(label) {
|
|
5933
5998
|
switch (label) {
|
|
5934
5999
|
case DiagnosticCategoryLabel.Warning:
|
|
5935
|
-
return
|
|
6000
|
+
return ts30.DiagnosticCategory.Warning;
|
|
5936
6001
|
case DiagnosticCategoryLabel.Error:
|
|
5937
|
-
return
|
|
6002
|
+
return ts30.DiagnosticCategory.Error;
|
|
5938
6003
|
case DiagnosticCategoryLabel.Suppress:
|
|
5939
6004
|
return null;
|
|
5940
6005
|
default:
|
|
@@ -5946,13 +6011,13 @@ function assertNever(value) {
|
|
|
5946
6011
|
${value}`);
|
|
5947
6012
|
}
|
|
5948
6013
|
|
|
5949
|
-
// bazel-out/
|
|
6014
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.mjs
|
|
5950
6015
|
var ALL_DIAGNOSTIC_FACTORIES = [
|
|
5951
6016
|
factory,
|
|
5952
6017
|
factory2
|
|
5953
6018
|
];
|
|
5954
6019
|
|
|
5955
|
-
// bazel-out/
|
|
6020
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
5956
6021
|
var CompilationTicketKind;
|
|
5957
6022
|
(function(CompilationTicketKind2) {
|
|
5958
6023
|
CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -6029,7 +6094,7 @@ var NgCompiler = class {
|
|
|
6029
6094
|
this.currentProgram = inputProgram;
|
|
6030
6095
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6031
6096
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6032
|
-
const moduleResolutionCache =
|
|
6097
|
+
const moduleResolutionCache = ts31.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
6033
6098
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
6034
6099
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
6035
6100
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -6085,7 +6150,7 @@ var NgCompiler = class {
|
|
|
6085
6150
|
}
|
|
6086
6151
|
for (const clazz of classesToUpdate) {
|
|
6087
6152
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6088
|
-
if (!
|
|
6153
|
+
if (!ts31.isClassDeclaration(clazz)) {
|
|
6089
6154
|
continue;
|
|
6090
6155
|
}
|
|
6091
6156
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6437,10 +6502,11 @@ var NgCompiler = class {
|
|
|
6437
6502
|
const localMetaReader = localMetaRegistry;
|
|
6438
6503
|
const depScopeReader = new MetadataDtsModuleScopeResolver(dtsReader, aliasingHost);
|
|
6439
6504
|
const metaReader = new CompoundMetadataReader([localMetaReader, dtsReader]);
|
|
6440
|
-
const
|
|
6441
|
-
const
|
|
6505
|
+
const ngModuleScopeRegistry = new LocalModuleScopeRegistry(localMetaReader, metaReader, depScopeReader, refEmitter, aliasingHost);
|
|
6506
|
+
const standaloneScopeReader = new StandaloneComponentScopeReader(metaReader, ngModuleScopeRegistry, depScopeReader);
|
|
6507
|
+
const scopeReader = new CompoundComponentScopeReader([ngModuleScopeRegistry, standaloneScopeReader]);
|
|
6442
6508
|
const semanticDepGraphUpdater = this.incrementalCompilation.semanticDepGraphUpdater;
|
|
6443
|
-
const metaRegistry = new CompoundMetadataRegistry([localMetaRegistry,
|
|
6509
|
+
const metaRegistry = new CompoundMetadataRegistry([localMetaRegistry, ngModuleScopeRegistry]);
|
|
6444
6510
|
const injectableRegistry = new InjectableClassRegistry(reflector);
|
|
6445
6511
|
const typeCheckScopeRegistry = new TypeCheckScopeRegistry(scopeReader, metaReader);
|
|
6446
6512
|
let referencesRegistry;
|
|
@@ -6457,24 +6523,24 @@ var NgCompiler = class {
|
|
|
6457
6523
|
const compilationMode = this.options.compilationMode === "partial" && !isCore ? CompilationMode.PARTIAL : CompilationMode.FULL;
|
|
6458
6524
|
const cycleHandlingStrategy = compilationMode === CompilationMode.FULL ? 0 : 1;
|
|
6459
6525
|
const handlers = [
|
|
6460
|
-
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader,
|
|
6461
|
-
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry,
|
|
6462
|
-
new PipeDecoratorHandler(reflector, evaluator, metaRegistry,
|
|
6526
|
+
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder),
|
|
6527
|
+
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, isCore, semanticDepGraphUpdater, this.closureCompilerEnabled, false, this.delegatingPerfRecorder),
|
|
6528
|
+
new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder),
|
|
6463
6529
|
new InjectableDecoratorHandler(reflector, isCore, this.options.strictInjectionParameters || false, injectableRegistry, this.delegatingPerfRecorder),
|
|
6464
|
-
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry,
|
|
6530
|
+
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, isCore, refEmitter, this.adapter.factoryTracker, this.closureCompilerEnabled, injectableRegistry, this.delegatingPerfRecorder)
|
|
6465
6531
|
];
|
|
6466
|
-
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater);
|
|
6532
|
+
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
|
|
6467
6533
|
const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {
|
|
6468
6534
|
this.incrementalStrategy.setIncrementalState(this.incrementalCompilation.state, program);
|
|
6469
6535
|
this.currentProgram = program;
|
|
6470
6536
|
});
|
|
6471
|
-
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation,
|
|
6537
|
+
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, scopeReader, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
6472
6538
|
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
6473
6539
|
return {
|
|
6474
6540
|
isCore,
|
|
6475
6541
|
traitCompiler,
|
|
6476
6542
|
reflector,
|
|
6477
|
-
scopeRegistry,
|
|
6543
|
+
scopeRegistry: ngModuleScopeRegistry,
|
|
6478
6544
|
dtsTransforms,
|
|
6479
6545
|
exportReferenceGraph,
|
|
6480
6546
|
metaReader,
|
|
@@ -6493,17 +6559,17 @@ function isAngularCorePackage(program) {
|
|
|
6493
6559
|
return false;
|
|
6494
6560
|
}
|
|
6495
6561
|
return r3Symbols.statements.some((stmt) => {
|
|
6496
|
-
if (!
|
|
6562
|
+
if (!ts31.isVariableStatement(stmt)) {
|
|
6497
6563
|
return false;
|
|
6498
6564
|
}
|
|
6499
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
6565
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts31.SyntaxKind.ExportKeyword)) {
|
|
6500
6566
|
return false;
|
|
6501
6567
|
}
|
|
6502
6568
|
return stmt.declarationList.declarations.some((decl) => {
|
|
6503
|
-
if (!
|
|
6569
|
+
if (!ts31.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
6504
6570
|
return false;
|
|
6505
6571
|
}
|
|
6506
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
6572
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts31.SyntaxKind.TrueKeyword) {
|
|
6507
6573
|
return false;
|
|
6508
6574
|
}
|
|
6509
6575
|
return true;
|
|
@@ -6517,7 +6583,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
6517
6583
|
var _a, _b, _c;
|
|
6518
6584
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
6519
6585
|
yield makeConfigDiagnostic({
|
|
6520
|
-
category:
|
|
6586
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6521
6587
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
6522
6588
|
messageText: `
|
|
6523
6589
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -6536,7 +6602,7 @@ https://angular.io/guide/template-typecheck
|
|
|
6536
6602
|
}
|
|
6537
6603
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
6538
6604
|
yield makeConfigDiagnostic({
|
|
6539
|
-
category:
|
|
6605
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6540
6606
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
6541
6607
|
messageText: `
|
|
6542
6608
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -6553,7 +6619,7 @@ One of the following actions is required:
|
|
|
6553
6619
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
6554
6620
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
6555
6621
|
yield makeConfigDiagnostic({
|
|
6556
|
-
category:
|
|
6622
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6557
6623
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6558
6624
|
messageText: `
|
|
6559
6625
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -6567,7 +6633,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
6567
6633
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
6568
6634
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
6569
6635
|
yield makeConfigDiagnostic({
|
|
6570
|
-
category:
|
|
6636
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6571
6637
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
6572
6638
|
messageText: `
|
|
6573
6639
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -6579,7 +6645,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
6579
6645
|
}
|
|
6580
6646
|
if (!allowedCategoryLabels.includes(category)) {
|
|
6581
6647
|
yield makeConfigDiagnostic({
|
|
6582
|
-
category:
|
|
6648
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6583
6649
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6584
6650
|
messageText: `
|
|
6585
6651
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -6609,7 +6675,7 @@ var ReferenceGraphAdapter = class {
|
|
|
6609
6675
|
for (const { node } of references) {
|
|
6610
6676
|
let sourceFile = node.getSourceFile();
|
|
6611
6677
|
if (sourceFile === void 0) {
|
|
6612
|
-
sourceFile =
|
|
6678
|
+
sourceFile = ts31.getOriginalNode(node).getSourceFile();
|
|
6613
6679
|
}
|
|
6614
6680
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
6615
6681
|
this.graph.add(source, node);
|
|
@@ -6647,8 +6713,8 @@ function versionMapFromProgram(program, driver) {
|
|
|
6647
6713
|
return versions;
|
|
6648
6714
|
}
|
|
6649
6715
|
|
|
6650
|
-
// bazel-out/
|
|
6651
|
-
import
|
|
6716
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
6717
|
+
import ts32 from "typescript";
|
|
6652
6718
|
var DelegatingCompilerHost2 = class {
|
|
6653
6719
|
constructor(delegate) {
|
|
6654
6720
|
this.delegate = delegate;
|
|
@@ -6738,7 +6804,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6738
6804
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
6739
6805
|
if (entryPoint === null) {
|
|
6740
6806
|
diagnostics.push({
|
|
6741
|
-
category:
|
|
6807
|
+
category: ts32.DiagnosticCategory.Error,
|
|
6742
6808
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
6743
6809
|
file: void 0,
|
|
6744
6810
|
start: void 0,
|
|
@@ -6759,6 +6825,9 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6759
6825
|
isShim(sf) {
|
|
6760
6826
|
return isShim(sf);
|
|
6761
6827
|
}
|
|
6828
|
+
isResource(sf) {
|
|
6829
|
+
return false;
|
|
6830
|
+
}
|
|
6762
6831
|
getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile) {
|
|
6763
6832
|
const shimSf = this.shimAdapter.maybeGenerate(resolve(fileName));
|
|
6764
6833
|
if (shimSf !== null) {
|
|
@@ -6778,17 +6847,17 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6778
6847
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
6779
6848
|
}
|
|
6780
6849
|
createCachedResolveModuleNamesFunction() {
|
|
6781
|
-
const moduleResolutionCache =
|
|
6850
|
+
const moduleResolutionCache = ts32.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
6782
6851
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
6783
6852
|
return moduleNames.map((moduleName) => {
|
|
6784
|
-
const module =
|
|
6853
|
+
const module = ts32.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
6785
6854
|
return module.resolvedModule;
|
|
6786
6855
|
});
|
|
6787
6856
|
};
|
|
6788
6857
|
}
|
|
6789
6858
|
};
|
|
6790
6859
|
|
|
6791
|
-
// bazel-out/
|
|
6860
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
6792
6861
|
var NgtscProgram = class {
|
|
6793
6862
|
constructor(rootNames, options, delegateHost, oldProgram) {
|
|
6794
6863
|
this.options = options;
|
|
@@ -6802,7 +6871,7 @@ var NgtscProgram = class {
|
|
|
6802
6871
|
if (reuseProgram !== void 0) {
|
|
6803
6872
|
retagAllTsFiles(reuseProgram);
|
|
6804
6873
|
}
|
|
6805
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
6874
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts33.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
6806
6875
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
6807
6876
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
6808
6877
|
this.host.postProgramCreationCleanup();
|
|
@@ -6995,38 +7064,38 @@ function mergeEmitResults(emitResults) {
|
|
|
6995
7064
|
return { diagnostics, emitSkipped, emittedFiles };
|
|
6996
7065
|
}
|
|
6997
7066
|
|
|
6998
|
-
// bazel-out/
|
|
7067
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
6999
7068
|
function createProgram({ rootNames, options, host, oldProgram }) {
|
|
7000
7069
|
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
7001
7070
|
}
|
|
7002
7071
|
|
|
7003
|
-
// bazel-out/
|
|
7004
|
-
import
|
|
7072
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7073
|
+
import ts35 from "typescript";
|
|
7005
7074
|
|
|
7006
|
-
// bazel-out/
|
|
7007
|
-
import
|
|
7075
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
7076
|
+
import ts34 from "typescript";
|
|
7008
7077
|
var GENERATED_FILES = /(.*?)\.(ngfactory|shim\.ngstyle|ngstyle|ngsummary)\.(js|d\.ts|ts)$/;
|
|
7009
7078
|
function createMessageDiagnostic(messageText) {
|
|
7010
7079
|
return {
|
|
7011
7080
|
file: void 0,
|
|
7012
7081
|
start: void 0,
|
|
7013
7082
|
length: void 0,
|
|
7014
|
-
category:
|
|
7083
|
+
category: ts34.DiagnosticCategory.Message,
|
|
7015
7084
|
messageText,
|
|
7016
7085
|
code: DEFAULT_ERROR_CODE,
|
|
7017
7086
|
source: SOURCE
|
|
7018
7087
|
};
|
|
7019
7088
|
}
|
|
7020
7089
|
|
|
7021
|
-
// bazel-out/
|
|
7090
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7022
7091
|
var defaultFormatHost = {
|
|
7023
|
-
getCurrentDirectory: () =>
|
|
7092
|
+
getCurrentDirectory: () => ts35.sys.getCurrentDirectory(),
|
|
7024
7093
|
getCanonicalFileName: (fileName) => fileName,
|
|
7025
|
-
getNewLine: () =>
|
|
7094
|
+
getNewLine: () => ts35.sys.newLine
|
|
7026
7095
|
};
|
|
7027
7096
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7028
7097
|
if (diags && diags.length) {
|
|
7029
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
7098
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts35.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7030
7099
|
} else {
|
|
7031
7100
|
return "";
|
|
7032
7101
|
}
|
|
@@ -7043,7 +7112,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7043
7112
|
var _a, _b;
|
|
7044
7113
|
try {
|
|
7045
7114
|
const fs = getFileSystem();
|
|
7046
|
-
const readConfigFile = (configFile) =>
|
|
7115
|
+
const readConfigFile = (configFile) => ts35.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7047
7116
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7048
7117
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7049
7118
|
if (error2) {
|
|
@@ -7075,7 +7144,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7075
7144
|
basePath
|
|
7076
7145
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
7077
7146
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7078
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
7147
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts35.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7079
7148
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
7080
7149
|
let emitFlags = EmitFlags.Default;
|
|
7081
7150
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -7087,7 +7156,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7087
7156
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7088
7157
|
} catch (e) {
|
|
7089
7158
|
const errors = [{
|
|
7090
|
-
category:
|
|
7159
|
+
category: ts35.DiagnosticCategory.Error,
|
|
7091
7160
|
messageText: (_b = e.stack) != null ? _b : e.message,
|
|
7092
7161
|
file: void 0,
|
|
7093
7162
|
start: void 0,
|
|
@@ -7101,7 +7170,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7101
7170
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7102
7171
|
return {
|
|
7103
7172
|
fileExists: host.exists.bind(host),
|
|
7104
|
-
readDirectory:
|
|
7173
|
+
readDirectory: ts35.sys.readDirectory,
|
|
7105
7174
|
readFile: host.readFile.bind(host),
|
|
7106
7175
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7107
7176
|
};
|
|
@@ -7121,7 +7190,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7121
7190
|
}
|
|
7122
7191
|
} else {
|
|
7123
7192
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7124
|
-
const { resolvedModule } =
|
|
7193
|
+
const { resolvedModule } = ts35.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts35.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
7125
7194
|
if (resolvedModule) {
|
|
7126
7195
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
7127
7196
|
}
|
|
@@ -7131,7 +7200,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7131
7200
|
function exitCodeFromResult(diags) {
|
|
7132
7201
|
if (!diags)
|
|
7133
7202
|
return 0;
|
|
7134
|
-
if (diags.every((diag) => diag.category !==
|
|
7203
|
+
if (diags.every((diag) => diag.category !== ts35.DiagnosticCategory.Error)) {
|
|
7135
7204
|
return 0;
|
|
7136
7205
|
}
|
|
7137
7206
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7164,7 +7233,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7164
7233
|
} catch (e) {
|
|
7165
7234
|
program = void 0;
|
|
7166
7235
|
allDiagnostics.push({
|
|
7167
|
-
category:
|
|
7236
|
+
category: ts35.DiagnosticCategory.Error,
|
|
7168
7237
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7169
7238
|
code: UNKNOWN_ERROR_CODE,
|
|
7170
7239
|
file: void 0,
|
|
@@ -7191,7 +7260,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7191
7260
|
return allDiagnostics;
|
|
7192
7261
|
}
|
|
7193
7262
|
function hasErrors(diags) {
|
|
7194
|
-
return diags.some((d) => d.category ===
|
|
7263
|
+
return diags.some((d) => d.category === ts35.DiagnosticCategory.Error);
|
|
7195
7264
|
}
|
|
7196
7265
|
|
|
7197
7266
|
export {
|
|
@@ -7203,11 +7272,10 @@ export {
|
|
|
7203
7272
|
createCompilerHost,
|
|
7204
7273
|
CycleAnalyzer,
|
|
7205
7274
|
ImportGraph,
|
|
7275
|
+
isShim,
|
|
7276
|
+
untagAllTsFiles,
|
|
7206
7277
|
TsCreateProgramDriver,
|
|
7207
7278
|
PatchedProgramIncrementalBuildStrategy,
|
|
7208
|
-
MetadataDtsModuleScopeResolver,
|
|
7209
|
-
LocalModuleScopeRegistry,
|
|
7210
|
-
TypeCheckScopeRegistry,
|
|
7211
7279
|
OptimizeFor,
|
|
7212
7280
|
freshCompilationTicket,
|
|
7213
7281
|
incrementalFromStateTicket,
|
|
@@ -7231,4 +7299,5 @@ export {
|
|
|
7231
7299
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7232
7300
|
* found in the LICENSE file at https://angular.io/license
|
|
7233
7301
|
*/
|
|
7234
|
-
|
|
7302
|
+
// Closure Compiler ignores @suppress and similar if the comment contains @license.
|
|
7303
|
+
//# sourceMappingURL=chunk-VLER5B3O.js.map
|