@angular/compiler-cli 13.2.0-next.2 → 14.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-NU7DCJLY.js → chunk-5CHRTEXL.js} +3 -3
- package/bundles/{chunk-NU7DCJLY.js.map → chunk-5CHRTEXL.js.map} +0 -0
- package/bundles/{chunk-L2JNRKLG.js → chunk-LMCFGUUV.js} +528 -114
- package/bundles/chunk-LMCFGUUV.js.map +6 -0
- package/bundles/{chunk-ZWPDFY6U.js → chunk-OFPFDCGQ.js} +2 -2
- package/bundles/{chunk-ZWPDFY6U.js.map → chunk-OFPFDCGQ.js.map} +0 -0
- package/bundles/chunk-UESD6FVI.js +2 -2
- package/bundles/{chunk-L5DQYLOG.js → chunk-XDGI7TS4.js} +368 -759
- package/bundles/chunk-XDGI7TS4.js.map +6 -0
- package/bundles/{chunk-QGM254OS.js → chunk-XHMJ6POQ.js} +129 -82
- package/bundles/{chunk-QGM254OS.js.map → chunk-XHMJ6POQ.js.map} +2 -2
- package/bundles/index.js +5 -4
- package/bundles/index.js.map +1 -1
- package/bundles/ngcc/index.js +4 -4
- package/bundles/ngcc/main-ngcc.js +4 -4
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +3 -3
- package/bundles/private/migrations.js +1 -1
- package/bundles/src/bin/ng_xi18n.js +3 -3
- package/bundles/src/bin/ngc.js +3 -3
- 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 -2
- package/bundles/chunk-L2JNRKLG.js.map +0 -6
- package/bundles/chunk-L5DQYLOG.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-LMCFGUUV.js";
|
|
29
38
|
import {
|
|
30
39
|
TypeScriptReflectionHost,
|
|
31
40
|
isNamedClassDeclaration
|
|
@@ -75,7 +84,6 @@ import {
|
|
|
75
84
|
LogicalFileSystem,
|
|
76
85
|
absoluteFrom,
|
|
77
86
|
absoluteFromSourceFile,
|
|
78
|
-
basename,
|
|
79
87
|
dirname,
|
|
80
88
|
getFileSystem,
|
|
81
89
|
getSourceFileOrError,
|
|
@@ -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 ts31 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 ts29 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,
|
|
@@ -1566,22 +1174,22 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1566
1174
|
this.identifiers.add(variableIdentifier);
|
|
1567
1175
|
}
|
|
1568
1176
|
elementOrTemplateToIdentifier(node) {
|
|
1177
|
+
var _a;
|
|
1569
1178
|
if (this.elementAndTemplateIdentifierCache.has(node)) {
|
|
1570
1179
|
return this.elementAndTemplateIdentifierCache.get(node);
|
|
1571
1180
|
}
|
|
1572
1181
|
let name;
|
|
1573
1182
|
let kind;
|
|
1574
1183
|
if (node instanceof TmplAstTemplate) {
|
|
1575
|
-
name = node.tagName;
|
|
1184
|
+
name = (_a = node.tagName) != null ? _a : "ng-template";
|
|
1576
1185
|
kind = IdentifierKind.Template;
|
|
1577
1186
|
} else {
|
|
1578
|
-
|
|
1579
|
-
name = node.name.split(":").pop();
|
|
1580
|
-
} else {
|
|
1581
|
-
name = node.name;
|
|
1582
|
-
}
|
|
1187
|
+
name = node.name;
|
|
1583
1188
|
kind = IdentifierKind.Element;
|
|
1584
1189
|
}
|
|
1190
|
+
if (name.startsWith(":")) {
|
|
1191
|
+
name = name.split(":").pop();
|
|
1192
|
+
}
|
|
1585
1193
|
const sourceSpan = node.startSourceSpan;
|
|
1586
1194
|
const start = this.getStartLocation(name, sourceSpan);
|
|
1587
1195
|
const absoluteSpan = new AbsoluteSourceSpan(start, start + name.length);
|
|
@@ -1707,7 +1315,7 @@ function generateAnalysis(context) {
|
|
|
1707
1315
|
}
|
|
1708
1316
|
|
|
1709
1317
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
1710
|
-
import
|
|
1318
|
+
import ts7 from "typescript";
|
|
1711
1319
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
1712
1320
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
1713
1321
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -1817,7 +1425,7 @@ var AdapterResourceLoader = class {
|
|
|
1817
1425
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
1818
1426
|
}
|
|
1819
1427
|
getResolvedCandidateLocations(url, fromFile) {
|
|
1820
|
-
const failedLookup =
|
|
1428
|
+
const failedLookup = ts7.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
1821
1429
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
1822
1430
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
1823
1431
|
}
|
|
@@ -1940,7 +1548,7 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
1940
1548
|
|
|
1941
1549
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
1942
1550
|
import { ExternalExpr } from "@angular/compiler";
|
|
1943
|
-
import
|
|
1551
|
+
import ts8 from "typescript";
|
|
1944
1552
|
var LocalModuleScopeRegistry = class {
|
|
1945
1553
|
constructor(localReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
1946
1554
|
this.localReader = localReader;
|
|
@@ -2141,7 +1749,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
2141
1749
|
}
|
|
2142
1750
|
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
2143
1751
|
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
2144
|
-
if (!
|
|
1752
|
+
if (!ts8.isClassDeclaration(ref.node)) {
|
|
2145
1753
|
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
2146
1754
|
diagnostics.push(makeDiagnostic(code, identifierOfNode(ref.node) || ref.node, `Appears in the NgModule.${type}s of ${nodeNameForError(ownerForErrors)}, but could not be resolved to an NgModule`));
|
|
2147
1755
|
return "invalid";
|
|
@@ -2250,7 +1858,7 @@ function reexportCollision(module, refA, refB) {
|
|
|
2250
1858
|
|
|
2251
1859
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
2252
1860
|
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
2253
|
-
import
|
|
1861
|
+
import ts9 from "typescript";
|
|
2254
1862
|
var TypeCheckScopeRegistry = class {
|
|
2255
1863
|
constructor(scopeReader, metaReader) {
|
|
2256
1864
|
this.scopeReader = scopeReader;
|
|
@@ -2283,8 +1891,8 @@ var TypeCheckScopeRegistry = class {
|
|
|
2283
1891
|
}
|
|
2284
1892
|
}
|
|
2285
1893
|
for (const { name, ref } of scope.compilation.pipes) {
|
|
2286
|
-
if (!
|
|
2287
|
-
throw new Error(`Unexpected non-class declaration ${
|
|
1894
|
+
if (!ts9.isClassDeclaration(ref.node)) {
|
|
1895
|
+
throw new Error(`Unexpected non-class declaration ${ts9.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
|
|
2288
1896
|
}
|
|
2289
1897
|
pipes.set(name, ref);
|
|
2290
1898
|
}
|
|
@@ -2313,7 +1921,7 @@ var TypeCheckScopeRegistry = class {
|
|
|
2313
1921
|
import { CssSelector as CssSelector2, DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
2314
1922
|
|
|
2315
1923
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
2316
|
-
import
|
|
1924
|
+
import ts10 from "typescript";
|
|
2317
1925
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
2318
1926
|
if (mapping.type === "direct") {
|
|
2319
1927
|
let relatedInformation = void 0;
|
|
@@ -2321,7 +1929,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2321
1929
|
relatedInformation = [];
|
|
2322
1930
|
for (const relatedMessage of relatedMessages) {
|
|
2323
1931
|
relatedInformation.push({
|
|
2324
|
-
category:
|
|
1932
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2325
1933
|
code: 0,
|
|
2326
1934
|
file: relatedMessage.sourceFile,
|
|
2327
1935
|
start: relatedMessage.start,
|
|
@@ -2346,12 +1954,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2346
1954
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
2347
1955
|
const componentName = mapping.componentClass.name.text;
|
|
2348
1956
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
2349
|
-
const sf =
|
|
1957
|
+
const sf = ts10.createSourceFile(fileName, mapping.template, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.JSX);
|
|
2350
1958
|
let relatedInformation = [];
|
|
2351
1959
|
if (relatedMessages !== void 0) {
|
|
2352
1960
|
for (const relatedMessage of relatedMessages) {
|
|
2353
1961
|
relatedInformation.push({
|
|
2354
|
-
category:
|
|
1962
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2355
1963
|
code: 0,
|
|
2356
1964
|
file: relatedMessage.sourceFile,
|
|
2357
1965
|
start: relatedMessage.start,
|
|
@@ -2361,7 +1969,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
2361
1969
|
}
|
|
2362
1970
|
}
|
|
2363
1971
|
relatedInformation.push({
|
|
2364
|
-
category:
|
|
1972
|
+
category: ts10.DiagnosticCategory.Message,
|
|
2365
1973
|
code: 0,
|
|
2366
1974
|
file: componentSf,
|
|
2367
1975
|
start: mapping.node.getStart(),
|
|
@@ -2404,15 +2012,15 @@ function allocateTemplateId(sf) {
|
|
|
2404
2012
|
|
|
2405
2013
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2406
2014
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2407
|
-
import
|
|
2015
|
+
import ts12 from "typescript";
|
|
2408
2016
|
|
|
2409
2017
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2410
2018
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2411
|
-
import
|
|
2019
|
+
import ts11 from "typescript";
|
|
2412
2020
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2413
2021
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2414
|
-
return
|
|
2415
|
-
if (kind !==
|
|
2022
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2023
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2416
2024
|
return null;
|
|
2417
2025
|
}
|
|
2418
2026
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2435,15 +2043,15 @@ var ExpressionIdentifier;
|
|
|
2435
2043
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
2436
2044
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2437
2045
|
function addExpressionIdentifier(node, identifier) {
|
|
2438
|
-
|
|
2046
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
2439
2047
|
}
|
|
2440
2048
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2441
2049
|
function markIgnoreDiagnostics(node) {
|
|
2442
|
-
|
|
2050
|
+
ts11.addSyntheticTrailingComment(node, ts11.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
2443
2051
|
}
|
|
2444
2052
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2445
|
-
return
|
|
2446
|
-
if (kind !==
|
|
2053
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2054
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2447
2055
|
return null;
|
|
2448
2056
|
}
|
|
2449
2057
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2517,8 +2125,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2517
2125
|
return results;
|
|
2518
2126
|
}
|
|
2519
2127
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2520
|
-
return
|
|
2521
|
-
if (kind !==
|
|
2128
|
+
return ts11.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2129
|
+
if (kind !== ts11.SyntaxKind.MultiLineCommentTrivia) {
|
|
2522
2130
|
return false;
|
|
2523
2131
|
}
|
|
2524
2132
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2535,7 +2143,7 @@ var CompletionEngine = class {
|
|
|
2535
2143
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2536
2144
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2537
2145
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2538
|
-
filter:
|
|
2146
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2539
2147
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2540
2148
|
});
|
|
2541
2149
|
if (globalRead !== null) {
|
|
@@ -2558,7 +2166,7 @@ var CompletionEngine = class {
|
|
|
2558
2166
|
let nodeContext = null;
|
|
2559
2167
|
if (node instanceof EmptyExpr) {
|
|
2560
2168
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2561
|
-
filter:
|
|
2169
|
+
filter: ts12.isIdentifier,
|
|
2562
2170
|
withSpan: node.sourceSpan
|
|
2563
2171
|
});
|
|
2564
2172
|
if (nodeLocation !== null) {
|
|
@@ -2570,7 +2178,7 @@ var CompletionEngine = class {
|
|
|
2570
2178
|
}
|
|
2571
2179
|
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2572
2180
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2573
|
-
filter:
|
|
2181
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2574
2182
|
withSpan: node.sourceSpan
|
|
2575
2183
|
});
|
|
2576
2184
|
if (nodeLocation) {
|
|
@@ -2593,21 +2201,21 @@ var CompletionEngine = class {
|
|
|
2593
2201
|
let tsExpr = null;
|
|
2594
2202
|
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2595
2203
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2596
|
-
filter:
|
|
2204
|
+
filter: ts12.isPropertyAccessExpression,
|
|
2597
2205
|
withSpan: expr.nameSpan
|
|
2598
2206
|
});
|
|
2599
2207
|
} else if (expr instanceof SafePropertyRead) {
|
|
2600
2208
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2601
|
-
filter:
|
|
2209
|
+
filter: ts12.isParenthesizedExpression,
|
|
2602
2210
|
withSpan: expr.sourceSpan
|
|
2603
2211
|
});
|
|
2604
|
-
if (ternaryExpr === null || !
|
|
2212
|
+
if (ternaryExpr === null || !ts12.isConditionalExpression(ternaryExpr.expression)) {
|
|
2605
2213
|
return null;
|
|
2606
2214
|
}
|
|
2607
2215
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2608
|
-
if (
|
|
2216
|
+
if (ts12.isPropertyAccessExpression(whenTrue)) {
|
|
2609
2217
|
tsExpr = whenTrue;
|
|
2610
|
-
} else if (
|
|
2218
|
+
} else if (ts12.isCallExpression(whenTrue) && ts12.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2611
2219
|
tsExpr = whenTrue.expression;
|
|
2612
2220
|
}
|
|
2613
2221
|
}
|
|
@@ -2628,15 +2236,15 @@ var CompletionEngine = class {
|
|
|
2628
2236
|
let tsExpr = null;
|
|
2629
2237
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2630
2238
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2631
|
-
filter:
|
|
2239
|
+
filter: ts12.isParenthesizedExpression,
|
|
2632
2240
|
withSpan: expr.sourceSpan
|
|
2633
2241
|
});
|
|
2634
|
-
if (strNode !== null &&
|
|
2242
|
+
if (strNode !== null && ts12.isStringLiteral(strNode.expression)) {
|
|
2635
2243
|
tsExpr = strNode.expression;
|
|
2636
2244
|
}
|
|
2637
2245
|
} else {
|
|
2638
2246
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2639
|
-
filter: (n) =>
|
|
2247
|
+
filter: (n) => ts12.isStringLiteral(n) || ts12.isNumericLiteral(n),
|
|
2640
2248
|
withSpan: expr.sourceSpan
|
|
2641
2249
|
});
|
|
2642
2250
|
}
|
|
@@ -2644,7 +2252,7 @@ var CompletionEngine = class {
|
|
|
2644
2252
|
return null;
|
|
2645
2253
|
}
|
|
2646
2254
|
let positionInShimFile = tsExpr.getEnd();
|
|
2647
|
-
if (
|
|
2255
|
+
if (ts12.isStringLiteral(tsExpr)) {
|
|
2648
2256
|
positionInShimFile -= 1;
|
|
2649
2257
|
}
|
|
2650
2258
|
const res = {
|
|
@@ -2678,11 +2286,11 @@ var CompletionEngine = class {
|
|
|
2678
2286
|
};
|
|
2679
2287
|
|
|
2680
2288
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2681
|
-
import
|
|
2289
|
+
import ts26 from "typescript";
|
|
2682
2290
|
|
|
2683
2291
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2684
2292
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
2685
|
-
import
|
|
2293
|
+
import ts13 from "typescript";
|
|
2686
2294
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
2687
2295
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
2688
2296
|
var RegistryDomSchemaChecker = class {
|
|
@@ -2706,7 +2314,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2706
2314
|
} else {
|
|
2707
2315
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2708
2316
|
}
|
|
2709
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
2317
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2710
2318
|
this._diagnostics.push(diag);
|
|
2711
2319
|
}
|
|
2712
2320
|
}
|
|
@@ -2724,70 +2332,70 @@ var RegistryDomSchemaChecker = class {
|
|
|
2724
2332
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
2725
2333
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2726
2334
|
}
|
|
2727
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
2335
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts13.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2728
2336
|
this._diagnostics.push(diag);
|
|
2729
2337
|
}
|
|
2730
2338
|
}
|
|
2731
2339
|
};
|
|
2732
2340
|
|
|
2733
2341
|
// 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
|
|
2342
|
+
import { ExpressionType, ExternalExpr as ExternalExpr2, TypeModifier } from "@angular/compiler";
|
|
2343
|
+
import ts19 from "typescript";
|
|
2736
2344
|
|
|
2737
2345
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2738
|
-
import
|
|
2346
|
+
import ts14 from "typescript";
|
|
2739
2347
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2348
|
+
ts14.SyntaxKind.ParenthesizedExpression,
|
|
2349
|
+
ts14.SyntaxKind.Identifier,
|
|
2350
|
+
ts14.SyntaxKind.CallExpression,
|
|
2351
|
+
ts14.SyntaxKind.NonNullExpression,
|
|
2352
|
+
ts14.SyntaxKind.ElementAccessExpression,
|
|
2353
|
+
ts14.SyntaxKind.PropertyAccessExpression,
|
|
2354
|
+
ts14.SyntaxKind.ArrayLiteralExpression,
|
|
2355
|
+
ts14.SyntaxKind.ObjectLiteralExpression,
|
|
2356
|
+
ts14.SyntaxKind.StringLiteral,
|
|
2357
|
+
ts14.SyntaxKind.NumericLiteral,
|
|
2358
|
+
ts14.SyntaxKind.TrueKeyword,
|
|
2359
|
+
ts14.SyntaxKind.FalseKeyword,
|
|
2360
|
+
ts14.SyntaxKind.NullKeyword,
|
|
2361
|
+
ts14.SyntaxKind.UndefinedKeyword
|
|
2754
2362
|
]);
|
|
2755
2363
|
function tsCastToAny(expr) {
|
|
2756
2364
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2757
|
-
expr =
|
|
2365
|
+
expr = ts14.createParen(expr);
|
|
2758
2366
|
}
|
|
2759
|
-
return
|
|
2367
|
+
return ts14.createParen(ts14.createAsExpression(expr, ts14.createKeywordTypeNode(ts14.SyntaxKind.AnyKeyword)));
|
|
2760
2368
|
}
|
|
2761
2369
|
function tsCreateElement(tagName) {
|
|
2762
|
-
const createElement =
|
|
2763
|
-
return
|
|
2370
|
+
const createElement = ts14.createPropertyAccess(ts14.createIdentifier("document"), "createElement");
|
|
2371
|
+
return ts14.createCall(createElement, void 0, [ts14.createLiteral(tagName)]);
|
|
2764
2372
|
}
|
|
2765
2373
|
function tsDeclareVariable(id, type) {
|
|
2766
|
-
const decl =
|
|
2767
|
-
return
|
|
2374
|
+
const decl = ts14.createVariableDeclaration(id, type, ts14.createNonNullExpression(ts14.createNull()));
|
|
2375
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2768
2376
|
}
|
|
2769
2377
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2770
|
-
return
|
|
2378
|
+
return ts14.createTypeQueryNode(ts14.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2771
2379
|
}
|
|
2772
2380
|
function tsCreateVariable(id, initializer) {
|
|
2773
|
-
const decl =
|
|
2774
|
-
return
|
|
2381
|
+
const decl = ts14.createVariableDeclaration(id, void 0, initializer);
|
|
2382
|
+
return ts14.createVariableStatement(void 0, [decl]);
|
|
2775
2383
|
}
|
|
2776
2384
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2777
|
-
const methodAccess =
|
|
2778
|
-
return
|
|
2385
|
+
const methodAccess = ts14.createPropertyAccess(receiver, methodName);
|
|
2386
|
+
return ts14.createCall(methodAccess, void 0, args);
|
|
2779
2387
|
}
|
|
2780
2388
|
function checkIfClassIsExported(node) {
|
|
2781
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
2389
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts14.SyntaxKind.ExportKeyword)) {
|
|
2782
2390
|
return true;
|
|
2783
|
-
} else if (node.parent !== void 0 &&
|
|
2391
|
+
} else if (node.parent !== void 0 && ts14.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
2784
2392
|
return true;
|
|
2785
2393
|
}
|
|
2786
2394
|
return false;
|
|
2787
2395
|
}
|
|
2788
2396
|
function checkIfFileHasExport(sf, name) {
|
|
2789
2397
|
for (const stmt of sf.statements) {
|
|
2790
|
-
if (
|
|
2398
|
+
if (ts14.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts14.isNamedExports(stmt.exportClause)) {
|
|
2791
2399
|
for (const element of stmt.exportClause.elements) {
|
|
2792
2400
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
2793
2401
|
return true;
|
|
@@ -2800,20 +2408,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
2800
2408
|
return false;
|
|
2801
2409
|
}
|
|
2802
2410
|
function isAccessExpression(node) {
|
|
2803
|
-
return
|
|
2411
|
+
return ts14.isPropertyAccessExpression(node) || ts14.isElementAccessExpression(node);
|
|
2804
2412
|
}
|
|
2805
2413
|
|
|
2806
2414
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2807
|
-
import
|
|
2415
|
+
import ts18 from "typescript";
|
|
2808
2416
|
|
|
2809
2417
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2810
|
-
import
|
|
2418
|
+
import ts17 from "typescript";
|
|
2811
2419
|
|
|
2812
2420
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2813
|
-
import
|
|
2421
|
+
import ts16 from "typescript";
|
|
2814
2422
|
|
|
2815
2423
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2816
|
-
import
|
|
2424
|
+
import ts15 from "typescript";
|
|
2817
2425
|
var INELIGIBLE = {};
|
|
2818
2426
|
function canEmitType(type, canEmit) {
|
|
2819
2427
|
return canEmitTypeWorker(type);
|
|
@@ -2821,13 +2429,13 @@ function canEmitType(type, canEmit) {
|
|
|
2821
2429
|
return visitNode(type2) !== INELIGIBLE;
|
|
2822
2430
|
}
|
|
2823
2431
|
function visitNode(node) {
|
|
2824
|
-
if (
|
|
2432
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2825
2433
|
return INELIGIBLE;
|
|
2826
2434
|
}
|
|
2827
|
-
if (
|
|
2435
|
+
if (ts15.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2828
2436
|
return INELIGIBLE;
|
|
2829
2437
|
} else {
|
|
2830
|
-
return
|
|
2438
|
+
return ts15.forEachChild(node, visitNode);
|
|
2831
2439
|
}
|
|
2832
2440
|
}
|
|
2833
2441
|
function canEmitTypeReference(type2) {
|
|
@@ -2844,22 +2452,22 @@ var TypeEmitter = class {
|
|
|
2844
2452
|
emitType(type) {
|
|
2845
2453
|
const typeReferenceTransformer = (context) => {
|
|
2846
2454
|
const visitNode = (node) => {
|
|
2847
|
-
if (
|
|
2455
|
+
if (ts15.isImportTypeNode(node)) {
|
|
2848
2456
|
throw new Error("Unable to emit import type");
|
|
2849
2457
|
}
|
|
2850
|
-
if (
|
|
2458
|
+
if (ts15.isTypeReferenceNode(node)) {
|
|
2851
2459
|
return this.emitTypeReference(node);
|
|
2852
|
-
} else if (
|
|
2853
|
-
const clone =
|
|
2854
|
-
|
|
2460
|
+
} else if (ts15.isLiteralExpression(node)) {
|
|
2461
|
+
const clone = ts15.getMutableClone(node);
|
|
2462
|
+
ts15.setTextRange(clone, { pos: -1, end: -1 });
|
|
2855
2463
|
return clone;
|
|
2856
2464
|
} else {
|
|
2857
|
-
return
|
|
2465
|
+
return ts15.visitEachChild(node, visitNode, context);
|
|
2858
2466
|
}
|
|
2859
2467
|
};
|
|
2860
|
-
return (node) =>
|
|
2468
|
+
return (node) => ts15.visitNode(node, visitNode);
|
|
2861
2469
|
};
|
|
2862
|
-
return
|
|
2470
|
+
return ts15.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2863
2471
|
}
|
|
2864
2472
|
emitTypeReference(type) {
|
|
2865
2473
|
const translatedType = this.translator(type);
|
|
@@ -2868,9 +2476,9 @@ var TypeEmitter = class {
|
|
|
2868
2476
|
}
|
|
2869
2477
|
let typeArguments = void 0;
|
|
2870
2478
|
if (type.typeArguments !== void 0) {
|
|
2871
|
-
typeArguments =
|
|
2479
|
+
typeArguments = ts15.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2872
2480
|
}
|
|
2873
|
-
return
|
|
2481
|
+
return ts15.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2874
2482
|
}
|
|
2875
2483
|
};
|
|
2876
2484
|
|
|
@@ -2911,11 +2519,11 @@ var TypeParameterEmitter = class {
|
|
|
2911
2519
|
return this.typeParameters.map((typeParam) => {
|
|
2912
2520
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2913
2521
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2914
|
-
return
|
|
2522
|
+
return ts16.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2915
2523
|
});
|
|
2916
2524
|
}
|
|
2917
2525
|
resolveTypeReference(type) {
|
|
2918
|
-
const target =
|
|
2526
|
+
const target = ts16.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2919
2527
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2920
2528
|
if (declaration === null || declaration.node === null) {
|
|
2921
2529
|
return null;
|
|
@@ -2941,8 +2549,8 @@ var TypeParameterEmitter = class {
|
|
|
2941
2549
|
if (typeNode === null) {
|
|
2942
2550
|
return null;
|
|
2943
2551
|
}
|
|
2944
|
-
if (!
|
|
2945
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2552
|
+
if (!ts16.isTypeReferenceNode(typeNode)) {
|
|
2553
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts16.SyntaxKind[typeNode.kind]}.`);
|
|
2946
2554
|
}
|
|
2947
2555
|
return typeNode;
|
|
2948
2556
|
}
|
|
@@ -2984,14 +2592,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2984
2592
|
}
|
|
2985
2593
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2986
2594
|
for (const stmt of file.statements) {
|
|
2987
|
-
if (
|
|
2595
|
+
if (ts17.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2988
2596
|
return stmt;
|
|
2989
2597
|
}
|
|
2990
2598
|
}
|
|
2991
2599
|
return null;
|
|
2992
2600
|
}
|
|
2993
2601
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2994
|
-
while (node !== void 0 && !
|
|
2602
|
+
while (node !== void 0 && !ts17.isFunctionDeclaration(node)) {
|
|
2995
2603
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2996
2604
|
return null;
|
|
2997
2605
|
}
|
|
@@ -3008,7 +2616,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
3008
2616
|
return null;
|
|
3009
2617
|
}
|
|
3010
2618
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
3011
|
-
while (!
|
|
2619
|
+
while (!ts17.isFunctionDeclaration(node)) {
|
|
3012
2620
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
3013
2621
|
return null;
|
|
3014
2622
|
}
|
|
@@ -3018,8 +2626,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
3018
2626
|
}
|
|
3019
2627
|
}
|
|
3020
2628
|
const start = node.getFullStart();
|
|
3021
|
-
return
|
|
3022
|
-
if (kind !==
|
|
2629
|
+
return ts17.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2630
|
+
if (kind !== ts17.SyntaxKind.MultiLineCommentTrivia) {
|
|
3023
2631
|
return null;
|
|
3024
2632
|
}
|
|
3025
2633
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -3034,29 +2642,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
3034
2642
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
3035
2643
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
3036
2644
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
3037
|
-
const rawType =
|
|
2645
|
+
const rawType = ts18.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
3038
2646
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3039
2647
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
3040
2648
|
if (meta.body) {
|
|
3041
|
-
const fnType =
|
|
3042
|
-
const decl =
|
|
3043
|
-
const declList =
|
|
3044
|
-
return
|
|
2649
|
+
const fnType = ts18.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2650
|
+
const decl = ts18.createVariableDeclaration(meta.fnName, fnType, ts18.createNonNullExpression(ts18.createNull()));
|
|
2651
|
+
const declList = ts18.createVariableDeclarationList([decl], ts18.NodeFlags.Const);
|
|
2652
|
+
return ts18.createVariableStatement(void 0, declList);
|
|
3045
2653
|
} else {
|
|
3046
|
-
return
|
|
2654
|
+
return ts18.createFunctionDeclaration(void 0, [ts18.createModifier(ts18.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
3047
2655
|
}
|
|
3048
2656
|
}
|
|
3049
2657
|
function generateInlineTypeCtor(node, meta) {
|
|
3050
2658
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
3051
|
-
const rawType =
|
|
2659
|
+
const rawType = ts18.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
3052
2660
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
3053
2661
|
let body = void 0;
|
|
3054
2662
|
if (meta.body) {
|
|
3055
|
-
body =
|
|
3056
|
-
|
|
2663
|
+
body = ts18.createBlock([
|
|
2664
|
+
ts18.createReturn(ts18.createNonNullExpression(ts18.createNull()))
|
|
3057
2665
|
]);
|
|
3058
2666
|
}
|
|
3059
|
-
return
|
|
2667
|
+
return ts18.createMethod(void 0, [ts18.createModifier(ts18.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
3060
2668
|
}
|
|
3061
2669
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
3062
2670
|
let initType = null;
|
|
@@ -3065,26 +2673,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
3065
2673
|
const coercedKeys = [];
|
|
3066
2674
|
for (const key of keys) {
|
|
3067
2675
|
if (!meta.coercedInputFields.has(key)) {
|
|
3068
|
-
plainKeys.push(
|
|
2676
|
+
plainKeys.push(ts18.createLiteralTypeNode(ts18.createStringLiteral(key)));
|
|
3069
2677
|
} else {
|
|
3070
|
-
coercedKeys.push(
|
|
2678
|
+
coercedKeys.push(ts18.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key), void 0));
|
|
3071
2679
|
}
|
|
3072
2680
|
}
|
|
3073
2681
|
if (plainKeys.length > 0) {
|
|
3074
|
-
const keyTypeUnion =
|
|
3075
|
-
initType =
|
|
2682
|
+
const keyTypeUnion = ts18.createUnionTypeNode(plainKeys);
|
|
2683
|
+
initType = ts18.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
3076
2684
|
}
|
|
3077
2685
|
if (coercedKeys.length > 0) {
|
|
3078
|
-
const coercedLiteral =
|
|
3079
|
-
initType = initType !== null ?
|
|
2686
|
+
const coercedLiteral = ts18.createTypeLiteralNode(coercedKeys);
|
|
2687
|
+
initType = initType !== null ? ts18.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
3080
2688
|
}
|
|
3081
2689
|
if (initType === null) {
|
|
3082
|
-
initType =
|
|
2690
|
+
initType = ts18.createTypeLiteralNode([]);
|
|
3083
2691
|
}
|
|
3084
|
-
return
|
|
2692
|
+
return ts18.createParameter(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
3085
2693
|
}
|
|
3086
2694
|
function generateGenericArgs(params) {
|
|
3087
|
-
return params.map((param) =>
|
|
2695
|
+
return params.map((param) => ts18.createTypeReferenceNode(param.name, void 0));
|
|
3088
2696
|
}
|
|
3089
2697
|
function requiresInlineTypeCtor(node, host, env) {
|
|
3090
2698
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -3095,7 +2703,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
3095
2703
|
}
|
|
3096
2704
|
return params.map((param) => {
|
|
3097
2705
|
if (param.default === void 0) {
|
|
3098
|
-
return
|
|
2706
|
+
return ts18.updateTypeParameterDeclaration(param, param.name, param.constraint, ts18.createKeywordTypeNode(ts18.SyntaxKind.AnyKeyword));
|
|
3099
2707
|
} else {
|
|
3100
2708
|
return param;
|
|
3101
2709
|
}
|
|
@@ -3127,13 +2735,13 @@ var Environment = class {
|
|
|
3127
2735
|
}
|
|
3128
2736
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
3129
2737
|
const ref = this.reference(dirRef);
|
|
3130
|
-
const typeCtorExpr =
|
|
2738
|
+
const typeCtorExpr = ts19.createPropertyAccess(ref, "ngTypeCtor");
|
|
3131
2739
|
this.typeCtors.set(node, typeCtorExpr);
|
|
3132
2740
|
return typeCtorExpr;
|
|
3133
2741
|
} else {
|
|
3134
2742
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
3135
2743
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
3136
|
-
if (!
|
|
2744
|
+
if (!ts19.isTypeReferenceNode(nodeTypeRef)) {
|
|
3137
2745
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
3138
2746
|
}
|
|
3139
2747
|
const meta = {
|
|
@@ -3149,7 +2757,7 @@ var Environment = class {
|
|
|
3149
2757
|
const typeParams = this.emitTypeParameters(node);
|
|
3150
2758
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
3151
2759
|
this.typeCtorStatements.push(typeCtor);
|
|
3152
|
-
const fnId =
|
|
2760
|
+
const fnId = ts19.createIdentifier(fnName);
|
|
3153
2761
|
this.typeCtors.set(node, fnId);
|
|
3154
2762
|
return fnId;
|
|
3155
2763
|
}
|
|
@@ -3159,7 +2767,7 @@ var Environment = class {
|
|
|
3159
2767
|
return this.pipeInsts.get(ref.node);
|
|
3160
2768
|
}
|
|
3161
2769
|
const pipeType = this.referenceType(ref);
|
|
3162
|
-
const pipeInstId =
|
|
2770
|
+
const pipeInstId = ts19.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
3163
2771
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
3164
2772
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
3165
2773
|
return pipeInstId;
|
|
@@ -3184,7 +2792,7 @@ var Environment = class {
|
|
|
3184
2792
|
}
|
|
3185
2793
|
referenceExternalType(moduleName, name, typeParams) {
|
|
3186
2794
|
const external = new ExternalExpr2({ moduleName, name });
|
|
3187
|
-
return translateType(new ExpressionType(external,
|
|
2795
|
+
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.importManager);
|
|
3188
2796
|
}
|
|
3189
2797
|
getPreludeStatements() {
|
|
3190
2798
|
return [
|
|
@@ -3196,7 +2804,7 @@ var Environment = class {
|
|
|
3196
2804
|
|
|
3197
2805
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
3198
2806
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
3199
|
-
import
|
|
2807
|
+
import ts20 from "typescript";
|
|
3200
2808
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
3201
2809
|
constructor(resolver) {
|
|
3202
2810
|
this.resolver = resolver;
|
|
@@ -3210,7 +2818,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3210
2818
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3211
2819
|
const value = ref.value.trim();
|
|
3212
2820
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
3213
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2821
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
3214
2822
|
}
|
|
3215
2823
|
missingPipe(templateId, ast) {
|
|
3216
2824
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -3222,7 +2830,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3222
2830
|
if (sourceSpan === null) {
|
|
3223
2831
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
3224
2832
|
}
|
|
3225
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2833
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
3226
2834
|
this.recordedPipes.add(ast);
|
|
3227
2835
|
}
|
|
3228
2836
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -3233,7 +2841,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3233
2841
|
if (sourceSpan === null) {
|
|
3234
2842
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
3235
2843
|
}
|
|
3236
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2844
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
3237
2845
|
text: `The variable ${assignment.name} is declared here.`,
|
|
3238
2846
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
3239
2847
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -3243,7 +2851,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3243
2851
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
3244
2852
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
3245
2853
|
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,
|
|
2854
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
3247
2855
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
3248
2856
|
start: firstDecl.sourceSpan.start.offset,
|
|
3249
2857
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -3282,7 +2890,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
3282
2890
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
3283
2891
|
|
|
3284
2892
|
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,
|
|
2893
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts20.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
3286
2894
|
}
|
|
3287
2895
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
3288
2896
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -3316,7 +2924,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
3316
2924
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
3317
2925
|
});
|
|
3318
2926
|
}
|
|
3319
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2927
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts20.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
3320
2928
|
}
|
|
3321
2929
|
};
|
|
3322
2930
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -3327,7 +2935,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
3327
2935
|
}
|
|
3328
2936
|
|
|
3329
2937
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
3330
|
-
import
|
|
2938
|
+
import ts21 from "typescript";
|
|
3331
2939
|
var TypeCheckShimGenerator = class {
|
|
3332
2940
|
constructor() {
|
|
3333
2941
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -3337,7 +2945,7 @@ var TypeCheckShimGenerator = class {
|
|
|
3337
2945
|
if (priorShimSf !== null) {
|
|
3338
2946
|
return priorShimSf;
|
|
3339
2947
|
}
|
|
3340
|
-
return
|
|
2948
|
+
return ts21.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts21.ScriptTarget.Latest, true, ts21.ScriptKind.TS);
|
|
3341
2949
|
}
|
|
3342
2950
|
static shimFor(fileName) {
|
|
3343
2951
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -3346,16 +2954,16 @@ var TypeCheckShimGenerator = class {
|
|
|
3346
2954
|
|
|
3347
2955
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3348
2956
|
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
|
|
2957
|
+
import ts24 from "typescript";
|
|
3350
2958
|
|
|
3351
2959
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
3352
2960
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
3353
|
-
import
|
|
2961
|
+
import ts22 from "typescript";
|
|
3354
2962
|
function wrapForDiagnostics(expr) {
|
|
3355
|
-
return
|
|
2963
|
+
return ts22.createParen(expr);
|
|
3356
2964
|
}
|
|
3357
2965
|
function wrapForTypeChecker(expr) {
|
|
3358
|
-
return
|
|
2966
|
+
return ts22.createParen(expr);
|
|
3359
2967
|
}
|
|
3360
2968
|
function addParseSpanInfo(node, span) {
|
|
3361
2969
|
let commentText;
|
|
@@ -3364,10 +2972,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3364
2972
|
} else {
|
|
3365
2973
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3366
2974
|
}
|
|
3367
|
-
|
|
2975
|
+
ts22.addSyntheticTrailingComment(node, ts22.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3368
2976
|
}
|
|
3369
2977
|
function addTemplateId(tcb, id) {
|
|
3370
|
-
|
|
2978
|
+
ts22.addSyntheticLeadingComment(tcb, ts22.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3371
2979
|
}
|
|
3372
2980
|
function shouldReportDiagnostic(diagnostic) {
|
|
3373
2981
|
const { code } = diagnostic;
|
|
@@ -3396,32 +3004,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3396
3004
|
|
|
3397
3005
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3398
3006
|
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 =
|
|
3007
|
+
import ts23 from "typescript";
|
|
3008
|
+
var NULL_AS_ANY = ts23.createAsExpression(ts23.createNull(), ts23.createKeywordTypeNode(ts23.SyntaxKind.AnyKeyword));
|
|
3009
|
+
var UNDEFINED = ts23.createIdentifier("undefined");
|
|
3402
3010
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3403
|
-
["+",
|
|
3404
|
-
["-",
|
|
3011
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3012
|
+
["-", ts23.SyntaxKind.MinusToken]
|
|
3405
3013
|
]);
|
|
3406
3014
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3407
|
-
["+",
|
|
3408
|
-
["-",
|
|
3409
|
-
["<",
|
|
3410
|
-
[">",
|
|
3411
|
-
["<=",
|
|
3412
|
-
[">=",
|
|
3413
|
-
["==",
|
|
3414
|
-
["===",
|
|
3415
|
-
["*",
|
|
3416
|
-
["/",
|
|
3417
|
-
["%",
|
|
3418
|
-
["!=",
|
|
3419
|
-
["!==",
|
|
3420
|
-
["||",
|
|
3421
|
-
["&&",
|
|
3422
|
-
["&",
|
|
3423
|
-
["|",
|
|
3424
|
-
["??",
|
|
3015
|
+
["+", ts23.SyntaxKind.PlusToken],
|
|
3016
|
+
["-", ts23.SyntaxKind.MinusToken],
|
|
3017
|
+
["<", ts23.SyntaxKind.LessThanToken],
|
|
3018
|
+
[">", ts23.SyntaxKind.GreaterThanToken],
|
|
3019
|
+
["<=", ts23.SyntaxKind.LessThanEqualsToken],
|
|
3020
|
+
[">=", ts23.SyntaxKind.GreaterThanEqualsToken],
|
|
3021
|
+
["==", ts23.SyntaxKind.EqualsEqualsToken],
|
|
3022
|
+
["===", ts23.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3023
|
+
["*", ts23.SyntaxKind.AsteriskToken],
|
|
3024
|
+
["/", ts23.SyntaxKind.SlashToken],
|
|
3025
|
+
["%", ts23.SyntaxKind.PercentToken],
|
|
3026
|
+
["!=", ts23.SyntaxKind.ExclamationEqualsToken],
|
|
3027
|
+
["!==", ts23.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3028
|
+
["||", ts23.SyntaxKind.BarBarToken],
|
|
3029
|
+
["&&", ts23.SyntaxKind.AmpersandAmpersandToken],
|
|
3030
|
+
["&", ts23.SyntaxKind.AmpersandToken],
|
|
3031
|
+
["|", ts23.SyntaxKind.BarToken],
|
|
3032
|
+
["??", ts23.SyntaxKind.QuestionQuestionToken]
|
|
3425
3033
|
]);
|
|
3426
3034
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3427
3035
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3437,7 +3045,7 @@ var AstTranslator = class {
|
|
|
3437
3045
|
ast = ast.ast;
|
|
3438
3046
|
}
|
|
3439
3047
|
if (ast instanceof EmptyExpr2) {
|
|
3440
|
-
const res =
|
|
3048
|
+
const res = ts23.factory.createIdentifier("undefined");
|
|
3441
3049
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3442
3050
|
return res;
|
|
3443
3051
|
}
|
|
@@ -3453,7 +3061,7 @@ var AstTranslator = class {
|
|
|
3453
3061
|
if (op === void 0) {
|
|
3454
3062
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3455
3063
|
}
|
|
3456
|
-
const node = wrapForDiagnostics(
|
|
3064
|
+
const node = wrapForDiagnostics(ts23.createPrefix(op, expr));
|
|
3457
3065
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3458
3066
|
return node;
|
|
3459
3067
|
}
|
|
@@ -3464,13 +3072,13 @@ var AstTranslator = class {
|
|
|
3464
3072
|
if (op === void 0) {
|
|
3465
3073
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3466
3074
|
}
|
|
3467
|
-
const node =
|
|
3075
|
+
const node = ts23.createBinary(lhs, op, rhs);
|
|
3468
3076
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3469
3077
|
return node;
|
|
3470
3078
|
}
|
|
3471
3079
|
visitChain(ast) {
|
|
3472
3080
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3473
|
-
const node = wrapForDiagnostics(
|
|
3081
|
+
const node = wrapForDiagnostics(ts23.createCommaList(elements));
|
|
3474
3082
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3475
3083
|
return node;
|
|
3476
3084
|
}
|
|
@@ -3478,7 +3086,7 @@ var AstTranslator = class {
|
|
|
3478
3086
|
const condExpr = this.translate(ast.condition);
|
|
3479
3087
|
const trueExpr = this.translate(ast.trueExp);
|
|
3480
3088
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3481
|
-
const node =
|
|
3089
|
+
const node = ts23.createParen(ts23.createConditional(condExpr, trueExpr, falseExpr));
|
|
3482
3090
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3483
3091
|
return node;
|
|
3484
3092
|
}
|
|
@@ -3489,26 +3097,26 @@ var AstTranslator = class {
|
|
|
3489
3097
|
throw new Error("Method not implemented.");
|
|
3490
3098
|
}
|
|
3491
3099
|
visitInterpolation(ast) {
|
|
3492
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3100
|
+
return ast.expressions.reduce((lhs, ast2) => ts23.createBinary(lhs, ts23.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts23.createLiteral(""));
|
|
3493
3101
|
}
|
|
3494
3102
|
visitKeyedRead(ast) {
|
|
3495
3103
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3496
3104
|
const key = this.translate(ast.key);
|
|
3497
|
-
const node =
|
|
3105
|
+
const node = ts23.createElementAccess(receiver, key);
|
|
3498
3106
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3499
3107
|
return node;
|
|
3500
3108
|
}
|
|
3501
3109
|
visitKeyedWrite(ast) {
|
|
3502
3110
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3503
|
-
const left =
|
|
3111
|
+
const left = ts23.createElementAccess(receiver, this.translate(ast.key));
|
|
3504
3112
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3505
|
-
const node = wrapForDiagnostics(
|
|
3113
|
+
const node = wrapForDiagnostics(ts23.createBinary(left, ts23.SyntaxKind.EqualsToken, right));
|
|
3506
3114
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3507
3115
|
return node;
|
|
3508
3116
|
}
|
|
3509
3117
|
visitLiteralArray(ast) {
|
|
3510
3118
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3511
|
-
const literal =
|
|
3119
|
+
const literal = ts23.createArrayLiteral(elements);
|
|
3512
3120
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3513
3121
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3514
3122
|
return node;
|
|
@@ -3516,9 +3124,9 @@ var AstTranslator = class {
|
|
|
3516
3124
|
visitLiteralMap(ast) {
|
|
3517
3125
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3518
3126
|
const value = this.translate(ast.values[idx]);
|
|
3519
|
-
return
|
|
3127
|
+
return ts23.createPropertyAssignment(ts23.createStringLiteral(key), value);
|
|
3520
3128
|
});
|
|
3521
|
-
const literal =
|
|
3129
|
+
const literal = ts23.createObjectLiteral(properties, true);
|
|
3522
3130
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3523
3131
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3524
3132
|
return node;
|
|
@@ -3526,18 +3134,18 @@ var AstTranslator = class {
|
|
|
3526
3134
|
visitLiteralPrimitive(ast) {
|
|
3527
3135
|
let node;
|
|
3528
3136
|
if (ast.value === void 0) {
|
|
3529
|
-
node =
|
|
3137
|
+
node = ts23.createIdentifier("undefined");
|
|
3530
3138
|
} else if (ast.value === null) {
|
|
3531
|
-
node =
|
|
3139
|
+
node = ts23.createNull();
|
|
3532
3140
|
} else {
|
|
3533
|
-
node =
|
|
3141
|
+
node = ts23.createLiteral(ast.value);
|
|
3534
3142
|
}
|
|
3535
3143
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3536
3144
|
return node;
|
|
3537
3145
|
}
|
|
3538
3146
|
visitNonNullAssert(ast) {
|
|
3539
3147
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3540
|
-
const node =
|
|
3148
|
+
const node = ts23.createNonNullExpression(expr);
|
|
3541
3149
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3542
3150
|
return node;
|
|
3543
3151
|
}
|
|
@@ -3546,13 +3154,13 @@ var AstTranslator = class {
|
|
|
3546
3154
|
}
|
|
3547
3155
|
visitPrefixNot(ast) {
|
|
3548
3156
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3549
|
-
const node =
|
|
3157
|
+
const node = ts23.createLogicalNot(expression);
|
|
3550
3158
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3551
3159
|
return node;
|
|
3552
3160
|
}
|
|
3553
3161
|
visitPropertyRead(ast) {
|
|
3554
3162
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3555
|
-
const name =
|
|
3163
|
+
const name = ts23.createPropertyAccess(receiver, ast.name);
|
|
3556
3164
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3557
3165
|
const node = wrapForDiagnostics(name);
|
|
3558
3166
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3560,12 +3168,12 @@ var AstTranslator = class {
|
|
|
3560
3168
|
}
|
|
3561
3169
|
visitPropertyWrite(ast) {
|
|
3562
3170
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3563
|
-
const left =
|
|
3171
|
+
const left = ts23.createPropertyAccess(receiver, ast.name);
|
|
3564
3172
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3565
3173
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3566
3174
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3567
3175
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3568
|
-
const node = wrapForDiagnostics(
|
|
3176
|
+
const node = wrapForDiagnostics(ts23.createBinary(leftWithPath, ts23.SyntaxKind.EqualsToken, right));
|
|
3569
3177
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3570
3178
|
return node;
|
|
3571
3179
|
}
|
|
@@ -3576,13 +3184,13 @@ var AstTranslator = class {
|
|
|
3576
3184
|
let node;
|
|
3577
3185
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3578
3186
|
if (this.config.strictSafeNavigationTypes) {
|
|
3579
|
-
const expr =
|
|
3187
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3580
3188
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3581
|
-
node =
|
|
3189
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3582
3190
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3583
|
-
node =
|
|
3191
|
+
node = ts23.createPropertyAccess(tsCastToAny(receiver), ast.name);
|
|
3584
3192
|
} else {
|
|
3585
|
-
const expr =
|
|
3193
|
+
const expr = ts23.createPropertyAccess(ts23.createNonNullExpression(receiver), ast.name);
|
|
3586
3194
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3587
3195
|
node = tsCastToAny(expr);
|
|
3588
3196
|
}
|
|
@@ -3594,13 +3202,13 @@ var AstTranslator = class {
|
|
|
3594
3202
|
const key = this.translate(ast.key);
|
|
3595
3203
|
let node;
|
|
3596
3204
|
if (this.config.strictSafeNavigationTypes) {
|
|
3597
|
-
const expr =
|
|
3205
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3598
3206
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3599
|
-
node =
|
|
3207
|
+
node = ts23.createParen(ts23.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
3600
3208
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3601
|
-
node =
|
|
3209
|
+
node = ts23.createElementAccess(tsCastToAny(receiver), key);
|
|
3602
3210
|
} else {
|
|
3603
|
-
const expr =
|
|
3211
|
+
const expr = ts23.createElementAccess(ts23.createNonNullExpression(receiver), key);
|
|
3604
3212
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3605
3213
|
node = tsCastToAny(expr);
|
|
3606
3214
|
}
|
|
@@ -3617,7 +3225,7 @@ var AstTranslator = class {
|
|
|
3617
3225
|
expr = resolved;
|
|
3618
3226
|
} else {
|
|
3619
3227
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3620
|
-
expr =
|
|
3228
|
+
expr = ts23.createPropertyAccess(propertyReceiver, receiver.name);
|
|
3621
3229
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3622
3230
|
}
|
|
3623
3231
|
} else {
|
|
@@ -3627,7 +3235,7 @@ var AstTranslator = class {
|
|
|
3627
3235
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3628
3236
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3629
3237
|
} else {
|
|
3630
|
-
node =
|
|
3238
|
+
node = ts23.createCall(expr, void 0, args);
|
|
3631
3239
|
}
|
|
3632
3240
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3633
3241
|
return node;
|
|
@@ -3641,13 +3249,13 @@ var AstTranslator = class {
|
|
|
3641
3249
|
}
|
|
3642
3250
|
convertToSafeCall(ast, expr, args) {
|
|
3643
3251
|
if (this.config.strictSafeNavigationTypes) {
|
|
3644
|
-
const call =
|
|
3645
|
-
return
|
|
3252
|
+
const call = ts23.createCall(ts23.createNonNullExpression(expr), void 0, args);
|
|
3253
|
+
return ts23.createParen(ts23.createConditional(NULL_AS_ANY, call, UNDEFINED));
|
|
3646
3254
|
}
|
|
3647
3255
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3648
|
-
return
|
|
3256
|
+
return ts23.createCall(tsCastToAny(expr), void 0, args);
|
|
3649
3257
|
}
|
|
3650
|
-
return tsCastToAny(
|
|
3258
|
+
return tsCastToAny(ts23.createCall(ts23.createNonNullExpression(expr), void 0, args));
|
|
3651
3259
|
}
|
|
3652
3260
|
};
|
|
3653
3261
|
var VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3759,7 +3367,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3759
3367
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
3760
3368
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3761
3369
|
const ctxRawType = env.referenceType(ref);
|
|
3762
|
-
if (!
|
|
3370
|
+
if (!ts24.isTypeReferenceNode(ctxRawType)) {
|
|
3763
3371
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3764
3372
|
}
|
|
3765
3373
|
let typeParameters = void 0;
|
|
@@ -3771,25 +3379,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3771
3379
|
switch (genericContextBehavior) {
|
|
3772
3380
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3773
3381
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3774
|
-
typeArguments = typeParameters.map((param) =>
|
|
3382
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3775
3383
|
break;
|
|
3776
3384
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3777
3385
|
typeParameters = [...ref.node.typeParameters];
|
|
3778
|
-
typeArguments = typeParameters.map((param) =>
|
|
3386
|
+
typeArguments = typeParameters.map((param) => ts24.factory.createTypeReferenceNode(param.name));
|
|
3779
3387
|
break;
|
|
3780
3388
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3781
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3389
|
+
typeArguments = ref.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3782
3390
|
break;
|
|
3783
3391
|
}
|
|
3784
3392
|
}
|
|
3785
3393
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3786
3394
|
const scopeStatements = scope.render();
|
|
3787
|
-
const innerBody =
|
|
3395
|
+
const innerBody = ts24.createBlock([
|
|
3788
3396
|
...env.getPreludeStatements(),
|
|
3789
3397
|
...scopeStatements
|
|
3790
3398
|
]);
|
|
3791
|
-
const body =
|
|
3792
|
-
const fnDecl =
|
|
3399
|
+
const body = ts24.createBlock([ts24.createIf(ts24.createTrue(), innerBody, void 0)]);
|
|
3400
|
+
const fnDecl = ts24.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3793
3401
|
addTemplateId(fnDecl, meta.id);
|
|
3794
3402
|
return fnDecl;
|
|
3795
3403
|
}
|
|
@@ -3830,7 +3438,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3830
3438
|
execute() {
|
|
3831
3439
|
const ctx = this.scope.resolve(this.template);
|
|
3832
3440
|
const id = this.tcb.allocateId();
|
|
3833
|
-
const initializer =
|
|
3441
|
+
const initializer = ts24.createPropertyAccess(ctx, this.variable.value || "$implicit");
|
|
3834
3442
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3835
3443
|
let variable;
|
|
3836
3444
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3853,7 +3461,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3853
3461
|
}
|
|
3854
3462
|
execute() {
|
|
3855
3463
|
const ctx = this.tcb.allocateId();
|
|
3856
|
-
const type =
|
|
3464
|
+
const type = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
3857
3465
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3858
3466
|
return ctx;
|
|
3859
3467
|
}
|
|
@@ -3906,16 +3514,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3906
3514
|
}
|
|
3907
3515
|
let guard = null;
|
|
3908
3516
|
if (directiveGuards.length > 0) {
|
|
3909
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3517
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts24.createBinary(expr, ts24.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3910
3518
|
}
|
|
3911
3519
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3912
3520
|
const statements = tmplScope.render();
|
|
3913
3521
|
if (statements.length === 0) {
|
|
3914
3522
|
return null;
|
|
3915
3523
|
}
|
|
3916
|
-
let tmplBlock =
|
|
3524
|
+
let tmplBlock = ts24.createBlock(statements);
|
|
3917
3525
|
if (guard !== null) {
|
|
3918
|
-
tmplBlock =
|
|
3526
|
+
tmplBlock = ts24.createIf(guard, tmplBlock);
|
|
3919
3527
|
}
|
|
3920
3528
|
this.scope.addStatement(tmplBlock);
|
|
3921
3529
|
return null;
|
|
@@ -3933,7 +3541,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3933
3541
|
}
|
|
3934
3542
|
execute() {
|
|
3935
3543
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3936
|
-
this.scope.addStatement(
|
|
3544
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
3937
3545
|
return null;
|
|
3938
3546
|
}
|
|
3939
3547
|
};
|
|
@@ -3955,11 +3563,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3955
3563
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3956
3564
|
type = rawType;
|
|
3957
3565
|
} else {
|
|
3958
|
-
if (!
|
|
3566
|
+
if (!ts24.isTypeReferenceNode(rawType)) {
|
|
3959
3567
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3960
3568
|
}
|
|
3961
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3962
|
-
type =
|
|
3569
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3570
|
+
type = ts24.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3963
3571
|
}
|
|
3964
3572
|
const id = this.tcb.allocateId();
|
|
3965
3573
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -4000,11 +3608,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
4000
3608
|
const id = this.tcb.allocateId();
|
|
4001
3609
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
4002
3610
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
4003
|
-
initializer =
|
|
3611
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4004
3612
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
4005
|
-
initializer =
|
|
4006
|
-
initializer =
|
|
4007
|
-
initializer =
|
|
3613
|
+
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3614
|
+
initializer = ts24.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3615
|
+
initializer = ts24.createParen(initializer);
|
|
4008
3616
|
}
|
|
4009
3617
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
4010
3618
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -4094,7 +3702,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4094
3702
|
let target;
|
|
4095
3703
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
4096
3704
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4097
|
-
if (!
|
|
3705
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4098
3706
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4099
3707
|
}
|
|
4100
3708
|
const id = this.tcb.allocateId();
|
|
@@ -4109,10 +3717,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4109
3717
|
}
|
|
4110
3718
|
const id = this.tcb.allocateId();
|
|
4111
3719
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
4112
|
-
if (!
|
|
3720
|
+
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
4113
3721
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
4114
3722
|
}
|
|
4115
|
-
const type =
|
|
3723
|
+
const type = ts24.createIndexedAccessTypeNode(ts24.createTypeQueryNode(dirId), ts24.createLiteralTypeNode(ts24.createStringLiteral(fieldName)));
|
|
4116
3724
|
const temp = tsDeclareVariable(id, type);
|
|
4117
3725
|
this.scope.addStatement(temp);
|
|
4118
3726
|
target = id;
|
|
@@ -4120,18 +3728,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
4120
3728
|
if (dirId === null) {
|
|
4121
3729
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4122
3730
|
}
|
|
4123
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3731
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts24.createElementAccess(dirId, ts24.createStringLiteral(fieldName)) : ts24.createPropertyAccess(dirId, ts24.createIdentifier(fieldName));
|
|
4124
3732
|
}
|
|
4125
3733
|
if (input.attribute.keySpan !== void 0) {
|
|
4126
3734
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
4127
3735
|
}
|
|
4128
|
-
assignment =
|
|
3736
|
+
assignment = ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, assignment);
|
|
4129
3737
|
}
|
|
4130
3738
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
4131
3739
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
4132
3740
|
markIgnoreDiagnostics(assignment);
|
|
4133
3741
|
}
|
|
4134
|
-
this.scope.addStatement(
|
|
3742
|
+
this.scope.addStatement(ts24.createExpressionStatement(assignment));
|
|
4135
3743
|
}
|
|
4136
3744
|
return null;
|
|
4137
3745
|
}
|
|
@@ -4150,7 +3758,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
4150
3758
|
execute() {
|
|
4151
3759
|
const id = this.tcb.allocateId();
|
|
4152
3760
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
4153
|
-
const circularPlaceholder =
|
|
3761
|
+
const circularPlaceholder = ts24.createCall(typeCtor, void 0, [ts24.createNonNullExpression(ts24.createNull())]);
|
|
4154
3762
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
4155
3763
|
return id;
|
|
4156
3764
|
}
|
|
@@ -4216,15 +3824,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
4216
3824
|
elId = this.scope.resolve(this.element);
|
|
4217
3825
|
}
|
|
4218
3826
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
4219
|
-
const prop =
|
|
4220
|
-
const stmt =
|
|
3827
|
+
const prop = ts24.createElementAccess(elId, ts24.createStringLiteral(propertyName));
|
|
3828
|
+
const stmt = ts24.createBinary(prop, ts24.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
4221
3829
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
4222
|
-
this.scope.addStatement(
|
|
3830
|
+
this.scope.addStatement(ts24.createExpressionStatement(stmt));
|
|
4223
3831
|
} else {
|
|
4224
|
-
this.scope.addStatement(
|
|
3832
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4225
3833
|
}
|
|
4226
3834
|
} else {
|
|
4227
|
-
this.scope.addStatement(
|
|
3835
|
+
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
4228
3836
|
}
|
|
4229
3837
|
}
|
|
4230
3838
|
return null;
|
|
@@ -4256,18 +3864,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
4256
3864
|
if (dirId === null) {
|
|
4257
3865
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
4258
3866
|
}
|
|
4259
|
-
const outputField =
|
|
3867
|
+
const outputField = ts24.createElementAccess(dirId, ts24.createStringLiteral(field));
|
|
4260
3868
|
addParseSpanInfo(outputField, output.keySpan);
|
|
4261
3869
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
4262
3870
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4263
|
-
const subscribeFn =
|
|
4264
|
-
const call =
|
|
3871
|
+
const subscribeFn = ts24.createPropertyAccess(outputField, "subscribe");
|
|
3872
|
+
const call = ts24.createCall(subscribeFn, void 0, [handler]);
|
|
4265
3873
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4266
|
-
this.scope.addStatement(
|
|
3874
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4267
3875
|
} else {
|
|
4268
|
-
this.scope.addStatement(
|
|
3876
|
+
this.scope.addStatement(ts24.createExpressionStatement(outputField));
|
|
4269
3877
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4270
|
-
this.scope.addStatement(
|
|
3878
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4271
3879
|
}
|
|
4272
3880
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4273
3881
|
}
|
|
@@ -4300,20 +3908,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
4300
3908
|
if (output.type === 1) {
|
|
4301
3909
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
4302
3910
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
4303
|
-
this.scope.addStatement(
|
|
3911
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4304
3912
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
4305
3913
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4306
3914
|
if (elId === null) {
|
|
4307
3915
|
elId = this.scope.resolve(this.element);
|
|
4308
3916
|
}
|
|
4309
|
-
const propertyAccess =
|
|
3917
|
+
const propertyAccess = ts24.createPropertyAccess(elId, "addEventListener");
|
|
4310
3918
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
4311
|
-
const call =
|
|
3919
|
+
const call = ts24.createCall(propertyAccess, void 0, [ts24.createStringLiteral(output.name), handler]);
|
|
4312
3920
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4313
|
-
this.scope.addStatement(
|
|
3921
|
+
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
4314
3922
|
} else {
|
|
4315
3923
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4316
|
-
this.scope.addStatement(
|
|
3924
|
+
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
4317
3925
|
}
|
|
4318
3926
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4319
3927
|
}
|
|
@@ -4327,15 +3935,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
4327
3935
|
this.optional = false;
|
|
4328
3936
|
}
|
|
4329
3937
|
execute() {
|
|
4330
|
-
const ctx =
|
|
4331
|
-
const ctxDot =
|
|
3938
|
+
const ctx = ts24.createIdentifier("ctx");
|
|
3939
|
+
const ctxDot = ts24.createPropertyAccess(ctx, "");
|
|
4332
3940
|
markIgnoreDiagnostics(ctxDot);
|
|
4333
3941
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
4334
|
-
this.scope.addStatement(
|
|
3942
|
+
this.scope.addStatement(ts24.createExpressionStatement(ctxDot));
|
|
4335
3943
|
return null;
|
|
4336
3944
|
}
|
|
4337
3945
|
};
|
|
4338
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3946
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts24.createNonNullExpression(ts24.createNull());
|
|
4339
3947
|
var Context = class {
|
|
4340
3948
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
4341
3949
|
this.env = env;
|
|
@@ -4348,7 +3956,7 @@ var Context = class {
|
|
|
4348
3956
|
this.nextId = 1;
|
|
4349
3957
|
}
|
|
4350
3958
|
allocateId() {
|
|
4351
|
-
return
|
|
3959
|
+
return ts24.createIdentifier(`_t${this.nextId++}`);
|
|
4352
3960
|
}
|
|
4353
3961
|
getPipeByName(name) {
|
|
4354
3962
|
if (!this.pipes.has(name)) {
|
|
@@ -4400,8 +4008,8 @@ var Scope = class {
|
|
|
4400
4008
|
resolve(node, directive) {
|
|
4401
4009
|
const res = this.resolveLocal(node, directive);
|
|
4402
4010
|
if (res !== null) {
|
|
4403
|
-
const clone =
|
|
4404
|
-
|
|
4011
|
+
const clone = ts24.getMutableClone(res);
|
|
4012
|
+
ts24.setSyntheticTrailingComments(clone, []);
|
|
4405
4013
|
return clone;
|
|
4406
4014
|
} else if (this.parent !== null) {
|
|
4407
4015
|
return this.parent.resolve(node, directive);
|
|
@@ -4429,7 +4037,7 @@ var Scope = class {
|
|
|
4429
4037
|
} else if (parentGuards === null) {
|
|
4430
4038
|
return this.guard;
|
|
4431
4039
|
} else {
|
|
4432
|
-
return
|
|
4040
|
+
return ts24.createBinary(parentGuards, ts24.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4433
4041
|
}
|
|
4434
4042
|
}
|
|
4435
4043
|
resolveLocal(ref, directive) {
|
|
@@ -4609,8 +4217,8 @@ var Scope = class {
|
|
|
4609
4217
|
}
|
|
4610
4218
|
};
|
|
4611
4219
|
function tcbCtxParam(node, name, typeArguments) {
|
|
4612
|
-
const type =
|
|
4613
|
-
return
|
|
4220
|
+
const type = ts24.factory.createTypeReferenceNode(name, typeArguments);
|
|
4221
|
+
return ts24.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
4614
4222
|
}
|
|
4615
4223
|
function tcbExpression(ast, tcb, scope) {
|
|
4616
4224
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -4633,11 +4241,11 @@ var TcbExpressionTranslator = class {
|
|
|
4633
4241
|
return null;
|
|
4634
4242
|
}
|
|
4635
4243
|
const expr = this.translate(ast.value);
|
|
4636
|
-
const result =
|
|
4244
|
+
const result = ts24.createParen(ts24.createBinary(target, ts24.SyntaxKind.EqualsToken, expr));
|
|
4637
4245
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4638
4246
|
return result;
|
|
4639
4247
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4640
|
-
return
|
|
4248
|
+
return ts24.createIdentifier("ctx");
|
|
4641
4249
|
} else if (ast instanceof BindingPipe) {
|
|
4642
4250
|
const expr = this.translate(ast.exp);
|
|
4643
4251
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4649,19 +4257,19 @@ var TcbExpressionTranslator = class {
|
|
|
4649
4257
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4650
4258
|
}
|
|
4651
4259
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4652
|
-
let methodAccess =
|
|
4260
|
+
let methodAccess = ts24.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4653
4261
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4654
4262
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4655
|
-
methodAccess =
|
|
4263
|
+
methodAccess = ts24.factory.createAsExpression(methodAccess, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4656
4264
|
}
|
|
4657
|
-
const result =
|
|
4265
|
+
const result = ts24.createCall(methodAccess, void 0, [expr, ...args]);
|
|
4658
4266
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4659
4267
|
return result;
|
|
4660
4268
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4661
4269
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4662
4270
|
const expr = this.translate(ast.args[0]);
|
|
4663
|
-
const exprAsAny =
|
|
4664
|
-
const result =
|
|
4271
|
+
const exprAsAny = ts24.createAsExpression(expr, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4272
|
+
const result = ts24.createParen(exprAsAny);
|
|
4665
4273
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4666
4274
|
return result;
|
|
4667
4275
|
}
|
|
@@ -4672,7 +4280,7 @@ var TcbExpressionTranslator = class {
|
|
|
4672
4280
|
const method = wrapForDiagnostics(receiver);
|
|
4673
4281
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4674
4282
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4675
|
-
const node =
|
|
4283
|
+
const node = ts24.createCall(method, void 0, args);
|
|
4676
4284
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4677
4285
|
return node;
|
|
4678
4286
|
} else {
|
|
@@ -4692,17 +4300,17 @@ var TcbExpressionTranslator = class {
|
|
|
4692
4300
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4693
4301
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4694
4302
|
const members = inputs.map((input) => {
|
|
4695
|
-
const propertyName =
|
|
4303
|
+
const propertyName = ts24.createStringLiteral(input.field);
|
|
4696
4304
|
if (input.type === "binding") {
|
|
4697
4305
|
const expr = widenBinding(input.expression, tcb);
|
|
4698
|
-
const assignment =
|
|
4306
|
+
const assignment = ts24.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4699
4307
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4700
4308
|
return assignment;
|
|
4701
4309
|
} else {
|
|
4702
|
-
return
|
|
4310
|
+
return ts24.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4703
4311
|
}
|
|
4704
4312
|
});
|
|
4705
|
-
return
|
|
4313
|
+
return ts24.createCall(typeCtor, void 0, [ts24.createObjectLiteral(members)]);
|
|
4706
4314
|
}
|
|
4707
4315
|
function getBoundInputs(directive, node, tcb) {
|
|
4708
4316
|
const boundInputs = [];
|
|
@@ -4728,17 +4336,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4728
4336
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4729
4337
|
return tcbExpression(attr.value, tcb, scope);
|
|
4730
4338
|
} else {
|
|
4731
|
-
return
|
|
4339
|
+
return ts24.createStringLiteral(attr.value);
|
|
4732
4340
|
}
|
|
4733
4341
|
}
|
|
4734
4342
|
function widenBinding(expr, tcb) {
|
|
4735
4343
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4736
4344
|
return tsCastToAny(expr);
|
|
4737
4345
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4738
|
-
if (
|
|
4346
|
+
if (ts24.isObjectLiteralExpression(expr) || ts24.isArrayLiteralExpression(expr)) {
|
|
4739
4347
|
return expr;
|
|
4740
4348
|
} else {
|
|
4741
|
-
return
|
|
4349
|
+
return ts24.createNonNullExpression(expr);
|
|
4742
4350
|
}
|
|
4743
4351
|
} else {
|
|
4744
4352
|
return expr;
|
|
@@ -4751,18 +4359,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4751
4359
|
if (eventType === 0) {
|
|
4752
4360
|
eventParamType = void 0;
|
|
4753
4361
|
} else if (eventType === 1) {
|
|
4754
|
-
eventParamType =
|
|
4362
|
+
eventParamType = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
4755
4363
|
} else {
|
|
4756
4364
|
eventParamType = eventType;
|
|
4757
4365
|
}
|
|
4758
4366
|
const guards = scope.guards();
|
|
4759
|
-
let body =
|
|
4367
|
+
let body = ts24.createExpressionStatement(handler);
|
|
4760
4368
|
if (guards !== null) {
|
|
4761
|
-
body =
|
|
4369
|
+
body = ts24.createIf(guards, body);
|
|
4762
4370
|
}
|
|
4763
|
-
const eventParam =
|
|
4371
|
+
const eventParam = ts24.createParameter(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4764
4372
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4765
|
-
return
|
|
4373
|
+
return ts24.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword), ts24.createBlock([body]));
|
|
4766
4374
|
}
|
|
4767
4375
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4768
4376
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4790,7 +4398,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4790
4398
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4791
4399
|
resolve(ast) {
|
|
4792
4400
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4793
|
-
const event =
|
|
4401
|
+
const event = ts24.createIdentifier(EVENT_PARAMETER);
|
|
4794
4402
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4795
4403
|
return event;
|
|
4796
4404
|
}
|
|
@@ -4799,32 +4407,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4799
4407
|
};
|
|
4800
4408
|
|
|
4801
4409
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4802
|
-
import
|
|
4410
|
+
import ts25 from "typescript";
|
|
4803
4411
|
var TypeCheckFile = class extends Environment {
|
|
4804
4412
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4805
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
4413
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts25.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts25.ScriptTarget.Latest, true));
|
|
4806
4414
|
this.fileName = fileName;
|
|
4807
4415
|
this.nextTcbId = 1;
|
|
4808
4416
|
this.tcbStatements = [];
|
|
4809
4417
|
}
|
|
4810
4418
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4811
|
-
const fnId =
|
|
4419
|
+
const fnId = ts25.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4812
4420
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4813
4421
|
this.tcbStatements.push(fn);
|
|
4814
4422
|
}
|
|
4815
4423
|
render(removeComments) {
|
|
4816
4424
|
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 =
|
|
4425
|
+
const printer = ts25.createPrinter({ removeComments });
|
|
4818
4426
|
source += "\n";
|
|
4819
4427
|
for (const stmt of this.pipeInstStatements) {
|
|
4820
|
-
source += printer.printNode(
|
|
4428
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4821
4429
|
}
|
|
4822
4430
|
for (const stmt of this.typeCtorStatements) {
|
|
4823
|
-
source += printer.printNode(
|
|
4431
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4824
4432
|
}
|
|
4825
4433
|
source += "\n";
|
|
4826
4434
|
for (const stmt of this.tcbStatements) {
|
|
4827
|
-
source += printer.printNode(
|
|
4435
|
+
source += printer.printNode(ts25.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4828
4436
|
}
|
|
4829
4437
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4830
4438
|
return source;
|
|
@@ -4932,7 +4540,7 @@ var TypeCheckContextImpl = class {
|
|
|
4932
4540
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4933
4541
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4934
4542
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4935
|
-
const printer =
|
|
4543
|
+
const printer = ts26.createPrinter({ omitTrailingSemicolon: true });
|
|
4936
4544
|
let code = textParts[0];
|
|
4937
4545
|
ops.forEach((op, idx) => {
|
|
4938
4546
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -5013,7 +4621,7 @@ var TypeCheckContextImpl = class {
|
|
|
5013
4621
|
if (span.start.offset === span.end.offset) {
|
|
5014
4622
|
span.end.offset++;
|
|
5015
4623
|
}
|
|
5016
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4624
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts26.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
5017
4625
|
});
|
|
5018
4626
|
}
|
|
5019
4627
|
};
|
|
@@ -5031,9 +4639,9 @@ var InlineTcbOp = class {
|
|
|
5031
4639
|
}
|
|
5032
4640
|
execute(im, sf, refEmitter, printer) {
|
|
5033
4641
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
5034
|
-
const fnName =
|
|
4642
|
+
const fnName = ts26.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
5035
4643
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
5036
|
-
return printer.printNode(
|
|
4644
|
+
return printer.printNode(ts26.EmitHint.Unspecified, fn, sf);
|
|
5037
4645
|
}
|
|
5038
4646
|
};
|
|
5039
4647
|
var TypeCtorOp = class {
|
|
@@ -5046,7 +4654,7 @@ var TypeCtorOp = class {
|
|
|
5046
4654
|
}
|
|
5047
4655
|
execute(im, sf, refEmitter, printer) {
|
|
5048
4656
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
5049
|
-
return printer.printNode(
|
|
4657
|
+
return printer.printNode(ts26.EmitHint.Unspecified, tcb, sf);
|
|
5050
4658
|
}
|
|
5051
4659
|
};
|
|
5052
4660
|
function orderOps(op1, op2) {
|
|
@@ -5161,7 +4769,7 @@ var TemplateSourceManager = class {
|
|
|
5161
4769
|
|
|
5162
4770
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
5163
4771
|
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
|
|
4772
|
+
import ts27 from "typescript";
|
|
5165
4773
|
var SymbolBuilder = class {
|
|
5166
4774
|
constructor(shimPath, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
5167
4775
|
this.shimPath = shimPath;
|
|
@@ -5204,7 +4812,7 @@ var SymbolBuilder = class {
|
|
|
5204
4812
|
getSymbolOfElement(element) {
|
|
5205
4813
|
var _a;
|
|
5206
4814
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5207
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4815
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts27.isVariableDeclaration });
|
|
5208
4816
|
if (node === null) {
|
|
5209
4817
|
return null;
|
|
5210
4818
|
}
|
|
@@ -5223,12 +4831,12 @@ var SymbolBuilder = class {
|
|
|
5223
4831
|
var _a;
|
|
5224
4832
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5225
4833
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
5226
|
-
const isDirectiveDeclaration = (node) => (
|
|
4834
|
+
const isDirectiveDeclaration = (node) => (ts27.isTypeNode(node) || ts27.isIdentifier(node)) && ts27.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
5227
4835
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
5228
4836
|
return nodes.map((node) => {
|
|
5229
4837
|
var _a2;
|
|
5230
4838
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
5231
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4839
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5232
4840
|
return null;
|
|
5233
4841
|
}
|
|
5234
4842
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -5297,17 +4905,17 @@ var SymbolBuilder = class {
|
|
|
5297
4905
|
if (!isAccessExpression(n)) {
|
|
5298
4906
|
return false;
|
|
5299
4907
|
}
|
|
5300
|
-
if (
|
|
4908
|
+
if (ts27.isPropertyAccessExpression(n)) {
|
|
5301
4909
|
return n.name.getText() === expectedAccess;
|
|
5302
4910
|
} else {
|
|
5303
|
-
return
|
|
4911
|
+
return ts27.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
5304
4912
|
}
|
|
5305
4913
|
}
|
|
5306
4914
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
5307
4915
|
const bindings = [];
|
|
5308
4916
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
5309
4917
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
5310
|
-
if (!
|
|
4918
|
+
if (!ts27.isPropertyAccessExpression(outputFieldAccess)) {
|
|
5311
4919
|
continue;
|
|
5312
4920
|
}
|
|
5313
4921
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -5326,7 +4934,7 @@ var SymbolBuilder = class {
|
|
|
5326
4934
|
shimLocation: { shimPath: this.shimPath, positionInShimFile }
|
|
5327
4935
|
});
|
|
5328
4936
|
} else {
|
|
5329
|
-
if (!
|
|
4937
|
+
if (!ts27.isElementAccessExpression(outputFieldAccess)) {
|
|
5330
4938
|
continue;
|
|
5331
4939
|
}
|
|
5332
4940
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -5394,11 +5002,11 @@ var SymbolBuilder = class {
|
|
|
5394
5002
|
return null;
|
|
5395
5003
|
}
|
|
5396
5004
|
const [declaration] = tsSymbol.declarations;
|
|
5397
|
-
if (!
|
|
5005
|
+
if (!ts27.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
5398
5006
|
return null;
|
|
5399
5007
|
}
|
|
5400
5008
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5401
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5009
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts27.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5402
5010
|
return null;
|
|
5403
5011
|
}
|
|
5404
5012
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5414,7 +5022,7 @@ var SymbolBuilder = class {
|
|
|
5414
5022
|
};
|
|
5415
5023
|
}
|
|
5416
5024
|
getSymbolOfVariable(variable) {
|
|
5417
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5025
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5418
5026
|
if (node === null || node.initializer === void 0) {
|
|
5419
5027
|
return null;
|
|
5420
5028
|
}
|
|
@@ -5436,11 +5044,11 @@ var SymbolBuilder = class {
|
|
|
5436
5044
|
}
|
|
5437
5045
|
getSymbolOfReference(ref) {
|
|
5438
5046
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5439
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5047
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts27.isVariableDeclaration });
|
|
5440
5048
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5441
5049
|
return null;
|
|
5442
5050
|
}
|
|
5443
|
-
const originalDeclaration =
|
|
5051
|
+
const originalDeclaration = ts27.isParenthesizedExpression(node.initializer) && ts27.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5444
5052
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5445
5053
|
return null;
|
|
5446
5054
|
}
|
|
@@ -5463,7 +5071,7 @@ var SymbolBuilder = class {
|
|
|
5463
5071
|
referenceVarLocation: referenceVarShimLocation
|
|
5464
5072
|
};
|
|
5465
5073
|
} else {
|
|
5466
|
-
if (!
|
|
5074
|
+
if (!ts27.isClassDeclaration(target.directive.ref.node)) {
|
|
5467
5075
|
return null;
|
|
5468
5076
|
}
|
|
5469
5077
|
return {
|
|
@@ -5478,7 +5086,7 @@ var SymbolBuilder = class {
|
|
|
5478
5086
|
}
|
|
5479
5087
|
}
|
|
5480
5088
|
getSymbolOfPipe(expression) {
|
|
5481
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5089
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts27.isPropertyAccessExpression });
|
|
5482
5090
|
if (methodAccess === null) {
|
|
5483
5091
|
return null;
|
|
5484
5092
|
}
|
|
@@ -5517,7 +5125,7 @@ var SymbolBuilder = class {
|
|
|
5517
5125
|
}
|
|
5518
5126
|
let node = null;
|
|
5519
5127
|
if (expression instanceof PropertyRead5) {
|
|
5520
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5128
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts27.isPropertyAccessExpression });
|
|
5521
5129
|
}
|
|
5522
5130
|
if (node === null) {
|
|
5523
5131
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5525,10 +5133,10 @@ var SymbolBuilder = class {
|
|
|
5525
5133
|
if (node === null) {
|
|
5526
5134
|
return null;
|
|
5527
5135
|
}
|
|
5528
|
-
while (
|
|
5136
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5529
5137
|
node = node.expression;
|
|
5530
5138
|
}
|
|
5531
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5139
|
+
if (expression instanceof SafePropertyRead4 && ts27.isConditionalExpression(node)) {
|
|
5532
5140
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5533
5141
|
if (whenTrueSymbol === null) {
|
|
5534
5142
|
return null;
|
|
@@ -5544,13 +5152,13 @@ var SymbolBuilder = class {
|
|
|
5544
5152
|
}
|
|
5545
5153
|
getSymbolOfTsNode(node) {
|
|
5546
5154
|
var _a;
|
|
5547
|
-
while (
|
|
5155
|
+
while (ts27.isParenthesizedExpression(node)) {
|
|
5548
5156
|
node = node.expression;
|
|
5549
5157
|
}
|
|
5550
5158
|
let tsSymbol;
|
|
5551
|
-
if (
|
|
5159
|
+
if (ts27.isPropertyAccessExpression(node)) {
|
|
5552
5160
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5553
|
-
} else if (
|
|
5161
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5554
5162
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5555
5163
|
} else {
|
|
5556
5164
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -5564,13 +5172,13 @@ var SymbolBuilder = class {
|
|
|
5564
5172
|
};
|
|
5565
5173
|
}
|
|
5566
5174
|
getShimPositionForNode(node) {
|
|
5567
|
-
if (
|
|
5175
|
+
if (ts27.isTypeReferenceNode(node)) {
|
|
5568
5176
|
return this.getShimPositionForNode(node.typeName);
|
|
5569
|
-
} else if (
|
|
5177
|
+
} else if (ts27.isQualifiedName(node)) {
|
|
5570
5178
|
return node.right.getStart();
|
|
5571
|
-
} else if (
|
|
5179
|
+
} else if (ts27.isPropertyAccessExpression(node)) {
|
|
5572
5180
|
return node.name.getStart();
|
|
5573
|
-
} else if (
|
|
5181
|
+
} else if (ts27.isElementAccessExpression(node)) {
|
|
5574
5182
|
return node.argumentExpression.getStart();
|
|
5575
5183
|
} else {
|
|
5576
5184
|
return node.getStart();
|
|
@@ -6243,7 +5851,7 @@ var factory2 = {
|
|
|
6243
5851
|
};
|
|
6244
5852
|
|
|
6245
5853
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
6246
|
-
import
|
|
5854
|
+
import ts28 from "typescript";
|
|
6247
5855
|
|
|
6248
5856
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
6249
5857
|
var DiagnosticCategoryLabel;
|
|
@@ -6291,9 +5899,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
6291
5899
|
function diagnosticLabelToCategory(label) {
|
|
6292
5900
|
switch (label) {
|
|
6293
5901
|
case DiagnosticCategoryLabel.Warning:
|
|
6294
|
-
return
|
|
5902
|
+
return ts28.DiagnosticCategory.Warning;
|
|
6295
5903
|
case DiagnosticCategoryLabel.Error:
|
|
6296
|
-
return
|
|
5904
|
+
return ts28.DiagnosticCategory.Error;
|
|
6297
5905
|
case DiagnosticCategoryLabel.Suppress:
|
|
6298
5906
|
return null;
|
|
6299
5907
|
default:
|
|
@@ -6391,7 +5999,7 @@ var NgCompiler = class {
|
|
|
6391
5999
|
this.currentProgram = inputProgram;
|
|
6392
6000
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6393
6001
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6394
|
-
const moduleResolutionCache =
|
|
6002
|
+
const moduleResolutionCache = ts29.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
6395
6003
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
6396
6004
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
6397
6005
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -6447,7 +6055,7 @@ var NgCompiler = class {
|
|
|
6447
6055
|
}
|
|
6448
6056
|
for (const clazz of classesToUpdate) {
|
|
6449
6057
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6450
|
-
if (!
|
|
6058
|
+
if (!ts29.isClassDeclaration(clazz)) {
|
|
6451
6059
|
continue;
|
|
6452
6060
|
}
|
|
6453
6061
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6461,7 +6069,7 @@ var NgCompiler = class {
|
|
|
6461
6069
|
getDiagnostics() {
|
|
6462
6070
|
const diagnostics = [];
|
|
6463
6071
|
diagnostics.push(...this.getNonTemplateDiagnostics(), ...this.getTemplateDiagnostics());
|
|
6464
|
-
if (this.options.
|
|
6072
|
+
if (this.options.strictTemplates) {
|
|
6465
6073
|
diagnostics.push(...this.getExtendedTemplateDiagnostics());
|
|
6466
6074
|
}
|
|
6467
6075
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6469,7 +6077,7 @@ var NgCompiler = class {
|
|
|
6469
6077
|
getDiagnosticsForFile(file, optimizeFor) {
|
|
6470
6078
|
const diagnostics = [];
|
|
6471
6079
|
diagnostics.push(...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file), ...this.getTemplateDiagnosticsForFile(file, optimizeFor));
|
|
6472
|
-
if (this.options.
|
|
6080
|
+
if (this.options.strictTemplates) {
|
|
6473
6081
|
diagnostics.push(...this.getExtendedTemplateDiagnostics(file));
|
|
6474
6082
|
}
|
|
6475
6083
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6479,8 +6087,8 @@ var NgCompiler = class {
|
|
|
6479
6087
|
const ttc = compilation.templateTypeChecker;
|
|
6480
6088
|
const diagnostics = [];
|
|
6481
6089
|
diagnostics.push(...ttc.getDiagnosticsForComponent(component));
|
|
6482
|
-
|
|
6483
|
-
|
|
6090
|
+
const extendedTemplateChecker = compilation.extendedTemplateChecker;
|
|
6091
|
+
if (this.options.strictTemplates && extendedTemplateChecker) {
|
|
6484
6092
|
diagnostics.push(...extendedTemplateChecker.getDiagnosticsForComponent(component));
|
|
6485
6093
|
}
|
|
6486
6094
|
return this.addMessageTextDetails(diagnostics);
|
|
@@ -6754,6 +6362,9 @@ var NgCompiler = class {
|
|
|
6754
6362
|
const diagnostics = [];
|
|
6755
6363
|
const compilation = this.ensureAnalyzed();
|
|
6756
6364
|
const extendedTemplateChecker = compilation.extendedTemplateChecker;
|
|
6365
|
+
if (!extendedTemplateChecker) {
|
|
6366
|
+
return [];
|
|
6367
|
+
}
|
|
6757
6368
|
if (sf !== void 0) {
|
|
6758
6369
|
return compilation.traitCompiler.extendedTemplateCheck(sf, extendedTemplateChecker);
|
|
6759
6370
|
}
|
|
@@ -6828,7 +6439,7 @@ var NgCompiler = class {
|
|
|
6828
6439
|
this.currentProgram = program;
|
|
6829
6440
|
});
|
|
6830
6441
|
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);
|
|
6442
|
+
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
6832
6443
|
return {
|
|
6833
6444
|
isCore,
|
|
6834
6445
|
traitCompiler,
|
|
@@ -6852,17 +6463,17 @@ function isAngularCorePackage(program) {
|
|
|
6852
6463
|
return false;
|
|
6853
6464
|
}
|
|
6854
6465
|
return r3Symbols.statements.some((stmt) => {
|
|
6855
|
-
if (!
|
|
6466
|
+
if (!ts29.isVariableStatement(stmt)) {
|
|
6856
6467
|
return false;
|
|
6857
6468
|
}
|
|
6858
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
6469
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts29.SyntaxKind.ExportKeyword)) {
|
|
6859
6470
|
return false;
|
|
6860
6471
|
}
|
|
6861
6472
|
return stmt.declarationList.declarations.some((decl) => {
|
|
6862
|
-
if (!
|
|
6473
|
+
if (!ts29.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
6863
6474
|
return false;
|
|
6864
6475
|
}
|
|
6865
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
6476
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts29.SyntaxKind.TrueKeyword) {
|
|
6866
6477
|
return false;
|
|
6867
6478
|
}
|
|
6868
6479
|
return true;
|
|
@@ -6876,7 +6487,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
6876
6487
|
var _a, _b, _c;
|
|
6877
6488
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
6878
6489
|
yield makeConfigDiagnostic({
|
|
6879
|
-
category:
|
|
6490
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6880
6491
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
6881
6492
|
messageText: `
|
|
6882
6493
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -6895,7 +6506,7 @@ https://angular.io/guide/template-typecheck
|
|
|
6895
6506
|
}
|
|
6896
6507
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
6897
6508
|
yield makeConfigDiagnostic({
|
|
6898
|
-
category:
|
|
6509
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6899
6510
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
6900
6511
|
messageText: `
|
|
6901
6512
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -6912,7 +6523,7 @@ One of the following actions is required:
|
|
|
6912
6523
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
6913
6524
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
6914
6525
|
yield makeConfigDiagnostic({
|
|
6915
|
-
category:
|
|
6526
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6916
6527
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6917
6528
|
messageText: `
|
|
6918
6529
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -6926,7 +6537,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
6926
6537
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
6927
6538
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
6928
6539
|
yield makeConfigDiagnostic({
|
|
6929
|
-
category:
|
|
6540
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6930
6541
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
6931
6542
|
messageText: `
|
|
6932
6543
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -6938,7 +6549,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
6938
6549
|
}
|
|
6939
6550
|
if (!allowedCategoryLabels.includes(category)) {
|
|
6940
6551
|
yield makeConfigDiagnostic({
|
|
6941
|
-
category:
|
|
6552
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6942
6553
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6943
6554
|
messageText: `
|
|
6944
6555
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -6968,7 +6579,7 @@ var ReferenceGraphAdapter = class {
|
|
|
6968
6579
|
for (const { node } of references) {
|
|
6969
6580
|
let sourceFile = node.getSourceFile();
|
|
6970
6581
|
if (sourceFile === void 0) {
|
|
6971
|
-
sourceFile =
|
|
6582
|
+
sourceFile = ts29.getOriginalNode(node).getSourceFile();
|
|
6972
6583
|
}
|
|
6973
6584
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
6974
6585
|
this.graph.add(source, node);
|
|
@@ -7007,7 +6618,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
7007
6618
|
}
|
|
7008
6619
|
|
|
7009
6620
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
7010
|
-
import
|
|
6621
|
+
import ts30 from "typescript";
|
|
7011
6622
|
var DelegatingCompilerHost2 = class {
|
|
7012
6623
|
constructor(delegate) {
|
|
7013
6624
|
this.delegate = delegate;
|
|
@@ -7097,7 +6708,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7097
6708
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
7098
6709
|
if (entryPoint === null) {
|
|
7099
6710
|
diagnostics.push({
|
|
7100
|
-
category:
|
|
6711
|
+
category: ts30.DiagnosticCategory.Error,
|
|
7101
6712
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
7102
6713
|
file: void 0,
|
|
7103
6714
|
start: void 0,
|
|
@@ -7137,10 +6748,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7137
6748
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
7138
6749
|
}
|
|
7139
6750
|
createCachedResolveModuleNamesFunction() {
|
|
7140
|
-
const moduleResolutionCache =
|
|
6751
|
+
const moduleResolutionCache = ts30.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
7141
6752
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
7142
6753
|
return moduleNames.map((moduleName) => {
|
|
7143
|
-
const module =
|
|
6754
|
+
const module = ts30.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
7144
6755
|
return module.resolvedModule;
|
|
7145
6756
|
});
|
|
7146
6757
|
};
|
|
@@ -7161,7 +6772,7 @@ var NgtscProgram = class {
|
|
|
7161
6772
|
if (reuseProgram !== void 0) {
|
|
7162
6773
|
retagAllTsFiles(reuseProgram);
|
|
7163
6774
|
}
|
|
7164
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
6775
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts31.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
7165
6776
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
7166
6777
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
7167
6778
|
this.host.postProgramCreationCleanup();
|
|
@@ -7360,17 +6971,17 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
7360
6971
|
}
|
|
7361
6972
|
|
|
7362
6973
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7363
|
-
import
|
|
6974
|
+
import ts33 from "typescript";
|
|
7364
6975
|
|
|
7365
6976
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
7366
|
-
import
|
|
6977
|
+
import ts32 from "typescript";
|
|
7367
6978
|
var GENERATED_FILES = /(.*?)\.(ngfactory|shim\.ngstyle|ngstyle|ngsummary)\.(js|d\.ts|ts)$/;
|
|
7368
6979
|
function createMessageDiagnostic(messageText) {
|
|
7369
6980
|
return {
|
|
7370
6981
|
file: void 0,
|
|
7371
6982
|
start: void 0,
|
|
7372
6983
|
length: void 0,
|
|
7373
|
-
category:
|
|
6984
|
+
category: ts32.DiagnosticCategory.Message,
|
|
7374
6985
|
messageText,
|
|
7375
6986
|
code: DEFAULT_ERROR_CODE,
|
|
7376
6987
|
source: SOURCE
|
|
@@ -7379,13 +6990,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
7379
6990
|
|
|
7380
6991
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7381
6992
|
var defaultFormatHost = {
|
|
7382
|
-
getCurrentDirectory: () =>
|
|
6993
|
+
getCurrentDirectory: () => ts33.sys.getCurrentDirectory(),
|
|
7383
6994
|
getCanonicalFileName: (fileName) => fileName,
|
|
7384
|
-
getNewLine: () =>
|
|
6995
|
+
getNewLine: () => ts33.sys.newLine
|
|
7385
6996
|
};
|
|
7386
6997
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7387
6998
|
if (diags && diags.length) {
|
|
7388
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
6999
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts33.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7389
7000
|
} else {
|
|
7390
7001
|
return "";
|
|
7391
7002
|
}
|
|
@@ -7402,7 +7013,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7402
7013
|
var _a;
|
|
7403
7014
|
try {
|
|
7404
7015
|
const fs = getFileSystem();
|
|
7405
|
-
const readConfigFile = (configFile) =>
|
|
7016
|
+
const readConfigFile = (configFile) => ts33.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7406
7017
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7407
7018
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7408
7019
|
if (error2) {
|
|
@@ -7434,7 +7045,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7434
7045
|
basePath
|
|
7435
7046
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
7436
7047
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7437
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
7048
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts33.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7438
7049
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
7439
7050
|
let emitFlags = EmitFlags.Default;
|
|
7440
7051
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -7446,7 +7057,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7446
7057
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7447
7058
|
} catch (e) {
|
|
7448
7059
|
const errors = [{
|
|
7449
|
-
category:
|
|
7060
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7450
7061
|
messageText: e.stack,
|
|
7451
7062
|
file: void 0,
|
|
7452
7063
|
start: void 0,
|
|
@@ -7460,7 +7071,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7460
7071
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7461
7072
|
return {
|
|
7462
7073
|
fileExists: host.exists.bind(host),
|
|
7463
|
-
readDirectory:
|
|
7074
|
+
readDirectory: ts33.sys.readDirectory,
|
|
7464
7075
|
readFile: host.readFile.bind(host),
|
|
7465
7076
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7466
7077
|
};
|
|
@@ -7480,7 +7091,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7480
7091
|
}
|
|
7481
7092
|
} else {
|
|
7482
7093
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7483
|
-
const { resolvedModule } =
|
|
7094
|
+
const { resolvedModule } = ts33.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts33.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
7484
7095
|
if (resolvedModule) {
|
|
7485
7096
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
7486
7097
|
}
|
|
@@ -7490,7 +7101,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7490
7101
|
function exitCodeFromResult(diags) {
|
|
7491
7102
|
if (!diags)
|
|
7492
7103
|
return 0;
|
|
7493
|
-
if (diags.every((diag) => diag.category !==
|
|
7104
|
+
if (diags.every((diag) => diag.category !== ts33.DiagnosticCategory.Error)) {
|
|
7494
7105
|
return 0;
|
|
7495
7106
|
}
|
|
7496
7107
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7522,7 +7133,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7522
7133
|
} catch (e) {
|
|
7523
7134
|
program = void 0;
|
|
7524
7135
|
allDiagnostics.push({
|
|
7525
|
-
category:
|
|
7136
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7526
7137
|
messageText: e.stack,
|
|
7527
7138
|
code: UNKNOWN_ERROR_CODE,
|
|
7528
7139
|
file: void 0,
|
|
@@ -7549,7 +7160,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7549
7160
|
return allDiagnostics;
|
|
7550
7161
|
}
|
|
7551
7162
|
function hasErrors(diags) {
|
|
7552
|
-
return diags.some((d) => d.category ===
|
|
7163
|
+
return diags.some((d) => d.category === ts33.DiagnosticCategory.Error);
|
|
7553
7164
|
}
|
|
7554
7165
|
|
|
7555
7166
|
export {
|
|
@@ -7561,7 +7172,6 @@ export {
|
|
|
7561
7172
|
createCompilerHost,
|
|
7562
7173
|
CycleAnalyzer,
|
|
7563
7174
|
ImportGraph,
|
|
7564
|
-
untagAllTsFiles,
|
|
7565
7175
|
TsCreateProgramDriver,
|
|
7566
7176
|
PatchedProgramIncrementalBuildStrategy,
|
|
7567
7177
|
MetadataDtsModuleScopeResolver,
|
|
@@ -7590,5 +7200,4 @@ export {
|
|
|
7590
7200
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7591
7201
|
* found in the LICENSE file at https://angular.io/license
|
|
7592
7202
|
*/
|
|
7593
|
-
|
|
7594
|
-
//# sourceMappingURL=chunk-L5DQYLOG.js.map
|
|
7203
|
+
//# sourceMappingURL=chunk-XDGI7TS4.js.map
|