@angular/compiler-cli 13.2.0-next.2 → 13.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-UESD6FVI.js → chunk-ALKVYGAK.js} +5 -5
- package/bundles/{chunk-UESD6FVI.js.map → chunk-ALKVYGAK.js.map} +0 -0
- package/bundles/{chunk-L2JNRKLG.js → chunk-C44PYKVA.js} +530 -116
- package/bundles/chunk-C44PYKVA.js.map +6 -0
- package/bundles/{chunk-676MI6WZ.js → chunk-FXU7FMZC.js} +5 -5
- package/bundles/{chunk-676MI6WZ.js.map → chunk-FXU7FMZC.js.map} +1 -1
- package/bundles/{chunk-ADHVDA4A.js → chunk-K2Z44JHH.js} +1 -1
- package/bundles/{chunk-ADHVDA4A.js.map → chunk-K2Z44JHH.js.map} +1 -1
- package/bundles/{chunk-NU7DCJLY.js → chunk-NRJCXTRC.js} +4 -4
- package/bundles/{chunk-NU7DCJLY.js.map → chunk-NRJCXTRC.js.map} +1 -1
- package/bundles/{chunk-ZWPDFY6U.js → chunk-O57ZKMWS.js} +2 -2
- package/bundles/{chunk-ZWPDFY6U.js.map → chunk-O57ZKMWS.js.map} +0 -0
- package/bundles/{chunk-L5DQYLOG.js → chunk-PJPAHVUO.js} +428 -788
- package/bundles/chunk-PJPAHVUO.js.map +6 -0
- package/bundles/{chunk-QGM254OS.js → chunk-XLVWXQAR.js} +132 -85
- package/bundles/{chunk-QGM254OS.js.map → chunk-XLVWXQAR.js.map} +2 -2
- package/bundles/{chunk-QBU7RUKB.js → chunk-XNYP2SFR.js} +8 -3
- package/bundles/chunk-XNYP2SFR.js.map +6 -0
- package/bundles/{chunk-O4XVCXRT.js → chunk-Z2HS4HDG.js} +2 -2
- package/bundles/{chunk-O4XVCXRT.js.map → chunk-Z2HS4HDG.js.map} +0 -0
- package/bundles/index.js +7 -6
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +4 -4
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +4 -4
- package/bundles/ngcc/index.js +7 -7
- package/bundles/ngcc/main-ngcc.js +8 -8
- package/bundles/ngcc/main-ngcc.js.map +1 -1
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +7 -7
- 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 +1 -1
- package/bundles/private/localize.js +2 -2
- package/bundles/private/migrations.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +5 -5
- package/bundles/src/bin/ngc.js +5 -5
- package/bundles_metadata.json +1 -1
- package/ngcc/src/packages/adjust_cjs_umd_exports.d.ts +17 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/source_file_cache.d.ts +2 -1
- package/package.json +2 -3
- package/src/ngtsc/core/api/src/options.d.ts +0 -4
- package/src/ngtsc/imports/src/emitter.d.ts +16 -2
- package/src/ngtsc/indexer/src/api.d.ts +1 -0
- package/src/ngtsc/indexer/src/template.d.ts +4 -1
- package/bundles/chunk-L2JNRKLG.js.map +0 -6
- package/bundles/chunk-L5DQYLOG.js.map +0 -6
- package/bundles/chunk-QBU7RUKB.js.map +0 -6
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
DirectiveDecoratorHandler,
|
|
12
12
|
DtsMetadataReader,
|
|
13
13
|
DtsTransformRegistry,
|
|
14
|
+
FactoryGenerator,
|
|
14
15
|
InjectableClassRegistry,
|
|
15
16
|
InjectableDecoratorHandler,
|
|
16
17
|
LocalMetadataRegistry,
|
|
@@ -20,12 +21,20 @@ import {
|
|
|
20
21
|
PipeDecoratorHandler,
|
|
21
22
|
ResourceRegistry,
|
|
22
23
|
SemanticDepGraphUpdater,
|
|
24
|
+
ShimAdapter,
|
|
25
|
+
ShimReferenceTagger,
|
|
26
|
+
SummaryGenerator,
|
|
23
27
|
TraitCompiler,
|
|
24
28
|
aliasTransformFactory,
|
|
29
|
+
copyFileShimData,
|
|
25
30
|
declarationTransformFactory,
|
|
26
31
|
flattenInheritedDirectiveMetadata,
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
generatedFactoryTransform,
|
|
33
|
+
isShim,
|
|
34
|
+
ivyTransformFactory,
|
|
35
|
+
retagAllTsFiles,
|
|
36
|
+
untagAllTsFiles
|
|
37
|
+
} from "./chunk-C44PYKVA.js";
|
|
29
38
|
import {
|
|
30
39
|
TypeScriptReflectionHost,
|
|
31
40
|
isNamedClassDeclaration
|
|
@@ -70,18 +79,17 @@ import {
|
|
|
70
79
|
toUnredirectedSourceFile,
|
|
71
80
|
translateExpression,
|
|
72
81
|
translateType
|
|
73
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-XNYP2SFR.js";
|
|
74
83
|
import {
|
|
75
84
|
LogicalFileSystem,
|
|
76
85
|
absoluteFrom,
|
|
77
86
|
absoluteFromSourceFile,
|
|
78
|
-
basename,
|
|
79
87
|
dirname,
|
|
80
88
|
getFileSystem,
|
|
81
89
|
getSourceFileOrError,
|
|
82
90
|
join,
|
|
83
91
|
resolve
|
|
84
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-FXU7FMZC.js";
|
|
85
93
|
import {
|
|
86
94
|
ActivePerfRecorder,
|
|
87
95
|
DelegatingPerfRecorder,
|
|
@@ -154,7 +162,7 @@ var SymbolKind;
|
|
|
154
162
|
|
|
155
163
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
156
164
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
157
|
-
import
|
|
165
|
+
import ts32 from "typescript";
|
|
158
166
|
|
|
159
167
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
160
168
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -259,7 +267,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
259
267
|
}
|
|
260
268
|
|
|
261
269
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
262
|
-
import
|
|
270
|
+
import ts30 from "typescript";
|
|
263
271
|
|
|
264
272
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
265
273
|
var CycleAnalyzer = class {
|
|
@@ -608,407 +616,7 @@ var UpdateMode;
|
|
|
608
616
|
})(UpdateMode || (UpdateMode = {}));
|
|
609
617
|
|
|
610
618
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
611
|
-
import ts9 from "typescript";
|
|
612
|
-
|
|
613
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
614
619
|
import ts6 from "typescript";
|
|
615
|
-
|
|
616
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
617
|
-
var NgExtension = Symbol("NgExtension");
|
|
618
|
-
function isExtended(sf) {
|
|
619
|
-
return sf[NgExtension] !== void 0;
|
|
620
|
-
}
|
|
621
|
-
function sfExtensionData(sf) {
|
|
622
|
-
const extSf = sf;
|
|
623
|
-
if (extSf[NgExtension] !== void 0) {
|
|
624
|
-
return extSf[NgExtension];
|
|
625
|
-
}
|
|
626
|
-
const extension = {
|
|
627
|
-
isTopLevelShim: false,
|
|
628
|
-
fileShim: null,
|
|
629
|
-
originalReferencedFiles: null,
|
|
630
|
-
taggedReferenceFiles: null
|
|
631
|
-
};
|
|
632
|
-
extSf[NgExtension] = extension;
|
|
633
|
-
return extension;
|
|
634
|
-
}
|
|
635
|
-
function isFileShimSourceFile(sf) {
|
|
636
|
-
return isExtended(sf) && sf[NgExtension].fileShim !== null;
|
|
637
|
-
}
|
|
638
|
-
function isShim(sf) {
|
|
639
|
-
return isExtended(sf) && (sf[NgExtension].fileShim !== null || sf[NgExtension].isTopLevelShim);
|
|
640
|
-
}
|
|
641
|
-
function copyFileShimData(from, to) {
|
|
642
|
-
if (!isFileShimSourceFile(from)) {
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
sfExtensionData(to).fileShim = sfExtensionData(from).fileShim;
|
|
646
|
-
}
|
|
647
|
-
function untagAllTsFiles(program) {
|
|
648
|
-
for (const sf of program.getSourceFiles()) {
|
|
649
|
-
untagTsFile(sf);
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
function retagAllTsFiles(program) {
|
|
653
|
-
for (const sf of program.getSourceFiles()) {
|
|
654
|
-
retagTsFile(sf);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
function untagTsFile(sf) {
|
|
658
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
const ext = sfExtensionData(sf);
|
|
662
|
-
if (ext.originalReferencedFiles !== null) {
|
|
663
|
-
sf.referencedFiles = ext.originalReferencedFiles;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
function retagTsFile(sf) {
|
|
667
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
const ext = sfExtensionData(sf);
|
|
671
|
-
if (ext.taggedReferenceFiles !== null) {
|
|
672
|
-
sf.referencedFiles = ext.taggedReferenceFiles;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/util.mjs
|
|
677
|
-
var TS_EXTENSIONS = /\.tsx?$/i;
|
|
678
|
-
function makeShimFileName(fileName, suffix) {
|
|
679
|
-
return absoluteFrom(fileName.replace(TS_EXTENSIONS, suffix));
|
|
680
|
-
}
|
|
681
|
-
function generatedModuleName(originalModuleName, originalFileName, genSuffix) {
|
|
682
|
-
let moduleName;
|
|
683
|
-
if (originalFileName.endsWith("/index.ts")) {
|
|
684
|
-
moduleName = originalModuleName + "/index" + genSuffix;
|
|
685
|
-
} else {
|
|
686
|
-
moduleName = originalModuleName + genSuffix;
|
|
687
|
-
}
|
|
688
|
-
return moduleName;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
692
|
-
var ShimAdapter = class {
|
|
693
|
-
constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
|
|
694
|
-
this.delegate = delegate;
|
|
695
|
-
this.shims = /* @__PURE__ */ new Map();
|
|
696
|
-
this.priorShims = /* @__PURE__ */ new Map();
|
|
697
|
-
this.notShims = /* @__PURE__ */ new Set();
|
|
698
|
-
this.generators = [];
|
|
699
|
-
this.ignoreForEmit = /* @__PURE__ */ new Set();
|
|
700
|
-
this.extensionPrefixes = [];
|
|
701
|
-
for (const gen of perFileGenerators) {
|
|
702
|
-
const pattern = `^(.*)\\.${gen.extensionPrefix}\\.ts$`;
|
|
703
|
-
const regexp = new RegExp(pattern, "i");
|
|
704
|
-
this.generators.push({
|
|
705
|
-
generator: gen,
|
|
706
|
-
test: regexp,
|
|
707
|
-
suffix: `.${gen.extensionPrefix}.ts`
|
|
708
|
-
});
|
|
709
|
-
this.extensionPrefixes.push(gen.extensionPrefix);
|
|
710
|
-
}
|
|
711
|
-
const extraInputFiles = [];
|
|
712
|
-
for (const gen of topLevelGenerators) {
|
|
713
|
-
const sf = gen.makeTopLevelShim();
|
|
714
|
-
sfExtensionData(sf).isTopLevelShim = true;
|
|
715
|
-
if (!gen.shouldEmit) {
|
|
716
|
-
this.ignoreForEmit.add(sf);
|
|
717
|
-
}
|
|
718
|
-
const fileName = absoluteFromSourceFile(sf);
|
|
719
|
-
this.shims.set(fileName, sf);
|
|
720
|
-
extraInputFiles.push(fileName);
|
|
721
|
-
}
|
|
722
|
-
for (const rootFile of tsRootFiles) {
|
|
723
|
-
for (const gen of this.generators) {
|
|
724
|
-
extraInputFiles.push(makeShimFileName(rootFile, gen.suffix));
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
this.extraInputFiles = extraInputFiles;
|
|
728
|
-
if (oldProgram !== null) {
|
|
729
|
-
for (const oldSf of oldProgram.getSourceFiles()) {
|
|
730
|
-
if (oldSf.isDeclarationFile || !isFileShimSourceFile(oldSf)) {
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
this.priorShims.set(absoluteFromSourceFile(oldSf), oldSf);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
maybeGenerate(fileName) {
|
|
738
|
-
if (this.notShims.has(fileName)) {
|
|
739
|
-
return null;
|
|
740
|
-
} else if (this.shims.has(fileName)) {
|
|
741
|
-
return this.shims.get(fileName);
|
|
742
|
-
}
|
|
743
|
-
if (isDtsPath(fileName)) {
|
|
744
|
-
this.notShims.add(fileName);
|
|
745
|
-
return null;
|
|
746
|
-
}
|
|
747
|
-
for (const record of this.generators) {
|
|
748
|
-
const match = record.test.exec(fileName);
|
|
749
|
-
if (match === null) {
|
|
750
|
-
continue;
|
|
751
|
-
}
|
|
752
|
-
const prefix = match[1];
|
|
753
|
-
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
754
|
-
if (!this.delegate.fileExists(baseFileName)) {
|
|
755
|
-
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
756
|
-
if (!this.delegate.fileExists(baseFileName)) {
|
|
757
|
-
return void 0;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
const inputFile = this.delegate.getSourceFile(baseFileName, ts6.ScriptTarget.Latest);
|
|
761
|
-
if (inputFile === void 0 || isShim(inputFile)) {
|
|
762
|
-
return void 0;
|
|
763
|
-
}
|
|
764
|
-
return this.generateSpecific(fileName, record.generator, inputFile);
|
|
765
|
-
}
|
|
766
|
-
this.notShims.add(fileName);
|
|
767
|
-
return null;
|
|
768
|
-
}
|
|
769
|
-
generateSpecific(fileName, generator, inputFile) {
|
|
770
|
-
let priorShimSf = null;
|
|
771
|
-
if (this.priorShims.has(fileName)) {
|
|
772
|
-
priorShimSf = this.priorShims.get(fileName);
|
|
773
|
-
this.priorShims.delete(fileName);
|
|
774
|
-
}
|
|
775
|
-
const shimSf = generator.generateShimForFile(inputFile, fileName, priorShimSf);
|
|
776
|
-
sfExtensionData(shimSf).fileShim = {
|
|
777
|
-
extension: generator.extensionPrefix,
|
|
778
|
-
generatedFrom: absoluteFromSourceFile(inputFile)
|
|
779
|
-
};
|
|
780
|
-
if (!generator.shouldEmit) {
|
|
781
|
-
this.ignoreForEmit.add(shimSf);
|
|
782
|
-
}
|
|
783
|
-
this.shims.set(fileName, shimSf);
|
|
784
|
-
return shimSf;
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
|
|
788
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.mjs
|
|
789
|
-
import ts7 from "typescript";
|
|
790
|
-
var TS_DTS_SUFFIX = /(\.d)?\.ts$/;
|
|
791
|
-
var STRIP_NG_FACTORY = /(.*)NgFactory$/;
|
|
792
|
-
var FactoryGenerator = class {
|
|
793
|
-
constructor() {
|
|
794
|
-
this.sourceInfo = /* @__PURE__ */ new Map();
|
|
795
|
-
this.sourceToFactorySymbols = /* @__PURE__ */ new Map();
|
|
796
|
-
this.shouldEmit = true;
|
|
797
|
-
this.extensionPrefix = "ngfactory";
|
|
798
|
-
}
|
|
799
|
-
generateShimForFile(sf, genFilePath) {
|
|
800
|
-
const absoluteSfPath = absoluteFromSourceFile(sf);
|
|
801
|
-
const relativePathToSource = "./" + basename(sf.fileName).replace(TS_DTS_SUFFIX, "");
|
|
802
|
-
const symbolNames = sf.statements.filter(ts7.isClassDeclaration).filter((decl) => isExported(decl) && decl.decorators !== void 0 && decl.name !== void 0).map((decl) => decl.name.text);
|
|
803
|
-
let sourceText = "";
|
|
804
|
-
const leadingComment = getFileoverviewComment(sf);
|
|
805
|
-
if (leadingComment !== null) {
|
|
806
|
-
sourceText = leadingComment + "\n\n";
|
|
807
|
-
}
|
|
808
|
-
if (symbolNames.length > 0) {
|
|
809
|
-
const varLines = symbolNames.map((name) => `export const ${name}NgFactory: i0.\u0275NgModuleFactory<any> = new i0.\u0275NgModuleFactory(${name});`);
|
|
810
|
-
sourceText += [
|
|
811
|
-
`import * as i0 from '@angular/core';`,
|
|
812
|
-
`import {${symbolNames.join(", ")}} from '${relativePathToSource}';`,
|
|
813
|
-
...varLines
|
|
814
|
-
].join("\n");
|
|
815
|
-
}
|
|
816
|
-
sourceText += "\nexport const \u0275NonEmptyModule = true;";
|
|
817
|
-
const genFile = ts7.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts7.ScriptKind.TS);
|
|
818
|
-
if (sf.moduleName !== void 0) {
|
|
819
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngfactory");
|
|
820
|
-
}
|
|
821
|
-
const moduleSymbols = /* @__PURE__ */ new Map();
|
|
822
|
-
this.sourceToFactorySymbols.set(absoluteSfPath, moduleSymbols);
|
|
823
|
-
this.sourceInfo.set(genFilePath, {
|
|
824
|
-
sourceFilePath: absoluteSfPath,
|
|
825
|
-
moduleSymbols
|
|
826
|
-
});
|
|
827
|
-
return genFile;
|
|
828
|
-
}
|
|
829
|
-
track(sf, moduleInfo) {
|
|
830
|
-
if (this.sourceToFactorySymbols.has(sf.fileName)) {
|
|
831
|
-
this.sourceToFactorySymbols.get(sf.fileName).set(moduleInfo.name, moduleInfo);
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
function isExported(decl) {
|
|
836
|
-
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts7.SyntaxKind.ExportKeyword);
|
|
837
|
-
}
|
|
838
|
-
function generatedFactoryTransform(factoryMap, importRewriter) {
|
|
839
|
-
return (context) => {
|
|
840
|
-
return (file) => {
|
|
841
|
-
return transformFactorySourceFile(factoryMap, context, importRewriter, file);
|
|
842
|
-
};
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
|
|
846
|
-
if (!factoryMap.has(file.fileName)) {
|
|
847
|
-
return file;
|
|
848
|
-
}
|
|
849
|
-
const { moduleSymbols, sourceFilePath } = factoryMap.get(file.fileName);
|
|
850
|
-
const transformedStatements = [];
|
|
851
|
-
let nonEmptyExport = null;
|
|
852
|
-
const coreImportIdentifiers = /* @__PURE__ */ new Set();
|
|
853
|
-
for (const stmt of file.statements) {
|
|
854
|
-
if (ts7.isImportDeclaration(stmt) && ts7.isStringLiteral(stmt.moduleSpecifier) && stmt.moduleSpecifier.text === "@angular/core") {
|
|
855
|
-
const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier("@angular/core", sourceFilePath);
|
|
856
|
-
if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
|
|
857
|
-
transformedStatements.push(ts7.updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts7.createStringLiteral(rewrittenModuleSpecifier), void 0));
|
|
858
|
-
if (stmt.importClause !== void 0 && stmt.importClause.namedBindings !== void 0 && ts7.isNamespaceImport(stmt.importClause.namedBindings)) {
|
|
859
|
-
coreImportIdentifiers.add(stmt.importClause.namedBindings.name.text);
|
|
860
|
-
}
|
|
861
|
-
} else {
|
|
862
|
-
transformedStatements.push(stmt);
|
|
863
|
-
}
|
|
864
|
-
} else if (ts7.isVariableStatement(stmt) && stmt.declarationList.declarations.length === 1) {
|
|
865
|
-
const decl = stmt.declarationList.declarations[0];
|
|
866
|
-
if (ts7.isIdentifier(decl.name)) {
|
|
867
|
-
if (decl.name.text === "\u0275NonEmptyModule") {
|
|
868
|
-
nonEmptyExport = stmt;
|
|
869
|
-
continue;
|
|
870
|
-
}
|
|
871
|
-
const match = STRIP_NG_FACTORY.exec(decl.name.text);
|
|
872
|
-
const module = match ? moduleSymbols.get(match[1]) : null;
|
|
873
|
-
if (module) {
|
|
874
|
-
const moduleIsTreeShakable = !module.hasId;
|
|
875
|
-
const newStmt = !moduleIsTreeShakable ? stmt : updateInitializers(stmt, (init) => init ? wrapInNoSideEffects(init) : void 0);
|
|
876
|
-
transformedStatements.push(newStmt);
|
|
877
|
-
}
|
|
878
|
-
} else {
|
|
879
|
-
transformedStatements.push(stmt);
|
|
880
|
-
}
|
|
881
|
-
} else {
|
|
882
|
-
transformedStatements.push(stmt);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
if (!transformedStatements.some(ts7.isVariableStatement) && nonEmptyExport !== null) {
|
|
886
|
-
transformedStatements.push(nonEmptyExport);
|
|
887
|
-
}
|
|
888
|
-
file = ts7.updateSourceFileNode(file, transformedStatements);
|
|
889
|
-
if (coreImportIdentifiers.size > 0) {
|
|
890
|
-
const visit = (node) => {
|
|
891
|
-
node = ts7.visitEachChild(node, (child) => visit(child), context);
|
|
892
|
-
if (ts7.isPropertyAccessExpression(node) && ts7.isIdentifier(node.expression) && coreImportIdentifiers.has(node.expression.text)) {
|
|
893
|
-
const rewrittenSymbol = importRewriter.rewriteSymbol(node.name.text, "@angular/core");
|
|
894
|
-
if (rewrittenSymbol !== node.name.text) {
|
|
895
|
-
const updated = ts7.updatePropertyAccess(node, node.expression, ts7.createIdentifier(rewrittenSymbol));
|
|
896
|
-
node = updated;
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
return node;
|
|
900
|
-
};
|
|
901
|
-
file = visit(file);
|
|
902
|
-
}
|
|
903
|
-
return file;
|
|
904
|
-
}
|
|
905
|
-
function getFileoverviewComment(sourceFile) {
|
|
906
|
-
const text = sourceFile.getFullText();
|
|
907
|
-
const trivia = text.substring(0, sourceFile.getStart());
|
|
908
|
-
const leadingComments = ts7.getLeadingCommentRanges(trivia, 0);
|
|
909
|
-
if (!leadingComments || leadingComments.length === 0) {
|
|
910
|
-
return null;
|
|
911
|
-
}
|
|
912
|
-
const comment = leadingComments[0];
|
|
913
|
-
if (comment.kind !== ts7.SyntaxKind.MultiLineCommentTrivia) {
|
|
914
|
-
return null;
|
|
915
|
-
}
|
|
916
|
-
if (text.substring(comment.end, comment.end + 2) !== "\n\n") {
|
|
917
|
-
return null;
|
|
918
|
-
}
|
|
919
|
-
const commentText = text.substring(comment.pos, comment.end);
|
|
920
|
-
if (commentText.indexOf("@license") !== -1) {
|
|
921
|
-
return null;
|
|
922
|
-
}
|
|
923
|
-
return commentText;
|
|
924
|
-
}
|
|
925
|
-
function wrapInNoSideEffects(expr) {
|
|
926
|
-
const noSideEffects = ts7.createPropertyAccess(ts7.createIdentifier("i0"), "\u0275noSideEffects");
|
|
927
|
-
return ts7.createCall(noSideEffects, [], [
|
|
928
|
-
ts7.createFunctionExpression([], void 0, void 0, [], [], void 0, ts7.createBlock([
|
|
929
|
-
ts7.createReturn(expr)
|
|
930
|
-
]))
|
|
931
|
-
]);
|
|
932
|
-
}
|
|
933
|
-
function updateInitializers(stmt, update) {
|
|
934
|
-
return ts7.updateVariableStatement(stmt, stmt.modifiers, ts7.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts7.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
|
|
938
|
-
var ShimReferenceTagger = class {
|
|
939
|
-
constructor(shimExtensions) {
|
|
940
|
-
this.tagged = /* @__PURE__ */ new Set();
|
|
941
|
-
this.enabled = true;
|
|
942
|
-
this.suffixes = shimExtensions.map((extension) => `.${extension}.ts`);
|
|
943
|
-
}
|
|
944
|
-
tag(sf) {
|
|
945
|
-
if (!this.enabled || sf.isDeclarationFile || isShim(sf) || this.tagged.has(sf) || !isNonDeclarationTsPath(sf.fileName)) {
|
|
946
|
-
return;
|
|
947
|
-
}
|
|
948
|
-
const ext = sfExtensionData(sf);
|
|
949
|
-
if (ext.originalReferencedFiles === null) {
|
|
950
|
-
ext.originalReferencedFiles = sf.referencedFiles;
|
|
951
|
-
}
|
|
952
|
-
const referencedFiles = [...ext.originalReferencedFiles];
|
|
953
|
-
const sfPath = absoluteFromSourceFile(sf);
|
|
954
|
-
for (const suffix of this.suffixes) {
|
|
955
|
-
referencedFiles.push({
|
|
956
|
-
fileName: makeShimFileName(sfPath, suffix),
|
|
957
|
-
pos: 0,
|
|
958
|
-
end: 0
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
ext.taggedReferenceFiles = referencedFiles;
|
|
962
|
-
sf.referencedFiles = referencedFiles;
|
|
963
|
-
this.tagged.add(sf);
|
|
964
|
-
}
|
|
965
|
-
finalize() {
|
|
966
|
-
this.enabled = false;
|
|
967
|
-
this.tagged.clear();
|
|
968
|
-
}
|
|
969
|
-
};
|
|
970
|
-
|
|
971
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.mjs
|
|
972
|
-
import ts8 from "typescript";
|
|
973
|
-
var SummaryGenerator = class {
|
|
974
|
-
constructor() {
|
|
975
|
-
this.shouldEmit = true;
|
|
976
|
-
this.extensionPrefix = "ngsummary";
|
|
977
|
-
}
|
|
978
|
-
generateShimForFile(sf, genFilePath) {
|
|
979
|
-
const symbolNames = [];
|
|
980
|
-
for (const stmt of sf.statements) {
|
|
981
|
-
if (ts8.isClassDeclaration(stmt)) {
|
|
982
|
-
if (!isExported2(stmt) || stmt.decorators === void 0 || stmt.name === void 0) {
|
|
983
|
-
continue;
|
|
984
|
-
}
|
|
985
|
-
symbolNames.push(stmt.name.text);
|
|
986
|
-
} else if (ts8.isExportDeclaration(stmt)) {
|
|
987
|
-
if (stmt.exportClause === void 0 || stmt.moduleSpecifier !== void 0 || !ts8.isNamedExports(stmt.exportClause)) {
|
|
988
|
-
continue;
|
|
989
|
-
}
|
|
990
|
-
for (const specifier of stmt.exportClause.elements) {
|
|
991
|
-
symbolNames.push(specifier.name.text);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
const varLines = symbolNames.map((name) => `export const ${name}NgSummary: any = null;`);
|
|
996
|
-
if (varLines.length === 0) {
|
|
997
|
-
varLines.push(`export const \u0275empty = null;`);
|
|
998
|
-
}
|
|
999
|
-
const sourceText = varLines.join("\n");
|
|
1000
|
-
const genFile = ts8.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts8.ScriptKind.TS);
|
|
1001
|
-
if (sf.moduleName !== void 0) {
|
|
1002
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngsummary");
|
|
1003
|
-
}
|
|
1004
|
-
return genFile;
|
|
1005
|
-
}
|
|
1006
|
-
};
|
|
1007
|
-
function isExported2(decl) {
|
|
1008
|
-
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts8.SyntaxKind.ExportKeyword);
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
1012
620
|
var DelegatingCompilerHost = class {
|
|
1013
621
|
constructor(delegate) {
|
|
1014
622
|
this.delegate = delegate;
|
|
@@ -1097,7 +705,7 @@ var TsCreateProgramDriver = class {
|
|
|
1097
705
|
this.sfMap.clear();
|
|
1098
706
|
}
|
|
1099
707
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
1100
|
-
const sf =
|
|
708
|
+
const sf = ts6.createSourceFile(filePath, newText, ts6.ScriptTarget.Latest, true);
|
|
1101
709
|
if (originalFile !== null) {
|
|
1102
710
|
sf[NgOriginalFile] = originalFile;
|
|
1103
711
|
}
|
|
@@ -1106,7 +714,7 @@ var TsCreateProgramDriver = class {
|
|
|
1106
714
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
1107
715
|
const oldProgram = this.program;
|
|
1108
716
|
retagAllTsFiles(oldProgram);
|
|
1109
|
-
this.program =
|
|
717
|
+
this.program = ts6.createProgram({
|
|
1110
718
|
host,
|
|
1111
719
|
rootNames: this.program.getRootFileNames(),
|
|
1112
720
|
options: this.options,
|
|
@@ -1471,11 +1079,12 @@ var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
|
1471
1079
|
this.boundTemplate = boundTemplate;
|
|
1472
1080
|
this.targetToIdentifier = targetToIdentifier;
|
|
1473
1081
|
this.identifiers = [];
|
|
1082
|
+
this.errors = [];
|
|
1474
1083
|
}
|
|
1475
1084
|
static getIdentifiers(ast, source, absoluteOffset, boundTemplate, targetToIdentifier) {
|
|
1476
1085
|
const visitor = new ExpressionVisitor(source, absoluteOffset, boundTemplate, targetToIdentifier);
|
|
1477
1086
|
visitor.visit(ast);
|
|
1478
|
-
return visitor.identifiers;
|
|
1087
|
+
return { identifiers: visitor.identifiers, errors: visitor.errors };
|
|
1479
1088
|
}
|
|
1480
1089
|
visit(ast) {
|
|
1481
1090
|
ast.visit(this);
|
|
@@ -1497,7 +1106,8 @@ var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
|
1497
1106
|
identifierStart = ast.nameSpan.start - this.absoluteOffset;
|
|
1498
1107
|
}
|
|
1499
1108
|
if (!this.expressionStr.substring(identifierStart).startsWith(ast.name)) {
|
|
1500
|
-
|
|
1109
|
+
this.errors.push(new Error(`Impossible state: "${ast.name}" not found in "${this.expressionStr}" at location ${identifierStart}`));
|
|
1110
|
+
return;
|
|
1501
1111
|
}
|
|
1502
1112
|
const absoluteStart = this.absoluteOffset + identifierStart;
|
|
1503
1113
|
const span = new AbsoluteSourceSpan(absoluteStart, absoluteStart + ast.name.length);
|
|
@@ -1517,6 +1127,7 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1517
1127
|
super();
|
|
1518
1128
|
this.boundTemplate = boundTemplate;
|
|
1519
1129
|
this.identifiers = /* @__PURE__ */ new Set();
|
|
1130
|
+
this.errors = [];
|
|
1520
1131
|
this.targetIdentifierCache = /* @__PURE__ */ new Map();
|
|
1521
1132
|
this.elementAndTemplateIdentifierCache = /* @__PURE__ */ new Map();
|
|
1522
1133
|
}
|
|
@@ -1528,7 +1139,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1528
1139
|
}
|
|
1529
1140
|
visitElement(element) {
|
|
1530
1141
|
const elementIdentifier = this.elementOrTemplateToIdentifier(element);
|
|
1531
|
-
|
|
1142
|
+
if (elementIdentifier !== null) {
|
|
1143
|
+
this.identifiers.add(elementIdentifier);
|
|
1144
|
+
}
|
|
1532
1145
|
this.visitAll(element.references);
|
|
1533
1146
|
this.visitAll(element.inputs);
|
|
1534
1147
|
this.visitAll(element.attributes);
|
|
@@ -1537,7 +1150,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1537
1150
|
}
|
|
1538
1151
|
visitTemplate(template) {
|
|
1539
1152
|
const templateIdentifier = this.elementOrTemplateToIdentifier(template);
|
|
1540
|
-
|
|
1153
|
+
if (templateIdentifier !== null) {
|
|
1154
|
+
this.identifiers.add(templateIdentifier);
|
|
1155
|
+
}
|
|
1541
1156
|
this.visitAll(template.variables);
|
|
1542
1157
|
this.visitAll(template.attributes);
|
|
1543
1158
|
this.visitAll(template.templateAttrs);
|
|
@@ -1548,8 +1163,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1548
1163
|
if (attribute.valueSpan === void 0) {
|
|
1549
1164
|
return;
|
|
1550
1165
|
}
|
|
1551
|
-
const identifiers = ExpressionVisitor.getIdentifiers(attribute.value, attribute.valueSpan.toString(), attribute.valueSpan.start.offset, this.boundTemplate, this.targetToIdentifier.bind(this));
|
|
1166
|
+
const { identifiers, errors } = ExpressionVisitor.getIdentifiers(attribute.value, attribute.valueSpan.toString(), attribute.valueSpan.start.offset, this.boundTemplate, this.targetToIdentifier.bind(this));
|
|
1552
1167
|
identifiers.forEach((id) => this.identifiers.add(id));
|
|
1168
|
+
this.errors.push(...errors);
|
|
1553
1169
|
}
|
|
1554
1170
|
visitBoundEvent(attribute) {
|
|
1555
1171
|
this.visitExpression(attribute.handler);
|
|
@@ -1559,31 +1175,40 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1559
1175
|
}
|
|
1560
1176
|
visitReference(reference) {
|
|
1561
1177
|
const referenceIdentifer = this.targetToIdentifier(reference);
|
|
1178
|
+
if (referenceIdentifer === null) {
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1562
1181
|
this.identifiers.add(referenceIdentifer);
|
|
1563
1182
|
}
|
|
1564
1183
|
visitVariable(variable) {
|
|
1565
1184
|
const variableIdentifier = this.targetToIdentifier(variable);
|
|
1185
|
+
if (variableIdentifier === null) {
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1566
1188
|
this.identifiers.add(variableIdentifier);
|
|
1567
1189
|
}
|
|
1568
1190
|
elementOrTemplateToIdentifier(node) {
|
|
1191
|
+
var _a;
|
|
1569
1192
|
if (this.elementAndTemplateIdentifierCache.has(node)) {
|
|
1570
1193
|
return this.elementAndTemplateIdentifierCache.get(node);
|
|
1571
1194
|
}
|
|
1572
1195
|
let name;
|
|
1573
1196
|
let kind;
|
|
1574
1197
|
if (node instanceof TmplAstTemplate) {
|
|
1575
|
-
name = node.tagName;
|
|
1198
|
+
name = (_a = node.tagName) != null ? _a : "ng-template";
|
|
1576
1199
|
kind = IdentifierKind.Template;
|
|
1577
1200
|
} else {
|
|
1578
|
-
|
|
1579
|
-
name = node.name.split(":").pop();
|
|
1580
|
-
} else {
|
|
1581
|
-
name = node.name;
|
|
1582
|
-
}
|
|
1201
|
+
name = node.name;
|
|
1583
1202
|
kind = IdentifierKind.Element;
|
|
1584
1203
|
}
|
|
1204
|
+
if (name.startsWith(":")) {
|
|
1205
|
+
name = name.split(":").pop();
|
|
1206
|
+
}
|
|
1585
1207
|
const sourceSpan = node.startSourceSpan;
|
|
1586
1208
|
const start = this.getStartLocation(name, sourceSpan);
|
|
1209
|
+
if (start === null) {
|
|
1210
|
+
return null;
|
|
1211
|
+
}
|
|
1587
1212
|
const absoluteSpan = new AbsoluteSourceSpan(start, start + name.length);
|
|
1588
1213
|
const attributes = node.attributes.map(({ name: name2, sourceSpan: sourceSpan2 }) => {
|
|
1589
1214
|
return {
|
|
@@ -1614,23 +1239,30 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1614
1239
|
}
|
|
1615
1240
|
const { name, sourceSpan } = node;
|
|
1616
1241
|
const start = this.getStartLocation(name, sourceSpan);
|
|
1242
|
+
if (start === null) {
|
|
1243
|
+
return null;
|
|
1244
|
+
}
|
|
1617
1245
|
const span = new AbsoluteSourceSpan(start, start + name.length);
|
|
1618
1246
|
let identifier;
|
|
1619
1247
|
if (node instanceof TmplAstReference) {
|
|
1620
1248
|
const refTarget = this.boundTemplate.getReferenceTarget(node);
|
|
1621
1249
|
let target = null;
|
|
1622
1250
|
if (refTarget) {
|
|
1251
|
+
let node2 = null;
|
|
1252
|
+
let directive = null;
|
|
1623
1253
|
if (refTarget instanceof TmplAstElement || refTarget instanceof TmplAstTemplate) {
|
|
1624
|
-
|
|
1625
|
-
node: this.elementOrTemplateToIdentifier(refTarget),
|
|
1626
|
-
directive: null
|
|
1627
|
-
};
|
|
1254
|
+
node2 = this.elementOrTemplateToIdentifier(refTarget);
|
|
1628
1255
|
} else {
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
directive: refTarget.directive.ref.node
|
|
1632
|
-
};
|
|
1256
|
+
node2 = this.elementOrTemplateToIdentifier(refTarget.node);
|
|
1257
|
+
directive = refTarget.directive.ref.node;
|
|
1633
1258
|
}
|
|
1259
|
+
if (node2 === null) {
|
|
1260
|
+
return null;
|
|
1261
|
+
}
|
|
1262
|
+
target = {
|
|
1263
|
+
node: node2,
|
|
1264
|
+
directive
|
|
1265
|
+
};
|
|
1634
1266
|
}
|
|
1635
1267
|
identifier = {
|
|
1636
1268
|
name,
|
|
@@ -1651,7 +1283,8 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1651
1283
|
getStartLocation(name, context) {
|
|
1652
1284
|
const localStr = context.toString();
|
|
1653
1285
|
if (!localStr.includes(name)) {
|
|
1654
|
-
|
|
1286
|
+
this.errors.push(new Error(`Impossible state: "${name}" not found in "${localStr}"`));
|
|
1287
|
+
return null;
|
|
1655
1288
|
}
|
|
1656
1289
|
return context.start.offset + localStr.indexOf(name);
|
|
1657
1290
|
}
|
|
@@ -1659,8 +1292,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1659
1292
|
if (ast instanceof ASTWithSource && ast.source !== null) {
|
|
1660
1293
|
const targetToIdentifier = this.targetToIdentifier.bind(this);
|
|
1661
1294
|
const absoluteOffset = ast.sourceSpan.start;
|
|
1662
|
-
const identifiers = ExpressionVisitor.getIdentifiers(ast, ast.source, absoluteOffset, this.boundTemplate, targetToIdentifier);
|
|
1295
|
+
const { identifiers, errors } = ExpressionVisitor.getIdentifiers(ast, ast.source, absoluteOffset, this.boundTemplate, targetToIdentifier);
|
|
1663
1296
|
identifiers.forEach((id) => this.identifiers.add(id));
|
|
1297
|
+
this.errors.push(...errors);
|
|
1664
1298
|
}
|
|
1665
1299
|
}
|
|
1666
1300
|
};
|
|
@@ -1669,7 +1303,7 @@ function getTemplateIdentifiers(boundTemplate) {
|
|
|
1669
1303
|
if (boundTemplate.target.template !== void 0) {
|
|
1670
1304
|
visitor.visitAll(boundTemplate.target.template);
|
|
1671
1305
|
}
|
|
1672
|
-
return visitor.identifiers;
|
|
1306
|
+
return { identifiers: visitor.identifiers, errors: visitor.errors };
|
|
1673
1307
|
}
|
|
1674
1308
|
|
|
1675
1309
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
@@ -1691,23 +1325,25 @@ function generateAnalysis(context) {
|
|
|
1691
1325
|
} else {
|
|
1692
1326
|
templateFile = templateMeta.file;
|
|
1693
1327
|
}
|
|
1328
|
+
const { identifiers, errors } = getTemplateIdentifiers(boundTemplate);
|
|
1694
1329
|
analysis.set(declaration, {
|
|
1695
1330
|
name,
|
|
1696
1331
|
selector,
|
|
1697
1332
|
file: componentFile,
|
|
1698
1333
|
template: {
|
|
1699
|
-
identifiers
|
|
1334
|
+
identifiers,
|
|
1700
1335
|
usedComponents,
|
|
1701
1336
|
isInline: templateMeta.isInline,
|
|
1702
1337
|
file: templateFile
|
|
1703
|
-
}
|
|
1338
|
+
},
|
|
1339
|
+
errors
|
|
1704
1340
|
});
|
|
1705
1341
|
});
|
|
1706
1342
|
return analysis;
|
|
1707
1343
|
}
|
|
1708
1344
|
|
|
1709
1345
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
1710
|
-
import
|
|
1346
|
+
import ts7 from "typescript";
|
|
1711
1347
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
1712
1348
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
1713
1349
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -1817,7 +1453,7 @@ var AdapterResourceLoader = class {
|
|
|
1817
1453
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
1818
1454
|
}
|
|
1819
1455
|
getResolvedCandidateLocations(url, fromFile) {
|
|
1820
|
-
const failedLookup =
|
|
1456
|
+
const failedLookup = ts7.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
1821
1457
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
1822
1458
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
1823
1459
|
}
|
|
@@ -1940,7 +1576,7 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
1940
1576
|
|
|
1941
1577
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
1942
1578
|
import { ExternalExpr } from "@angular/compiler";
|
|
1943
|
-
import
|
|
1579
|
+
import ts8 from "typescript";
|
|
1944
1580
|
var LocalModuleScopeRegistry = class {
|
|
1945
1581
|
constructor(localReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
1946
1582
|
this.localReader = localReader;
|
|
@@ -2141,7 +1777,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
2141
1777
|
}
|
|
2142
1778
|
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
2143
1779
|
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
2144
|
-
if (!
|
|
1780
|
+
if (!ts8.isClassDeclaration(ref.node)) {
|
|
2145
1781
|
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
2146
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`));
|
|
2147
1783
|
return "invalid";
|
|
@@ -2250,7 +1886,7 @@ function reexportCollision(module, refA, refB) {
|
|
|
2250
1886
|
|
|
2251
1887
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
2252
1888
|
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
2253
|
-
import
|
|
1889
|
+
import ts9 from "typescript";
|
|
2254
1890
|
var TypeCheckScopeRegistry = class {
|
|
2255
1891
|
constructor(scopeReader, metaReader) {
|
|
2256
1892
|
this.scopeReader = scopeReader;
|
|
@@ -2283,8 +1919,8 @@ var TypeCheckScopeRegistry = class {
|
|
|
2283
1919
|
}
|
|
2284
1920
|
}
|
|
2285
1921
|
for (const { name, ref } of scope.compilation.pipes) {
|
|
2286
|
-
if (!
|
|
2287
|
-
throw new Error(`Unexpected non-class declaration ${
|
|
1922
|
+
if (!ts9.isClassDeclaration(ref.node)) {
|
|
1923
|
+
throw new Error(`Unexpected non-class declaration ${ts9.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
|
|
2288
1924
|
}
|
|
2289
1925
|
pipes.set(name, ref);
|
|
2290
1926
|
}
|
|
@@ -2313,7 +1949,7 @@ var TypeCheckScopeRegistry = class {
|
|
|
2313
1949
|
import { CssSelector as CssSelector2, DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
2314
1950
|
|
|
2315
1951
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
2316
|
-
import
|
|
1952
|
+
import ts10 from "typescript";
|
|
2317
1953
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
2318
1954
|
if (mapping.type === "direct") {
|
|
2319
1955
|
let relatedInformation = void 0;
|
|
@@ -2321,7 +1957,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2321
1957
|
relatedInformation = [];
|
|
2322
1958
|
for (const relatedMessage of relatedMessages) {
|
|
2323
1959
|
relatedInformation.push({
|
|
2324
|
-
category:
|
|
1960
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2325
1961
|
code: 0,
|
|
2326
1962
|
file: relatedMessage.sourceFile,
|
|
2327
1963
|
start: relatedMessage.start,
|
|
@@ -2346,12 +1982,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2346
1982
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
2347
1983
|
const componentName = mapping.componentClass.name.text;
|
|
2348
1984
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
2349
|
-
const sf =
|
|
1985
|
+
const sf = ts10.createSourceFile(fileName, mapping.template, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.JSX);
|
|
2350
1986
|
let relatedInformation = [];
|
|
2351
1987
|
if (relatedMessages !== void 0) {
|
|
2352
1988
|
for (const relatedMessage of relatedMessages) {
|
|
2353
1989
|
relatedInformation.push({
|
|
2354
|
-
category:
|
|
1990
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2355
1991
|
code: 0,
|
|
2356
1992
|
file: relatedMessage.sourceFile,
|
|
2357
1993
|
start: relatedMessage.start,
|
|
@@ -2361,7 +1997,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2361
1997
|
}
|
|
2362
1998
|
}
|
|
2363
1999
|
relatedInformation.push({
|
|
2364
|
-
category:
|
|
2000
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2365
2001
|
code: 0,
|
|
2366
2002
|
file: componentSf,
|
|
2367
2003
|
start: mapping.node.getStart(),
|
|
@@ -2404,15 +2040,15 @@ function allocateTemplateId(sf) {
|
|
|
2404
2040
|
|
|
2405
2041
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2406
2042
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2407
|
-
import
|
|
2043
|
+
import ts12 from "typescript";
|
|
2408
2044
|
|
|
2409
2045
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2410
2046
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2411
|
-
import
|
|
2047
|
+
import ts11 from "typescript";
|
|
2412
2048
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2413
2049
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2414
|
-
return
|
|
2415
|
-
if (kind !==
|
|
2050
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2051
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2416
2052
|
return null;
|
|
2417
2053
|
}
|
|
2418
2054
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2435,15 +2071,15 @@ var ExpressionIdentifier;
|
|
|
2435
2071
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
2436
2072
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2437
2073
|
function addExpressionIdentifier(node, identifier) {
|
|
2438
|
-
|
|
2074
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
2439
2075
|
}
|
|
2440
2076
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2441
2077
|
function markIgnoreDiagnostics(node) {
|
|
2442
|
-
|
|
2078
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
2443
2079
|
}
|
|
2444
2080
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2445
|
-
return
|
|
2446
|
-
if (kind !==
|
|
2081
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2082
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2447
2083
|
return null;
|
|
2448
2084
|
}
|
|
2449
2085
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2517,8 +2153,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2517
2153
|
return results;
|
|
2518
2154
|
}
|
|
2519
2155
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2520
|
-
return
|
|
2521
|
-
if (kind !==
|
|
2156
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2157
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2522
2158
|
return false;
|
|
2523
2159
|
}
|
|
2524
2160
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2535,7 +2171,7 @@ var CompletionEngine = class {
|
|
|
2535
2171
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2536
2172
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2537
2173
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2538
|
-
filter:
|
|
2174
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2539
2175
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2540
2176
|
});
|
|
2541
2177
|
if (globalRead !== null) {
|
|
@@ -2558,7 +2194,7 @@ var CompletionEngine = class {
|
|
|
2558
2194
|
let nodeContext = null;
|
|
2559
2195
|
if (node instanceof EmptyExpr) {
|
|
2560
2196
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2561
|
-
filter:
|
|
2197
|
+
filter: ts12.isIdentifier,
|
|
2562
2198
|
withSpan: node.sourceSpan
|
|
2563
2199
|
});
|
|
2564
2200
|
if (nodeLocation !== null) {
|
|
@@ -2570,7 +2206,7 @@ var CompletionEngine = class {
|
|
|
2570
2206
|
}
|
|
2571
2207
|
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2572
2208
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2573
|
-
filter:
|
|
2209
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2574
2210
|
withSpan: node.sourceSpan
|
|
2575
2211
|
});
|
|
2576
2212
|
if (nodeLocation) {
|
|
@@ -2593,21 +2229,21 @@ var CompletionEngine = class {
|
|
|
2593
2229
|
let tsExpr = null;
|
|
2594
2230
|
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2595
2231
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2596
|
-
filter:
|
|
2232
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2597
2233
|
withSpan: expr.nameSpan
|
|
2598
2234
|
});
|
|
2599
2235
|
} else if (expr instanceof SafePropertyRead) {
|
|
2600
2236
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2601
|
-
filter:
|
|
2237
|
+
filter: ts12.isParenthesizedExpression,
|
|
2602
2238
|
withSpan: expr.sourceSpan
|
|
2603
2239
|
});
|
|
2604
|
-
if (ternaryExpr === null || !
|
|
2240
|
+
if (ternaryExpr === null || !ts12.isConditionalExpression(ternaryExpr.expression)) {
|
|
2605
2241
|
return null;
|
|
2606
2242
|
}
|
|
2607
2243
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2608
|
-
if (
|
|
2244
|
+
if (ts12.isPropertyAccessExpression(whenTrue)) {
|
|
2609
2245
|
tsExpr = whenTrue;
|
|
2610
|
-
} else if (
|
|
2246
|
+
} else if (ts12.isCallExpression(whenTrue) && ts12.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2611
2247
|
tsExpr = whenTrue.expression;
|
|
2612
2248
|
}
|
|
2613
2249
|
}
|
|
@@ -2628,15 +2264,15 @@ var CompletionEngine = class {
|
|
|
2628
2264
|
let tsExpr = null;
|
|
2629
2265
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2630
2266
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2631
|
-
filter:
|
|
2267
|
+
filter: ts12.isParenthesizedExpression,
|
|
2632
2268
|
withSpan: expr.sourceSpan
|
|
2633
2269
|
});
|
|
2634
|
-
if (strNode !== null &&
|
|
2270
|
+
if (strNode !== null && ts12.isStringLiteral(strNode.expression)) {
|
|
2635
2271
|
tsExpr = strNode.expression;
|
|
2636
2272
|
}
|
|
2637
2273
|
} else {
|
|
2638
2274
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2639
|
-
filter: (n) =>
|
|
2275
|
+
filter: (n) => ts12.isStringLiteral(n) || ts12.isNumericLiteral(n),
|
|
2640
2276
|
withSpan: expr.sourceSpan
|
|
2641
2277
|
});
|
|
2642
2278
|
}
|
|
@@ -2644,7 +2280,7 @@ var CompletionEngine = class {
|
|
|
2644
2280
|
return null;
|
|
2645
2281
|
}
|
|
2646
2282
|
let positionInShimFile = tsExpr.getEnd();
|
|
2647
|
-
if (
|
|
2283
|
+
if (ts12.isStringLiteral(tsExpr)) {
|
|
2648
2284
|
positionInShimFile -= 1;
|
|
2649
2285
|
}
|
|
2650
2286
|
const res = {
|
|
@@ -2678,11 +2314,11 @@ var CompletionEngine = class {
|
|
|
2678
2314
|
};
|
|
2679
2315
|
|
|
2680
2316
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2681
|
-
import
|
|
2317
|
+
import ts26 from "typescript";
|
|
2682
2318
|
|
|
2683
2319
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2684
2320
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
2685
|
-
import
|
|
2321
|
+
import ts13 from "typescript";
|
|
2686
2322
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
2687
2323
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
2688
2324
|
var RegistryDomSchemaChecker = class {
|
|
@@ -2706,7 +2342,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2706
2342
|
} else {
|
|
2707
2343
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2708
2344
|
}
|
|
2709
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
2345
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2710
2346
|
this._diagnostics.push(diag);
|
|
2711
2347
|
}
|
|
2712
2348
|
}
|
|
@@ -2724,70 +2360,70 @@ var RegistryDomSchemaChecker = class {
|
|
|
2724
2360
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
2725
2361
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2726
2362
|
}
|
|
2727
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
2363
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2728
2364
|
this._diagnostics.push(diag);
|
|
2729
2365
|
}
|
|
2730
2366
|
}
|
|
2731
2367
|
};
|
|
2732
2368
|
|
|
2733
2369
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2734
|
-
import { ExpressionType, ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
2735
|
-
import
|
|
2370
|
+
import { ExpressionType, ExternalExpr as ExternalExpr2, TypeModifier } from "@angular/compiler";
|
|
2371
|
+
import ts19 from "typescript";
|
|
2736
2372
|
|
|
2737
2373
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2738
|
-
import
|
|
2374
|
+
import ts14 from "typescript";
|
|
2739
2375
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2376
|
+
ts14.SyntaxKind.ParenthesizedExpression,
|
|
2377
|
+
ts14.SyntaxKind.Identifier,
|
|
2378
|
+
ts14.SyntaxKind.CallExpression,
|
|
2379
|
+
ts14.SyntaxKind.NonNullExpression,
|
|
2380
|
+
ts14.SyntaxKind.ElementAccessExpression,
|
|
2381
|
+
ts14.SyntaxKind.PropertyAccessExpression,
|
|
2382
|
+
ts14.SyntaxKind.ArrayLiteralExpression,
|
|
2383
|
+
ts14.SyntaxKind.ObjectLiteralExpression,
|
|
2384
|
+
ts14.SyntaxKind.StringLiteral,
|
|
2385
|
+
ts14.SyntaxKind.NumericLiteral,
|
|
2386
|
+
ts14.SyntaxKind.TrueKeyword,
|
|
2387
|
+
ts14.SyntaxKind.FalseKeyword,
|
|
2388
|
+
ts14.SyntaxKind.NullKeyword,
|
|
2389
|
+
ts14.SyntaxKind.UndefinedKeyword
|
|
2754
2390
|
]);
|
|
2755
2391
|
function tsCastToAny(expr) {
|
|
2756
2392
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2757
|
-
expr =
|
|
2393
|
+
expr = ts14.createParen(expr);
|
|
2758
2394
|
}
|
|
2759
|
-
return
|
|
2395
|
+
return ts14.createParen(ts14.createAsExpression(expr, ts14.createKeywordTypeNode(ts14.SyntaxKind.AnyKeyword)));
|
|
2760
2396
|
}
|
|
2761
2397
|
function tsCreateElement(tagName) {
|
|
2762
|
-
const createElement =
|
|
2763
|
-
return
|
|
2398
|
+
const createElement = ts14.createPropertyAccess(ts14.createIdentifier("document"), "createElement");
|
|
2399
|
+
return ts14.createCall(createElement, void 0, [ts14.createLiteral(tagName)]);
|
|
2764
2400
|
}
|
|
2765
2401
|
function tsDeclareVariable(id, type) {
|
|
2766
|
-
const decl =
|
|
2767
|
-
return
|
|
2402
|
+
const decl = ts14.createVariableDeclaration(id, type, ts14.createNonNullExpression(ts14.createNull()));
|
|
2403
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2768
2404
|
}
|
|
2769
2405
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2770
|
-
return
|
|
2406
|
+
return ts14.createTypeQueryNode(ts14.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2771
2407
|
}
|
|
2772
2408
|
function tsCreateVariable(id, initializer) {
|
|
2773
|
-
const decl =
|
|
2774
|
-
return
|
|
2409
|
+
const decl = ts14.createVariableDeclaration(id, void 0, initializer);
|
|
2410
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2775
2411
|
}
|
|
2776
2412
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2777
|
-
const methodAccess =
|
|
2778
|
-
return
|
|
2413
|
+
const methodAccess = ts14.createPropertyAccess(receiver, methodName);
|
|
2414
|
+
return ts14.createCall(methodAccess, void 0, args);
|
|
2779
2415
|
}
|
|
2780
2416
|
function checkIfClassIsExported(node) {
|
|
2781
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
2417
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts14.SyntaxKind.ExportKeyword)) {
|
|
2782
2418
|
return true;
|
|
2783
|
-
} else if (node.parent !== void 0 &&
|
|
2419
|
+
} else if (node.parent !== void 0 && ts14.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
2784
2420
|
return true;
|
|
2785
2421
|
}
|
|
2786
2422
|
return false;
|
|
2787
2423
|
}
|
|
2788
2424
|
function checkIfFileHasExport(sf, name) {
|
|
2789
2425
|
for (const stmt of sf.statements) {
|
|
2790
|
-
if (
|
|
2426
|
+
if (ts14.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts14.isNamedExports(stmt.exportClause)) {
|
|
2791
2427
|
for (const element of stmt.exportClause.elements) {
|
|
2792
2428
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
2793
2429
|
return true;
|
|
@@ -2800,20 +2436,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
2800
2436
|
return false;
|
|
2801
2437
|
}
|
|
2802
2438
|
function isAccessExpression(node) {
|
|
2803
|
-
return
|
|
2439
|
+
return ts14.isPropertyAccessExpression(node) || ts14.isElementAccessExpression(node);
|
|
2804
2440
|
}
|
|
2805
2441
|
|
|
2806
2442
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2807
|
-
import
|
|
2443
|
+
import ts18 from "typescript";
|
|
2808
2444
|
|
|
2809
2445
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2810
|
-
import
|
|
2446
|
+
import ts17 from "typescript";
|
|
2811
2447
|
|
|
2812
2448
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2813
|
-
import
|
|
2449
|
+
import ts16 from "typescript";
|
|
2814
2450
|
|
|
2815
2451
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2816
|
-
import
|
|
2452
|
+
import ts15 from "typescript";
|
|
2817
2453
|
var INELIGIBLE = {};
|
|
2818
2454
|
function canEmitType(type, canEmit) {
|
|
2819
2455
|
return canEmitTypeWorker(type);
|
|
@@ -2821,13 +2457,13 @@ function canEmitType(type, canEmit) {
|
|
|
2821
2457
|
return visitNode(type2) !== INELIGIBLE;
|
|
2822
2458
|
}
|
|
2823
2459
|
function visitNode(node) {
|
|
2824
|
-
if (
|
|
2460
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2825
2461
|
return INELIGIBLE;
|
|
2826
2462
|
}
|
|
2827
|
-
if (
|
|
2463
|
+
if (ts15.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2828
2464
|
return INELIGIBLE;
|
|
2829
2465
|
} else {
|
|
2830
|
-
return
|
|
2466
|
+
return ts15.forEachChild(node, visitNode);
|
|
2831
2467
|
}
|
|
2832
2468
|
}
|
|
2833
2469
|
function canEmitTypeReference(type2) {
|
|
@@ -2844,22 +2480,22 @@ var TypeEmitter = class {
|
|
|
2844
2480
|
emitType(type) {
|
|
2845
2481
|
const typeReferenceTransformer = (context) => {
|
|
2846
2482
|
const visitNode = (node) => {
|
|
2847
|
-
if (
|
|
2483
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2848
2484
|
throw new Error("Unable to emit import type");
|
|
2849
2485
|
}
|
|
2850
|
-
if (
|
|
2486
|
+
if (ts15.isTypeReferenceNode(node)) {
|
|
2851
2487
|
return this.emitTypeReference(node);
|
|
2852
|
-
} else if (
|
|
2853
|
-
const clone =
|
|
2854
|
-
|
|
2488
|
+
} else if (ts15.isLiteralExpression(node)) {
|
|
2489
|
+
const clone = ts15.getMutableClone(node);
|
|
2490
|
+
ts15.setTextRange(clone, { pos: -1, end: -1 });
|
|
2855
2491
|
return clone;
|
|
2856
2492
|
} else {
|
|
2857
|
-
return
|
|
2493
|
+
return ts15.visitEachChild(node, visitNode, context);
|
|
2858
2494
|
}
|
|
2859
2495
|
};
|
|
2860
|
-
return (node) =>
|
|
2496
|
+
return (node) => ts15.visitNode(node, visitNode);
|
|
2861
2497
|
};
|
|
2862
|
-
return
|
|
2498
|
+
return ts15.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2863
2499
|
}
|
|
2864
2500
|
emitTypeReference(type) {
|
|
2865
2501
|
const translatedType = this.translator(type);
|
|
@@ -2868,9 +2504,9 @@ var TypeEmitter = class {
|
|
|
2868
2504
|
}
|
|
2869
2505
|
let typeArguments = void 0;
|
|
2870
2506
|
if (type.typeArguments !== void 0) {
|
|
2871
|
-
typeArguments =
|
|
2507
|
+
typeArguments = ts15.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2872
2508
|
}
|
|
2873
|
-
return
|
|
2509
|
+
return ts15.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2874
2510
|
}
|
|
2875
2511
|
};
|
|
2876
2512
|
|
|
@@ -2911,11 +2547,11 @@ var TypeParameterEmitter = class {
|
|
|
2911
2547
|
return this.typeParameters.map((typeParam) => {
|
|
2912
2548
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2913
2549
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2914
|
-
return
|
|
2550
|
+
return ts16.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2915
2551
|
});
|
|
2916
2552
|
}
|
|
2917
2553
|
resolveTypeReference(type) {
|
|
2918
|
-
const target =
|
|
2554
|
+
const target = ts16.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2919
2555
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2920
2556
|
if (declaration === null || declaration.node === null) {
|
|
2921
2557
|
return null;
|
|
@@ -2941,8 +2577,8 @@ var TypeParameterEmitter = class {
|
|
|
2941
2577
|
if (typeNode === null) {
|
|
2942
2578
|
return null;
|
|
2943
2579
|
}
|
|
2944
|
-
if (!
|
|
2945
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2580
|
+
if (!ts16.isTypeReferenceNode(typeNode)) {
|
|
2581
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts16.SyntaxKind[typeNode.kind]}.`);
|
|
2946
2582
|
}
|
|
2947
2583
|
return typeNode;
|
|
2948
2584
|
}
|
|
@@ -2984,14 +2620,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2984
2620
|
}
|
|
2985
2621
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2986
2622
|
for (const stmt of file.statements) {
|
|
2987
|
-
if (
|
|
2623
|
+
if (ts17.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2988
2624
|
return stmt;
|
|
2989
2625
|
}
|
|
2990
2626
|
}
|
|
2991
2627
|
return null;
|
|
2992
2628
|
}
|
|
2993
2629
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2994
|
-
while (node !== void 0 && !
|
|
2630
|
+
while (node !== void 0 && !ts17.isFunctionDeclaration(node)) {
|
|
2995
2631
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2996
2632
|
return null;
|
|
2997
2633
|
}
|
|
@@ -3008,7 +2644,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
3008
2644
|
return null;
|
|
3009
2645
|
}
|
|
3010
2646
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
3011
|
-
while (!
|
|
2647
|
+
while (!ts17.isFunctionDeclaration(node)) {
|
|
3012
2648
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
3013
2649
|
return null;
|
|
3014
2650
|
}
|
|
@@ -3018,8 +2654,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
3018
2654
|
}
|
|
3019
2655
|
}
|
|
3020
2656
|
const start = node.getFullStart();
|
|
3021
|
-
return
|
|
3022
|
-
if (kind !==
|
|
2657
|
+
return ts17.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2658
|
+
if (kind !== ts17.SyntaxKind.MultiLineCommentTrivia) {
|
|
3023
2659
|
return null;
|
|
3024
2660
|
}
|
|
3025
2661
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -3034,29 +2670,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
3034
2670
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
3035
2671
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
3036
2672
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
3037
|
-
const rawType =
|
|
2673
|
+
const rawType = ts18.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
3038
2674
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3039
2675
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
3040
2676
|
if (meta.body) {
|
|
3041
|
-
const fnType =
|
|
3042
|
-
const decl =
|
|
3043
|
-
const declList =
|
|
3044
|
-
return
|
|
2677
|
+
const fnType = ts18.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2678
|
+
const decl = ts18.createVariableDeclaration(meta.fnName, fnType, ts18.createNonNullExpression(ts18.createNull()));
|
|
2679
|
+
const declList = ts18.createVariableDeclarationList([decl], ts18.NodeFlags.Const);
|
|
2680
|
+
return ts18.createVariableStatement(void 0, declList);
|
|
3045
2681
|
} else {
|
|
3046
|
-
return
|
|
2682
|
+
return ts18.createFunctionDeclaration(void 0, [ts18.createModifier(ts18.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
3047
2683
|
}
|
|
3048
2684
|
}
|
|
3049
2685
|
function generateInlineTypeCtor(node, meta) {
|
|
3050
2686
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
3051
|
-
const rawType =
|
|
2687
|
+
const rawType = ts18.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
3052
2688
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3053
2689
|
let body = void 0;
|
|
3054
2690
|
if (meta.body) {
|
|
3055
|
-
body =
|
|
3056
|
-
|
|
2691
|
+
body = ts18.createBlock([
|
|
2692
|
+
ts18.createReturn(ts18.createNonNullExpression(ts18.createNull()))
|
|
3057
2693
|
]);
|
|
3058
2694
|
}
|
|
3059
|
-
return
|
|
2695
|
+
return ts18.createMethod(void 0, [ts18.createModifier(ts18.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
3060
2696
|
}
|
|
3061
2697
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
3062
2698
|
let initType = null;
|
|
@@ -3065,26 +2701,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
3065
2701
|
const coercedKeys = [];
|
|
3066
2702
|
for (const key of keys) {
|
|
3067
2703
|
if (!meta.coercedInputFields.has(key)) {
|
|
3068
|
-
plainKeys.push(
|
|
2704
|
+
plainKeys.push(ts18.createLiteralTypeNode(ts18.createStringLiteral(key)));
|
|
3069
2705
|
} else {
|
|
3070
|
-
coercedKeys.push(
|
|
2706
|
+
coercedKeys.push(ts18.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key), void 0));
|
|
3071
2707
|
}
|
|
3072
2708
|
}
|
|
3073
2709
|
if (plainKeys.length > 0) {
|
|
3074
|
-
const keyTypeUnion =
|
|
3075
|
-
initType =
|
|
2710
|
+
const keyTypeUnion = ts18.createUnionTypeNode(plainKeys);
|
|
2711
|
+
initType = ts18.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
3076
2712
|
}
|
|
3077
2713
|
if (coercedKeys.length > 0) {
|
|
3078
|
-
const coercedLiteral =
|
|
3079
|
-
initType = initType !== null ?
|
|
2714
|
+
const coercedLiteral = ts18.createTypeLiteralNode(coercedKeys);
|
|
2715
|
+
initType = initType !== null ? ts18.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
3080
2716
|
}
|
|
3081
2717
|
if (initType === null) {
|
|
3082
|
-
initType =
|
|
2718
|
+
initType = ts18.createTypeLiteralNode([]);
|
|
3083
2719
|
}
|
|
3084
|
-
return
|
|
2720
|
+
return ts18.createParameter(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
3085
2721
|
}
|
|
3086
2722
|
function generateGenericArgs(params) {
|
|
3087
|
-
return params.map((param) =>
|
|
2723
|
+
return params.map((param) => ts18.createTypeReferenceNode(param.name, void 0));
|
|
3088
2724
|
}
|
|
3089
2725
|
function requiresInlineTypeCtor(node, host, env) {
|
|
3090
2726
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -3095,7 +2731,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
3095
2731
|
}
|
|
3096
2732
|
return params.map((param) => {
|
|
3097
2733
|
if (param.default === void 0) {
|
|
3098
|
-
return
|
|
2734
|
+
return ts18.updateTypeParameterDeclaration(param, param.name, param.constraint, ts18.createKeywordTypeNode(ts18.SyntaxKind.AnyKeyword));
|
|
3099
2735
|
} else {
|
|
3100
2736
|
return param;
|
|
3101
2737
|
}
|
|
@@ -3127,13 +2763,13 @@ var Environment = class {
|
|
|
3127
2763
|
}
|
|
3128
2764
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
3129
2765
|
const ref = this.reference(dirRef);
|
|
3130
|
-
const typeCtorExpr =
|
|
2766
|
+
const typeCtorExpr = ts19.createPropertyAccess(ref, "ngTypeCtor");
|
|
3131
2767
|
this.typeCtors.set(node, typeCtorExpr);
|
|
3132
2768
|
return typeCtorExpr;
|
|
3133
2769
|
} else {
|
|
3134
2770
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
3135
2771
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
3136
|
-
if (!
|
|
2772
|
+
if (!ts19.isTypeReferenceNode(nodeTypeRef)) {
|
|
3137
2773
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
3138
2774
|
}
|
|
3139
2775
|
const meta = {
|
|
@@ -3149,7 +2785,7 @@ var Environment = class {
|
|
|
3149
2785
|
const typeParams = this.emitTypeParameters(node);
|
|
3150
2786
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
3151
2787
|
this.typeCtorStatements.push(typeCtor);
|
|
3152
|
-
const fnId =
|
|
2788
|
+
const fnId = ts19.createIdentifier(fnName);
|
|
3153
2789
|
this.typeCtors.set(node, fnId);
|
|
3154
2790
|
return fnId;
|
|
3155
2791
|
}
|
|
@@ -3159,7 +2795,7 @@ var Environment = class {
|
|
|
3159
2795
|
return this.pipeInsts.get(ref.node);
|
|
3160
2796
|
}
|
|
3161
2797
|
const pipeType = this.referenceType(ref);
|
|
3162
|
-
const pipeInstId =
|
|
2798
|
+
const pipeInstId = ts19.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
3163
2799
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
3164
2800
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
3165
2801
|
return pipeInstId;
|
|
@@ -3170,11 +2806,11 @@ var Environment = class {
|
|
|
3170
2806
|
return translateExpression(ngExpr.expression, this.importManager);
|
|
3171
2807
|
}
|
|
3172
2808
|
canReferenceType(ref) {
|
|
3173
|
-
const result = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2809
|
+
const result = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports);
|
|
3174
2810
|
return result.kind === 0;
|
|
3175
2811
|
}
|
|
3176
2812
|
referenceType(ref) {
|
|
3177
|
-
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2813
|
+
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports);
|
|
3178
2814
|
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
|
|
3179
2815
|
return translateType(new ExpressionType(ngExpr.expression), this.importManager);
|
|
3180
2816
|
}
|
|
@@ -3184,7 +2820,7 @@ var Environment = class {
|
|
|
3184
2820
|
}
|
|
3185
2821
|
referenceExternalType(moduleName, name, typeParams) {
|
|
3186
2822
|
const external = new ExternalExpr2({ moduleName, name });
|
|
3187
|
-
return translateType(new ExpressionType(external,
|
|
2823
|
+
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.importManager);
|
|
3188
2824
|
}
|
|
3189
2825
|
getPreludeStatements() {
|
|
3190
2826
|
return [
|
|
@@ -3196,7 +2832,7 @@ var Environment = class {
|
|
|
3196
2832
|
|
|
3197
2833
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
3198
2834
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
3199
|
-
import
|
|
2835
|
+
import ts20 from "typescript";
|
|
3200
2836
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
3201
2837
|
constructor(resolver) {
|
|
3202
2838
|
this.resolver = resolver;
|
|
@@ -3210,7 +2846,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3210
2846
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3211
2847
|
const value = ref.value.trim();
|
|
3212
2848
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
3213
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2849
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
3214
2850
|
}
|
|
3215
2851
|
missingPipe(templateId, ast) {
|
|
3216
2852
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -3222,7 +2858,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3222
2858
|
if (sourceSpan === null) {
|
|
3223
2859
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
3224
2860
|
}
|
|
3225
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2861
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
3226
2862
|
this.recordedPipes.add(ast);
|
|
3227
2863
|
}
|
|
3228
2864
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -3233,7 +2869,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3233
2869
|
if (sourceSpan === null) {
|
|
3234
2870
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
3235
2871
|
}
|
|
3236
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2872
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
3237
2873
|
text: `The variable ${assignment.name} is declared here.`,
|
|
3238
2874
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
3239
2875
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -3243,7 +2879,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3243
2879
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
3244
2880
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3245
2881
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
3246
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
2882
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
3247
2883
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
3248
2884
|
start: firstDecl.sourceSpan.start.offset,
|
|
3249
2885
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -3282,7 +2918,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3282
2918
|
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.
|
|
3283
2919
|
|
|
3284
2920
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
3285
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
2921
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts20.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
3286
2922
|
}
|
|
3287
2923
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
3288
2924
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -3316,7 +2952,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
3316
2952
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
3317
2953
|
});
|
|
3318
2954
|
}
|
|
3319
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2955
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
3320
2956
|
}
|
|
3321
2957
|
};
|
|
3322
2958
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -3327,7 +2963,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
3327
2963
|
}
|
|
3328
2964
|
|
|
3329
2965
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
3330
|
-
import
|
|
2966
|
+
import ts21 from "typescript";
|
|
3331
2967
|
var TypeCheckShimGenerator = class {
|
|
3332
2968
|
constructor() {
|
|
3333
2969
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -3337,7 +2973,7 @@ var TypeCheckShimGenerator = class {
|
|
|
3337
2973
|
if (priorShimSf !== null) {
|
|
3338
2974
|
return priorShimSf;
|
|
3339
2975
|
}
|
|
3340
|
-
return
|
|
2976
|
+
return ts21.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts21.ScriptTarget.Latest, true, ts21.ScriptKind.TS);
|
|
3341
2977
|
}
|
|
3342
2978
|
static shimFor(fileName) {
|
|
3343
2979
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -3346,16 +2982,16 @@ var TypeCheckShimGenerator = class {
|
|
|
3346
2982
|
|
|
3347
2983
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3348
2984
|
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";
|
|
3349
|
-
import
|
|
2985
|
+
import ts24 from "typescript";
|
|
3350
2986
|
|
|
3351
2987
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
3352
2988
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
3353
|
-
import
|
|
2989
|
+
import ts22 from "typescript";
|
|
3354
2990
|
function wrapForDiagnostics(expr) {
|
|
3355
|
-
return
|
|
2991
|
+
return ts22.createParen(expr);
|
|
3356
2992
|
}
|
|
3357
2993
|
function wrapForTypeChecker(expr) {
|
|
3358
|
-
return
|
|
2994
|
+
return ts22.createParen(expr);
|
|
3359
2995
|
}
|
|
3360
2996
|
function addParseSpanInfo(node, span) {
|
|
3361
2997
|
let commentText;
|
|
@@ -3364,10 +3000,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3364
3000
|
} else {
|
|
3365
3001
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3366
3002
|
}
|
|
3367
|
-
|
|
3003
|
+
ts22.addSyntheticTrailingComment(node, ts22.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3368
3004
|
}
|
|
3369
3005
|
function addTemplateId(tcb, id) {
|
|
3370
|
-
|
|
3006
|
+
ts22.addSyntheticLeadingComment(tcb, ts22.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3371
3007
|
}
|
|
3372
3008
|
function shouldReportDiagnostic(diagnostic) {
|
|
3373
3009
|
const { code } = diagnostic;
|
|
@@ -3396,32 +3032,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3396
3032
|
|
|
3397
3033
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3398
3034
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3399
|
-
import
|
|
3400
|
-
var NULL_AS_ANY =
|
|
3401
|
-
var UNDEFINED =
|
|
3035
|
+
import ts23 from "typescript";
|
|
3036
|
+
var NULL_AS_ANY = ts23.createAsExpression(ts23.createNull(), ts23.createKeywordTypeNode(ts23.SyntaxKind.AnyKeyword));
|
|
3037
|
+
var UNDEFINED = ts23.createIdentifier("undefined");
|
|
3402
3038
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3403
|
-
["+",
|
|
3404
|
-
["-",
|
|
3039
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3040
|
+
["-", ts23.SyntaxKind.MinusToken]
|
|
3405
3041
|
]);
|
|
3406
3042
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3407
|
-
["+",
|
|
3408
|
-
["-",
|
|
3409
|
-
["<",
|
|
3410
|
-
[">",
|
|
3411
|
-
["<=",
|
|
3412
|
-
[">=",
|
|
3413
|
-
["==",
|
|
3414
|
-
["===",
|
|
3415
|
-
["*",
|
|
3416
|
-
["/",
|
|
3417
|
-
["%",
|
|
3418
|
-
["!=",
|
|
3419
|
-
["!==",
|
|
3420
|
-
["||",
|
|
3421
|
-
["&&",
|
|
3422
|
-
["&",
|
|
3423
|
-
["|",
|
|
3424
|
-
["??",
|
|
3043
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3044
|
+
["-", ts23.SyntaxKind.MinusToken],
|
|
3045
|
+
["<", ts23.SyntaxKind.LessThanToken],
|
|
3046
|
+
[">", ts23.SyntaxKind.GreaterThanToken],
|
|
3047
|
+
["<=", ts23.SyntaxKind.LessThanEqualsToken],
|
|
3048
|
+
[">=", ts23.SyntaxKind.GreaterThanEqualsToken],
|
|
3049
|
+
["==", ts23.SyntaxKind.EqualsEqualsToken],
|
|
3050
|
+
["===", ts23.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3051
|
+
["*", ts23.SyntaxKind.AsteriskToken],
|
|
3052
|
+
["/", ts23.SyntaxKind.SlashToken],
|
|
3053
|
+
["%", ts23.SyntaxKind.PercentToken],
|
|
3054
|
+
["!=", ts23.SyntaxKind.ExclamationEqualsToken],
|
|
3055
|
+
["!==", ts23.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3056
|
+
["||", ts23.SyntaxKind.BarBarToken],
|
|
3057
|
+
["&&", ts23.SyntaxKind.AmpersandAmpersandToken],
|
|
3058
|
+
["&", ts23.SyntaxKind.AmpersandToken],
|
|
3059
|
+
["|", ts23.SyntaxKind.BarToken],
|
|
3060
|
+
["??", ts23.SyntaxKind.QuestionQuestionToken]
|
|
3425
3061
|
]);
|
|
3426
3062
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3427
3063
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3437,7 +3073,7 @@ var AstTranslator = class {
|
|
|
3437
3073
|
ast = ast.ast;
|
|
3438
3074
|
}
|
|
3439
3075
|
if (ast instanceof EmptyExpr2) {
|
|
3440
|
-
const res =
|
|
3076
|
+
const res = ts23.factory.createIdentifier("undefined");
|
|
3441
3077
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3442
3078
|
return res;
|
|
3443
3079
|
}
|
|
@@ -3453,7 +3089,7 @@ var AstTranslator = class {
|
|
|
3453
3089
|
if (op === void 0) {
|
|
3454
3090
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3455
3091
|
}
|
|
3456
|
-
const node = wrapForDiagnostics(
|
|
3092
|
+
const node = wrapForDiagnostics(ts23.createPrefix(op, expr));
|
|
3457
3093
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3458
3094
|
return node;
|
|
3459
3095
|
}
|
|
@@ -3464,13 +3100,13 @@ var AstTranslator = class {
|
|
|
3464
3100
|
if (op === void 0) {
|
|
3465
3101
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3466
3102
|
}
|
|
3467
|
-
const node =
|
|
3103
|
+
const node = ts23.createBinary(lhs, op, rhs);
|
|
3468
3104
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3469
3105
|
return node;
|
|
3470
3106
|
}
|
|
3471
3107
|
visitChain(ast) {
|
|
3472
3108
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3473
|
-
const node = wrapForDiagnostics(
|
|
3109
|
+
const node = wrapForDiagnostics(ts23.createCommaList(elements));
|
|
3474
3110
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3475
3111
|
return node;
|
|
3476
3112
|
}
|
|
@@ -3478,7 +3114,7 @@ var AstTranslator = class {
|
|
|
3478
3114
|
const condExpr = this.translate(ast.condition);
|
|
3479
3115
|
const trueExpr = this.translate(ast.trueExp);
|
|
3480
3116
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3481
|
-
const node =
|
|
3117
|
+
const node = ts23.createParen(ts23.createConditional(condExpr, trueExpr, falseExpr));
|
|
3482
3118
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3483
3119
|
return node;
|
|
3484
3120
|
}
|
|
@@ -3489,26 +3125,26 @@ var AstTranslator = class {
|
|
|
3489
3125
|
throw new Error("Method not implemented.");
|
|
3490
3126
|
}
|
|
3491
3127
|
visitInterpolation(ast) {
|
|
3492
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3128
|
+
return ast.expressions.reduce((lhs, ast2) => ts23.createBinary(lhs, ts23.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts23.createLiteral(""));
|
|
3493
3129
|
}
|
|
3494
3130
|
visitKeyedRead(ast) {
|
|
3495
3131
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3496
3132
|
const key = this.translate(ast.key);
|
|
3497
|
-
const node =
|
|
3133
|
+
const node = ts23.createElementAccess(receiver, key);
|
|
3498
3134
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3499
3135
|
return node;
|
|
3500
3136
|
}
|
|
3501
3137
|
visitKeyedWrite(ast) {
|
|
3502
3138
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3503
|
-
const left =
|
|
3139
|
+
const left = ts23.createElementAccess(receiver, this.translate(ast.key));
|
|
3504
3140
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3505
|
-
const node = wrapForDiagnostics(
|
|
3141
|
+
const node = wrapForDiagnostics(ts23.createBinary(left, ts23.SyntaxKind.EqualsToken, right));
|
|
3506
3142
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3507
3143
|
return node;
|
|
3508
3144
|
}
|
|
3509
3145
|
visitLiteralArray(ast) {
|
|
3510
3146
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3511
|
-
const literal =
|
|
3147
|
+
const literal = ts23.createArrayLiteral(elements);
|
|
3512
3148
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3513
3149
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3514
3150
|
return node;
|
|
@@ -3516,9 +3152,9 @@ var AstTranslator = class {
|
|
|
3516
3152
|
visitLiteralMap(ast) {
|
|
3517
3153
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3518
3154
|
const value = this.translate(ast.values[idx]);
|
|
3519
|
-
return
|
|
3155
|
+
return ts23.createPropertyAssignment(ts23.createStringLiteral(key), value);
|
|
3520
3156
|
});
|
|
3521
|
-
const literal =
|
|
3157
|
+
const literal = ts23.createObjectLiteral(properties, true);
|
|
3522
3158
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3523
3159
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3524
3160
|
return node;
|
|
@@ -3526,18 +3162,18 @@ var AstTranslator = class {
|
|
|
3526
3162
|
visitLiteralPrimitive(ast) {
|
|
3527
3163
|
let node;
|
|
3528
3164
|
if (ast.value === void 0) {
|
|
3529
|
-
node =
|
|
3165
|
+
node = ts23.createIdentifier("undefined");
|
|
3530
3166
|
} else if (ast.value === null) {
|
|
3531
|
-
node =
|
|
3167
|
+
node = ts23.createNull();
|
|
3532
3168
|
} else {
|
|
3533
|
-
node =
|
|
3169
|
+
node = ts23.createLiteral(ast.value);
|
|
3534
3170
|
}
|
|
3535
3171
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3536
3172
|
return node;
|
|
3537
3173
|
}
|
|
3538
3174
|
visitNonNullAssert(ast) {
|
|
3539
3175
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3540
|
-
const node =
|
|
3176
|
+
const node = ts23.createNonNullExpression(expr);
|
|
3541
3177
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3542
3178
|
return node;
|
|
3543
3179
|
}
|
|
@@ -3546,13 +3182,13 @@ var AstTranslator = class {
|
|
|
3546
3182
|
}
|
|
3547
3183
|
visitPrefixNot(ast) {
|
|
3548
3184
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3549
|
-
const node =
|
|
3185
|
+
const node = ts23.createLogicalNot(expression);
|
|
3550
3186
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3551
3187
|
return node;
|
|
3552
3188
|
}
|
|
3553
3189
|
visitPropertyRead(ast) {
|
|
3554
3190
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3555
|
-
const name =
|
|
3191
|
+
const name = ts23.createPropertyAccess(receiver, ast.name);
|
|
3556
3192
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3557
3193
|
const node = wrapForDiagnostics(name);
|
|
3558
3194
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3560,12 +3196,12 @@ var AstTranslator = class {
|
|
|
3560
3196
|
}
|
|
3561
3197
|
visitPropertyWrite(ast) {
|
|
3562
3198
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3563
|
-
const left =
|
|
3199
|
+
const left = ts23.createPropertyAccess(receiver, ast.name);
|
|
3564
3200
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3565
3201
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3566
3202
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3567
3203
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3568
|
-
const node = wrapForDiagnostics(
|
|
3204
|
+
const node = wrapForDiagnostics(ts23.createBinary(leftWithPath, ts23.SyntaxKind.EqualsToken, right));
|
|
3569
3205
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3570
3206
|
return node;
|
|
3571
3207
|
}
|
|
@@ -3576,13 +3212,13 @@ var AstTranslator = class {
|
|
|
3576
3212
|
let node;
|
|
3577
3213
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3578
3214
|
if (this.config.strictSafeNavigationTypes) {
|
|
3579
|
-
const expr =
|
|
3215
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3580
3216
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3581
|
-
node =
|
|
3217
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3582
3218
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3583
|
-
node =
|
|
3219
|
+
node = ts23.createPropertyAccess(tsCastToAny(receiver), ast.name);
|
|
3584
3220
|
} else {
|
|
3585
|
-
const expr =
|
|
3221
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3586
3222
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3587
3223
|
node = tsCastToAny(expr);
|
|
3588
3224
|
}
|
|
@@ -3594,13 +3230,13 @@ var AstTranslator = class {
|
|
|
3594
3230
|
const key = this.translate(ast.key);
|
|
3595
3231
|
let node;
|
|
3596
3232
|
if (this.config.strictSafeNavigationTypes) {
|
|
3597
|
-
const expr =
|
|
3233
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3598
3234
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3599
|
-
node =
|
|
3235
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3600
3236
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3601
|
-
node =
|
|
3237
|
+
node = ts23.createElementAccess(tsCastToAny(receiver), key);
|
|
3602
3238
|
} else {
|
|
3603
|
-
const expr =
|
|
3239
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3604
3240
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3605
3241
|
node = tsCastToAny(expr);
|
|
3606
3242
|
}
|
|
@@ -3617,7 +3253,7 @@ var AstTranslator = class {
|
|
|
3617
3253
|
expr = resolved;
|
|
3618
3254
|
} else {
|
|
3619
3255
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3620
|
-
expr =
|
|
3256
|
+
expr = ts23.createPropertyAccess(propertyReceiver, receiver.name);
|
|
3621
3257
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3622
3258
|
}
|
|
3623
3259
|
} else {
|
|
@@ -3627,7 +3263,7 @@ var AstTranslator = class {
|
|
|
3627
3263
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3628
3264
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3629
3265
|
} else {
|
|
3630
|
-
node =
|
|
3266
|
+
node = ts23.createCall(expr, void 0, args);
|
|
3631
3267
|
}
|
|
3632
3268
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3633
3269
|
return node;
|
|
@@ -3641,13 +3277,13 @@ var AstTranslator = class {
|
|
|
3641
3277
|
}
|
|
3642
3278
|
convertToSafeCall(ast, expr, args) {
|
|
3643
3279
|
if (this.config.strictSafeNavigationTypes) {
|
|
3644
|
-
const call =
|
|
3645
|
-
return
|
|
3280
|
+
const call = ts23.createCall(ts23.createNonNullExpression(expr), void 0, args);
|
|
3281
|
+
return ts23.createParen(ts23.createConditional(NULL_AS_ANY, call, UNDEFINED));
|
|
3646
3282
|
}
|
|
3647
3283
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3648
|
-
return
|
|
3284
|
+
return ts23.createCall(tsCastToAny(expr), void 0, args);
|
|
3649
3285
|
}
|
|
3650
|
-
return tsCastToAny(
|
|
3286
|
+
return tsCastToAny(ts23.createCall(ts23.createNonNullExpression(expr), void 0, args));
|
|
3651
3287
|
}
|
|
3652
3288
|
};
|
|
3653
3289
|
var VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3759,7 +3395,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3759
3395
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
3760
3396
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3761
3397
|
const ctxRawType = env.referenceType(ref);
|
|
3762
|
-
if (!
|
|
3398
|
+
if (!ts24.isTypeReferenceNode(ctxRawType)) {
|
|
3763
3399
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3764
3400
|
}
|
|
3765
3401
|
let typeParameters = void 0;
|
|
@@ -3771,25 +3407,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3771
3407
|
switch (genericContextBehavior) {
|
|
3772
3408
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3773
3409
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3774
|
-
typeArguments = typeParameters.map((param) =>
|
|
3410
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3775
3411
|
break;
|
|
3776
3412
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3777
3413
|
typeParameters = [...ref.node.typeParameters];
|
|
3778
|
-
typeArguments = typeParameters.map((param) =>
|
|
3414
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3779
3415
|
break;
|
|
3780
3416
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3781
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3417
|
+
typeArguments = ref.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3782
3418
|
break;
|
|
3783
3419
|
}
|
|
3784
3420
|
}
|
|
3785
3421
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3786
3422
|
const scopeStatements = scope.render();
|
|
3787
|
-
const innerBody =
|
|
3423
|
+
const innerBody = ts24.createBlock([
|
|
3788
3424
|
...env.getPreludeStatements(),
|
|
3789
3425
|
...scopeStatements
|
|
3790
3426
|
]);
|
|
3791
|
-
const body =
|
|
3792
|
-
const fnDecl =
|
|
3427
|
+
const body = ts24.createBlock([ts24.createIf(ts24.createTrue(), innerBody, void 0)]);
|
|
3428
|
+
const fnDecl = ts24.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3793
3429
|
addTemplateId(fnDecl, meta.id);
|
|
3794
3430
|
return fnDecl;
|
|
3795
3431
|
}
|
|
@@ -3830,7 +3466,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3830
3466
|
execute() {
|
|
3831
3467
|
const ctx = this.scope.resolve(this.template);
|
|
3832
3468
|
const id = this.tcb.allocateId();
|
|
3833
|
-
const initializer =
|
|
3469
|
+
const initializer = ts24.createPropertyAccess(ctx, this.variable.value || "$implicit");
|
|
3834
3470
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3835
3471
|
let variable;
|
|
3836
3472
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3853,7 +3489,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3853
3489
|
}
|
|
3854
3490
|
execute() {
|
|
3855
3491
|
const ctx = this.tcb.allocateId();
|
|
3856
|
-
const type =
|
|
3492
|
+
const type = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
3857
3493
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3858
3494
|
return ctx;
|
|
3859
3495
|
}
|
|
@@ -3906,16 +3542,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3906
3542
|
}
|
|
3907
3543
|
let guard = null;
|
|
3908
3544
|
if (directiveGuards.length > 0) {
|
|
3909
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3545
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts24.createBinary(expr, ts24.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3910
3546
|
}
|
|
3911
3547
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3912
3548
|
const statements = tmplScope.render();
|
|
3913
3549
|
if (statements.length === 0) {
|
|
3914
3550
|
return null;
|
|
3915
3551
|
}
|
|
3916
|
-
let tmplBlock =
|
|
3552
|
+
let tmplBlock = ts24.createBlock(statements);
|
|
3917
3553
|
if (guard !== null) {
|
|
3918
|
-
tmplBlock =
|
|
3554
|
+
tmplBlock = ts24.createIf(guard, tmplBlock);
|
|
3919
3555
|
}
|
|
3920
3556
|
this.scope.addStatement(tmplBlock);
|
|
3921
3557
|
return null;
|
|
@@ -3933,7 +3569,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3933
3569
|
}
|
|
3934
3570
|
execute() {
|
|
3935
3571
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3936
|
-
this.scope.addStatement(
|
|
3572
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
3937
3573
|
return null;
|
|
3938
3574
|
}
|
|
3939
3575
|
};
|
|
@@ -3955,11 +3591,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3955
3591
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3956
3592
|
type = rawType;
|
|
3957
3593
|
} else {
|
|
3958
|
-
if (!
|
|
3594
|
+
if (!ts24.isTypeReferenceNode(rawType)) {
|
|
3959
3595
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3960
3596
|
}
|
|
3961
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3962
|
-
type =
|
|
3597
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3598
|
+
type = ts24.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3963
3599
|
}
|
|
3964
3600
|
const id = this.tcb.allocateId();
|
|
3965
3601
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -4000,11 +3636,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
4000
3636
|
const id = this.tcb.allocateId();
|
|
4001
3637
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
4002
3638
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
4003
|
-
initializer =
|
|
3639
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4004
3640
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
4005
|
-
initializer =
|
|
4006
|
-
initializer =
|
|
4007
|
-
initializer =
|
|
3641
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3642
|
+
initializer = ts24.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3643
|
+
initializer = ts24.createParen(initializer);
|
|
4008
3644
|
}
|
|
4009
3645
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
4010
3646
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -4094,7 +3730,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4094
3730
|
let target;
|
|
4095
3731
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
4096
3732
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4097
|
-
if (!
|
|
3733
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4098
3734
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4099
3735
|
}
|
|
4100
3736
|
const id = this.tcb.allocateId();
|
|
@@ -4109,10 +3745,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4109
3745
|
}
|
|
4110
3746
|
const id = this.tcb.allocateId();
|
|
4111
3747
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4112
|
-
if (!
|
|
3748
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4113
3749
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4114
3750
|
}
|
|
4115
|
-
const type =
|
|
3751
|
+
const type = ts24.createIndexedAccessTypeNode(ts24.createTypeQueryNode(dirId), ts24.createLiteralTypeNode(ts24.createStringLiteral(fieldName)));
|
|
4116
3752
|
const temp = tsDeclareVariable(id, type);
|
|
4117
3753
|
this.scope.addStatement(temp);
|
|
4118
3754
|
target = id;
|
|
@@ -4120,18 +3756,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4120
3756
|
if (dirId === null) {
|
|
4121
3757
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4122
3758
|
}
|
|
4123
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3759
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts24.createElementAccess(dirId, ts24.createStringLiteral(fieldName)) : ts24.createPropertyAccess(dirId, ts24.createIdentifier(fieldName));
|
|
4124
3760
|
}
|
|
4125
3761
|
if (input.attribute.keySpan !== void 0) {
|
|
4126
3762
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
4127
3763
|
}
|
|
4128
|
-
assignment =
|
|
3764
|
+
assignment = ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, assignment);
|
|
4129
3765
|
}
|
|
4130
3766
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
4131
3767
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
4132
3768
|
markIgnoreDiagnostics(assignment);
|
|
4133
3769
|
}
|
|
4134
|
-
this.scope.addStatement(
|
|
3770
|
+
this.scope.addStatement(ts24.createExpressionStatement(assignment));
|
|
4135
3771
|
}
|
|
4136
3772
|
return null;
|
|
4137
3773
|
}
|
|
@@ -4150,7 +3786,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
4150
3786
|
execute() {
|
|
4151
3787
|
const id = this.tcb.allocateId();
|
|
4152
3788
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
4153
|
-
const circularPlaceholder =
|
|
3789
|
+
const circularPlaceholder = ts24.createCall(typeCtor, void 0, [ts24.createNonNullExpression(ts24.createNull())]);
|
|
4154
3790
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
4155
3791
|
return id;
|
|
4156
3792
|
}
|
|
@@ -4216,15 +3852,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
4216
3852
|
elId = this.scope.resolve(this.element);
|
|
4217
3853
|
}
|
|
4218
3854
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
4219
|
-
const prop =
|
|
4220
|
-
const stmt =
|
|
3855
|
+
const prop = ts24.createElementAccess(elId, ts24.createStringLiteral(propertyName));
|
|
3856
|
+
const stmt = ts24.createBinary(prop, ts24.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
4221
3857
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
4222
|
-
this.scope.addStatement(
|
|
3858
|
+
this.scope.addStatement(ts24.createExpressionStatement(stmt));
|
|
4223
3859
|
} else {
|
|
4224
|
-
this.scope.addStatement(
|
|
3860
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4225
3861
|
}
|
|
4226
3862
|
} else {
|
|
4227
|
-
this.scope.addStatement(
|
|
3863
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4228
3864
|
}
|
|
4229
3865
|
}
|
|
4230
3866
|
return null;
|
|
@@ -4256,18 +3892,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
4256
3892
|
if (dirId === null) {
|
|
4257
3893
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4258
3894
|
}
|
|
4259
|
-
const outputField =
|
|
3895
|
+
const outputField = ts24.createElementAccess(dirId, ts24.createStringLiteral(field));
|
|
4260
3896
|
addParseSpanInfo(outputField, output.keySpan);
|
|
4261
3897
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
4262
3898
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4263
|
-
const subscribeFn =
|
|
4264
|
-
const call =
|
|
3899
|
+
const subscribeFn = ts24.createPropertyAccess(outputField, "subscribe");
|
|
3900
|
+
const call = ts24.createCall(subscribeFn, void 0, [handler]);
|
|
4265
3901
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4266
|
-
this.scope.addStatement(
|
|
3902
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4267
3903
|
} else {
|
|
4268
|
-
this.scope.addStatement(
|
|
3904
|
+
this.scope.addStatement(ts24.createExpressionStatement(outputField));
|
|
4269
3905
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4270
|
-
this.scope.addStatement(
|
|
3906
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4271
3907
|
}
|
|
4272
3908
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4273
3909
|
}
|
|
@@ -4300,20 +3936,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
4300
3936
|
if (output.type === 1) {
|
|
4301
3937
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
4302
3938
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
4303
|
-
this.scope.addStatement(
|
|
3939
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4304
3940
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
4305
3941
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4306
3942
|
if (elId === null) {
|
|
4307
3943
|
elId = this.scope.resolve(this.element);
|
|
4308
3944
|
}
|
|
4309
|
-
const propertyAccess =
|
|
3945
|
+
const propertyAccess = ts24.createPropertyAccess(elId, "addEventListener");
|
|
4310
3946
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
4311
|
-
const call =
|
|
3947
|
+
const call = ts24.createCall(propertyAccess, void 0, [ts24.createStringLiteral(output.name), handler]);
|
|
4312
3948
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4313
|
-
this.scope.addStatement(
|
|
3949
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4314
3950
|
} else {
|
|
4315
3951
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4316
|
-
this.scope.addStatement(
|
|
3952
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4317
3953
|
}
|
|
4318
3954
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4319
3955
|
}
|
|
@@ -4327,15 +3963,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
4327
3963
|
this.optional = false;
|
|
4328
3964
|
}
|
|
4329
3965
|
execute() {
|
|
4330
|
-
const ctx =
|
|
4331
|
-
const ctxDot =
|
|
3966
|
+
const ctx = ts24.createIdentifier("ctx");
|
|
3967
|
+
const ctxDot = ts24.createPropertyAccess(ctx, "");
|
|
4332
3968
|
markIgnoreDiagnostics(ctxDot);
|
|
4333
3969
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
4334
|
-
this.scope.addStatement(
|
|
3970
|
+
this.scope.addStatement(ts24.createExpressionStatement(ctxDot));
|
|
4335
3971
|
return null;
|
|
4336
3972
|
}
|
|
4337
3973
|
};
|
|
4338
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3974
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts24.createNonNullExpression(ts24.createNull());
|
|
4339
3975
|
var Context = class {
|
|
4340
3976
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
4341
3977
|
this.env = env;
|
|
@@ -4348,7 +3984,7 @@ var Context = class {
|
|
|
4348
3984
|
this.nextId = 1;
|
|
4349
3985
|
}
|
|
4350
3986
|
allocateId() {
|
|
4351
|
-
return
|
|
3987
|
+
return ts24.createIdentifier(`_t${this.nextId++}`);
|
|
4352
3988
|
}
|
|
4353
3989
|
getPipeByName(name) {
|
|
4354
3990
|
if (!this.pipes.has(name)) {
|
|
@@ -4400,8 +4036,8 @@ var Scope = class {
|
|
|
4400
4036
|
resolve(node, directive) {
|
|
4401
4037
|
const res = this.resolveLocal(node, directive);
|
|
4402
4038
|
if (res !== null) {
|
|
4403
|
-
const clone =
|
|
4404
|
-
|
|
4039
|
+
const clone = ts24.getMutableClone(res);
|
|
4040
|
+
ts24.setSyntheticTrailingComments(clone, []);
|
|
4405
4041
|
return clone;
|
|
4406
4042
|
} else if (this.parent !== null) {
|
|
4407
4043
|
return this.parent.resolve(node, directive);
|
|
@@ -4429,7 +4065,7 @@ var Scope = class {
|
|
|
4429
4065
|
} else if (parentGuards === null) {
|
|
4430
4066
|
return this.guard;
|
|
4431
4067
|
} else {
|
|
4432
|
-
return
|
|
4068
|
+
return ts24.createBinary(parentGuards, ts24.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4433
4069
|
}
|
|
4434
4070
|
}
|
|
4435
4071
|
resolveLocal(ref, directive) {
|
|
@@ -4609,8 +4245,8 @@ var Scope = class {
|
|
|
4609
4245
|
}
|
|
4610
4246
|
};
|
|
4611
4247
|
function tcbCtxParam(node, name, typeArguments) {
|
|
4612
|
-
const type =
|
|
4613
|
-
return
|
|
4248
|
+
const type = ts24.factory.createTypeReferenceNode(name, typeArguments);
|
|
4249
|
+
return ts24.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
4614
4250
|
}
|
|
4615
4251
|
function tcbExpression(ast, tcb, scope) {
|
|
4616
4252
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -4633,11 +4269,11 @@ var TcbExpressionTranslator = class {
|
|
|
4633
4269
|
return null;
|
|
4634
4270
|
}
|
|
4635
4271
|
const expr = this.translate(ast.value);
|
|
4636
|
-
const result =
|
|
4272
|
+
const result = ts24.createParen(ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, expr));
|
|
4637
4273
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4638
4274
|
return result;
|
|
4639
4275
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4640
|
-
return
|
|
4276
|
+
return ts24.createIdentifier("ctx");
|
|
4641
4277
|
} else if (ast instanceof BindingPipe) {
|
|
4642
4278
|
const expr = this.translate(ast.exp);
|
|
4643
4279
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4649,19 +4285,19 @@ var TcbExpressionTranslator = class {
|
|
|
4649
4285
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4650
4286
|
}
|
|
4651
4287
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4652
|
-
let methodAccess =
|
|
4288
|
+
let methodAccess = ts24.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4653
4289
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4654
4290
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4655
|
-
methodAccess =
|
|
4291
|
+
methodAccess = ts24.factory.createAsExpression(methodAccess, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4656
4292
|
}
|
|
4657
|
-
const result =
|
|
4293
|
+
const result = ts24.createCall(methodAccess, void 0, [expr, ...args]);
|
|
4658
4294
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4659
4295
|
return result;
|
|
4660
4296
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4661
4297
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4662
4298
|
const expr = this.translate(ast.args[0]);
|
|
4663
|
-
const exprAsAny =
|
|
4664
|
-
const result =
|
|
4299
|
+
const exprAsAny = ts24.createAsExpression(expr, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4300
|
+
const result = ts24.createParen(exprAsAny);
|
|
4665
4301
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4666
4302
|
return result;
|
|
4667
4303
|
}
|
|
@@ -4672,7 +4308,7 @@ var TcbExpressionTranslator = class {
|
|
|
4672
4308
|
const method = wrapForDiagnostics(receiver);
|
|
4673
4309
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4674
4310
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4675
|
-
const node =
|
|
4311
|
+
const node = ts24.createCall(method, void 0, args);
|
|
4676
4312
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4677
4313
|
return node;
|
|
4678
4314
|
} else {
|
|
@@ -4692,17 +4328,17 @@ var TcbExpressionTranslator = class {
|
|
|
4692
4328
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4693
4329
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4694
4330
|
const members = inputs.map((input) => {
|
|
4695
|
-
const propertyName =
|
|
4331
|
+
const propertyName = ts24.createStringLiteral(input.field);
|
|
4696
4332
|
if (input.type === "binding") {
|
|
4697
4333
|
const expr = widenBinding(input.expression, tcb);
|
|
4698
|
-
const assignment =
|
|
4334
|
+
const assignment = ts24.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4699
4335
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4700
4336
|
return assignment;
|
|
4701
4337
|
} else {
|
|
4702
|
-
return
|
|
4338
|
+
return ts24.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4703
4339
|
}
|
|
4704
4340
|
});
|
|
4705
|
-
return
|
|
4341
|
+
return ts24.createCall(typeCtor, void 0, [ts24.createObjectLiteral(members)]);
|
|
4706
4342
|
}
|
|
4707
4343
|
function getBoundInputs(directive, node, tcb) {
|
|
4708
4344
|
const boundInputs = [];
|
|
@@ -4728,17 +4364,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4728
4364
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4729
4365
|
return tcbExpression(attr.value, tcb, scope);
|
|
4730
4366
|
} else {
|
|
4731
|
-
return
|
|
4367
|
+
return ts24.createStringLiteral(attr.value);
|
|
4732
4368
|
}
|
|
4733
4369
|
}
|
|
4734
4370
|
function widenBinding(expr, tcb) {
|
|
4735
4371
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4736
4372
|
return tsCastToAny(expr);
|
|
4737
4373
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4738
|
-
if (
|
|
4374
|
+
if (ts24.isObjectLiteralExpression(expr) || ts24.isArrayLiteralExpression(expr)) {
|
|
4739
4375
|
return expr;
|
|
4740
4376
|
} else {
|
|
4741
|
-
return
|
|
4377
|
+
return ts24.createNonNullExpression(expr);
|
|
4742
4378
|
}
|
|
4743
4379
|
} else {
|
|
4744
4380
|
return expr;
|
|
@@ -4751,18 +4387,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4751
4387
|
if (eventType === 0) {
|
|
4752
4388
|
eventParamType = void 0;
|
|
4753
4389
|
} else if (eventType === 1) {
|
|
4754
|
-
eventParamType =
|
|
4390
|
+
eventParamType = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
4755
4391
|
} else {
|
|
4756
4392
|
eventParamType = eventType;
|
|
4757
4393
|
}
|
|
4758
4394
|
const guards = scope.guards();
|
|
4759
|
-
let body =
|
|
4395
|
+
let body = ts24.createExpressionStatement(handler);
|
|
4760
4396
|
if (guards !== null) {
|
|
4761
|
-
body =
|
|
4397
|
+
body = ts24.createIf(guards, body);
|
|
4762
4398
|
}
|
|
4763
|
-
const eventParam =
|
|
4399
|
+
const eventParam = ts24.createParameter(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4764
4400
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4765
|
-
return
|
|
4401
|
+
return ts24.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword), ts24.createBlock([body]));
|
|
4766
4402
|
}
|
|
4767
4403
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4768
4404
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4790,7 +4426,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4790
4426
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4791
4427
|
resolve(ast) {
|
|
4792
4428
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4793
|
-
const event =
|
|
4429
|
+
const event = ts24.createIdentifier(EVENT_PARAMETER);
|
|
4794
4430
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4795
4431
|
return event;
|
|
4796
4432
|
}
|
|
@@ -4799,32 +4435,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4799
4435
|
};
|
|
4800
4436
|
|
|
4801
4437
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4802
|
-
import
|
|
4438
|
+
import ts25 from "typescript";
|
|
4803
4439
|
var TypeCheckFile = class extends Environment {
|
|
4804
4440
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4805
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
4441
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts25.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts25.ScriptTarget.Latest, true));
|
|
4806
4442
|
this.fileName = fileName;
|
|
4807
4443
|
this.nextTcbId = 1;
|
|
4808
4444
|
this.tcbStatements = [];
|
|
4809
4445
|
}
|
|
4810
4446
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4811
|
-
const fnId =
|
|
4447
|
+
const fnId = ts25.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4812
4448
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4813
4449
|
this.tcbStatements.push(fn);
|
|
4814
4450
|
}
|
|
4815
4451
|
render(removeComments) {
|
|
4816
4452
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
4817
|
-
const printer =
|
|
4453
|
+
const printer = ts25.createPrinter({ removeComments });
|
|
4818
4454
|
source += "\n";
|
|
4819
4455
|
for (const stmt of this.pipeInstStatements) {
|
|
4820
|
-
source += printer.printNode(
|
|
4456
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4821
4457
|
}
|
|
4822
4458
|
for (const stmt of this.typeCtorStatements) {
|
|
4823
|
-
source += printer.printNode(
|
|
4459
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4824
4460
|
}
|
|
4825
4461
|
source += "\n";
|
|
4826
4462
|
for (const stmt of this.tcbStatements) {
|
|
4827
|
-
source += printer.printNode(
|
|
4463
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4828
4464
|
}
|
|
4829
4465
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4830
4466
|
return source;
|
|
@@ -4932,7 +4568,7 @@ var TypeCheckContextImpl = class {
|
|
|
4932
4568
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4933
4569
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4934
4570
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4935
|
-
const printer =
|
|
4571
|
+
const printer = ts26.createPrinter({ omitTrailingSemicolon: true });
|
|
4936
4572
|
let code = textParts[0];
|
|
4937
4573
|
ops.forEach((op, idx) => {
|
|
4938
4574
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -5013,7 +4649,7 @@ var TypeCheckContextImpl = class {
|
|
|
5013
4649
|
if (span.start.offset === span.end.offset) {
|
|
5014
4650
|
span.end.offset++;
|
|
5015
4651
|
}
|
|
5016
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4652
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts26.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
5017
4653
|
});
|
|
5018
4654
|
}
|
|
5019
4655
|
};
|
|
@@ -5031,9 +4667,9 @@ var InlineTcbOp = class {
|
|
|
5031
4667
|
}
|
|
5032
4668
|
execute(im, sf, refEmitter, printer) {
|
|
5033
4669
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
5034
|
-
const fnName =
|
|
4670
|
+
const fnName = ts26.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
5035
4671
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
5036
|
-
return printer.printNode(
|
|
4672
|
+
return printer.printNode(ts26.EmitHint.Unspecified, fn, sf);
|
|
5037
4673
|
}
|
|
5038
4674
|
};
|
|
5039
4675
|
var TypeCtorOp = class {
|
|
@@ -5046,7 +4682,7 @@ var TypeCtorOp = class {
|
|
|
5046
4682
|
}
|
|
5047
4683
|
execute(im, sf, refEmitter, printer) {
|
|
5048
4684
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
5049
|
-
return printer.printNode(
|
|
4685
|
+
return printer.printNode(ts26.EmitHint.Unspecified, tcb, sf);
|
|
5050
4686
|
}
|
|
5051
4687
|
};
|
|
5052
4688
|
function orderOps(op1, op2) {
|
|
@@ -5161,7 +4797,7 @@ var TemplateSourceManager = class {
|
|
|
5161
4797
|
|
|
5162
4798
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
5163
4799
|
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";
|
|
5164
|
-
import
|
|
4800
|
+
import ts27 from "typescript";
|
|
5165
4801
|
var SymbolBuilder = class {
|
|
5166
4802
|
constructor(shimPath, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
5167
4803
|
this.shimPath = shimPath;
|
|
@@ -5204,7 +4840,7 @@ var SymbolBuilder = class {
|
|
|
5204
4840
|
getSymbolOfElement(element) {
|
|
5205
4841
|
var _a;
|
|
5206
4842
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5207
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4843
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts27.isVariableDeclaration });
|
|
5208
4844
|
if (node === null) {
|
|
5209
4845
|
return null;
|
|
5210
4846
|
}
|
|
@@ -5223,12 +4859,12 @@ var SymbolBuilder = class {
|
|
|
5223
4859
|
var _a;
|
|
5224
4860
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5225
4861
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
5226
|
-
const isDirectiveDeclaration = (node) => (
|
|
4862
|
+
const isDirectiveDeclaration = (node) => (ts27.isTypeNode(node) || ts27.isIdentifier(node)) && ts27.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
5227
4863
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
5228
4864
|
return nodes.map((node) => {
|
|
5229
4865
|
var _a2;
|
|
5230
4866
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
5231
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4867
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5232
4868
|
return null;
|
|
5233
4869
|
}
|
|
5234
4870
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -5297,17 +4933,17 @@ var SymbolBuilder = class {
|
|
|
5297
4933
|
if (!isAccessExpression(n)) {
|
|
5298
4934
|
return false;
|
|
5299
4935
|
}
|
|
5300
|
-
if (
|
|
4936
|
+
if (ts27.isPropertyAccessExpression(n)) {
|
|
5301
4937
|
return n.name.getText() === expectedAccess;
|
|
5302
4938
|
} else {
|
|
5303
|
-
return
|
|
4939
|
+
return ts27.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
5304
4940
|
}
|
|
5305
4941
|
}
|
|
5306
4942
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
5307
4943
|
const bindings = [];
|
|
5308
4944
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
5309
4945
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
5310
|
-
if (!
|
|
4946
|
+
if (!ts27.isPropertyAccessExpression(outputFieldAccess)) {
|
|
5311
4947
|
continue;
|
|
5312
4948
|
}
|
|
5313
4949
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -5326,7 +4962,7 @@ var SymbolBuilder = class {
|
|
|
5326
4962
|
shimLocation: { shimPath: this.shimPath, positionInShimFile }
|
|
5327
4963
|
});
|
|
5328
4964
|
} else {
|
|
5329
|
-
if (!
|
|
4965
|
+
if (!ts27.isElementAccessExpression(outputFieldAccess)) {
|
|
5330
4966
|
continue;
|
|
5331
4967
|
}
|
|
5332
4968
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -5394,11 +5030,11 @@ var SymbolBuilder = class {
|
|
|
5394
5030
|
return null;
|
|
5395
5031
|
}
|
|
5396
5032
|
const [declaration] = tsSymbol.declarations;
|
|
5397
|
-
if (!
|
|
5033
|
+
if (!ts27.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
5398
5034
|
return null;
|
|
5399
5035
|
}
|
|
5400
5036
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5401
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5037
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5402
5038
|
return null;
|
|
5403
5039
|
}
|
|
5404
5040
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5414,7 +5050,7 @@ var SymbolBuilder = class {
|
|
|
5414
5050
|
};
|
|
5415
5051
|
}
|
|
5416
5052
|
getSymbolOfVariable(variable) {
|
|
5417
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5053
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5418
5054
|
if (node === null || node.initializer === void 0) {
|
|
5419
5055
|
return null;
|
|
5420
5056
|
}
|
|
@@ -5436,11 +5072,11 @@ var SymbolBuilder = class {
|
|
|
5436
5072
|
}
|
|
5437
5073
|
getSymbolOfReference(ref) {
|
|
5438
5074
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5439
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5075
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5440
5076
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5441
5077
|
return null;
|
|
5442
5078
|
}
|
|
5443
|
-
const originalDeclaration =
|
|
5079
|
+
const originalDeclaration = ts27.isParenthesizedExpression(node.initializer) && ts27.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5444
5080
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5445
5081
|
return null;
|
|
5446
5082
|
}
|
|
@@ -5463,7 +5099,7 @@ var SymbolBuilder = class {
|
|
|
5463
5099
|
referenceVarLocation: referenceVarShimLocation
|
|
5464
5100
|
};
|
|
5465
5101
|
} else {
|
|
5466
|
-
if (!
|
|
5102
|
+
if (!ts27.isClassDeclaration(target.directive.ref.node)) {
|
|
5467
5103
|
return null;
|
|
5468
5104
|
}
|
|
5469
5105
|
return {
|
|
@@ -5478,7 +5114,7 @@ var SymbolBuilder = class {
|
|
|
5478
5114
|
}
|
|
5479
5115
|
}
|
|
5480
5116
|
getSymbolOfPipe(expression) {
|
|
5481
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5117
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts27.isPropertyAccessExpression });
|
|
5482
5118
|
if (methodAccess === null) {
|
|
5483
5119
|
return null;
|
|
5484
5120
|
}
|
|
@@ -5517,7 +5153,7 @@ var SymbolBuilder = class {
|
|
|
5517
5153
|
}
|
|
5518
5154
|
let node = null;
|
|
5519
5155
|
if (expression instanceof PropertyRead5) {
|
|
5520
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5156
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts27.isPropertyAccessExpression });
|
|
5521
5157
|
}
|
|
5522
5158
|
if (node === null) {
|
|
5523
5159
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5525,10 +5161,10 @@ var SymbolBuilder = class {
|
|
|
5525
5161
|
if (node === null) {
|
|
5526
5162
|
return null;
|
|
5527
5163
|
}
|
|
5528
|
-
while (
|
|
5164
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5529
5165
|
node = node.expression;
|
|
5530
5166
|
}
|
|
5531
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5167
|
+
if (expression instanceof SafePropertyRead4 && ts27.isConditionalExpression(node)) {
|
|
5532
5168
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5533
5169
|
if (whenTrueSymbol === null) {
|
|
5534
5170
|
return null;
|
|
@@ -5544,13 +5180,13 @@ var SymbolBuilder = class {
|
|
|
5544
5180
|
}
|
|
5545
5181
|
getSymbolOfTsNode(node) {
|
|
5546
5182
|
var _a;
|
|
5547
|
-
while (
|
|
5183
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5548
5184
|
node = node.expression;
|
|
5549
5185
|
}
|
|
5550
5186
|
let tsSymbol;
|
|
5551
|
-
if (
|
|
5187
|
+
if (ts27.isPropertyAccessExpression(node)) {
|
|
5552
5188
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5553
|
-
} else if (
|
|
5189
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5554
5190
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5555
5191
|
} else {
|
|
5556
5192
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -5564,13 +5200,13 @@ var SymbolBuilder = class {
|
|
|
5564
5200
|
};
|
|
5565
5201
|
}
|
|
5566
5202
|
getShimPositionForNode(node) {
|
|
5567
|
-
if (
|
|
5203
|
+
if (ts27.isTypeReferenceNode(node)) {
|
|
5568
5204
|
return this.getShimPositionForNode(node.typeName);
|
|
5569
|
-
} else if (
|
|
5205
|
+
} else if (ts27.isQualifiedName(node)) {
|
|
5570
5206
|
return node.right.getStart();
|
|
5571
|
-
} else if (
|
|
5207
|
+
} else if (ts27.isPropertyAccessExpression(node)) {
|
|
5572
5208
|
return node.name.getStart();
|
|
5573
|
-
} else if (
|
|
5209
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5574
5210
|
return node.argumentExpression.getStart();
|
|
5575
5211
|
} else {
|
|
5576
5212
|
return node.getStart();
|
|
@@ -6207,6 +5843,7 @@ var factory = {
|
|
|
6207
5843
|
|
|
6208
5844
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
6209
5845
|
import { Binary } from "@angular/compiler";
|
|
5846
|
+
import ts28 from "typescript";
|
|
6210
5847
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6211
5848
|
constructor() {
|
|
6212
5849
|
super(...arguments);
|
|
@@ -6220,6 +5857,9 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6220
5857
|
return [];
|
|
6221
5858
|
}
|
|
6222
5859
|
const typeLeft = symbolLeft.tsType;
|
|
5860
|
+
if (typeLeft.flags & (ts28.TypeFlags.Any | ts28.TypeFlags.Unknown)) {
|
|
5861
|
+
return [];
|
|
5862
|
+
}
|
|
6223
5863
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
6224
5864
|
return [];
|
|
6225
5865
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
@@ -6235,7 +5875,8 @@ var factory2 = {
|
|
|
6235
5875
|
code: ErrorCode.NULLISH_COALESCING_NOT_NULLABLE,
|
|
6236
5876
|
name: ExtendedTemplateDiagnosticName.NULLISH_COALESCING_NOT_NULLABLE,
|
|
6237
5877
|
create: (options) => {
|
|
6238
|
-
|
|
5878
|
+
const strictNullChecks = options.strictNullChecks === void 0 ? !!options.strict : !!options.strictNullChecks;
|
|
5879
|
+
if (!strictNullChecks) {
|
|
6239
5880
|
return null;
|
|
6240
5881
|
}
|
|
6241
5882
|
return new NullishCoalescingNotNullableCheck();
|
|
@@ -6243,7 +5884,7 @@ var factory2 = {
|
|
|
6243
5884
|
};
|
|
6244
5885
|
|
|
6245
5886
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
6246
|
-
import
|
|
5887
|
+
import ts29 from "typescript";
|
|
6247
5888
|
|
|
6248
5889
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
6249
5890
|
var DiagnosticCategoryLabel;
|
|
@@ -6291,9 +5932,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
6291
5932
|
function diagnosticLabelToCategory(label) {
|
|
6292
5933
|
switch (label) {
|
|
6293
5934
|
case DiagnosticCategoryLabel.Warning:
|
|
6294
|
-
return
|
|
5935
|
+
return ts29.DiagnosticCategory.Warning;
|
|
6295
5936
|
case DiagnosticCategoryLabel.Error:
|
|
6296
|
-
return
|
|
5937
|
+
return ts29.DiagnosticCategory.Error;
|
|
6297
5938
|
case DiagnosticCategoryLabel.Suppress:
|
|
6298
5939
|
return null;
|
|
6299
5940
|
default:
|
|
@@ -6384,14 +6025,11 @@ var NgCompiler = class {
|
|
|
6384
6025
|
this.constructionDiagnostics = [];
|
|
6385
6026
|
this.nonTemplateDiagnostics = null;
|
|
6386
6027
|
this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
|
|
6387
|
-
if (this.options._extendedTemplateDiagnostics === true && this.options.strictTemplates === false) {
|
|
6388
|
-
throw new Error("The '_extendedTemplateDiagnostics' option requires 'strictTemplates' to also be enabled.");
|
|
6389
|
-
}
|
|
6390
6028
|
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
|
|
6391
6029
|
this.currentProgram = inputProgram;
|
|
6392
6030
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6393
6031
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6394
|
-
const moduleResolutionCache =
|
|
6032
|
+
const moduleResolutionCache = ts30.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
6395
6033
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
6396
6034
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
6397
6035
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -6447,7 +6085,7 @@ var NgCompiler = class {
|
|
|
6447
6085
|
}
|
|
6448
6086
|
for (const clazz of classesToUpdate) {
|
|
6449
6087
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6450
|
-
if (!
|
|
6088
|
+
if (!ts30.isClassDeclaration(clazz)) {
|
|
6451
6089
|
continue;
|
|
6452
6090
|
}
|
|
6453
6091
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6461,7 +6099,7 @@ var NgCompiler = class {
|
|
|
6461
6099
|
getDiagnostics() {
|
|
6462
6100
|
const diagnostics = [];
|
|
6463
6101
|
diagnostics.push(...this.getNonTemplateDiagnostics(), ...this.getTemplateDiagnostics());
|
|
6464
|
-
if (this.options.
|
|
6102
|
+
if (this.options.strictTemplates) {
|
|
6465
6103
|
diagnostics.push(...this.getExtendedTemplateDiagnostics());
|
|
6466
6104
|
}
|
|
6467
6105
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6469,7 +6107,7 @@ var NgCompiler = class {
|
|
|
6469
6107
|
getDiagnosticsForFile(file, optimizeFor) {
|
|
6470
6108
|
const diagnostics = [];
|
|
6471
6109
|
diagnostics.push(...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file), ...this.getTemplateDiagnosticsForFile(file, optimizeFor));
|
|
6472
|
-
if (this.options.
|
|
6110
|
+
if (this.options.strictTemplates) {
|
|
6473
6111
|
diagnostics.push(...this.getExtendedTemplateDiagnostics(file));
|
|
6474
6112
|
}
|
|
6475
6113
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6479,8 +6117,8 @@ var NgCompiler = class {
|
|
|
6479
6117
|
const ttc = compilation.templateTypeChecker;
|
|
6480
6118
|
const diagnostics = [];
|
|
6481
6119
|
diagnostics.push(...ttc.getDiagnosticsForComponent(component));
|
|
6482
|
-
|
|
6483
|
-
|
|
6120
|
+
const extendedTemplateChecker = compilation.extendedTemplateChecker;
|
|
6121
|
+
if (this.options.strictTemplates && extendedTemplateChecker) {
|
|
6484
6122
|
diagnostics.push(...extendedTemplateChecker.getDiagnosticsForComponent(component));
|
|
6485
6123
|
}
|
|
6486
6124
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6754,6 +6392,9 @@ var NgCompiler = class {
|
|
|
6754
6392
|
const diagnostics = [];
|
|
6755
6393
|
const compilation = this.ensureAnalyzed();
|
|
6756
6394
|
const extendedTemplateChecker = compilation.extendedTemplateChecker;
|
|
6395
|
+
if (!extendedTemplateChecker) {
|
|
6396
|
+
return [];
|
|
6397
|
+
}
|
|
6757
6398
|
if (sf !== void 0) {
|
|
6758
6399
|
return compilation.traitCompiler.extendedTemplateCheck(sf, extendedTemplateChecker);
|
|
6759
6400
|
}
|
|
@@ -6828,7 +6469,7 @@ var NgCompiler = class {
|
|
|
6828
6469
|
this.currentProgram = program;
|
|
6829
6470
|
});
|
|
6830
6471
|
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, scopeRegistry, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
6831
|
-
const extendedTemplateChecker = new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options);
|
|
6472
|
+
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
6832
6473
|
return {
|
|
6833
6474
|
isCore,
|
|
6834
6475
|
traitCompiler,
|
|
@@ -6852,17 +6493,17 @@ function isAngularCorePackage(program) {
|
|
|
6852
6493
|
return false;
|
|
6853
6494
|
}
|
|
6854
6495
|
return r3Symbols.statements.some((stmt) => {
|
|
6855
|
-
if (!
|
|
6496
|
+
if (!ts30.isVariableStatement(stmt)) {
|
|
6856
6497
|
return false;
|
|
6857
6498
|
}
|
|
6858
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
6499
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts30.SyntaxKind.ExportKeyword)) {
|
|
6859
6500
|
return false;
|
|
6860
6501
|
}
|
|
6861
6502
|
return stmt.declarationList.declarations.some((decl) => {
|
|
6862
|
-
if (!
|
|
6503
|
+
if (!ts30.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
6863
6504
|
return false;
|
|
6864
6505
|
}
|
|
6865
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
6506
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts30.SyntaxKind.TrueKeyword) {
|
|
6866
6507
|
return false;
|
|
6867
6508
|
}
|
|
6868
6509
|
return true;
|
|
@@ -6876,7 +6517,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
6876
6517
|
var _a, _b, _c;
|
|
6877
6518
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
6878
6519
|
yield makeConfigDiagnostic({
|
|
6879
|
-
category:
|
|
6520
|
+
category: ts30.DiagnosticCategory.Error,
|
|
6880
6521
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
6881
6522
|
messageText: `
|
|
6882
6523
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -6895,7 +6536,7 @@ https://angular.io/guide/template-typecheck
|
|
|
6895
6536
|
}
|
|
6896
6537
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
6897
6538
|
yield makeConfigDiagnostic({
|
|
6898
|
-
category:
|
|
6539
|
+
category: ts30.DiagnosticCategory.Error,
|
|
6899
6540
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
6900
6541
|
messageText: `
|
|
6901
6542
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -6912,7 +6553,7 @@ One of the following actions is required:
|
|
|
6912
6553
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
6913
6554
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
6914
6555
|
yield makeConfigDiagnostic({
|
|
6915
|
-
category:
|
|
6556
|
+
category: ts30.DiagnosticCategory.Error,
|
|
6916
6557
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6917
6558
|
messageText: `
|
|
6918
6559
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -6926,7 +6567,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
6926
6567
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
6927
6568
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
6928
6569
|
yield makeConfigDiagnostic({
|
|
6929
|
-
category:
|
|
6570
|
+
category: ts30.DiagnosticCategory.Error,
|
|
6930
6571
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
6931
6572
|
messageText: `
|
|
6932
6573
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -6938,7 +6579,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
6938
6579
|
}
|
|
6939
6580
|
if (!allowedCategoryLabels.includes(category)) {
|
|
6940
6581
|
yield makeConfigDiagnostic({
|
|
6941
|
-
category:
|
|
6582
|
+
category: ts30.DiagnosticCategory.Error,
|
|
6942
6583
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6943
6584
|
messageText: `
|
|
6944
6585
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -6968,7 +6609,7 @@ var ReferenceGraphAdapter = class {
|
|
|
6968
6609
|
for (const { node } of references) {
|
|
6969
6610
|
let sourceFile = node.getSourceFile();
|
|
6970
6611
|
if (sourceFile === void 0) {
|
|
6971
|
-
sourceFile =
|
|
6612
|
+
sourceFile = ts30.getOriginalNode(node).getSourceFile();
|
|
6972
6613
|
}
|
|
6973
6614
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
6974
6615
|
this.graph.add(source, node);
|
|
@@ -7007,7 +6648,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
7007
6648
|
}
|
|
7008
6649
|
|
|
7009
6650
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
7010
|
-
import
|
|
6651
|
+
import ts31 from "typescript";
|
|
7011
6652
|
var DelegatingCompilerHost2 = class {
|
|
7012
6653
|
constructor(delegate) {
|
|
7013
6654
|
this.delegate = delegate;
|
|
@@ -7097,7 +6738,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7097
6738
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
7098
6739
|
if (entryPoint === null) {
|
|
7099
6740
|
diagnostics.push({
|
|
7100
|
-
category:
|
|
6741
|
+
category: ts31.DiagnosticCategory.Error,
|
|
7101
6742
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
7102
6743
|
file: void 0,
|
|
7103
6744
|
start: void 0,
|
|
@@ -7137,10 +6778,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7137
6778
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
7138
6779
|
}
|
|
7139
6780
|
createCachedResolveModuleNamesFunction() {
|
|
7140
|
-
const moduleResolutionCache =
|
|
6781
|
+
const moduleResolutionCache = ts31.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
7141
6782
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
7142
6783
|
return moduleNames.map((moduleName) => {
|
|
7143
|
-
const module =
|
|
6784
|
+
const module = ts31.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
7144
6785
|
return module.resolvedModule;
|
|
7145
6786
|
});
|
|
7146
6787
|
};
|
|
@@ -7161,7 +6802,7 @@ var NgtscProgram = class {
|
|
|
7161
6802
|
if (reuseProgram !== void 0) {
|
|
7162
6803
|
retagAllTsFiles(reuseProgram);
|
|
7163
6804
|
}
|
|
7164
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
6805
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts32.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
7165
6806
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
7166
6807
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
7167
6808
|
this.host.postProgramCreationCleanup();
|
|
@@ -7360,17 +7001,17 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
7360
7001
|
}
|
|
7361
7002
|
|
|
7362
7003
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7363
|
-
import
|
|
7004
|
+
import ts34 from "typescript";
|
|
7364
7005
|
|
|
7365
7006
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
7366
|
-
import
|
|
7007
|
+
import ts33 from "typescript";
|
|
7367
7008
|
var GENERATED_FILES = /(.*?)\.(ngfactory|shim\.ngstyle|ngstyle|ngsummary)\.(js|d\.ts|ts)$/;
|
|
7368
7009
|
function createMessageDiagnostic(messageText) {
|
|
7369
7010
|
return {
|
|
7370
7011
|
file: void 0,
|
|
7371
7012
|
start: void 0,
|
|
7372
7013
|
length: void 0,
|
|
7373
|
-
category:
|
|
7014
|
+
category: ts33.DiagnosticCategory.Message,
|
|
7374
7015
|
messageText,
|
|
7375
7016
|
code: DEFAULT_ERROR_CODE,
|
|
7376
7017
|
source: SOURCE
|
|
@@ -7379,13 +7020,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
7379
7020
|
|
|
7380
7021
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7381
7022
|
var defaultFormatHost = {
|
|
7382
|
-
getCurrentDirectory: () =>
|
|
7023
|
+
getCurrentDirectory: () => ts34.sys.getCurrentDirectory(),
|
|
7383
7024
|
getCanonicalFileName: (fileName) => fileName,
|
|
7384
|
-
getNewLine: () =>
|
|
7025
|
+
getNewLine: () => ts34.sys.newLine
|
|
7385
7026
|
};
|
|
7386
7027
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7387
7028
|
if (diags && diags.length) {
|
|
7388
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
7029
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts34.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7389
7030
|
} else {
|
|
7390
7031
|
return "";
|
|
7391
7032
|
}
|
|
@@ -7399,10 +7040,10 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
|
7399
7040
|
return { projectFile, basePath };
|
|
7400
7041
|
}
|
|
7401
7042
|
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
7402
|
-
var _a;
|
|
7043
|
+
var _a, _b;
|
|
7403
7044
|
try {
|
|
7404
7045
|
const fs = getFileSystem();
|
|
7405
|
-
const readConfigFile = (configFile) =>
|
|
7046
|
+
const readConfigFile = (configFile) => ts34.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7406
7047
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7407
7048
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7408
7049
|
if (error2) {
|
|
@@ -7434,7 +7075,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7434
7075
|
basePath
|
|
7435
7076
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
7436
7077
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7437
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
7078
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts34.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7438
7079
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
7439
7080
|
let emitFlags = EmitFlags.Default;
|
|
7440
7081
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -7446,8 +7087,8 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7446
7087
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7447
7088
|
} catch (e) {
|
|
7448
7089
|
const errors = [{
|
|
7449
|
-
category:
|
|
7450
|
-
messageText: e.stack,
|
|
7090
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7091
|
+
messageText: (_b = e.stack) != null ? _b : e.message,
|
|
7451
7092
|
file: void 0,
|
|
7452
7093
|
start: void 0,
|
|
7453
7094
|
length: void 0,
|
|
@@ -7460,7 +7101,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7460
7101
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7461
7102
|
return {
|
|
7462
7103
|
fileExists: host.exists.bind(host),
|
|
7463
|
-
readDirectory:
|
|
7104
|
+
readDirectory: ts34.sys.readDirectory,
|
|
7464
7105
|
readFile: host.readFile.bind(host),
|
|
7465
7106
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7466
7107
|
};
|
|
@@ -7480,7 +7121,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7480
7121
|
}
|
|
7481
7122
|
} else {
|
|
7482
7123
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7483
|
-
const { resolvedModule } =
|
|
7124
|
+
const { resolvedModule } = ts34.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts34.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
7484
7125
|
if (resolvedModule) {
|
|
7485
7126
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
7486
7127
|
}
|
|
@@ -7490,12 +7131,13 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7490
7131
|
function exitCodeFromResult(diags) {
|
|
7491
7132
|
if (!diags)
|
|
7492
7133
|
return 0;
|
|
7493
|
-
if (diags.every((diag) => diag.category !==
|
|
7134
|
+
if (diags.every((diag) => diag.category !== ts34.DiagnosticCategory.Error)) {
|
|
7494
7135
|
return 0;
|
|
7495
7136
|
}
|
|
7496
7137
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
7497
7138
|
}
|
|
7498
7139
|
function performCompilation({ rootNames, options, host, oldProgram, emitCallback, mergeEmitResultsCallback, gatherDiagnostics = defaultGatherDiagnostics, customTransformers, emitFlags = EmitFlags.Default, modifiedResourceFiles = null }) {
|
|
7140
|
+
var _a;
|
|
7499
7141
|
let program;
|
|
7500
7142
|
let emitResult;
|
|
7501
7143
|
let allDiagnostics = [];
|
|
@@ -7522,8 +7164,8 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7522
7164
|
} catch (e) {
|
|
7523
7165
|
program = void 0;
|
|
7524
7166
|
allDiagnostics.push({
|
|
7525
|
-
category:
|
|
7526
|
-
messageText: e.stack,
|
|
7167
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7168
|
+
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7527
7169
|
code: UNKNOWN_ERROR_CODE,
|
|
7528
7170
|
file: void 0,
|
|
7529
7171
|
start: void 0,
|
|
@@ -7549,7 +7191,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7549
7191
|
return allDiagnostics;
|
|
7550
7192
|
}
|
|
7551
7193
|
function hasErrors(diags) {
|
|
7552
|
-
return diags.some((d) => d.category ===
|
|
7194
|
+
return diags.some((d) => d.category === ts34.DiagnosticCategory.Error);
|
|
7553
7195
|
}
|
|
7554
7196
|
|
|
7555
7197
|
export {
|
|
@@ -7561,7 +7203,6 @@ export {
|
|
|
7561
7203
|
createCompilerHost,
|
|
7562
7204
|
CycleAnalyzer,
|
|
7563
7205
|
ImportGraph,
|
|
7564
|
-
untagAllTsFiles,
|
|
7565
7206
|
TsCreateProgramDriver,
|
|
7566
7207
|
PatchedProgramIncrementalBuildStrategy,
|
|
7567
7208
|
MetadataDtsModuleScopeResolver,
|
|
@@ -7590,5 +7231,4 @@ export {
|
|
|
7590
7231
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7591
7232
|
* found in the LICENSE file at https://angular.io/license
|
|
7592
7233
|
*/
|
|
7593
|
-
|
|
7594
|
-
//# sourceMappingURL=chunk-L5DQYLOG.js.map
|
|
7234
|
+
//# sourceMappingURL=chunk-PJPAHVUO.js.map
|