@angular/compiler-cli 14.0.0-next.7 → 14.0.0-rc.0
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-AR265E4B.js → chunk-2IMT6JFI.js} +1 -1
- package/bundles/chunk-2IMT6JFI.js.map +6 -0
- package/bundles/{chunk-VGNMN2NK.js → chunk-53V6MPBS.js} +19 -8
- package/bundles/chunk-53V6MPBS.js.map +6 -0
- package/bundles/{chunk-OOJDZK5W.js → chunk-7XY4OMWJ.js} +110 -70
- package/bundles/chunk-7XY4OMWJ.js.map +6 -0
- package/bundles/{chunk-NM2N677S.js → chunk-BHGVN4MI.js} +70 -25
- package/bundles/chunk-BHGVN4MI.js.map +6 -0
- package/bundles/{chunk-26T3CJIJ.js → chunk-GJVJ6GH4.js} +1079 -815
- package/bundles/chunk-GJVJ6GH4.js.map +6 -0
- package/bundles/{chunk-WQ3TNYTD.js → chunk-GMSUYBZP.js} +8 -11
- package/bundles/{chunk-WQ3TNYTD.js.map → chunk-GMSUYBZP.js.map} +0 -0
- package/bundles/{chunk-5RC6M6GX.js → chunk-JDKMNZ6O.js} +6 -8
- package/bundles/chunk-JDKMNZ6O.js.map +6 -0
- package/bundles/{chunk-U5ES6WUL.js → chunk-KPGMJT2X.js} +3 -3
- package/bundles/chunk-KPGMJT2X.js.map +6 -0
- package/bundles/{chunk-646P2DOR.js → chunk-LX5Q27EF.js} +1 -1
- package/bundles/chunk-LX5Q27EF.js.map +6 -0
- package/bundles/{chunk-KMCI52ED.js → chunk-N6HUFHQ6.js} +967 -901
- package/bundles/chunk-N6HUFHQ6.js.map +6 -0
- package/bundles/{chunk-MXJN5K6C.js → chunk-OLGEBPBY.js} +3 -3
- package/bundles/chunk-OLGEBPBY.js.map +6 -0
- package/bundles/{chunk-QDWL7SZJ.js → chunk-R3C7RFJ4.js} +1 -1
- package/bundles/chunk-R3C7RFJ4.js.map +6 -0
- package/bundles/{chunk-GLCRIILX.js → chunk-R4NY3TJC.js} +1 -1
- package/bundles/chunk-R4NY3TJC.js.map +6 -0
- package/bundles/{chunk-FXU7FMZC.js → chunk-T7MYRXIE.js} +3 -3
- package/bundles/chunk-T7MYRXIE.js.map +6 -0
- package/bundles/{chunk-3MNDX4LL.js → chunk-W6KM7BUM.js} +3 -3
- package/bundles/chunk-W6KM7BUM.js.map +6 -0
- package/bundles/{chunk-K2Z44JHH.js → chunk-WGBFSDVQ.js} +3 -3
- package/bundles/chunk-WGBFSDVQ.js.map +6 -0
- package/bundles/index.js +11 -12
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +6 -6
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +12 -12
- package/bundles/ngcc/index.js.map +1 -1
- package/bundles/ngcc/main-ngcc.js +13 -13
- package/bundles/ngcc/main-ngcc.js.map +1 -1
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +11 -11
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +1 -1
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +4 -4
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js.map +1 -1
- package/bundles/private/bazel.js +2 -2
- package/bundles/private/localize.js +4 -4
- package/bundles/private/migrations.js +6 -6
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +8 -8
- package/bundles/src/bin/ng_xi18n.js.map +1 -1
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles/src/bin/ngc.js.map +1 -1
- package/bundles_metadata.json +1 -1
- package/linker/src/file_linker/emit_scopes/emit_scope.d.ts +7 -3
- package/linker/src/file_linker/emit_scopes/{iife_emit_scope.d.ts → local_emit_scope.d.ts} +7 -11
- package/linker/src/file_linker/partial_linkers/partial_class_metadata_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_directive_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_factory_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_injectable_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_injector_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_linker.d.ts +8 -1
- package/linker/src/file_linker/partial_linkers/partial_ng_module_linker_1.d.ts +4 -4
- package/linker/src/file_linker/partial_linkers/partial_pipe_linker_1.d.ts +3 -3
- 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 +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/src/handler.d.ts +10 -7
- 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 +10 -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/shims/api.d.ts +0 -1
- package/src/ngtsc/transform/src/compilation.d.ts +3 -1
- package/src/ngtsc/tsc_plugin.d.ts +1 -1
- 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/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/template_symbol_builder.d.ts +4 -3
- package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
- package/src/ngtsc/util/src/typescript.d.ts +0 -5
- package/bundles/chunk-26T3CJIJ.js.map +0 -6
- package/bundles/chunk-3MNDX4LL.js.map +0 -6
- package/bundles/chunk-5RC6M6GX.js.map +0 -6
- package/bundles/chunk-646P2DOR.js.map +0 -6
- package/bundles/chunk-AR265E4B.js.map +0 -6
- package/bundles/chunk-FXU7FMZC.js.map +0 -6
- package/bundles/chunk-GLCRIILX.js.map +0 -6
- package/bundles/chunk-K2Z44JHH.js.map +0 -6
- package/bundles/chunk-KMCI52ED.js.map +0 -6
- package/bundles/chunk-MXJN5K6C.js.map +0 -6
- package/bundles/chunk-NM2N677S.js.map +0 -6
- package/bundles/chunk-OOJDZK5W.js.map +0 -6
- package/bundles/chunk-QDWL7SZJ.js.map +0 -6
- package/bundles/chunk-U5ES6WUL.js.map +0 -6
- package/bundles/chunk-VGNMN2NK.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-26T3CJIJ.js";
|
|
32
|
+
ivyTransformFactory
|
|
33
|
+
} from "./chunk-GJVJ6GH4.js";
|
|
38
34
|
import {
|
|
39
35
|
TypeScriptReflectionHost,
|
|
40
36
|
isNamedClassDeclaration
|
|
41
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-2IMT6JFI.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,35 +67,35 @@ 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-JDKMNZ6O.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-T7MYRXIE.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-R4NY3TJC.js";
|
|
100
95
|
import {
|
|
101
96
|
__spreadProps,
|
|
102
97
|
__spreadValues
|
|
103
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-GMSUYBZP.js";
|
|
104
99
|
|
|
105
100
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
106
101
|
var DEFAULT_ERROR_CODE = 100;
|
|
@@ -162,7 +157,7 @@ var SymbolKind;
|
|
|
162
157
|
|
|
163
158
|
// bazel-out/k8-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
162
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
168
163
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -254,8 +249,8 @@ function compareVersions(v1, v2) {
|
|
|
254
249
|
}
|
|
255
250
|
|
|
256
251
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
257
|
-
var MIN_TS_VERSION = "4.
|
|
258
|
-
var MAX_TS_VERSION = "4.
|
|
252
|
+
var MIN_TS_VERSION = "4.6.2";
|
|
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) {
|
|
@@ -267,7 +262,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
267
262
|
}
|
|
268
263
|
|
|
269
264
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
270
|
-
import
|
|
265
|
+
import ts31 from "typescript";
|
|
271
266
|
|
|
272
267
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
273
268
|
var CycleAnalyzer = class {
|
|
@@ -616,7 +611,405 @@ var UpdateMode;
|
|
|
616
611
|
})(UpdateMode || (UpdateMode = {}));
|
|
617
612
|
|
|
618
613
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
614
|
+
import ts9 from "typescript";
|
|
615
|
+
|
|
616
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
619
617
|
import ts6 from "typescript";
|
|
618
|
+
|
|
619
|
+
// bazel-out/k8-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/k8-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/k8-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/k8-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/k8-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/k8-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/k8-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,
|
|
@@ -1343,7 +1736,7 @@ function generateAnalysis(context) {
|
|
|
1343
1736
|
}
|
|
1344
1737
|
|
|
1345
1738
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
1346
|
-
import
|
|
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/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/
|
|
1492
|
-
var
|
|
1493
|
-
constructor(
|
|
1494
|
-
this.
|
|
1495
|
-
this.
|
|
1884
|
+
// bazel-out/k8-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(dirMeta);
|
|
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(pipeMeta);
|
|
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(ngModuleMeta);
|
|
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
1946
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
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
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
for (const { name, ref } of scope.compilation.pipes) {
|
|
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);
|
|
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
|
+
});
|
|
1926
1954
|
}
|
|
1927
|
-
|
|
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
1962
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
1949
|
-
import { CssSelector
|
|
1963
|
+
import { CssSelector, DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
1950
1964
|
|
|
1951
1965
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
1952
|
-
import
|
|
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(),
|
|
@@ -2040,15 +2054,15 @@ function allocateTemplateId(sf) {
|
|
|
2040
2054
|
|
|
2041
2055
|
// bazel-out/k8-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
2059
|
// bazel-out/k8-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);
|
|
@@ -2164,20 +2178,22 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
|
2164
2178
|
|
|
2165
2179
|
// bazel-out/k8-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;
|
|
@@ -2314,11 +2334,11 @@ var CompletionEngine = class {
|
|
|
2314
2334
|
};
|
|
2315
2335
|
|
|
2316
2336
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2317
|
-
import
|
|
2337
|
+
import ts27 from "typescript";
|
|
2318
2338
|
|
|
2319
2339
|
// bazel-out/k8-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 {
|
|
@@ -2342,7 +2362,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2342
2362
|
} else {
|
|
2343
2363
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2344
2364
|
}
|
|
2345
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
2365
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts14.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2346
2366
|
this._diagnostics.push(diag);
|
|
2347
2367
|
}
|
|
2348
2368
|
}
|
|
@@ -2360,70 +2380,74 @@ var RegistryDomSchemaChecker = class {
|
|
|
2360
2380
|
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
2381
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2362
2382
|
}
|
|
2363
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
2383
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts14.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2364
2384
|
this._diagnostics.push(diag);
|
|
2365
2385
|
}
|
|
2366
2386
|
}
|
|
2367
2387
|
};
|
|
2368
2388
|
|
|
2369
2389
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2370
|
-
import { ExpressionType, ExternalExpr
|
|
2371
|
-
import
|
|
2390
|
+
import { ExpressionType, ExternalExpr, TypeModifier } from "@angular/compiler";
|
|
2391
|
+
import ts20 from "typescript";
|
|
2372
2392
|
|
|
2373
2393
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2374
|
-
import
|
|
2394
|
+
import ts15 from "typescript";
|
|
2395
|
+
var PARSED_TS_VERSION = parseFloat(ts15.versionMajorMinor);
|
|
2375
2396
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2397
|
+
ts15.SyntaxKind.ParenthesizedExpression,
|
|
2398
|
+
ts15.SyntaxKind.Identifier,
|
|
2399
|
+
ts15.SyntaxKind.CallExpression,
|
|
2400
|
+
ts15.SyntaxKind.NonNullExpression,
|
|
2401
|
+
ts15.SyntaxKind.ElementAccessExpression,
|
|
2402
|
+
ts15.SyntaxKind.PropertyAccessExpression,
|
|
2403
|
+
ts15.SyntaxKind.ArrayLiteralExpression,
|
|
2404
|
+
ts15.SyntaxKind.ObjectLiteralExpression,
|
|
2405
|
+
ts15.SyntaxKind.StringLiteral,
|
|
2406
|
+
ts15.SyntaxKind.NumericLiteral,
|
|
2407
|
+
ts15.SyntaxKind.TrueKeyword,
|
|
2408
|
+
ts15.SyntaxKind.FalseKeyword,
|
|
2409
|
+
ts15.SyntaxKind.NullKeyword,
|
|
2410
|
+
ts15.SyntaxKind.UndefinedKeyword
|
|
2390
2411
|
]);
|
|
2391
2412
|
function tsCastToAny(expr) {
|
|
2392
2413
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2393
|
-
expr =
|
|
2414
|
+
expr = ts15.factory.createParenthesizedExpression(expr);
|
|
2394
2415
|
}
|
|
2395
|
-
return
|
|
2416
|
+
return ts15.factory.createParenthesizedExpression(ts15.factory.createAsExpression(expr, ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.AnyKeyword)));
|
|
2396
2417
|
}
|
|
2397
2418
|
function tsCreateElement(tagName) {
|
|
2398
|
-
const createElement =
|
|
2399
|
-
return
|
|
2419
|
+
const createElement = ts15.factory.createPropertyAccessExpression(ts15.factory.createIdentifier("document"), "createElement");
|
|
2420
|
+
return ts15.factory.createCallExpression(createElement, void 0, [ts15.factory.createStringLiteral(tagName)]);
|
|
2400
2421
|
}
|
|
2401
2422
|
function tsDeclareVariable(id, type) {
|
|
2402
|
-
const decl =
|
|
2403
|
-
return
|
|
2423
|
+
const decl = ts15.factory.createVariableDeclaration(id, void 0, type, ts15.factory.createNonNullExpression(ts15.factory.createNull()));
|
|
2424
|
+
return ts15.factory.createVariableStatement(void 0, [decl]);
|
|
2404
2425
|
}
|
|
2405
2426
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2406
|
-
return
|
|
2427
|
+
return ts15.factory.createTypeQueryNode(ts15.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2407
2428
|
}
|
|
2408
2429
|
function tsCreateVariable(id, initializer) {
|
|
2409
|
-
const decl =
|
|
2410
|
-
return
|
|
2430
|
+
const decl = ts15.factory.createVariableDeclaration(id, void 0, void 0, initializer);
|
|
2431
|
+
return ts15.factory.createVariableStatement(void 0, [decl]);
|
|
2411
2432
|
}
|
|
2412
2433
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2413
|
-
const methodAccess =
|
|
2414
|
-
return
|
|
2434
|
+
const methodAccess = ts15.factory.createPropertyAccessExpression(receiver, methodName);
|
|
2435
|
+
return ts15.factory.createCallExpression(methodAccess, void 0, args);
|
|
2436
|
+
}
|
|
2437
|
+
function tsUpdateTypeParameterDeclaration(node, name, constraint, defaultType) {
|
|
2438
|
+
return PARSED_TS_VERSION < 4.7 ? ts15.factory.updateTypeParameterDeclaration(node, name, constraint, defaultType) : ts15.factory.updateTypeParameterDeclaration(node, [], name, constraint, defaultType);
|
|
2415
2439
|
}
|
|
2416
2440
|
function checkIfClassIsExported(node) {
|
|
2417
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
2441
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts15.SyntaxKind.ExportKeyword)) {
|
|
2418
2442
|
return true;
|
|
2419
|
-
} else if (node.parent !== void 0 &&
|
|
2443
|
+
} else if (node.parent !== void 0 && ts15.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
2420
2444
|
return true;
|
|
2421
2445
|
}
|
|
2422
2446
|
return false;
|
|
2423
2447
|
}
|
|
2424
2448
|
function checkIfFileHasExport(sf, name) {
|
|
2425
2449
|
for (const stmt of sf.statements) {
|
|
2426
|
-
if (
|
|
2450
|
+
if (ts15.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts15.isNamedExports(stmt.exportClause)) {
|
|
2427
2451
|
for (const element of stmt.exportClause.elements) {
|
|
2428
2452
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
2429
2453
|
return true;
|
|
@@ -2436,20 +2460,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
2436
2460
|
return false;
|
|
2437
2461
|
}
|
|
2438
2462
|
function isAccessExpression(node) {
|
|
2439
|
-
return
|
|
2463
|
+
return ts15.isPropertyAccessExpression(node) || ts15.isElementAccessExpression(node);
|
|
2440
2464
|
}
|
|
2441
2465
|
|
|
2442
2466
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2443
|
-
import
|
|
2467
|
+
import ts19 from "typescript";
|
|
2444
2468
|
|
|
2445
2469
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2446
|
-
import
|
|
2470
|
+
import ts18 from "typescript";
|
|
2447
2471
|
|
|
2448
2472
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2449
|
-
import
|
|
2473
|
+
import ts17 from "typescript";
|
|
2450
2474
|
|
|
2451
2475
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2452
|
-
import
|
|
2476
|
+
import ts16 from "typescript";
|
|
2453
2477
|
var INELIGIBLE = {};
|
|
2454
2478
|
function canEmitType(type, canEmit) {
|
|
2455
2479
|
return canEmitTypeWorker(type);
|
|
@@ -2457,13 +2481,13 @@ function canEmitType(type, canEmit) {
|
|
|
2457
2481
|
return visitNode(type2) !== INELIGIBLE;
|
|
2458
2482
|
}
|
|
2459
2483
|
function visitNode(node) {
|
|
2460
|
-
if (
|
|
2484
|
+
if (ts16.isImportTypeNode(node)) {
|
|
2461
2485
|
return INELIGIBLE;
|
|
2462
2486
|
}
|
|
2463
|
-
if (
|
|
2487
|
+
if (ts16.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2464
2488
|
return INELIGIBLE;
|
|
2465
2489
|
} else {
|
|
2466
|
-
return
|
|
2490
|
+
return ts16.forEachChild(node, visitNode);
|
|
2467
2491
|
}
|
|
2468
2492
|
}
|
|
2469
2493
|
function canEmitTypeReference(type2) {
|
|
@@ -2480,22 +2504,22 @@ var TypeEmitter = class {
|
|
|
2480
2504
|
emitType(type) {
|
|
2481
2505
|
const typeReferenceTransformer = (context) => {
|
|
2482
2506
|
const visitNode = (node) => {
|
|
2483
|
-
if (
|
|
2507
|
+
if (ts16.isImportTypeNode(node)) {
|
|
2484
2508
|
throw new Error("Unable to emit import type");
|
|
2485
2509
|
}
|
|
2486
|
-
if (
|
|
2510
|
+
if (ts16.isTypeReferenceNode(node)) {
|
|
2487
2511
|
return this.emitTypeReference(node);
|
|
2488
|
-
} else if (
|
|
2489
|
-
const clone =
|
|
2490
|
-
|
|
2512
|
+
} else if (ts16.isLiteralExpression(node)) {
|
|
2513
|
+
const clone = ts16.getMutableClone(node);
|
|
2514
|
+
ts16.setTextRange(clone, { pos: -1, end: -1 });
|
|
2491
2515
|
return clone;
|
|
2492
2516
|
} else {
|
|
2493
|
-
return
|
|
2517
|
+
return ts16.visitEachChild(node, visitNode, context);
|
|
2494
2518
|
}
|
|
2495
2519
|
};
|
|
2496
|
-
return (node) =>
|
|
2520
|
+
return (node) => ts16.visitNode(node, visitNode);
|
|
2497
2521
|
};
|
|
2498
|
-
return
|
|
2522
|
+
return ts16.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2499
2523
|
}
|
|
2500
2524
|
emitTypeReference(type) {
|
|
2501
2525
|
const translatedType = this.translator(type);
|
|
@@ -2504,9 +2528,9 @@ var TypeEmitter = class {
|
|
|
2504
2528
|
}
|
|
2505
2529
|
let typeArguments = void 0;
|
|
2506
2530
|
if (type.typeArguments !== void 0) {
|
|
2507
|
-
typeArguments =
|
|
2531
|
+
typeArguments = ts16.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2508
2532
|
}
|
|
2509
|
-
return
|
|
2533
|
+
return ts16.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2510
2534
|
}
|
|
2511
2535
|
};
|
|
2512
2536
|
|
|
@@ -2547,11 +2571,11 @@ var TypeParameterEmitter = class {
|
|
|
2547
2571
|
return this.typeParameters.map((typeParam) => {
|
|
2548
2572
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2549
2573
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2550
|
-
return
|
|
2574
|
+
return tsUpdateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2551
2575
|
});
|
|
2552
2576
|
}
|
|
2553
2577
|
resolveTypeReference(type) {
|
|
2554
|
-
const target =
|
|
2578
|
+
const target = ts17.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2555
2579
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2556
2580
|
if (declaration === null || declaration.node === null) {
|
|
2557
2581
|
return null;
|
|
@@ -2577,8 +2601,8 @@ var TypeParameterEmitter = class {
|
|
|
2577
2601
|
if (typeNode === null) {
|
|
2578
2602
|
return null;
|
|
2579
2603
|
}
|
|
2580
|
-
if (!
|
|
2581
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2604
|
+
if (!ts17.isTypeReferenceNode(typeNode)) {
|
|
2605
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts17.SyntaxKind[typeNode.kind]}.`);
|
|
2582
2606
|
}
|
|
2583
2607
|
return typeNode;
|
|
2584
2608
|
}
|
|
@@ -2620,14 +2644,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2620
2644
|
}
|
|
2621
2645
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2622
2646
|
for (const stmt of file.statements) {
|
|
2623
|
-
if (
|
|
2647
|
+
if (ts18.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2624
2648
|
return stmt;
|
|
2625
2649
|
}
|
|
2626
2650
|
}
|
|
2627
2651
|
return null;
|
|
2628
2652
|
}
|
|
2629
2653
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2630
|
-
while (node !== void 0 && !
|
|
2654
|
+
while (node !== void 0 && !ts18.isFunctionDeclaration(node)) {
|
|
2631
2655
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2632
2656
|
return null;
|
|
2633
2657
|
}
|
|
@@ -2644,7 +2668,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
2644
2668
|
return null;
|
|
2645
2669
|
}
|
|
2646
2670
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
2647
|
-
while (!
|
|
2671
|
+
while (!ts18.isFunctionDeclaration(node)) {
|
|
2648
2672
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
2649
2673
|
return null;
|
|
2650
2674
|
}
|
|
@@ -2654,8 +2678,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
2654
2678
|
}
|
|
2655
2679
|
}
|
|
2656
2680
|
const start = node.getFullStart();
|
|
2657
|
-
return
|
|
2658
|
-
if (kind !==
|
|
2681
|
+
return ts18.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2682
|
+
if (kind !== ts18.SyntaxKind.MultiLineCommentTrivia) {
|
|
2659
2683
|
return null;
|
|
2660
2684
|
}
|
|
2661
2685
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2670,29 +2694,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
2670
2694
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2671
2695
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
2672
2696
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
2673
|
-
const rawType =
|
|
2697
|
+
const rawType = ts19.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
2674
2698
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2675
2699
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
2676
2700
|
if (meta.body) {
|
|
2677
|
-
const fnType =
|
|
2678
|
-
const decl =
|
|
2679
|
-
const declList =
|
|
2680
|
-
return
|
|
2701
|
+
const fnType = ts19.factory.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2702
|
+
const decl = ts19.factory.createVariableDeclaration(meta.fnName, void 0, fnType, ts19.factory.createNonNullExpression(ts19.factory.createNull()));
|
|
2703
|
+
const declList = ts19.factory.createVariableDeclarationList([decl], ts19.NodeFlags.Const);
|
|
2704
|
+
return ts19.factory.createVariableStatement(void 0, declList);
|
|
2681
2705
|
} else {
|
|
2682
|
-
return
|
|
2706
|
+
return ts19.factory.createFunctionDeclaration(void 0, [ts19.factory.createModifier(ts19.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
2683
2707
|
}
|
|
2684
2708
|
}
|
|
2685
2709
|
function generateInlineTypeCtor(node, meta) {
|
|
2686
2710
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
2687
|
-
const rawType =
|
|
2711
|
+
const rawType = ts19.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
2688
2712
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2689
2713
|
let body = void 0;
|
|
2690
2714
|
if (meta.body) {
|
|
2691
|
-
body =
|
|
2692
|
-
|
|
2715
|
+
body = ts19.factory.createBlock([
|
|
2716
|
+
ts19.factory.createReturnStatement(ts19.factory.createNonNullExpression(ts19.factory.createNull()))
|
|
2693
2717
|
]);
|
|
2694
2718
|
}
|
|
2695
|
-
return
|
|
2719
|
+
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
2720
|
}
|
|
2697
2721
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
2698
2722
|
let initType = null;
|
|
@@ -2701,26 +2725,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2701
2725
|
const coercedKeys = [];
|
|
2702
2726
|
for (const key of keys) {
|
|
2703
2727
|
if (!meta.coercedInputFields.has(key)) {
|
|
2704
|
-
plainKeys.push(
|
|
2728
|
+
plainKeys.push(ts19.factory.createLiteralTypeNode(ts19.factory.createStringLiteral(key)));
|
|
2705
2729
|
} else {
|
|
2706
|
-
coercedKeys.push(
|
|
2730
|
+
coercedKeys.push(ts19.factory.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key)));
|
|
2707
2731
|
}
|
|
2708
2732
|
}
|
|
2709
2733
|
if (plainKeys.length > 0) {
|
|
2710
|
-
const keyTypeUnion =
|
|
2711
|
-
initType =
|
|
2734
|
+
const keyTypeUnion = ts19.factory.createUnionTypeNode(plainKeys);
|
|
2735
|
+
initType = ts19.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
2712
2736
|
}
|
|
2713
2737
|
if (coercedKeys.length > 0) {
|
|
2714
|
-
const coercedLiteral =
|
|
2715
|
-
initType = initType !== null ?
|
|
2738
|
+
const coercedLiteral = ts19.factory.createTypeLiteralNode(coercedKeys);
|
|
2739
|
+
initType = initType !== null ? ts19.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
2716
2740
|
}
|
|
2717
2741
|
if (initType === null) {
|
|
2718
|
-
initType =
|
|
2742
|
+
initType = ts19.factory.createTypeLiteralNode([]);
|
|
2719
2743
|
}
|
|
2720
|
-
return
|
|
2744
|
+
return ts19.factory.createParameterDeclaration(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
2721
2745
|
}
|
|
2722
2746
|
function generateGenericArgs(params) {
|
|
2723
|
-
return params.map((param) =>
|
|
2747
|
+
return params.map((param) => ts19.factory.createTypeReferenceNode(param.name, void 0));
|
|
2724
2748
|
}
|
|
2725
2749
|
function requiresInlineTypeCtor(node, host, env) {
|
|
2726
2750
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -2731,7 +2755,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
2731
2755
|
}
|
|
2732
2756
|
return params.map((param) => {
|
|
2733
2757
|
if (param.default === void 0) {
|
|
2734
|
-
return
|
|
2758
|
+
return tsUpdateTypeParameterDeclaration(param, param.name, param.constraint, ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.AnyKeyword));
|
|
2735
2759
|
} else {
|
|
2736
2760
|
return param;
|
|
2737
2761
|
}
|
|
@@ -2763,13 +2787,13 @@ var Environment = class {
|
|
|
2763
2787
|
}
|
|
2764
2788
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
2765
2789
|
const ref = this.reference(dirRef);
|
|
2766
|
-
const typeCtorExpr =
|
|
2790
|
+
const typeCtorExpr = ts20.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
2767
2791
|
this.typeCtors.set(node, typeCtorExpr);
|
|
2768
2792
|
return typeCtorExpr;
|
|
2769
2793
|
} else {
|
|
2770
2794
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
2771
2795
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
2772
|
-
if (!
|
|
2796
|
+
if (!ts20.isTypeReferenceNode(nodeTypeRef)) {
|
|
2773
2797
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
2774
2798
|
}
|
|
2775
2799
|
const meta = {
|
|
@@ -2785,7 +2809,7 @@ var Environment = class {
|
|
|
2785
2809
|
const typeParams = this.emitTypeParameters(node);
|
|
2786
2810
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
2787
2811
|
this.typeCtorStatements.push(typeCtor);
|
|
2788
|
-
const fnId =
|
|
2812
|
+
const fnId = ts20.factory.createIdentifier(fnName);
|
|
2789
2813
|
this.typeCtors.set(node, fnId);
|
|
2790
2814
|
return fnId;
|
|
2791
2815
|
}
|
|
@@ -2795,7 +2819,7 @@ var Environment = class {
|
|
|
2795
2819
|
return this.pipeInsts.get(ref.node);
|
|
2796
2820
|
}
|
|
2797
2821
|
const pipeType = this.referenceType(ref);
|
|
2798
|
-
const pipeInstId =
|
|
2822
|
+
const pipeInstId = ts20.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
2799
2823
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
2800
2824
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
2801
2825
|
return pipeInstId;
|
|
@@ -2819,7 +2843,7 @@ var Environment = class {
|
|
|
2819
2843
|
return emitter.emit((ref) => this.referenceType(ref));
|
|
2820
2844
|
}
|
|
2821
2845
|
referenceExternalType(moduleName, name, typeParams) {
|
|
2822
|
-
const external = new
|
|
2846
|
+
const external = new ExternalExpr({ moduleName, name });
|
|
2823
2847
|
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.importManager);
|
|
2824
2848
|
}
|
|
2825
2849
|
getPreludeStatements() {
|
|
@@ -2832,7 +2856,7 @@ var Environment = class {
|
|
|
2832
2856
|
|
|
2833
2857
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
2834
2858
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
2835
|
-
import
|
|
2859
|
+
import ts21 from "typescript";
|
|
2836
2860
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
2837
2861
|
constructor(resolver) {
|
|
2838
2862
|
this.resolver = resolver;
|
|
@@ -2846,7 +2870,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2846
2870
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2847
2871
|
const value = ref.value.trim();
|
|
2848
2872
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
2849
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2873
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
2850
2874
|
}
|
|
2851
2875
|
missingPipe(templateId, ast) {
|
|
2852
2876
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -2858,7 +2882,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2858
2882
|
if (sourceSpan === null) {
|
|
2859
2883
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
2860
2884
|
}
|
|
2861
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2885
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
2862
2886
|
this.recordedPipes.add(ast);
|
|
2863
2887
|
}
|
|
2864
2888
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -2869,7 +2893,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2869
2893
|
if (sourceSpan === null) {
|
|
2870
2894
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
2871
2895
|
}
|
|
2872
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2896
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
2873
2897
|
text: `The variable ${assignment.name} is declared here.`,
|
|
2874
2898
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
2875
2899
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -2879,7 +2903,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2879
2903
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
2880
2904
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2881
2905
|
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,
|
|
2906
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
2883
2907
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
2884
2908
|
start: firstDecl.sourceSpan.start.offset,
|
|
2885
2909
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -2918,7 +2942,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2918
2942
|
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
2943
|
|
|
2920
2944
|
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,
|
|
2945
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts21.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
2922
2946
|
}
|
|
2923
2947
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
2924
2948
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -2952,7 +2976,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
2952
2976
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
2953
2977
|
});
|
|
2954
2978
|
}
|
|
2955
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2979
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts21.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
2956
2980
|
}
|
|
2957
2981
|
};
|
|
2958
2982
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -2963,7 +2987,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
2963
2987
|
}
|
|
2964
2988
|
|
|
2965
2989
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
2966
|
-
import
|
|
2990
|
+
import ts22 from "typescript";
|
|
2967
2991
|
var TypeCheckShimGenerator = class {
|
|
2968
2992
|
constructor() {
|
|
2969
2993
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -2973,7 +2997,7 @@ var TypeCheckShimGenerator = class {
|
|
|
2973
2997
|
if (priorShimSf !== null) {
|
|
2974
2998
|
return priorShimSf;
|
|
2975
2999
|
}
|
|
2976
|
-
return
|
|
3000
|
+
return ts22.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts22.ScriptTarget.Latest, true, ts22.ScriptKind.TS);
|
|
2977
3001
|
}
|
|
2978
3002
|
static shimFor(fileName) {
|
|
2979
3003
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -2982,16 +3006,16 @@ var TypeCheckShimGenerator = class {
|
|
|
2982
3006
|
|
|
2983
3007
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
2984
3008
|
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
|
|
3009
|
+
import ts25 from "typescript";
|
|
2986
3010
|
|
|
2987
3011
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
2988
3012
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
2989
|
-
import
|
|
3013
|
+
import ts23 from "typescript";
|
|
2990
3014
|
function wrapForDiagnostics(expr) {
|
|
2991
|
-
return
|
|
3015
|
+
return ts23.factory.createParenthesizedExpression(expr);
|
|
2992
3016
|
}
|
|
2993
3017
|
function wrapForTypeChecker(expr) {
|
|
2994
|
-
return
|
|
3018
|
+
return ts23.factory.createParenthesizedExpression(expr);
|
|
2995
3019
|
}
|
|
2996
3020
|
function addParseSpanInfo(node, span) {
|
|
2997
3021
|
let commentText;
|
|
@@ -3000,10 +3024,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3000
3024
|
} else {
|
|
3001
3025
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3002
3026
|
}
|
|
3003
|
-
|
|
3027
|
+
ts23.addSyntheticTrailingComment(node, ts23.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3004
3028
|
}
|
|
3005
3029
|
function addTemplateId(tcb, id) {
|
|
3006
|
-
|
|
3030
|
+
ts23.addSyntheticLeadingComment(tcb, ts23.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3007
3031
|
}
|
|
3008
3032
|
function shouldReportDiagnostic(diagnostic) {
|
|
3009
3033
|
const { code } = diagnostic;
|
|
@@ -3032,32 +3056,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3032
3056
|
|
|
3033
3057
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3034
3058
|
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 =
|
|
3059
|
+
import ts24 from "typescript";
|
|
3060
|
+
var NULL_AS_ANY = ts24.factory.createAsExpression(ts24.factory.createNull(), ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3061
|
+
var UNDEFINED = ts24.factory.createIdentifier("undefined");
|
|
3038
3062
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3039
|
-
["+",
|
|
3040
|
-
["-",
|
|
3063
|
+
["+", ts24.SyntaxKind.PlusToken],
|
|
3064
|
+
["-", ts24.SyntaxKind.MinusToken]
|
|
3041
3065
|
]);
|
|
3042
3066
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3043
|
-
["+",
|
|
3044
|
-
["-",
|
|
3045
|
-
["<",
|
|
3046
|
-
[">",
|
|
3047
|
-
["<=",
|
|
3048
|
-
[">=",
|
|
3049
|
-
["==",
|
|
3050
|
-
["===",
|
|
3051
|
-
["*",
|
|
3052
|
-
["/",
|
|
3053
|
-
["%",
|
|
3054
|
-
["!=",
|
|
3055
|
-
["!==",
|
|
3056
|
-
["||",
|
|
3057
|
-
["&&",
|
|
3058
|
-
["&",
|
|
3059
|
-
["|",
|
|
3060
|
-
["??",
|
|
3067
|
+
["+", ts24.SyntaxKind.PlusToken],
|
|
3068
|
+
["-", ts24.SyntaxKind.MinusToken],
|
|
3069
|
+
["<", ts24.SyntaxKind.LessThanToken],
|
|
3070
|
+
[">", ts24.SyntaxKind.GreaterThanToken],
|
|
3071
|
+
["<=", ts24.SyntaxKind.LessThanEqualsToken],
|
|
3072
|
+
[">=", ts24.SyntaxKind.GreaterThanEqualsToken],
|
|
3073
|
+
["==", ts24.SyntaxKind.EqualsEqualsToken],
|
|
3074
|
+
["===", ts24.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3075
|
+
["*", ts24.SyntaxKind.AsteriskToken],
|
|
3076
|
+
["/", ts24.SyntaxKind.SlashToken],
|
|
3077
|
+
["%", ts24.SyntaxKind.PercentToken],
|
|
3078
|
+
["!=", ts24.SyntaxKind.ExclamationEqualsToken],
|
|
3079
|
+
["!==", ts24.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3080
|
+
["||", ts24.SyntaxKind.BarBarToken],
|
|
3081
|
+
["&&", ts24.SyntaxKind.AmpersandAmpersandToken],
|
|
3082
|
+
["&", ts24.SyntaxKind.AmpersandToken],
|
|
3083
|
+
["|", ts24.SyntaxKind.BarToken],
|
|
3084
|
+
["??", ts24.SyntaxKind.QuestionQuestionToken]
|
|
3061
3085
|
]);
|
|
3062
3086
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3063
3087
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3073,7 +3097,7 @@ var AstTranslator = class {
|
|
|
3073
3097
|
ast = ast.ast;
|
|
3074
3098
|
}
|
|
3075
3099
|
if (ast instanceof EmptyExpr2) {
|
|
3076
|
-
const res =
|
|
3100
|
+
const res = ts24.factory.createIdentifier("undefined");
|
|
3077
3101
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3078
3102
|
return res;
|
|
3079
3103
|
}
|
|
@@ -3089,7 +3113,7 @@ var AstTranslator = class {
|
|
|
3089
3113
|
if (op === void 0) {
|
|
3090
3114
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3091
3115
|
}
|
|
3092
|
-
const node = wrapForDiagnostics(
|
|
3116
|
+
const node = wrapForDiagnostics(ts24.factory.createPrefixUnaryExpression(op, expr));
|
|
3093
3117
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3094
3118
|
return node;
|
|
3095
3119
|
}
|
|
@@ -3100,13 +3124,13 @@ var AstTranslator = class {
|
|
|
3100
3124
|
if (op === void 0) {
|
|
3101
3125
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3102
3126
|
}
|
|
3103
|
-
const node =
|
|
3127
|
+
const node = ts24.factory.createBinaryExpression(lhs, op, rhs);
|
|
3104
3128
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3105
3129
|
return node;
|
|
3106
3130
|
}
|
|
3107
3131
|
visitChain(ast) {
|
|
3108
3132
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3109
|
-
const node = wrapForDiagnostics(
|
|
3133
|
+
const node = wrapForDiagnostics(ts24.factory.createCommaListExpression(elements));
|
|
3110
3134
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3111
3135
|
return node;
|
|
3112
3136
|
}
|
|
@@ -3114,7 +3138,7 @@ var AstTranslator = class {
|
|
|
3114
3138
|
const condExpr = this.translate(ast.condition);
|
|
3115
3139
|
const trueExpr = this.translate(ast.trueExp);
|
|
3116
3140
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3117
|
-
const node =
|
|
3141
|
+
const node = ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
3118
3142
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3119
3143
|
return node;
|
|
3120
3144
|
}
|
|
@@ -3125,26 +3149,26 @@ var AstTranslator = class {
|
|
|
3125
3149
|
throw new Error("Method not implemented.");
|
|
3126
3150
|
}
|
|
3127
3151
|
visitInterpolation(ast) {
|
|
3128
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3152
|
+
return ast.expressions.reduce((lhs, ast2) => ts24.factory.createBinaryExpression(lhs, ts24.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts24.factory.createStringLiteral(""));
|
|
3129
3153
|
}
|
|
3130
3154
|
visitKeyedRead(ast) {
|
|
3131
3155
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3132
3156
|
const key = this.translate(ast.key);
|
|
3133
|
-
const node =
|
|
3157
|
+
const node = ts24.factory.createElementAccessExpression(receiver, key);
|
|
3134
3158
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3135
3159
|
return node;
|
|
3136
3160
|
}
|
|
3137
3161
|
visitKeyedWrite(ast) {
|
|
3138
3162
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3139
|
-
const left =
|
|
3163
|
+
const left = ts24.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
3140
3164
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3141
|
-
const node = wrapForDiagnostics(
|
|
3165
|
+
const node = wrapForDiagnostics(ts24.factory.createBinaryExpression(left, ts24.SyntaxKind.EqualsToken, right));
|
|
3142
3166
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3143
3167
|
return node;
|
|
3144
3168
|
}
|
|
3145
3169
|
visitLiteralArray(ast) {
|
|
3146
3170
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3147
|
-
const literal =
|
|
3171
|
+
const literal = ts24.factory.createArrayLiteralExpression(elements);
|
|
3148
3172
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3149
3173
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3150
3174
|
return node;
|
|
@@ -3152,9 +3176,9 @@ var AstTranslator = class {
|
|
|
3152
3176
|
visitLiteralMap(ast) {
|
|
3153
3177
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3154
3178
|
const value = this.translate(ast.values[idx]);
|
|
3155
|
-
return
|
|
3179
|
+
return ts24.factory.createPropertyAssignment(ts24.factory.createStringLiteral(key), value);
|
|
3156
3180
|
});
|
|
3157
|
-
const literal =
|
|
3181
|
+
const literal = ts24.factory.createObjectLiteralExpression(properties, true);
|
|
3158
3182
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3159
3183
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3160
3184
|
return node;
|
|
@@ -3162,15 +3186,15 @@ var AstTranslator = class {
|
|
|
3162
3186
|
visitLiteralPrimitive(ast) {
|
|
3163
3187
|
let node;
|
|
3164
3188
|
if (ast.value === void 0) {
|
|
3165
|
-
node =
|
|
3189
|
+
node = ts24.factory.createIdentifier("undefined");
|
|
3166
3190
|
} else if (ast.value === null) {
|
|
3167
|
-
node =
|
|
3191
|
+
node = ts24.factory.createNull();
|
|
3168
3192
|
} else if (typeof ast.value === "string") {
|
|
3169
|
-
node =
|
|
3193
|
+
node = ts24.factory.createStringLiteral(ast.value);
|
|
3170
3194
|
} else if (typeof ast.value === "number") {
|
|
3171
|
-
node =
|
|
3195
|
+
node = ts24.factory.createNumericLiteral(ast.value);
|
|
3172
3196
|
} else if (typeof ast.value === "boolean") {
|
|
3173
|
-
node = ast.value ?
|
|
3197
|
+
node = ast.value ? ts24.factory.createTrue() : ts24.factory.createFalse();
|
|
3174
3198
|
} else {
|
|
3175
3199
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
3176
3200
|
}
|
|
@@ -3179,7 +3203,7 @@ var AstTranslator = class {
|
|
|
3179
3203
|
}
|
|
3180
3204
|
visitNonNullAssert(ast) {
|
|
3181
3205
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3182
|
-
const node =
|
|
3206
|
+
const node = ts24.factory.createNonNullExpression(expr);
|
|
3183
3207
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3184
3208
|
return node;
|
|
3185
3209
|
}
|
|
@@ -3188,13 +3212,13 @@ var AstTranslator = class {
|
|
|
3188
3212
|
}
|
|
3189
3213
|
visitPrefixNot(ast) {
|
|
3190
3214
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3191
|
-
const node =
|
|
3215
|
+
const node = ts24.factory.createLogicalNot(expression);
|
|
3192
3216
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3193
3217
|
return node;
|
|
3194
3218
|
}
|
|
3195
3219
|
visitPropertyRead(ast) {
|
|
3196
3220
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3197
|
-
const name =
|
|
3221
|
+
const name = ts24.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3198
3222
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3199
3223
|
const node = wrapForDiagnostics(name);
|
|
3200
3224
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3202,12 +3226,12 @@ var AstTranslator = class {
|
|
|
3202
3226
|
}
|
|
3203
3227
|
visitPropertyWrite(ast) {
|
|
3204
3228
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3205
|
-
const left =
|
|
3229
|
+
const left = ts24.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3206
3230
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3207
3231
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3208
3232
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3209
3233
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3210
|
-
const node = wrapForDiagnostics(
|
|
3234
|
+
const node = wrapForDiagnostics(ts24.factory.createBinaryExpression(leftWithPath, ts24.SyntaxKind.EqualsToken, right));
|
|
3211
3235
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3212
3236
|
return node;
|
|
3213
3237
|
}
|
|
@@ -3215,13 +3239,13 @@ var AstTranslator = class {
|
|
|
3215
3239
|
let node;
|
|
3216
3240
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3217
3241
|
if (this.config.strictSafeNavigationTypes) {
|
|
3218
|
-
const expr =
|
|
3242
|
+
const expr = ts24.factory.createPropertyAccessExpression(ts24.factory.createNonNullExpression(receiver), ast.name);
|
|
3219
3243
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3220
|
-
node =
|
|
3244
|
+
node = ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3221
3245
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3222
|
-
node =
|
|
3246
|
+
node = ts24.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
3223
3247
|
} else {
|
|
3224
|
-
const expr =
|
|
3248
|
+
const expr = ts24.factory.createPropertyAccessExpression(ts24.factory.createNonNullExpression(receiver), ast.name);
|
|
3225
3249
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3226
3250
|
node = tsCastToAny(expr);
|
|
3227
3251
|
}
|
|
@@ -3233,13 +3257,13 @@ var AstTranslator = class {
|
|
|
3233
3257
|
const key = this.translate(ast.key);
|
|
3234
3258
|
let node;
|
|
3235
3259
|
if (this.config.strictSafeNavigationTypes) {
|
|
3236
|
-
const expr =
|
|
3260
|
+
const expr = ts24.factory.createElementAccessExpression(ts24.factory.createNonNullExpression(receiver), key);
|
|
3237
3261
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3238
|
-
node =
|
|
3262
|
+
node = ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3239
3263
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3240
|
-
node =
|
|
3264
|
+
node = ts24.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
3241
3265
|
} else {
|
|
3242
|
-
const expr =
|
|
3266
|
+
const expr = ts24.factory.createElementAccessExpression(ts24.factory.createNonNullExpression(receiver), key);
|
|
3243
3267
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3244
3268
|
node = tsCastToAny(expr);
|
|
3245
3269
|
}
|
|
@@ -3256,7 +3280,7 @@ var AstTranslator = class {
|
|
|
3256
3280
|
expr = resolved;
|
|
3257
3281
|
} else {
|
|
3258
3282
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3259
|
-
expr =
|
|
3283
|
+
expr = ts24.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
3260
3284
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3261
3285
|
}
|
|
3262
3286
|
} else {
|
|
@@ -3266,7 +3290,7 @@ var AstTranslator = class {
|
|
|
3266
3290
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3267
3291
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3268
3292
|
} else {
|
|
3269
|
-
node =
|
|
3293
|
+
node = ts24.factory.createCallExpression(expr, void 0, args);
|
|
3270
3294
|
}
|
|
3271
3295
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3272
3296
|
return node;
|
|
@@ -3280,13 +3304,13 @@ var AstTranslator = class {
|
|
|
3280
3304
|
}
|
|
3281
3305
|
convertToSafeCall(ast, expr, args) {
|
|
3282
3306
|
if (this.config.strictSafeNavigationTypes) {
|
|
3283
|
-
const call =
|
|
3284
|
-
return
|
|
3307
|
+
const call = ts24.factory.createCallExpression(ts24.factory.createNonNullExpression(expr), void 0, args);
|
|
3308
|
+
return ts24.factory.createParenthesizedExpression(ts24.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
3285
3309
|
}
|
|
3286
3310
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3287
|
-
return
|
|
3311
|
+
return ts24.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
3288
3312
|
}
|
|
3289
|
-
return tsCastToAny(
|
|
3313
|
+
return tsCastToAny(ts24.factory.createCallExpression(ts24.factory.createNonNullExpression(expr), void 0, args));
|
|
3290
3314
|
}
|
|
3291
3315
|
};
|
|
3292
3316
|
var VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3395,7 +3419,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3395
3419
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
3396
3420
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3397
3421
|
const ctxRawType = env.referenceType(ref);
|
|
3398
|
-
if (!
|
|
3422
|
+
if (!ts25.isTypeReferenceNode(ctxRawType)) {
|
|
3399
3423
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3400
3424
|
}
|
|
3401
3425
|
let typeParameters = void 0;
|
|
@@ -3407,25 +3431,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3407
3431
|
switch (genericContextBehavior) {
|
|
3408
3432
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3409
3433
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3410
|
-
typeArguments = typeParameters.map((param) =>
|
|
3434
|
+
typeArguments = typeParameters.map((param) => ts25.factory.createTypeReferenceNode(param.name));
|
|
3411
3435
|
break;
|
|
3412
3436
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3413
3437
|
typeParameters = [...ref.node.typeParameters];
|
|
3414
|
-
typeArguments = typeParameters.map((param) =>
|
|
3438
|
+
typeArguments = typeParameters.map((param) => ts25.factory.createTypeReferenceNode(param.name));
|
|
3415
3439
|
break;
|
|
3416
3440
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3417
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3441
|
+
typeArguments = ref.node.typeParameters.map(() => ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3418
3442
|
break;
|
|
3419
3443
|
}
|
|
3420
3444
|
}
|
|
3421
|
-
const paramList = [
|
|
3445
|
+
const paramList = [tcbThisParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3422
3446
|
const scopeStatements = scope.render();
|
|
3423
|
-
const innerBody =
|
|
3447
|
+
const innerBody = ts25.factory.createBlock([
|
|
3424
3448
|
...env.getPreludeStatements(),
|
|
3425
3449
|
...scopeStatements
|
|
3426
3450
|
]);
|
|
3427
|
-
const body =
|
|
3428
|
-
const fnDecl =
|
|
3451
|
+
const body = ts25.factory.createBlock([ts25.factory.createIfStatement(ts25.factory.createTrue(), innerBody, void 0)]);
|
|
3452
|
+
const fnDecl = ts25.factory.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3429
3453
|
addTemplateId(fnDecl, meta.id);
|
|
3430
3454
|
return fnDecl;
|
|
3431
3455
|
}
|
|
@@ -3466,7 +3490,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3466
3490
|
execute() {
|
|
3467
3491
|
const ctx = this.scope.resolve(this.template);
|
|
3468
3492
|
const id = this.tcb.allocateId();
|
|
3469
|
-
const initializer =
|
|
3493
|
+
const initializer = ts25.factory.createPropertyAccessExpression(ctx, this.variable.value || "$implicit");
|
|
3470
3494
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3471
3495
|
let variable;
|
|
3472
3496
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3489,7 +3513,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3489
3513
|
}
|
|
3490
3514
|
execute() {
|
|
3491
3515
|
const ctx = this.tcb.allocateId();
|
|
3492
|
-
const type =
|
|
3516
|
+
const type = ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword);
|
|
3493
3517
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3494
3518
|
return ctx;
|
|
3495
3519
|
}
|
|
@@ -3542,16 +3566,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3542
3566
|
}
|
|
3543
3567
|
let guard = null;
|
|
3544
3568
|
if (directiveGuards.length > 0) {
|
|
3545
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3569
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts25.factory.createBinaryExpression(expr, ts25.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3546
3570
|
}
|
|
3547
3571
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3548
3572
|
const statements = tmplScope.render();
|
|
3549
3573
|
if (statements.length === 0) {
|
|
3550
3574
|
return null;
|
|
3551
3575
|
}
|
|
3552
|
-
let tmplBlock =
|
|
3576
|
+
let tmplBlock = ts25.factory.createBlock(statements);
|
|
3553
3577
|
if (guard !== null) {
|
|
3554
|
-
tmplBlock =
|
|
3578
|
+
tmplBlock = ts25.factory.createIfStatement(guard, tmplBlock);
|
|
3555
3579
|
}
|
|
3556
3580
|
this.scope.addStatement(tmplBlock);
|
|
3557
3581
|
return null;
|
|
@@ -3569,7 +3593,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3569
3593
|
}
|
|
3570
3594
|
execute() {
|
|
3571
3595
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3572
|
-
this.scope.addStatement(
|
|
3596
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(expr));
|
|
3573
3597
|
return null;
|
|
3574
3598
|
}
|
|
3575
3599
|
};
|
|
@@ -3591,11 +3615,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3591
3615
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3592
3616
|
type = rawType;
|
|
3593
3617
|
} else {
|
|
3594
|
-
if (!
|
|
3618
|
+
if (!ts25.isTypeReferenceNode(rawType)) {
|
|
3595
3619
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3596
3620
|
}
|
|
3597
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3598
|
-
type =
|
|
3621
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3622
|
+
type = ts25.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3599
3623
|
}
|
|
3600
3624
|
const id = this.tcb.allocateId();
|
|
3601
3625
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3636,11 +3660,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3636
3660
|
const id = this.tcb.allocateId();
|
|
3637
3661
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3638
3662
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3639
|
-
initializer =
|
|
3663
|
+
initializer = ts25.factory.createAsExpression(initializer, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3640
3664
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3641
|
-
initializer =
|
|
3642
|
-
initializer =
|
|
3643
|
-
initializer =
|
|
3665
|
+
initializer = ts25.factory.createAsExpression(initializer, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
3666
|
+
initializer = ts25.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3667
|
+
initializer = ts25.factory.createParenthesizedExpression(initializer);
|
|
3644
3668
|
}
|
|
3645
3669
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3646
3670
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -3730,7 +3754,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3730
3754
|
let target;
|
|
3731
3755
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
3732
3756
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3733
|
-
if (!
|
|
3757
|
+
if (!ts25.isTypeReferenceNode(dirTypeRef)) {
|
|
3734
3758
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3735
3759
|
}
|
|
3736
3760
|
const id = this.tcb.allocateId();
|
|
@@ -3745,10 +3769,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3745
3769
|
}
|
|
3746
3770
|
const id = this.tcb.allocateId();
|
|
3747
3771
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3748
|
-
if (!
|
|
3772
|
+
if (!ts25.isTypeReferenceNode(dirTypeRef)) {
|
|
3749
3773
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3750
3774
|
}
|
|
3751
|
-
const type =
|
|
3775
|
+
const type = ts25.factory.createIndexedAccessTypeNode(ts25.factory.createTypeQueryNode(dirId), ts25.factory.createLiteralTypeNode(ts25.factory.createStringLiteral(fieldName)));
|
|
3752
3776
|
const temp = tsDeclareVariable(id, type);
|
|
3753
3777
|
this.scope.addStatement(temp);
|
|
3754
3778
|
target = id;
|
|
@@ -3756,18 +3780,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3756
3780
|
if (dirId === null) {
|
|
3757
3781
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3758
3782
|
}
|
|
3759
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3783
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts25.factory.createElementAccessExpression(dirId, ts25.factory.createStringLiteral(fieldName)) : ts25.factory.createPropertyAccessExpression(dirId, ts25.factory.createIdentifier(fieldName));
|
|
3760
3784
|
}
|
|
3761
3785
|
if (input.attribute.keySpan !== void 0) {
|
|
3762
3786
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
3763
3787
|
}
|
|
3764
|
-
assignment =
|
|
3788
|
+
assignment = ts25.factory.createBinaryExpression(target, ts25.SyntaxKind.EqualsToken, assignment);
|
|
3765
3789
|
}
|
|
3766
3790
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
3767
3791
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
3768
3792
|
markIgnoreDiagnostics(assignment);
|
|
3769
3793
|
}
|
|
3770
|
-
this.scope.addStatement(
|
|
3794
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(assignment));
|
|
3771
3795
|
}
|
|
3772
3796
|
return null;
|
|
3773
3797
|
}
|
|
@@ -3786,7 +3810,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
3786
3810
|
execute() {
|
|
3787
3811
|
const id = this.tcb.allocateId();
|
|
3788
3812
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
3789
|
-
const circularPlaceholder =
|
|
3813
|
+
const circularPlaceholder = ts25.factory.createCallExpression(typeCtor, void 0, [ts25.factory.createNonNullExpression(ts25.factory.createNull())]);
|
|
3790
3814
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
3791
3815
|
return id;
|
|
3792
3816
|
}
|
|
@@ -3852,15 +3876,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
3852
3876
|
elId = this.scope.resolve(this.element);
|
|
3853
3877
|
}
|
|
3854
3878
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
3855
|
-
const prop =
|
|
3856
|
-
const stmt =
|
|
3879
|
+
const prop = ts25.factory.createElementAccessExpression(elId, ts25.factory.createStringLiteral(propertyName));
|
|
3880
|
+
const stmt = ts25.factory.createBinaryExpression(prop, ts25.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
3857
3881
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
3858
|
-
this.scope.addStatement(
|
|
3882
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(stmt));
|
|
3859
3883
|
} else {
|
|
3860
|
-
this.scope.addStatement(
|
|
3884
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(expr));
|
|
3861
3885
|
}
|
|
3862
3886
|
} else {
|
|
3863
|
-
this.scope.addStatement(
|
|
3887
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(expr));
|
|
3864
3888
|
}
|
|
3865
3889
|
}
|
|
3866
3890
|
return null;
|
|
@@ -3892,18 +3916,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
3892
3916
|
if (dirId === null) {
|
|
3893
3917
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3894
3918
|
}
|
|
3895
|
-
const outputField =
|
|
3919
|
+
const outputField = ts25.factory.createElementAccessExpression(dirId, ts25.factory.createStringLiteral(field));
|
|
3896
3920
|
addParseSpanInfo(outputField, output.keySpan);
|
|
3897
3921
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
3898
3922
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3899
|
-
const subscribeFn =
|
|
3900
|
-
const call =
|
|
3923
|
+
const subscribeFn = ts25.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
3924
|
+
const call = ts25.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
3901
3925
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3902
|
-
this.scope.addStatement(
|
|
3926
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(call));
|
|
3903
3927
|
} else {
|
|
3904
|
-
this.scope.addStatement(
|
|
3928
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(outputField));
|
|
3905
3929
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3906
|
-
this.scope.addStatement(
|
|
3930
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(handler));
|
|
3907
3931
|
}
|
|
3908
3932
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3909
3933
|
}
|
|
@@ -3936,20 +3960,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
3936
3960
|
if (output.type === 1) {
|
|
3937
3961
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
3938
3962
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
3939
|
-
this.scope.addStatement(
|
|
3963
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(handler));
|
|
3940
3964
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
3941
3965
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3942
3966
|
if (elId === null) {
|
|
3943
3967
|
elId = this.scope.resolve(this.element);
|
|
3944
3968
|
}
|
|
3945
|
-
const propertyAccess =
|
|
3969
|
+
const propertyAccess = ts25.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
3946
3970
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
3947
|
-
const call =
|
|
3971
|
+
const call = ts25.factory.createCallExpression(propertyAccess, void 0, [ts25.factory.createStringLiteral(output.name), handler]);
|
|
3948
3972
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3949
|
-
this.scope.addStatement(
|
|
3973
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(call));
|
|
3950
3974
|
} else {
|
|
3951
3975
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3952
|
-
this.scope.addStatement(
|
|
3976
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(handler));
|
|
3953
3977
|
}
|
|
3954
3978
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3955
3979
|
}
|
|
@@ -3963,15 +3987,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
3963
3987
|
this.optional = false;
|
|
3964
3988
|
}
|
|
3965
3989
|
execute() {
|
|
3966
|
-
const ctx =
|
|
3967
|
-
const ctxDot =
|
|
3990
|
+
const ctx = ts25.factory.createThis();
|
|
3991
|
+
const ctxDot = ts25.factory.createPropertyAccessExpression(ctx, "");
|
|
3968
3992
|
markIgnoreDiagnostics(ctxDot);
|
|
3969
3993
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
3970
|
-
this.scope.addStatement(
|
|
3994
|
+
this.scope.addStatement(ts25.factory.createExpressionStatement(ctxDot));
|
|
3971
3995
|
return null;
|
|
3972
3996
|
}
|
|
3973
3997
|
};
|
|
3974
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3998
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts25.factory.createNonNullExpression(ts25.factory.createNull());
|
|
3975
3999
|
var Context = class {
|
|
3976
4000
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
3977
4001
|
this.env = env;
|
|
@@ -3984,7 +4008,7 @@ var Context = class {
|
|
|
3984
4008
|
this.nextId = 1;
|
|
3985
4009
|
}
|
|
3986
4010
|
allocateId() {
|
|
3987
|
-
return
|
|
4011
|
+
return ts25.factory.createIdentifier(`_t${this.nextId++}`);
|
|
3988
4012
|
}
|
|
3989
4013
|
getPipeByName(name) {
|
|
3990
4014
|
if (!this.pipes.has(name)) {
|
|
@@ -4036,8 +4060,8 @@ var Scope = class {
|
|
|
4036
4060
|
resolve(node, directive) {
|
|
4037
4061
|
const res = this.resolveLocal(node, directive);
|
|
4038
4062
|
if (res !== null) {
|
|
4039
|
-
const clone =
|
|
4040
|
-
|
|
4063
|
+
const clone = ts25.getMutableClone(res);
|
|
4064
|
+
ts25.setSyntheticTrailingComments(clone, []);
|
|
4041
4065
|
return clone;
|
|
4042
4066
|
} else if (this.parent !== null) {
|
|
4043
4067
|
return this.parent.resolve(node, directive);
|
|
@@ -4065,7 +4089,7 @@ var Scope = class {
|
|
|
4065
4089
|
} else if (parentGuards === null) {
|
|
4066
4090
|
return this.guard;
|
|
4067
4091
|
} else {
|
|
4068
|
-
return
|
|
4092
|
+
return ts25.factory.createBinaryExpression(parentGuards, ts25.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4069
4093
|
}
|
|
4070
4094
|
}
|
|
4071
4095
|
resolveLocal(ref, directive) {
|
|
@@ -4244,9 +4268,9 @@ var Scope = class {
|
|
|
4244
4268
|
}
|
|
4245
4269
|
}
|
|
4246
4270
|
};
|
|
4247
|
-
function
|
|
4248
|
-
const type =
|
|
4249
|
-
return
|
|
4271
|
+
function tcbThisParam(node, name, typeArguments) {
|
|
4272
|
+
const type = ts25.factory.createTypeReferenceNode(name, typeArguments);
|
|
4273
|
+
return ts25.factory.createParameterDeclaration(void 0, void 0, void 0, "this", void 0, type, void 0);
|
|
4250
4274
|
}
|
|
4251
4275
|
function tcbExpression(ast, tcb, scope) {
|
|
4252
4276
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -4269,11 +4293,11 @@ var TcbExpressionTranslator = class {
|
|
|
4269
4293
|
return null;
|
|
4270
4294
|
}
|
|
4271
4295
|
const expr = this.translate(ast.value);
|
|
4272
|
-
const result =
|
|
4296
|
+
const result = ts25.factory.createParenthesizedExpression(ts25.factory.createBinaryExpression(target, ts25.SyntaxKind.EqualsToken, expr));
|
|
4273
4297
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4274
4298
|
return result;
|
|
4275
4299
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4276
|
-
return
|
|
4300
|
+
return ts25.factory.createThis();
|
|
4277
4301
|
} else if (ast instanceof BindingPipe) {
|
|
4278
4302
|
const expr = this.translate(ast.exp);
|
|
4279
4303
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4285,19 +4309,19 @@ var TcbExpressionTranslator = class {
|
|
|
4285
4309
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4286
4310
|
}
|
|
4287
4311
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4288
|
-
let methodAccess =
|
|
4312
|
+
let methodAccess = ts25.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4289
4313
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4290
4314
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4291
|
-
methodAccess =
|
|
4315
|
+
methodAccess = ts25.factory.createAsExpression(methodAccess, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
4292
4316
|
}
|
|
4293
|
-
const result =
|
|
4317
|
+
const result = ts25.factory.createCallExpression(methodAccess, void 0, [expr, ...args]);
|
|
4294
4318
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4295
4319
|
return result;
|
|
4296
4320
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4297
4321
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4298
4322
|
const expr = this.translate(ast.args[0]);
|
|
4299
|
-
const exprAsAny =
|
|
4300
|
-
const result =
|
|
4323
|
+
const exprAsAny = ts25.factory.createAsExpression(expr, ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword));
|
|
4324
|
+
const result = ts25.factory.createParenthesizedExpression(exprAsAny);
|
|
4301
4325
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4302
4326
|
return result;
|
|
4303
4327
|
}
|
|
@@ -4308,7 +4332,7 @@ var TcbExpressionTranslator = class {
|
|
|
4308
4332
|
const method = wrapForDiagnostics(receiver);
|
|
4309
4333
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4310
4334
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4311
|
-
const node =
|
|
4335
|
+
const node = ts25.factory.createCallExpression(method, void 0, args);
|
|
4312
4336
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4313
4337
|
return node;
|
|
4314
4338
|
} else {
|
|
@@ -4328,17 +4352,17 @@ var TcbExpressionTranslator = class {
|
|
|
4328
4352
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4329
4353
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4330
4354
|
const members = inputs.map((input) => {
|
|
4331
|
-
const propertyName =
|
|
4355
|
+
const propertyName = ts25.factory.createStringLiteral(input.field);
|
|
4332
4356
|
if (input.type === "binding") {
|
|
4333
4357
|
const expr = widenBinding(input.expression, tcb);
|
|
4334
|
-
const assignment =
|
|
4358
|
+
const assignment = ts25.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4335
4359
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4336
4360
|
return assignment;
|
|
4337
4361
|
} else {
|
|
4338
|
-
return
|
|
4362
|
+
return ts25.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4339
4363
|
}
|
|
4340
4364
|
});
|
|
4341
|
-
return
|
|
4365
|
+
return ts25.factory.createCallExpression(typeCtor, void 0, [ts25.factory.createObjectLiteralExpression(members)]);
|
|
4342
4366
|
}
|
|
4343
4367
|
function getBoundInputs(directive, node, tcb) {
|
|
4344
4368
|
const boundInputs = [];
|
|
@@ -4364,17 +4388,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4364
4388
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4365
4389
|
return tcbExpression(attr.value, tcb, scope);
|
|
4366
4390
|
} else {
|
|
4367
|
-
return
|
|
4391
|
+
return ts25.factory.createStringLiteral(attr.value);
|
|
4368
4392
|
}
|
|
4369
4393
|
}
|
|
4370
4394
|
function widenBinding(expr, tcb) {
|
|
4371
4395
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4372
4396
|
return tsCastToAny(expr);
|
|
4373
4397
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4374
|
-
if (
|
|
4398
|
+
if (ts25.isObjectLiteralExpression(expr) || ts25.isArrayLiteralExpression(expr)) {
|
|
4375
4399
|
return expr;
|
|
4376
4400
|
} else {
|
|
4377
|
-
return
|
|
4401
|
+
return ts25.factory.createNonNullExpression(expr);
|
|
4378
4402
|
}
|
|
4379
4403
|
} else {
|
|
4380
4404
|
return expr;
|
|
@@ -4387,18 +4411,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4387
4411
|
if (eventType === 0) {
|
|
4388
4412
|
eventParamType = void 0;
|
|
4389
4413
|
} else if (eventType === 1) {
|
|
4390
|
-
eventParamType =
|
|
4414
|
+
eventParamType = ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword);
|
|
4391
4415
|
} else {
|
|
4392
4416
|
eventParamType = eventType;
|
|
4393
4417
|
}
|
|
4394
4418
|
const guards = scope.guards();
|
|
4395
|
-
let body =
|
|
4419
|
+
let body = ts25.factory.createExpressionStatement(handler);
|
|
4396
4420
|
if (guards !== null) {
|
|
4397
|
-
body =
|
|
4421
|
+
body = ts25.factory.createIfStatement(guards, body);
|
|
4398
4422
|
}
|
|
4399
|
-
const eventParam =
|
|
4423
|
+
const eventParam = ts25.factory.createParameterDeclaration(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4400
4424
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4401
|
-
return
|
|
4425
|
+
return ts25.factory.createArrowFunction(void 0, void 0, [eventParam], ts25.factory.createKeywordTypeNode(ts25.SyntaxKind.AnyKeyword), void 0, ts25.factory.createBlock([body]));
|
|
4402
4426
|
}
|
|
4403
4427
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4404
4428
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4426,7 +4450,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4426
4450
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4427
4451
|
resolve(ast) {
|
|
4428
4452
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4429
|
-
const event =
|
|
4453
|
+
const event = ts25.factory.createIdentifier(EVENT_PARAMETER);
|
|
4430
4454
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4431
4455
|
return event;
|
|
4432
4456
|
}
|
|
@@ -4435,32 +4459,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4435
4459
|
};
|
|
4436
4460
|
|
|
4437
4461
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4438
|
-
import
|
|
4462
|
+
import ts26 from "typescript";
|
|
4439
4463
|
var TypeCheckFile = class extends Environment {
|
|
4440
4464
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4441
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
4465
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts26.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts26.ScriptTarget.Latest, true));
|
|
4442
4466
|
this.fileName = fileName;
|
|
4443
4467
|
this.nextTcbId = 1;
|
|
4444
4468
|
this.tcbStatements = [];
|
|
4445
4469
|
}
|
|
4446
4470
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4447
|
-
const fnId =
|
|
4471
|
+
const fnId = ts26.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4448
4472
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4449
4473
|
this.tcbStatements.push(fn);
|
|
4450
4474
|
}
|
|
4451
4475
|
render(removeComments) {
|
|
4452
4476
|
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 =
|
|
4477
|
+
const printer = ts26.createPrinter({ removeComments });
|
|
4454
4478
|
source += "\n";
|
|
4455
4479
|
for (const stmt of this.pipeInstStatements) {
|
|
4456
|
-
source += printer.printNode(
|
|
4480
|
+
source += printer.printNode(ts26.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4457
4481
|
}
|
|
4458
4482
|
for (const stmt of this.typeCtorStatements) {
|
|
4459
|
-
source += printer.printNode(
|
|
4483
|
+
source += printer.printNode(ts26.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4460
4484
|
}
|
|
4461
4485
|
source += "\n";
|
|
4462
4486
|
for (const stmt of this.tcbStatements) {
|
|
4463
|
-
source += printer.printNode(
|
|
4487
|
+
source += printer.printNode(ts26.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4464
4488
|
}
|
|
4465
4489
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4466
4490
|
return source;
|
|
@@ -4568,7 +4592,7 @@ var TypeCheckContextImpl = class {
|
|
|
4568
4592
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4569
4593
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4570
4594
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4571
|
-
const printer =
|
|
4595
|
+
const printer = ts27.createPrinter({ omitTrailingSemicolon: true });
|
|
4572
4596
|
let code = textParts[0];
|
|
4573
4597
|
ops.forEach((op, idx) => {
|
|
4574
4598
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4649,7 +4673,7 @@ var TypeCheckContextImpl = class {
|
|
|
4649
4673
|
if (span.start.offset === span.end.offset) {
|
|
4650
4674
|
span.end.offset++;
|
|
4651
4675
|
}
|
|
4652
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4676
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4653
4677
|
});
|
|
4654
4678
|
}
|
|
4655
4679
|
};
|
|
@@ -4667,9 +4691,9 @@ var InlineTcbOp = class {
|
|
|
4667
4691
|
}
|
|
4668
4692
|
execute(im, sf, refEmitter, printer) {
|
|
4669
4693
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4670
|
-
const fnName =
|
|
4694
|
+
const fnName = ts27.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4671
4695
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4672
|
-
return printer.printNode(
|
|
4696
|
+
return printer.printNode(ts27.EmitHint.Unspecified, fn, sf);
|
|
4673
4697
|
}
|
|
4674
4698
|
};
|
|
4675
4699
|
var TypeCtorOp = class {
|
|
@@ -4682,7 +4706,7 @@ var TypeCtorOp = class {
|
|
|
4682
4706
|
}
|
|
4683
4707
|
execute(im, sf, refEmitter, printer) {
|
|
4684
4708
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
4685
|
-
return printer.printNode(
|
|
4709
|
+
return printer.printNode(ts27.EmitHint.Unspecified, tcb, sf);
|
|
4686
4710
|
}
|
|
4687
4711
|
};
|
|
4688
4712
|
function orderOps(op1, op2) {
|
|
@@ -4797,10 +4821,11 @@ var TemplateSourceManager = class {
|
|
|
4797
4821
|
|
|
4798
4822
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4799
4823
|
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
|
|
4824
|
+
import ts28 from "typescript";
|
|
4801
4825
|
var SymbolBuilder = class {
|
|
4802
|
-
constructor(
|
|
4803
|
-
this.
|
|
4826
|
+
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
4827
|
+
this.tcbPath = tcbPath;
|
|
4828
|
+
this.tcbIsShim = tcbIsShim;
|
|
4804
4829
|
this.typeCheckBlock = typeCheckBlock;
|
|
4805
4830
|
this.templateData = templateData;
|
|
4806
4831
|
this.componentScopeReader = componentScopeReader;
|
|
@@ -4840,7 +4865,7 @@ var SymbolBuilder = class {
|
|
|
4840
4865
|
getSymbolOfElement(element) {
|
|
4841
4866
|
var _a;
|
|
4842
4867
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4843
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4868
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts28.isVariableDeclaration });
|
|
4844
4869
|
if (node === null) {
|
|
4845
4870
|
return null;
|
|
4846
4871
|
}
|
|
@@ -4859,12 +4884,12 @@ var SymbolBuilder = class {
|
|
|
4859
4884
|
var _a;
|
|
4860
4885
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4861
4886
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
4862
|
-
const isDirectiveDeclaration = (node) => (
|
|
4887
|
+
const isDirectiveDeclaration = (node) => (ts28.isTypeNode(node) || ts28.isIdentifier(node)) && ts28.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
4863
4888
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
4864
4889
|
return nodes.map((node) => {
|
|
4865
4890
|
var _a2;
|
|
4866
4891
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
4867
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4892
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts28.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
4868
4893
|
return null;
|
|
4869
4894
|
}
|
|
4870
4895
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -4909,7 +4934,7 @@ var SymbolBuilder = class {
|
|
|
4909
4934
|
}
|
|
4910
4935
|
getDirectiveModule(declaration) {
|
|
4911
4936
|
const scope = this.componentScopeReader.getScopeForComponent(declaration);
|
|
4912
|
-
if (scope === null) {
|
|
4937
|
+
if (scope === null || scope.kind !== ComponentScopeKind.NgModule) {
|
|
4913
4938
|
return null;
|
|
4914
4939
|
}
|
|
4915
4940
|
return scope.ngModule;
|
|
@@ -4933,23 +4958,23 @@ var SymbolBuilder = class {
|
|
|
4933
4958
|
if (!isAccessExpression(n)) {
|
|
4934
4959
|
return false;
|
|
4935
4960
|
}
|
|
4936
|
-
if (
|
|
4961
|
+
if (ts28.isPropertyAccessExpression(n)) {
|
|
4937
4962
|
return n.name.getText() === expectedAccess;
|
|
4938
4963
|
} else {
|
|
4939
|
-
return
|
|
4964
|
+
return ts28.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
4940
4965
|
}
|
|
4941
4966
|
}
|
|
4942
4967
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
4943
4968
|
const bindings = [];
|
|
4944
4969
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
4945
4970
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
4946
|
-
if (!
|
|
4971
|
+
if (!ts28.isPropertyAccessExpression(outputFieldAccess)) {
|
|
4947
4972
|
continue;
|
|
4948
4973
|
}
|
|
4949
4974
|
const addEventListener = outputFieldAccess.name;
|
|
4950
4975
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(addEventListener);
|
|
4951
4976
|
const tsType = this.getTypeChecker().getTypeAtLocation(addEventListener);
|
|
4952
|
-
const
|
|
4977
|
+
const positionInFile = this.getTcbPositionForNode(addEventListener);
|
|
4953
4978
|
const target = this.getSymbol(consumer);
|
|
4954
4979
|
if (target === null || tsSymbol === void 0) {
|
|
4955
4980
|
continue;
|
|
@@ -4959,10 +4984,14 @@ var SymbolBuilder = class {
|
|
|
4959
4984
|
tsSymbol,
|
|
4960
4985
|
tsType,
|
|
4961
4986
|
target,
|
|
4962
|
-
|
|
4987
|
+
tcbLocation: {
|
|
4988
|
+
tcbPath: this.tcbPath,
|
|
4989
|
+
isShimFile: this.tcbIsShim,
|
|
4990
|
+
positionInFile
|
|
4991
|
+
}
|
|
4963
4992
|
});
|
|
4964
4993
|
} else {
|
|
4965
|
-
if (!
|
|
4994
|
+
if (!ts28.isElementAccessExpression(outputFieldAccess)) {
|
|
4966
4995
|
continue;
|
|
4967
4996
|
}
|
|
4968
4997
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -4973,14 +5002,18 @@ var SymbolBuilder = class {
|
|
|
4973
5002
|
if (target === null) {
|
|
4974
5003
|
continue;
|
|
4975
5004
|
}
|
|
4976
|
-
const
|
|
5005
|
+
const positionInFile = this.getTcbPositionForNode(outputFieldAccess);
|
|
4977
5006
|
const tsType = this.getTypeChecker().getTypeAtLocation(outputFieldAccess);
|
|
4978
5007
|
bindings.push({
|
|
4979
5008
|
kind: SymbolKind.Binding,
|
|
4980
5009
|
tsSymbol,
|
|
4981
5010
|
tsType,
|
|
4982
5011
|
target,
|
|
4983
|
-
|
|
5012
|
+
tcbLocation: {
|
|
5013
|
+
tcbPath: this.tcbPath,
|
|
5014
|
+
isShimFile: this.tcbIsShim,
|
|
5015
|
+
positionInFile
|
|
5016
|
+
}
|
|
4984
5017
|
});
|
|
4985
5018
|
}
|
|
4986
5019
|
}
|
|
@@ -5030,11 +5063,11 @@ var SymbolBuilder = class {
|
|
|
5030
5063
|
return null;
|
|
5031
5064
|
}
|
|
5032
5065
|
const [declaration] = tsSymbol.declarations;
|
|
5033
|
-
if (!
|
|
5066
|
+
if (!ts28.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
5034
5067
|
return null;
|
|
5035
5068
|
}
|
|
5036
5069
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5037
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5070
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts28.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5038
5071
|
return null;
|
|
5039
5072
|
}
|
|
5040
5073
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5042,7 +5075,7 @@ var SymbolBuilder = class {
|
|
|
5042
5075
|
kind: SymbolKind.Directive,
|
|
5043
5076
|
tsSymbol: symbol.tsSymbol,
|
|
5044
5077
|
tsType: symbol.tsType,
|
|
5045
|
-
|
|
5078
|
+
tcbLocation: symbol.tcbLocation,
|
|
5046
5079
|
isComponent,
|
|
5047
5080
|
isStructural,
|
|
5048
5081
|
selector,
|
|
@@ -5050,7 +5083,7 @@ var SymbolBuilder = class {
|
|
|
5050
5083
|
};
|
|
5051
5084
|
}
|
|
5052
5085
|
getSymbolOfVariable(variable) {
|
|
5053
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5086
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts28.isVariableDeclaration });
|
|
5054
5087
|
if (node === null || node.initializer === void 0) {
|
|
5055
5088
|
return null;
|
|
5056
5089
|
}
|
|
@@ -5061,22 +5094,23 @@ var SymbolBuilder = class {
|
|
|
5061
5094
|
return {
|
|
5062
5095
|
tsType: expressionSymbol.tsType,
|
|
5063
5096
|
tsSymbol: expressionSymbol.tsSymbol,
|
|
5064
|
-
initializerLocation: expressionSymbol.
|
|
5097
|
+
initializerLocation: expressionSymbol.tcbLocation,
|
|
5065
5098
|
kind: SymbolKind.Variable,
|
|
5066
5099
|
declaration: variable,
|
|
5067
5100
|
localVarLocation: {
|
|
5068
|
-
|
|
5069
|
-
|
|
5101
|
+
tcbPath: this.tcbPath,
|
|
5102
|
+
isShimFile: this.tcbIsShim,
|
|
5103
|
+
positionInFile: this.getTcbPositionForNode(node.name)
|
|
5070
5104
|
}
|
|
5071
5105
|
};
|
|
5072
5106
|
}
|
|
5073
5107
|
getSymbolOfReference(ref) {
|
|
5074
5108
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5075
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5109
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts28.isVariableDeclaration });
|
|
5076
5110
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5077
5111
|
return null;
|
|
5078
5112
|
}
|
|
5079
|
-
const originalDeclaration =
|
|
5113
|
+
const originalDeclaration = ts28.isParenthesizedExpression(node.initializer) && ts28.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5080
5114
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5081
5115
|
return null;
|
|
5082
5116
|
}
|
|
@@ -5084,9 +5118,10 @@ var SymbolBuilder = class {
|
|
|
5084
5118
|
if (symbol === null || symbol.tsSymbol === null) {
|
|
5085
5119
|
return null;
|
|
5086
5120
|
}
|
|
5087
|
-
const
|
|
5088
|
-
|
|
5089
|
-
|
|
5121
|
+
const referenceVarTcbLocation = {
|
|
5122
|
+
tcbPath: this.tcbPath,
|
|
5123
|
+
isShimFile: this.tcbIsShim,
|
|
5124
|
+
positionInFile: this.getTcbPositionForNode(node)
|
|
5090
5125
|
};
|
|
5091
5126
|
if (target instanceof TmplAstTemplate3 || target instanceof TmplAstElement4) {
|
|
5092
5127
|
return {
|
|
@@ -5095,11 +5130,11 @@ var SymbolBuilder = class {
|
|
|
5095
5130
|
tsType: symbol.tsType,
|
|
5096
5131
|
target,
|
|
5097
5132
|
declaration: ref,
|
|
5098
|
-
targetLocation: symbol.
|
|
5099
|
-
referenceVarLocation:
|
|
5133
|
+
targetLocation: symbol.tcbLocation,
|
|
5134
|
+
referenceVarLocation: referenceVarTcbLocation
|
|
5100
5135
|
};
|
|
5101
5136
|
} else {
|
|
5102
|
-
if (!
|
|
5137
|
+
if (!ts28.isClassDeclaration(target.directive.ref.node)) {
|
|
5103
5138
|
return null;
|
|
5104
5139
|
}
|
|
5105
5140
|
return {
|
|
@@ -5108,13 +5143,13 @@ var SymbolBuilder = class {
|
|
|
5108
5143
|
tsType: symbol.tsType,
|
|
5109
5144
|
declaration: ref,
|
|
5110
5145
|
target: target.directive.ref.node,
|
|
5111
|
-
targetLocation: symbol.
|
|
5112
|
-
referenceVarLocation:
|
|
5146
|
+
targetLocation: symbol.tcbLocation,
|
|
5147
|
+
referenceVarLocation: referenceVarTcbLocation
|
|
5113
5148
|
};
|
|
5114
5149
|
}
|
|
5115
5150
|
}
|
|
5116
5151
|
getSymbolOfPipe(expression) {
|
|
5117
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5152
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts28.isPropertyAccessExpression });
|
|
5118
5153
|
if (methodAccess === null) {
|
|
5119
5154
|
return null;
|
|
5120
5155
|
}
|
|
@@ -5153,7 +5188,7 @@ var SymbolBuilder = class {
|
|
|
5153
5188
|
}
|
|
5154
5189
|
let node = null;
|
|
5155
5190
|
if (expression instanceof PropertyRead5) {
|
|
5156
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5191
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts28.isPropertyAccessExpression });
|
|
5157
5192
|
}
|
|
5158
5193
|
if (node === null) {
|
|
5159
5194
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5161,10 +5196,10 @@ var SymbolBuilder = class {
|
|
|
5161
5196
|
if (node === null) {
|
|
5162
5197
|
return null;
|
|
5163
5198
|
}
|
|
5164
|
-
while (
|
|
5199
|
+
while (ts28.isParenthesizedExpression(node)) {
|
|
5165
5200
|
node = node.expression;
|
|
5166
5201
|
}
|
|
5167
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5202
|
+
if (expression instanceof SafePropertyRead4 && ts28.isConditionalExpression(node)) {
|
|
5168
5203
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5169
5204
|
if (whenTrueSymbol === null) {
|
|
5170
5205
|
return null;
|
|
@@ -5180,33 +5215,37 @@ var SymbolBuilder = class {
|
|
|
5180
5215
|
}
|
|
5181
5216
|
getSymbolOfTsNode(node) {
|
|
5182
5217
|
var _a;
|
|
5183
|
-
while (
|
|
5218
|
+
while (ts28.isParenthesizedExpression(node)) {
|
|
5184
5219
|
node = node.expression;
|
|
5185
5220
|
}
|
|
5186
5221
|
let tsSymbol;
|
|
5187
|
-
if (
|
|
5222
|
+
if (ts28.isPropertyAccessExpression(node)) {
|
|
5188
5223
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5189
|
-
} else if (
|
|
5224
|
+
} else if (ts28.isElementAccessExpression(node)) {
|
|
5190
5225
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5191
5226
|
} else {
|
|
5192
5227
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
5193
5228
|
}
|
|
5194
|
-
const
|
|
5229
|
+
const positionInFile = this.getTcbPositionForNode(node);
|
|
5195
5230
|
const type = this.getTypeChecker().getTypeAtLocation(node);
|
|
5196
5231
|
return {
|
|
5197
5232
|
tsSymbol: (_a = tsSymbol != null ? tsSymbol : type.symbol) != null ? _a : null,
|
|
5198
5233
|
tsType: type,
|
|
5199
|
-
|
|
5234
|
+
tcbLocation: {
|
|
5235
|
+
tcbPath: this.tcbPath,
|
|
5236
|
+
isShimFile: this.tcbIsShim,
|
|
5237
|
+
positionInFile
|
|
5238
|
+
}
|
|
5200
5239
|
};
|
|
5201
5240
|
}
|
|
5202
|
-
|
|
5203
|
-
if (
|
|
5204
|
-
return this.
|
|
5205
|
-
} else if (
|
|
5241
|
+
getTcbPositionForNode(node) {
|
|
5242
|
+
if (ts28.isTypeReferenceNode(node)) {
|
|
5243
|
+
return this.getTcbPositionForNode(node.typeName);
|
|
5244
|
+
} else if (ts28.isQualifiedName(node)) {
|
|
5206
5245
|
return node.right.getStart();
|
|
5207
|
-
} else if (
|
|
5246
|
+
} else if (ts28.isPropertyAccessExpression(node)) {
|
|
5208
5247
|
return node.name.getStart();
|
|
5209
|
-
} else if (
|
|
5248
|
+
} else if (ts28.isElementAccessExpression(node)) {
|
|
5210
5249
|
return node.argumentExpression.getStart();
|
|
5211
5250
|
} else {
|
|
5212
5251
|
return node.getStart();
|
|
@@ -5256,7 +5295,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5256
5295
|
const shimPath = TypeCheckShimGenerator.shimFor(sfPath);
|
|
5257
5296
|
const fileRecord = this.getFileData(sfPath);
|
|
5258
5297
|
if (!fileRecord.shimData.has(shimPath)) {
|
|
5259
|
-
return { data: null, tcb: null, shimPath };
|
|
5298
|
+
return { data: null, tcb: null, tcbPath: shimPath, tcbIsShim: true };
|
|
5260
5299
|
}
|
|
5261
5300
|
const templateId = fileRecord.sourceManager.getTemplateId(component);
|
|
5262
5301
|
const shimRecord = fileRecord.shimData.get(shimPath);
|
|
@@ -5267,19 +5306,38 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5267
5306
|
throw new Error(`Error: no shim file in program: ${shimPath}`);
|
|
5268
5307
|
}
|
|
5269
5308
|
let tcb = findTypeCheckBlock(shimSf, id, false);
|
|
5309
|
+
let tcbPath = shimPath;
|
|
5270
5310
|
if (tcb === null) {
|
|
5271
5311
|
const inlineSf = getSourceFileOrError(program, sfPath);
|
|
5272
5312
|
tcb = findTypeCheckBlock(inlineSf, id, false);
|
|
5313
|
+
if (tcb !== null) {
|
|
5314
|
+
tcbPath = sfPath;
|
|
5315
|
+
}
|
|
5273
5316
|
}
|
|
5274
5317
|
let data = null;
|
|
5275
5318
|
if (shimRecord.templates.has(templateId)) {
|
|
5276
5319
|
data = shimRecord.templates.get(templateId);
|
|
5277
5320
|
}
|
|
5278
|
-
return { data, tcb, shimPath };
|
|
5321
|
+
return { data, tcb, tcbPath, tcbIsShim: tcbPath === shimPath };
|
|
5279
5322
|
}
|
|
5280
5323
|
isTrackedTypeCheckFile(filePath) {
|
|
5281
5324
|
return this.getFileAndShimRecordsForPath(filePath) !== null;
|
|
5282
5325
|
}
|
|
5326
|
+
getFileRecordForTcbLocation({ tcbPath, isShimFile }) {
|
|
5327
|
+
if (!isShimFile) {
|
|
5328
|
+
if (this.state.has(tcbPath)) {
|
|
5329
|
+
return this.state.get(tcbPath);
|
|
5330
|
+
} else {
|
|
5331
|
+
return null;
|
|
5332
|
+
}
|
|
5333
|
+
}
|
|
5334
|
+
const records = this.getFileAndShimRecordsForPath(tcbPath);
|
|
5335
|
+
if (records !== null) {
|
|
5336
|
+
return records.fileRecord;
|
|
5337
|
+
} else {
|
|
5338
|
+
return null;
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5283
5341
|
getFileAndShimRecordsForPath(shimPath) {
|
|
5284
5342
|
for (const fileRecord of this.state.values()) {
|
|
5285
5343
|
if (fileRecord.shimData.has(shimPath)) {
|
|
@@ -5288,17 +5346,16 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5288
5346
|
}
|
|
5289
5347
|
return null;
|
|
5290
5348
|
}
|
|
5291
|
-
|
|
5292
|
-
const
|
|
5293
|
-
if (
|
|
5349
|
+
getTemplateMappingAtTcbLocation(tcbLocation) {
|
|
5350
|
+
const fileRecord = this.getFileRecordForTcbLocation(tcbLocation);
|
|
5351
|
+
if (fileRecord === null) {
|
|
5294
5352
|
return null;
|
|
5295
5353
|
}
|
|
5296
|
-
const
|
|
5297
|
-
const shimSf = this.programDriver.getProgram().getSourceFile(absoluteFrom(shimPath));
|
|
5354
|
+
const shimSf = this.programDriver.getProgram().getSourceFile(tcbLocation.tcbPath);
|
|
5298
5355
|
if (shimSf === void 0) {
|
|
5299
5356
|
return null;
|
|
5300
5357
|
}
|
|
5301
|
-
return getTemplateMapping(shimSf,
|
|
5358
|
+
return getTemplateMapping(shimSf, tcbLocation.positionInFile, fileRecord.sourceManager, false);
|
|
5302
5359
|
}
|
|
5303
5360
|
generateAllTypeCheckBlocks() {
|
|
5304
5361
|
this.ensureAllShimsForAllFiles();
|
|
@@ -5410,11 +5467,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5410
5467
|
if (this.completionCache.has(component)) {
|
|
5411
5468
|
return this.completionCache.get(component);
|
|
5412
5469
|
}
|
|
5413
|
-
const { tcb, data,
|
|
5470
|
+
const { tcb, data, tcbPath, tcbIsShim } = this.getLatestComponentState(component);
|
|
5414
5471
|
if (tcb === null || data === null) {
|
|
5415
5472
|
return null;
|
|
5416
5473
|
}
|
|
5417
|
-
const engine = new CompletionEngine(tcb, data,
|
|
5474
|
+
const engine = new CompletionEngine(tcb, data, tcbPath, tcbIsShim);
|
|
5418
5475
|
this.completionCache.set(component, engine);
|
|
5419
5476
|
return engine;
|
|
5420
5477
|
}
|
|
@@ -5538,11 +5595,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5538
5595
|
if (this.symbolBuilderCache.has(component)) {
|
|
5539
5596
|
return this.symbolBuilderCache.get(component);
|
|
5540
5597
|
}
|
|
5541
|
-
const { tcb, data,
|
|
5598
|
+
const { tcb, data, tcbPath, tcbIsShim } = this.getLatestComponentState(component);
|
|
5542
5599
|
if (tcb === null || data === null) {
|
|
5543
5600
|
return null;
|
|
5544
5601
|
}
|
|
5545
|
-
const builder = new SymbolBuilder(
|
|
5602
|
+
const builder = new SymbolBuilder(tcbPath, tcbIsShim, tcb, data, this.componentScopeReader, () => this.programDriver.getProgram().getTypeChecker());
|
|
5546
5603
|
this.symbolBuilderCache.set(component, builder);
|
|
5547
5604
|
return builder;
|
|
5548
5605
|
}
|
|
@@ -5577,7 +5634,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5577
5634
|
const scope = this.getScopeData(component);
|
|
5578
5635
|
if (scope !== null) {
|
|
5579
5636
|
for (const directive of scope.directives) {
|
|
5580
|
-
for (const selector of
|
|
5637
|
+
for (const selector of CssSelector.parse(directive.selector)) {
|
|
5581
5638
|
if (selector.element === null || tagMap.has(selector.element)) {
|
|
5582
5639
|
continue;
|
|
5583
5640
|
}
|
|
@@ -5609,42 +5666,44 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5609
5666
|
if (scope === null) {
|
|
5610
5667
|
return null;
|
|
5611
5668
|
}
|
|
5669
|
+
const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
|
|
5612
5670
|
const data = {
|
|
5613
5671
|
directives: [],
|
|
5614
5672
|
pipes: [],
|
|
5615
|
-
isPoisoned: scope.compilation.isPoisoned
|
|
5673
|
+
isPoisoned: scope.kind === ComponentScopeKind.NgModule ? scope.compilation.isPoisoned : scope.isPoisoned
|
|
5616
5674
|
};
|
|
5617
5675
|
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
|
-
|
|
5676
|
+
for (const dep of dependencies) {
|
|
5677
|
+
if (dep.kind === MetaKind.Directive) {
|
|
5678
|
+
if (dep.selector === null) {
|
|
5679
|
+
continue;
|
|
5680
|
+
}
|
|
5681
|
+
const tsSymbol = typeChecker.getSymbolAtLocation(dep.ref.node.name);
|
|
5682
|
+
if (!isSymbolWithValueDeclaration(tsSymbol)) {
|
|
5683
|
+
continue;
|
|
5684
|
+
}
|
|
5685
|
+
let ngModule = null;
|
|
5686
|
+
const moduleScopeOfDir = this.componentScopeReader.getScopeForComponent(dep.ref.node);
|
|
5687
|
+
if (moduleScopeOfDir !== null && moduleScopeOfDir.kind === ComponentScopeKind.NgModule) {
|
|
5688
|
+
ngModule = moduleScopeOfDir.ngModule;
|
|
5689
|
+
}
|
|
5690
|
+
data.directives.push({
|
|
5691
|
+
isComponent: dep.isComponent,
|
|
5692
|
+
isStructural: dep.isStructural,
|
|
5693
|
+
selector: dep.selector,
|
|
5694
|
+
tsSymbol,
|
|
5695
|
+
ngModule
|
|
5696
|
+
});
|
|
5697
|
+
} else if (dep.kind === MetaKind.Pipe) {
|
|
5698
|
+
const tsSymbol = typeChecker.getSymbolAtLocation(dep.ref.node.name);
|
|
5699
|
+
if (tsSymbol === void 0) {
|
|
5700
|
+
continue;
|
|
5701
|
+
}
|
|
5702
|
+
data.pipes.push({
|
|
5703
|
+
name: dep.name,
|
|
5704
|
+
tsSymbol
|
|
5705
|
+
});
|
|
5643
5706
|
}
|
|
5644
|
-
data.pipes.push({
|
|
5645
|
-
name: pipe.name,
|
|
5646
|
-
tsSymbol
|
|
5647
|
-
});
|
|
5648
5707
|
}
|
|
5649
5708
|
this.scopeCache.set(component, data);
|
|
5650
5709
|
return data;
|
|
@@ -5843,7 +5902,7 @@ var factory = {
|
|
|
5843
5902
|
|
|
5844
5903
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
5845
5904
|
import { Binary } from "@angular/compiler";
|
|
5846
|
-
import
|
|
5905
|
+
import ts29 from "typescript";
|
|
5847
5906
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
5848
5907
|
constructor() {
|
|
5849
5908
|
super(...arguments);
|
|
@@ -5857,7 +5916,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
5857
5916
|
return [];
|
|
5858
5917
|
}
|
|
5859
5918
|
const typeLeft = symbolLeft.tsType;
|
|
5860
|
-
if (typeLeft.flags & (
|
|
5919
|
+
if (typeLeft.flags & (ts29.TypeFlags.Any | ts29.TypeFlags.Unknown)) {
|
|
5861
5920
|
return [];
|
|
5862
5921
|
}
|
|
5863
5922
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -5866,8 +5925,11 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
5866
5925
|
if (symbol.kind !== SymbolKind.Expression) {
|
|
5867
5926
|
return [];
|
|
5868
5927
|
}
|
|
5869
|
-
const
|
|
5870
|
-
|
|
5928
|
+
const templateMapping = ctx.templateTypeChecker.getTemplateMappingAtTcbLocation(symbol.tcbLocation);
|
|
5929
|
+
if (templateMapping === null) {
|
|
5930
|
+
return [];
|
|
5931
|
+
}
|
|
5932
|
+
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
5933
|
return [diagnostic];
|
|
5872
5934
|
}
|
|
5873
5935
|
};
|
|
@@ -5884,7 +5946,7 @@ var factory2 = {
|
|
|
5884
5946
|
};
|
|
5885
5947
|
|
|
5886
5948
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5887
|
-
import
|
|
5949
|
+
import ts30 from "typescript";
|
|
5888
5950
|
|
|
5889
5951
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
5890
5952
|
var DiagnosticCategoryLabel;
|
|
@@ -5932,9 +5994,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
5932
5994
|
function diagnosticLabelToCategory(label) {
|
|
5933
5995
|
switch (label) {
|
|
5934
5996
|
case DiagnosticCategoryLabel.Warning:
|
|
5935
|
-
return
|
|
5997
|
+
return ts30.DiagnosticCategory.Warning;
|
|
5936
5998
|
case DiagnosticCategoryLabel.Error:
|
|
5937
|
-
return
|
|
5999
|
+
return ts30.DiagnosticCategory.Error;
|
|
5938
6000
|
case DiagnosticCategoryLabel.Suppress:
|
|
5939
6001
|
return null;
|
|
5940
6002
|
default:
|
|
@@ -6029,7 +6091,7 @@ var NgCompiler = class {
|
|
|
6029
6091
|
this.currentProgram = inputProgram;
|
|
6030
6092
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6031
6093
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6032
|
-
const moduleResolutionCache =
|
|
6094
|
+
const moduleResolutionCache = ts31.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
6033
6095
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
6034
6096
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
6035
6097
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -6085,7 +6147,7 @@ var NgCompiler = class {
|
|
|
6085
6147
|
}
|
|
6086
6148
|
for (const clazz of classesToUpdate) {
|
|
6087
6149
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6088
|
-
if (!
|
|
6150
|
+
if (!ts31.isClassDeclaration(clazz)) {
|
|
6089
6151
|
continue;
|
|
6090
6152
|
}
|
|
6091
6153
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6437,10 +6499,11 @@ var NgCompiler = class {
|
|
|
6437
6499
|
const localMetaReader = localMetaRegistry;
|
|
6438
6500
|
const depScopeReader = new MetadataDtsModuleScopeResolver(dtsReader, aliasingHost);
|
|
6439
6501
|
const metaReader = new CompoundMetadataReader([localMetaReader, dtsReader]);
|
|
6440
|
-
const
|
|
6441
|
-
const
|
|
6502
|
+
const ngModuleScopeRegistry = new LocalModuleScopeRegistry(localMetaReader, metaReader, depScopeReader, refEmitter, aliasingHost);
|
|
6503
|
+
const standaloneScopeReader = new StandaloneComponentScopeReader(metaReader, ngModuleScopeRegistry, depScopeReader);
|
|
6504
|
+
const scopeReader = new CompoundComponentScopeReader([ngModuleScopeRegistry, standaloneScopeReader]);
|
|
6442
6505
|
const semanticDepGraphUpdater = this.incrementalCompilation.semanticDepGraphUpdater;
|
|
6443
|
-
const metaRegistry = new CompoundMetadataRegistry([localMetaRegistry,
|
|
6506
|
+
const metaRegistry = new CompoundMetadataRegistry([localMetaRegistry, ngModuleScopeRegistry]);
|
|
6444
6507
|
const injectableRegistry = new InjectableClassRegistry(reflector);
|
|
6445
6508
|
const typeCheckScopeRegistry = new TypeCheckScopeRegistry(scopeReader, metaReader);
|
|
6446
6509
|
let referencesRegistry;
|
|
@@ -6457,24 +6520,24 @@ var NgCompiler = class {
|
|
|
6457
6520
|
const compilationMode = this.options.compilationMode === "partial" && !isCore ? CompilationMode.PARTIAL : CompilationMode.FULL;
|
|
6458
6521
|
const cycleHandlingStrategy = compilationMode === CompilationMode.FULL ? 0 : 1;
|
|
6459
6522
|
const handlers = [
|
|
6460
|
-
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader,
|
|
6461
|
-
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry,
|
|
6462
|
-
new PipeDecoratorHandler(reflector, evaluator, metaRegistry,
|
|
6523
|
+
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),
|
|
6524
|
+
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, isCore, semanticDepGraphUpdater, this.closureCompilerEnabled, false, this.delegatingPerfRecorder),
|
|
6525
|
+
new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder),
|
|
6463
6526
|
new InjectableDecoratorHandler(reflector, isCore, this.options.strictInjectionParameters || false, injectableRegistry, this.delegatingPerfRecorder),
|
|
6464
|
-
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry,
|
|
6527
|
+
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, isCore, refEmitter, this.adapter.factoryTracker, this.closureCompilerEnabled, injectableRegistry, this.delegatingPerfRecorder)
|
|
6465
6528
|
];
|
|
6466
|
-
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater);
|
|
6529
|
+
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
|
|
6467
6530
|
const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {
|
|
6468
6531
|
this.incrementalStrategy.setIncrementalState(this.incrementalCompilation.state, program);
|
|
6469
6532
|
this.currentProgram = program;
|
|
6470
6533
|
});
|
|
6471
|
-
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation,
|
|
6534
|
+
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, scopeReader, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
6472
6535
|
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
6473
6536
|
return {
|
|
6474
6537
|
isCore,
|
|
6475
6538
|
traitCompiler,
|
|
6476
6539
|
reflector,
|
|
6477
|
-
scopeRegistry,
|
|
6540
|
+
scopeRegistry: ngModuleScopeRegistry,
|
|
6478
6541
|
dtsTransforms,
|
|
6479
6542
|
exportReferenceGraph,
|
|
6480
6543
|
metaReader,
|
|
@@ -6493,17 +6556,17 @@ function isAngularCorePackage(program) {
|
|
|
6493
6556
|
return false;
|
|
6494
6557
|
}
|
|
6495
6558
|
return r3Symbols.statements.some((stmt) => {
|
|
6496
|
-
if (!
|
|
6559
|
+
if (!ts31.isVariableStatement(stmt)) {
|
|
6497
6560
|
return false;
|
|
6498
6561
|
}
|
|
6499
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
6562
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts31.SyntaxKind.ExportKeyword)) {
|
|
6500
6563
|
return false;
|
|
6501
6564
|
}
|
|
6502
6565
|
return stmt.declarationList.declarations.some((decl) => {
|
|
6503
|
-
if (!
|
|
6566
|
+
if (!ts31.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
6504
6567
|
return false;
|
|
6505
6568
|
}
|
|
6506
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
6569
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts31.SyntaxKind.TrueKeyword) {
|
|
6507
6570
|
return false;
|
|
6508
6571
|
}
|
|
6509
6572
|
return true;
|
|
@@ -6517,7 +6580,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
6517
6580
|
var _a, _b, _c;
|
|
6518
6581
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
6519
6582
|
yield makeConfigDiagnostic({
|
|
6520
|
-
category:
|
|
6583
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6521
6584
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
6522
6585
|
messageText: `
|
|
6523
6586
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -6536,7 +6599,7 @@ https://angular.io/guide/template-typecheck
|
|
|
6536
6599
|
}
|
|
6537
6600
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
6538
6601
|
yield makeConfigDiagnostic({
|
|
6539
|
-
category:
|
|
6602
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6540
6603
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
6541
6604
|
messageText: `
|
|
6542
6605
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -6553,7 +6616,7 @@ One of the following actions is required:
|
|
|
6553
6616
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
6554
6617
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
6555
6618
|
yield makeConfigDiagnostic({
|
|
6556
|
-
category:
|
|
6619
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6557
6620
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6558
6621
|
messageText: `
|
|
6559
6622
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -6567,7 +6630,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
6567
6630
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
6568
6631
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
6569
6632
|
yield makeConfigDiagnostic({
|
|
6570
|
-
category:
|
|
6633
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6571
6634
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
6572
6635
|
messageText: `
|
|
6573
6636
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -6579,7 +6642,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
6579
6642
|
}
|
|
6580
6643
|
if (!allowedCategoryLabels.includes(category)) {
|
|
6581
6644
|
yield makeConfigDiagnostic({
|
|
6582
|
-
category:
|
|
6645
|
+
category: ts31.DiagnosticCategory.Error,
|
|
6583
6646
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6584
6647
|
messageText: `
|
|
6585
6648
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -6609,7 +6672,7 @@ var ReferenceGraphAdapter = class {
|
|
|
6609
6672
|
for (const { node } of references) {
|
|
6610
6673
|
let sourceFile = node.getSourceFile();
|
|
6611
6674
|
if (sourceFile === void 0) {
|
|
6612
|
-
sourceFile =
|
|
6675
|
+
sourceFile = ts31.getOriginalNode(node).getSourceFile();
|
|
6613
6676
|
}
|
|
6614
6677
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
6615
6678
|
this.graph.add(source, node);
|
|
@@ -6648,7 +6711,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
6648
6711
|
}
|
|
6649
6712
|
|
|
6650
6713
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
6651
|
-
import
|
|
6714
|
+
import ts32 from "typescript";
|
|
6652
6715
|
var DelegatingCompilerHost2 = class {
|
|
6653
6716
|
constructor(delegate) {
|
|
6654
6717
|
this.delegate = delegate;
|
|
@@ -6738,7 +6801,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6738
6801
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
6739
6802
|
if (entryPoint === null) {
|
|
6740
6803
|
diagnostics.push({
|
|
6741
|
-
category:
|
|
6804
|
+
category: ts32.DiagnosticCategory.Error,
|
|
6742
6805
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
6743
6806
|
file: void 0,
|
|
6744
6807
|
start: void 0,
|
|
@@ -6759,6 +6822,9 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6759
6822
|
isShim(sf) {
|
|
6760
6823
|
return isShim(sf);
|
|
6761
6824
|
}
|
|
6825
|
+
isResource(sf) {
|
|
6826
|
+
return false;
|
|
6827
|
+
}
|
|
6762
6828
|
getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile) {
|
|
6763
6829
|
const shimSf = this.shimAdapter.maybeGenerate(resolve(fileName));
|
|
6764
6830
|
if (shimSf !== null) {
|
|
@@ -6778,10 +6844,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6778
6844
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
6779
6845
|
}
|
|
6780
6846
|
createCachedResolveModuleNamesFunction() {
|
|
6781
|
-
const moduleResolutionCache =
|
|
6847
|
+
const moduleResolutionCache = ts32.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
6782
6848
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
6783
6849
|
return moduleNames.map((moduleName) => {
|
|
6784
|
-
const module =
|
|
6850
|
+
const module = ts32.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
6785
6851
|
return module.resolvedModule;
|
|
6786
6852
|
});
|
|
6787
6853
|
};
|
|
@@ -6802,7 +6868,7 @@ var NgtscProgram = class {
|
|
|
6802
6868
|
if (reuseProgram !== void 0) {
|
|
6803
6869
|
retagAllTsFiles(reuseProgram);
|
|
6804
6870
|
}
|
|
6805
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
6871
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts33.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
6806
6872
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
6807
6873
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
6808
6874
|
this.host.postProgramCreationCleanup();
|
|
@@ -7001,17 +7067,17 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
7001
7067
|
}
|
|
7002
7068
|
|
|
7003
7069
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7004
|
-
import
|
|
7070
|
+
import ts35 from "typescript";
|
|
7005
7071
|
|
|
7006
7072
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
7007
|
-
import
|
|
7073
|
+
import ts34 from "typescript";
|
|
7008
7074
|
var GENERATED_FILES = /(.*?)\.(ngfactory|shim\.ngstyle|ngstyle|ngsummary)\.(js|d\.ts|ts)$/;
|
|
7009
7075
|
function createMessageDiagnostic(messageText) {
|
|
7010
7076
|
return {
|
|
7011
7077
|
file: void 0,
|
|
7012
7078
|
start: void 0,
|
|
7013
7079
|
length: void 0,
|
|
7014
|
-
category:
|
|
7080
|
+
category: ts34.DiagnosticCategory.Message,
|
|
7015
7081
|
messageText,
|
|
7016
7082
|
code: DEFAULT_ERROR_CODE,
|
|
7017
7083
|
source: SOURCE
|
|
@@ -7020,13 +7086,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
7020
7086
|
|
|
7021
7087
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7022
7088
|
var defaultFormatHost = {
|
|
7023
|
-
getCurrentDirectory: () =>
|
|
7089
|
+
getCurrentDirectory: () => ts35.sys.getCurrentDirectory(),
|
|
7024
7090
|
getCanonicalFileName: (fileName) => fileName,
|
|
7025
|
-
getNewLine: () =>
|
|
7091
|
+
getNewLine: () => ts35.sys.newLine
|
|
7026
7092
|
};
|
|
7027
7093
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7028
7094
|
if (diags && diags.length) {
|
|
7029
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
7095
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts35.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7030
7096
|
} else {
|
|
7031
7097
|
return "";
|
|
7032
7098
|
}
|
|
@@ -7043,7 +7109,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7043
7109
|
var _a, _b;
|
|
7044
7110
|
try {
|
|
7045
7111
|
const fs = getFileSystem();
|
|
7046
|
-
const readConfigFile = (configFile) =>
|
|
7112
|
+
const readConfigFile = (configFile) => ts35.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7047
7113
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7048
7114
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7049
7115
|
if (error2) {
|
|
@@ -7075,7 +7141,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7075
7141
|
basePath
|
|
7076
7142
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
7077
7143
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7078
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
7144
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts35.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7079
7145
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
7080
7146
|
let emitFlags = EmitFlags.Default;
|
|
7081
7147
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -7087,7 +7153,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7087
7153
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7088
7154
|
} catch (e) {
|
|
7089
7155
|
const errors = [{
|
|
7090
|
-
category:
|
|
7156
|
+
category: ts35.DiagnosticCategory.Error,
|
|
7091
7157
|
messageText: (_b = e.stack) != null ? _b : e.message,
|
|
7092
7158
|
file: void 0,
|
|
7093
7159
|
start: void 0,
|
|
@@ -7101,7 +7167,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7101
7167
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7102
7168
|
return {
|
|
7103
7169
|
fileExists: host.exists.bind(host),
|
|
7104
|
-
readDirectory:
|
|
7170
|
+
readDirectory: ts35.sys.readDirectory,
|
|
7105
7171
|
readFile: host.readFile.bind(host),
|
|
7106
7172
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7107
7173
|
};
|
|
@@ -7121,7 +7187,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7121
7187
|
}
|
|
7122
7188
|
} else {
|
|
7123
7189
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7124
|
-
const { resolvedModule } =
|
|
7190
|
+
const { resolvedModule } = ts35.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts35.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
7125
7191
|
if (resolvedModule) {
|
|
7126
7192
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
7127
7193
|
}
|
|
@@ -7131,7 +7197,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7131
7197
|
function exitCodeFromResult(diags) {
|
|
7132
7198
|
if (!diags)
|
|
7133
7199
|
return 0;
|
|
7134
|
-
if (diags.every((diag) => diag.category !==
|
|
7200
|
+
if (diags.every((diag) => diag.category !== ts35.DiagnosticCategory.Error)) {
|
|
7135
7201
|
return 0;
|
|
7136
7202
|
}
|
|
7137
7203
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7164,7 +7230,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7164
7230
|
} catch (e) {
|
|
7165
7231
|
program = void 0;
|
|
7166
7232
|
allDiagnostics.push({
|
|
7167
|
-
category:
|
|
7233
|
+
category: ts35.DiagnosticCategory.Error,
|
|
7168
7234
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7169
7235
|
code: UNKNOWN_ERROR_CODE,
|
|
7170
7236
|
file: void 0,
|
|
@@ -7191,7 +7257,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7191
7257
|
return allDiagnostics;
|
|
7192
7258
|
}
|
|
7193
7259
|
function hasErrors(diags) {
|
|
7194
|
-
return diags.some((d) => d.category ===
|
|
7260
|
+
return diags.some((d) => d.category === ts35.DiagnosticCategory.Error);
|
|
7195
7261
|
}
|
|
7196
7262
|
|
|
7197
7263
|
export {
|
|
@@ -7203,11 +7269,10 @@ export {
|
|
|
7203
7269
|
createCompilerHost,
|
|
7204
7270
|
CycleAnalyzer,
|
|
7205
7271
|
ImportGraph,
|
|
7272
|
+
isShim,
|
|
7273
|
+
untagAllTsFiles,
|
|
7206
7274
|
TsCreateProgramDriver,
|
|
7207
7275
|
PatchedProgramIncrementalBuildStrategy,
|
|
7208
|
-
MetadataDtsModuleScopeResolver,
|
|
7209
|
-
LocalModuleScopeRegistry,
|
|
7210
|
-
TypeCheckScopeRegistry,
|
|
7211
7276
|
OptimizeFor,
|
|
7212
7277
|
freshCompilationTicket,
|
|
7213
7278
|
incrementalFromStateTicket,
|
|
@@ -7231,4 +7296,5 @@ export {
|
|
|
7231
7296
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7232
7297
|
* found in the LICENSE file at https://angular.io/license
|
|
7233
7298
|
*/
|
|
7234
|
-
|
|
7299
|
+
// Closure Compiler ignores @suppress and similar if the comment contains @license.
|
|
7300
|
+
//# sourceMappingURL=chunk-N6HUFHQ6.js.map
|