@angular/compiler-cli 13.0.2 → 13.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/index.js +628 -673
- package/bundles/index.js.map +2 -2
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -2
- package/bundles/linker/index.js.map +1 -1
- package/bundles/ngcc/index.js +886 -868
- package/bundles/ngcc/index.js.map +2 -2
- package/bundles/ngcc/main-ngcc.js +886 -868
- package/bundles/ngcc/main-ngcc.js.map +2 -2
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +518 -500
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +2 -2
- package/bundles/private/migrations.js +20 -0
- package/bundles/private/migrations.js.map +1 -1
- package/bundles/private/tooling.js +2 -2
- package/bundles/private/tooling.js.map +1 -1
- package/bundles/src/bin/ng_xi18n.js +638 -683
- package/bundles/src/bin/ng_xi18n.js.map +2 -2
- package/bundles/src/bin/ngc.js +638 -683
- package/bundles/src/bin/ngc.js.map +2 -2
- package/bundles_metadata.json +1 -1
- package/ngcc/src/host/delegating_host.d.ts +1 -2
- package/ngcc/src/host/esm2015_host.d.ts +1 -8
- package/ngcc/src/host/ngcc_host.d.ts +0 -13
- package/ngcc/src/host/umd_host.d.ts +3 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/transformer.d.ts +0 -2
- package/ngcc/src/rendering/esm_rendering_formatter.d.ts +1 -5
- package/ngcc/src/rendering/renderer.d.ts +2 -3
- package/ngcc/src/rendering/rendering_formatter.d.ts +0 -2
- package/ngcc/src/utils.d.ts +0 -7
- package/package.json +2 -2
- package/src/ngtsc/partial_evaluator/src/builtin.d.ts +5 -0
- package/ngcc/src/analysis/switch_marker_analyzer.d.ts +0 -35
- package/src/ngtsc/switch/index.d.ts +0 -9
- package/src/ngtsc/switch/src/switch.d.ts +0 -10
|
@@ -383,12 +383,12 @@ function toggleCase(str) {
|
|
|
383
383
|
import yargs2 from "yargs";
|
|
384
384
|
|
|
385
385
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/main.mjs
|
|
386
|
-
import
|
|
386
|
+
import ts87 from "typescript";
|
|
387
387
|
import yargs from "yargs";
|
|
388
388
|
|
|
389
389
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
390
390
|
import { isSyntaxError as isSyntaxError2 } from "@angular/compiler";
|
|
391
|
-
import
|
|
391
|
+
import ts85 from "typescript";
|
|
392
392
|
|
|
393
393
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
|
|
394
394
|
var ErrorCode;
|
|
@@ -3109,12 +3109,12 @@ import {
|
|
|
3109
3109
|
readFileSync as readFileSync2
|
|
3110
3110
|
} from "fs";
|
|
3111
3111
|
import * as path6 from "path";
|
|
3112
|
-
import
|
|
3112
|
+
import ts84 from "typescript";
|
|
3113
3113
|
|
|
3114
3114
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/translate_diagnostics.mjs
|
|
3115
3115
|
import ts10 from "typescript";
|
|
3116
3116
|
function translateDiagnostics(host, untranslatedDiagnostics) {
|
|
3117
|
-
const
|
|
3117
|
+
const ts88 = [];
|
|
3118
3118
|
const ng2 = [];
|
|
3119
3119
|
untranslatedDiagnostics.forEach((diagnostic) => {
|
|
3120
3120
|
if (diagnostic.file && diagnostic.start && GENERATED_FILES.test(diagnostic.file.fileName)) {
|
|
@@ -3133,10 +3133,10 @@ function translateDiagnostics(host, untranslatedDiagnostics) {
|
|
|
3133
3133
|
});
|
|
3134
3134
|
}
|
|
3135
3135
|
} else {
|
|
3136
|
-
|
|
3136
|
+
ts88.push(diagnostic);
|
|
3137
3137
|
}
|
|
3138
3138
|
});
|
|
3139
|
-
return { ts:
|
|
3139
|
+
return { ts: ts88, ng: ng2 };
|
|
3140
3140
|
}
|
|
3141
3141
|
function sourceSpanOf(host, source, start) {
|
|
3142
3142
|
const { line, character } = ts10.getLineAndCharacterOfPosition(source, start);
|
|
@@ -3147,7 +3147,7 @@ function diagnosticMessageToString(message) {
|
|
|
3147
3147
|
}
|
|
3148
3148
|
|
|
3149
3149
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
3150
|
-
import
|
|
3150
|
+
import ts72 from "typescript";
|
|
3151
3151
|
|
|
3152
3152
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/component.mjs
|
|
3153
3153
|
import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DomElementSchemaRegistry, ExternalExpr as ExternalExpr7, FactoryTarget as FactoryTarget3, InterpolationConfig, makeBindingParser as makeBindingParser2, ParseSourceFile as ParseSourceFile2, parseTemplate, R3TargetBinder, SelectorMatcher, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
|
|
@@ -5377,6 +5377,24 @@ var ArrayConcatBuiltinFn = class extends KnownFn {
|
|
|
5377
5377
|
return result;
|
|
5378
5378
|
}
|
|
5379
5379
|
};
|
|
5380
|
+
var StringConcatBuiltinFn = class extends KnownFn {
|
|
5381
|
+
constructor(lhs) {
|
|
5382
|
+
super();
|
|
5383
|
+
this.lhs = lhs;
|
|
5384
|
+
}
|
|
5385
|
+
evaluate(node, args2) {
|
|
5386
|
+
let result = this.lhs;
|
|
5387
|
+
for (const arg of args2) {
|
|
5388
|
+
const resolved = arg instanceof EnumValue ? arg.resolved : arg;
|
|
5389
|
+
if (typeof resolved === "string" || typeof resolved === "number" || typeof resolved === "boolean" || resolved == null) {
|
|
5390
|
+
result = result.concat(resolved);
|
|
5391
|
+
} else {
|
|
5392
|
+
return DynamicValue.fromUnknown(node);
|
|
5393
|
+
}
|
|
5394
|
+
}
|
|
5395
|
+
return result;
|
|
5396
|
+
}
|
|
5397
|
+
};
|
|
5380
5398
|
var ObjectAssignBuiltinFn = class extends KnownFn {
|
|
5381
5399
|
evaluate(node, args2) {
|
|
5382
5400
|
if (args2.length === 0) {
|
|
@@ -5766,6 +5784,8 @@ var StaticInterpreter = class {
|
|
|
5766
5784
|
return DynamicValue.fromInvalidExpressionType(node, rhs);
|
|
5767
5785
|
}
|
|
5768
5786
|
return lhs[rhs];
|
|
5787
|
+
} else if (typeof lhs === "string" && rhs === "concat") {
|
|
5788
|
+
return new StringConcatBuiltinFn(lhs);
|
|
5769
5789
|
} else if (lhs instanceof Reference) {
|
|
5770
5790
|
const ref = lhs.node;
|
|
5771
5791
|
if (this.host.isClass(ref)) {
|
|
@@ -12636,70 +12656,6 @@ var TypeCheckScopeRegistry = class {
|
|
|
12636
12656
|
}
|
|
12637
12657
|
};
|
|
12638
12658
|
|
|
12639
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/switch/src/switch.mjs
|
|
12640
|
-
import ts52 from "typescript";
|
|
12641
|
-
var IVY_SWITCH_PRE_SUFFIX = "__PRE_R3__";
|
|
12642
|
-
var IVY_SWITCH_POST_SUFFIX = "__POST_R3__";
|
|
12643
|
-
function ivySwitchTransform(_) {
|
|
12644
|
-
return flipIvySwitchInFile;
|
|
12645
|
-
}
|
|
12646
|
-
function flipIvySwitchInFile(sf) {
|
|
12647
|
-
let newStatements = void 0;
|
|
12648
|
-
for (let i = 0; i < sf.statements.length; i++) {
|
|
12649
|
-
const statement = sf.statements[i];
|
|
12650
|
-
if (!ts52.isVariableStatement(statement) || !hasIvySwitches(statement)) {
|
|
12651
|
-
continue;
|
|
12652
|
-
}
|
|
12653
|
-
if (newStatements === void 0) {
|
|
12654
|
-
newStatements = [...sf.statements];
|
|
12655
|
-
}
|
|
12656
|
-
newStatements[i] = flipIvySwitchesInVariableStatement(statement, sf.statements);
|
|
12657
|
-
}
|
|
12658
|
-
if (newStatements !== void 0) {
|
|
12659
|
-
return ts52.updateSourceFileNode(sf, newStatements);
|
|
12660
|
-
}
|
|
12661
|
-
return sf;
|
|
12662
|
-
}
|
|
12663
|
-
function findPostSwitchIdentifier(statements, name) {
|
|
12664
|
-
for (const stmt of statements) {
|
|
12665
|
-
if (ts52.isVariableStatement(stmt)) {
|
|
12666
|
-
const decl = stmt.declarationList.declarations.find((decl2) => ts52.isIdentifier(decl2.name) && decl2.name.text === name);
|
|
12667
|
-
if (decl !== void 0) {
|
|
12668
|
-
return decl.name;
|
|
12669
|
-
}
|
|
12670
|
-
} else if (ts52.isFunctionDeclaration(stmt) || ts52.isClassDeclaration(stmt)) {
|
|
12671
|
-
if (stmt.name !== void 0 && ts52.isIdentifier(stmt.name) && stmt.name.text === name) {
|
|
12672
|
-
return stmt.name;
|
|
12673
|
-
}
|
|
12674
|
-
}
|
|
12675
|
-
}
|
|
12676
|
-
return null;
|
|
12677
|
-
}
|
|
12678
|
-
function flipIvySwitchesInVariableStatement(stmt, statements) {
|
|
12679
|
-
const newDeclarations = [...stmt.declarationList.declarations];
|
|
12680
|
-
for (let i = 0; i < newDeclarations.length; i++) {
|
|
12681
|
-
const decl = newDeclarations[i];
|
|
12682
|
-
if (decl.initializer === void 0 || !ts52.isIdentifier(decl.initializer)) {
|
|
12683
|
-
continue;
|
|
12684
|
-
}
|
|
12685
|
-
if (!decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX)) {
|
|
12686
|
-
continue;
|
|
12687
|
-
}
|
|
12688
|
-
const postSwitchName = decl.initializer.text.replace(IVY_SWITCH_PRE_SUFFIX, IVY_SWITCH_POST_SUFFIX);
|
|
12689
|
-
const newIdentifier = findPostSwitchIdentifier(statements, postSwitchName);
|
|
12690
|
-
if (newIdentifier === null) {
|
|
12691
|
-
throw new Error(`Unable to find identifier ${postSwitchName} in ${stmt.getSourceFile().fileName} for the Ivy switch.`);
|
|
12692
|
-
}
|
|
12693
|
-
newDeclarations[i] = ts52.updateVariableDeclaration(decl, decl.name, decl.type, newIdentifier);
|
|
12694
|
-
}
|
|
12695
|
-
const newDeclList = ts52.updateVariableDeclarationList(stmt.declarationList, newDeclarations);
|
|
12696
|
-
const newStmt = ts52.updateVariableStatement(stmt, stmt.modifiers, newDeclList);
|
|
12697
|
-
return newStmt;
|
|
12698
|
-
}
|
|
12699
|
-
function hasIvySwitches(stmt) {
|
|
12700
|
-
return stmt.declarationList.declarations.some((decl) => decl.initializer !== void 0 && ts52.isIdentifier(decl.initializer) && decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX));
|
|
12701
|
-
}
|
|
12702
|
-
|
|
12703
12659
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
12704
12660
|
import { CssSelector as CssSelector3, DomElementSchemaRegistry as DomElementSchemaRegistry3 } from "@angular/compiler";
|
|
12705
12661
|
|
|
@@ -12734,7 +12690,7 @@ var SymbolKind;
|
|
|
12734
12690
|
})(SymbolKind || (SymbolKind = {}));
|
|
12735
12691
|
|
|
12736
12692
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
12737
|
-
import
|
|
12693
|
+
import ts52 from "typescript";
|
|
12738
12694
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
12739
12695
|
if (mapping.type === "direct") {
|
|
12740
12696
|
let relatedInformation = void 0;
|
|
@@ -12742,7 +12698,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12742
12698
|
relatedInformation = [];
|
|
12743
12699
|
for (const relatedMessage of relatedMessages) {
|
|
12744
12700
|
relatedInformation.push({
|
|
12745
|
-
category:
|
|
12701
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12746
12702
|
code: 0,
|
|
12747
12703
|
file: relatedMessage.sourceFile,
|
|
12748
12704
|
start: relatedMessage.start,
|
|
@@ -12767,12 +12723,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12767
12723
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
12768
12724
|
const componentName = mapping.componentClass.name.text;
|
|
12769
12725
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
12770
|
-
const sf =
|
|
12726
|
+
const sf = ts52.createSourceFile(fileName, mapping.template, ts52.ScriptTarget.Latest, false, ts52.ScriptKind.JSX);
|
|
12771
12727
|
let relatedInformation = [];
|
|
12772
12728
|
if (relatedMessages !== void 0) {
|
|
12773
12729
|
for (const relatedMessage of relatedMessages) {
|
|
12774
12730
|
relatedInformation.push({
|
|
12775
|
-
category:
|
|
12731
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12776
12732
|
code: 0,
|
|
12777
12733
|
file: relatedMessage.sourceFile,
|
|
12778
12734
|
start: relatedMessage.start,
|
|
@@ -12782,7 +12738,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12782
12738
|
}
|
|
12783
12739
|
}
|
|
12784
12740
|
relatedInformation.push({
|
|
12785
|
-
category:
|
|
12741
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12786
12742
|
code: 0,
|
|
12787
12743
|
file: componentSf,
|
|
12788
12744
|
start: mapping.node.getStart(),
|
|
@@ -12825,15 +12781,15 @@ function allocateTemplateId(sf) {
|
|
|
12825
12781
|
|
|
12826
12782
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
12827
12783
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
12828
|
-
import
|
|
12784
|
+
import ts54 from "typescript";
|
|
12829
12785
|
|
|
12830
12786
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
12831
12787
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
12832
|
-
import
|
|
12788
|
+
import ts53 from "typescript";
|
|
12833
12789
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
12834
12790
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
12835
|
-
return
|
|
12836
|
-
if (kind !==
|
|
12791
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12792
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12837
12793
|
return null;
|
|
12838
12794
|
}
|
|
12839
12795
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -12856,15 +12812,15 @@ var ExpressionIdentifier;
|
|
|
12856
12812
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
12857
12813
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
12858
12814
|
function addExpressionIdentifier(node, identifier) {
|
|
12859
|
-
|
|
12815
|
+
ts53.addSyntheticTrailingComment(node, ts53.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
12860
12816
|
}
|
|
12861
12817
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
12862
12818
|
function markIgnoreDiagnostics(node) {
|
|
12863
|
-
|
|
12819
|
+
ts53.addSyntheticTrailingComment(node, ts53.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
12864
12820
|
}
|
|
12865
12821
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
12866
|
-
return
|
|
12867
|
-
if (kind !==
|
|
12822
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12823
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12868
12824
|
return null;
|
|
12869
12825
|
}
|
|
12870
12826
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -12938,8 +12894,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
12938
12894
|
return results;
|
|
12939
12895
|
}
|
|
12940
12896
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
12941
|
-
return
|
|
12942
|
-
if (kind !==
|
|
12897
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12898
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12943
12899
|
return false;
|
|
12944
12900
|
}
|
|
12945
12901
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -12956,7 +12912,7 @@ var CompletionEngine = class {
|
|
|
12956
12912
|
this.templateContextCache = new Map();
|
|
12957
12913
|
this.expressionCompletionCache = new Map();
|
|
12958
12914
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
12959
|
-
filter:
|
|
12915
|
+
filter: ts54.isPropertyAccessExpression,
|
|
12960
12916
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
12961
12917
|
});
|
|
12962
12918
|
if (globalRead !== null) {
|
|
@@ -12979,7 +12935,7 @@ var CompletionEngine = class {
|
|
|
12979
12935
|
let nodeContext = null;
|
|
12980
12936
|
if (node instanceof EmptyExpr) {
|
|
12981
12937
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
12982
|
-
filter:
|
|
12938
|
+
filter: ts54.isIdentifier,
|
|
12983
12939
|
withSpan: node.sourceSpan
|
|
12984
12940
|
});
|
|
12985
12941
|
if (nodeLocation !== null) {
|
|
@@ -12991,7 +12947,7 @@ var CompletionEngine = class {
|
|
|
12991
12947
|
}
|
|
12992
12948
|
if (node instanceof PropertyRead && node.receiver instanceof ImplicitReceiver2) {
|
|
12993
12949
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
12994
|
-
filter:
|
|
12950
|
+
filter: ts54.isPropertyAccessExpression,
|
|
12995
12951
|
withSpan: node.sourceSpan
|
|
12996
12952
|
});
|
|
12997
12953
|
if (nodeLocation) {
|
|
@@ -13014,21 +12970,21 @@ var CompletionEngine = class {
|
|
|
13014
12970
|
let tsExpr = null;
|
|
13015
12971
|
if (expr instanceof PropertyRead || expr instanceof PropertyWrite) {
|
|
13016
12972
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
13017
|
-
filter:
|
|
12973
|
+
filter: ts54.isPropertyAccessExpression,
|
|
13018
12974
|
withSpan: expr.nameSpan
|
|
13019
12975
|
});
|
|
13020
12976
|
} else if (expr instanceof SafePropertyRead) {
|
|
13021
12977
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
13022
|
-
filter:
|
|
12978
|
+
filter: ts54.isParenthesizedExpression,
|
|
13023
12979
|
withSpan: expr.sourceSpan
|
|
13024
12980
|
});
|
|
13025
|
-
if (ternaryExpr === null || !
|
|
12981
|
+
if (ternaryExpr === null || !ts54.isConditionalExpression(ternaryExpr.expression)) {
|
|
13026
12982
|
return null;
|
|
13027
12983
|
}
|
|
13028
12984
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
13029
|
-
if (
|
|
12985
|
+
if (ts54.isPropertyAccessExpression(whenTrue)) {
|
|
13030
12986
|
tsExpr = whenTrue;
|
|
13031
|
-
} else if (
|
|
12987
|
+
} else if (ts54.isCallExpression(whenTrue) && ts54.isPropertyAccessExpression(whenTrue.expression)) {
|
|
13032
12988
|
tsExpr = whenTrue.expression;
|
|
13033
12989
|
}
|
|
13034
12990
|
}
|
|
@@ -13049,15 +13005,15 @@ var CompletionEngine = class {
|
|
|
13049
13005
|
let tsExpr = null;
|
|
13050
13006
|
if (expr instanceof TmplAstTextAttribute) {
|
|
13051
13007
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
13052
|
-
filter:
|
|
13008
|
+
filter: ts54.isParenthesizedExpression,
|
|
13053
13009
|
withSpan: expr.sourceSpan
|
|
13054
13010
|
});
|
|
13055
|
-
if (strNode !== null &&
|
|
13011
|
+
if (strNode !== null && ts54.isStringLiteral(strNode.expression)) {
|
|
13056
13012
|
tsExpr = strNode.expression;
|
|
13057
13013
|
}
|
|
13058
13014
|
} else {
|
|
13059
13015
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
13060
|
-
filter: (n) =>
|
|
13016
|
+
filter: (n) => ts54.isStringLiteral(n) || ts54.isNumericLiteral(n),
|
|
13061
13017
|
withSpan: expr.sourceSpan
|
|
13062
13018
|
});
|
|
13063
13019
|
}
|
|
@@ -13065,7 +13021,7 @@ var CompletionEngine = class {
|
|
|
13065
13021
|
return null;
|
|
13066
13022
|
}
|
|
13067
13023
|
let positionInShimFile = tsExpr.getEnd();
|
|
13068
|
-
if (
|
|
13024
|
+
if (ts54.isStringLiteral(tsExpr)) {
|
|
13069
13025
|
positionInShimFile -= 1;
|
|
13070
13026
|
}
|
|
13071
13027
|
const res = {
|
|
@@ -13099,11 +13055,11 @@ var CompletionEngine = class {
|
|
|
13099
13055
|
};
|
|
13100
13056
|
|
|
13101
13057
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
13102
|
-
import
|
|
13058
|
+
import ts68 from "typescript";
|
|
13103
13059
|
|
|
13104
13060
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
13105
13061
|
import { DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
13106
|
-
import
|
|
13062
|
+
import ts55 from "typescript";
|
|
13107
13063
|
var REGISTRY = new DomElementSchemaRegistry2();
|
|
13108
13064
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
13109
13065
|
var RegistryDomSchemaChecker = class {
|
|
@@ -13127,7 +13083,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13127
13083
|
} else {
|
|
13128
13084
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
13129
13085
|
}
|
|
13130
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
13086
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts55.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
13131
13087
|
this._diagnostics.push(diag);
|
|
13132
13088
|
}
|
|
13133
13089
|
}
|
|
@@ -13145,7 +13101,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13145
13101
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
13146
13102
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
13147
13103
|
}
|
|
13148
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
13104
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts55.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
13149
13105
|
this._diagnostics.push(diag);
|
|
13150
13106
|
}
|
|
13151
13107
|
}
|
|
@@ -13153,62 +13109,62 @@ var RegistryDomSchemaChecker = class {
|
|
|
13153
13109
|
|
|
13154
13110
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
13155
13111
|
import { ExpressionType, ExternalExpr as ExternalExpr9 } from "@angular/compiler";
|
|
13156
|
-
import
|
|
13112
|
+
import ts61 from "typescript";
|
|
13157
13113
|
|
|
13158
13114
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
13159
|
-
import
|
|
13115
|
+
import ts56 from "typescript";
|
|
13160
13116
|
var SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13117
|
+
ts56.SyntaxKind.ParenthesizedExpression,
|
|
13118
|
+
ts56.SyntaxKind.Identifier,
|
|
13119
|
+
ts56.SyntaxKind.CallExpression,
|
|
13120
|
+
ts56.SyntaxKind.NonNullExpression,
|
|
13121
|
+
ts56.SyntaxKind.ElementAccessExpression,
|
|
13122
|
+
ts56.SyntaxKind.PropertyAccessExpression,
|
|
13123
|
+
ts56.SyntaxKind.ArrayLiteralExpression,
|
|
13124
|
+
ts56.SyntaxKind.ObjectLiteralExpression,
|
|
13125
|
+
ts56.SyntaxKind.StringLiteral,
|
|
13126
|
+
ts56.SyntaxKind.NumericLiteral,
|
|
13127
|
+
ts56.SyntaxKind.TrueKeyword,
|
|
13128
|
+
ts56.SyntaxKind.FalseKeyword,
|
|
13129
|
+
ts56.SyntaxKind.NullKeyword,
|
|
13130
|
+
ts56.SyntaxKind.UndefinedKeyword
|
|
13175
13131
|
]);
|
|
13176
13132
|
function tsCastToAny(expr) {
|
|
13177
13133
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
13178
|
-
expr =
|
|
13134
|
+
expr = ts56.createParen(expr);
|
|
13179
13135
|
}
|
|
13180
|
-
return
|
|
13136
|
+
return ts56.createParen(ts56.createAsExpression(expr, ts56.createKeywordTypeNode(ts56.SyntaxKind.AnyKeyword)));
|
|
13181
13137
|
}
|
|
13182
13138
|
function tsCreateElement(tagName) {
|
|
13183
|
-
const createElement =
|
|
13184
|
-
return
|
|
13139
|
+
const createElement = ts56.createPropertyAccess(ts56.createIdentifier("document"), "createElement");
|
|
13140
|
+
return ts56.createCall(createElement, void 0, [ts56.createLiteral(tagName)]);
|
|
13185
13141
|
}
|
|
13186
13142
|
function tsDeclareVariable(id, type) {
|
|
13187
|
-
const decl =
|
|
13188
|
-
return
|
|
13143
|
+
const decl = ts56.createVariableDeclaration(id, type, ts56.createNonNullExpression(ts56.createNull()));
|
|
13144
|
+
return ts56.createVariableStatement(void 0, [decl]);
|
|
13189
13145
|
}
|
|
13190
13146
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
13191
|
-
return
|
|
13147
|
+
return ts56.createTypeQueryNode(ts56.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
13192
13148
|
}
|
|
13193
13149
|
function tsCreateVariable(id, initializer) {
|
|
13194
|
-
const decl =
|
|
13195
|
-
return
|
|
13150
|
+
const decl = ts56.createVariableDeclaration(id, void 0, initializer);
|
|
13151
|
+
return ts56.createVariableStatement(void 0, [decl]);
|
|
13196
13152
|
}
|
|
13197
13153
|
function tsCallMethod(receiver, methodName, args2 = []) {
|
|
13198
|
-
const methodAccess =
|
|
13199
|
-
return
|
|
13154
|
+
const methodAccess = ts56.createPropertyAccess(receiver, methodName);
|
|
13155
|
+
return ts56.createCall(methodAccess, void 0, args2);
|
|
13200
13156
|
}
|
|
13201
13157
|
function checkIfClassIsExported(node) {
|
|
13202
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
13158
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts56.SyntaxKind.ExportKeyword)) {
|
|
13203
13159
|
return true;
|
|
13204
|
-
} else if (node.parent !== void 0 &&
|
|
13160
|
+
} else if (node.parent !== void 0 && ts56.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
13205
13161
|
return true;
|
|
13206
13162
|
}
|
|
13207
13163
|
return false;
|
|
13208
13164
|
}
|
|
13209
13165
|
function checkIfFileHasExport(sf, name) {
|
|
13210
13166
|
for (const stmt of sf.statements) {
|
|
13211
|
-
if (
|
|
13167
|
+
if (ts56.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts56.isNamedExports(stmt.exportClause)) {
|
|
13212
13168
|
for (const element of stmt.exportClause.elements) {
|
|
13213
13169
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
13214
13170
|
return true;
|
|
@@ -13221,20 +13177,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
13221
13177
|
return false;
|
|
13222
13178
|
}
|
|
13223
13179
|
function isAccessExpression(node) {
|
|
13224
|
-
return
|
|
13180
|
+
return ts56.isPropertyAccessExpression(node) || ts56.isElementAccessExpression(node);
|
|
13225
13181
|
}
|
|
13226
13182
|
|
|
13227
13183
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
13228
|
-
import
|
|
13184
|
+
import ts60 from "typescript";
|
|
13229
13185
|
|
|
13230
13186
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
13231
|
-
import
|
|
13187
|
+
import ts59 from "typescript";
|
|
13232
13188
|
|
|
13233
13189
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
13234
|
-
import
|
|
13190
|
+
import ts58 from "typescript";
|
|
13235
13191
|
|
|
13236
13192
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
13237
|
-
import
|
|
13193
|
+
import ts57 from "typescript";
|
|
13238
13194
|
var INELIGIBLE = {};
|
|
13239
13195
|
function canEmitType(type, resolver) {
|
|
13240
13196
|
return canEmitTypeWorker(type);
|
|
@@ -13242,13 +13198,13 @@ function canEmitType(type, resolver) {
|
|
|
13242
13198
|
return visitNode(type2) !== INELIGIBLE;
|
|
13243
13199
|
}
|
|
13244
13200
|
function visitNode(node) {
|
|
13245
|
-
if (
|
|
13201
|
+
if (ts57.isImportTypeNode(node)) {
|
|
13246
13202
|
return INELIGIBLE;
|
|
13247
13203
|
}
|
|
13248
|
-
if (
|
|
13204
|
+
if (ts57.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
13249
13205
|
return INELIGIBLE;
|
|
13250
13206
|
} else {
|
|
13251
|
-
return
|
|
13207
|
+
return ts57.forEachChild(node, visitNode);
|
|
13252
13208
|
}
|
|
13253
13209
|
}
|
|
13254
13210
|
function canEmitTypeReference(type2) {
|
|
@@ -13270,22 +13226,22 @@ var TypeEmitter = class {
|
|
|
13270
13226
|
emitType(type) {
|
|
13271
13227
|
const typeReferenceTransformer = (context) => {
|
|
13272
13228
|
const visitNode = (node) => {
|
|
13273
|
-
if (
|
|
13229
|
+
if (ts57.isImportTypeNode(node)) {
|
|
13274
13230
|
throw new Error("Unable to emit import type");
|
|
13275
13231
|
}
|
|
13276
|
-
if (
|
|
13232
|
+
if (ts57.isTypeReferenceNode(node)) {
|
|
13277
13233
|
return this.emitTypeReference(node);
|
|
13278
|
-
} else if (
|
|
13279
|
-
const clone =
|
|
13280
|
-
|
|
13234
|
+
} else if (ts57.isLiteralExpression(node)) {
|
|
13235
|
+
const clone = ts57.getMutableClone(node);
|
|
13236
|
+
ts57.setTextRange(clone, { pos: -1, end: -1 });
|
|
13281
13237
|
return clone;
|
|
13282
13238
|
} else {
|
|
13283
|
-
return
|
|
13239
|
+
return ts57.visitEachChild(node, visitNode, context);
|
|
13284
13240
|
}
|
|
13285
13241
|
};
|
|
13286
|
-
return (node) =>
|
|
13242
|
+
return (node) => ts57.visitNode(node, visitNode);
|
|
13287
13243
|
};
|
|
13288
|
-
return
|
|
13244
|
+
return ts57.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
13289
13245
|
}
|
|
13290
13246
|
emitTypeReference(type) {
|
|
13291
13247
|
const reference = this.resolver(type);
|
|
@@ -13294,17 +13250,17 @@ var TypeEmitter = class {
|
|
|
13294
13250
|
}
|
|
13295
13251
|
let typeArguments = void 0;
|
|
13296
13252
|
if (type.typeArguments !== void 0) {
|
|
13297
|
-
typeArguments =
|
|
13253
|
+
typeArguments = ts57.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
13298
13254
|
}
|
|
13299
13255
|
let typeName = type.typeName;
|
|
13300
13256
|
if (reference instanceof Reference) {
|
|
13301
13257
|
const emittedType = this.emitReference(reference);
|
|
13302
|
-
if (!
|
|
13303
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
13258
|
+
if (!ts57.isTypeReferenceNode(emittedType)) {
|
|
13259
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts57.SyntaxKind[emittedType.kind]}`);
|
|
13304
13260
|
}
|
|
13305
13261
|
typeName = emittedType.typeName;
|
|
13306
13262
|
}
|
|
13307
|
-
return
|
|
13263
|
+
return ts57.updateTypeReferenceNode(type, typeName, typeArguments);
|
|
13308
13264
|
}
|
|
13309
13265
|
};
|
|
13310
13266
|
|
|
@@ -13336,11 +13292,11 @@ var TypeParameterEmitter = class {
|
|
|
13336
13292
|
return this.typeParameters.map((typeParam) => {
|
|
13337
13293
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
13338
13294
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
13339
|
-
return
|
|
13295
|
+
return ts58.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
13340
13296
|
});
|
|
13341
13297
|
}
|
|
13342
13298
|
resolveTypeReference(type) {
|
|
13343
|
-
const target =
|
|
13299
|
+
const target = ts58.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
13344
13300
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
13345
13301
|
if (declaration === null || declaration.node === null) {
|
|
13346
13302
|
return null;
|
|
@@ -13361,7 +13317,7 @@ var TypeParameterEmitter = class {
|
|
|
13361
13317
|
return new Reference(declaration.node, owningModule2);
|
|
13362
13318
|
}
|
|
13363
13319
|
isTopLevelExport(decl) {
|
|
13364
|
-
if (decl.parent === void 0 || !
|
|
13320
|
+
if (decl.parent === void 0 || !ts58.isSourceFile(decl.parent)) {
|
|
13365
13321
|
return false;
|
|
13366
13322
|
}
|
|
13367
13323
|
return this.reflector.isStaticallyExported(decl);
|
|
@@ -13404,14 +13360,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
13404
13360
|
}
|
|
13405
13361
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
13406
13362
|
for (const stmt of file.statements) {
|
|
13407
|
-
if (
|
|
13363
|
+
if (ts59.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
13408
13364
|
return stmt;
|
|
13409
13365
|
}
|
|
13410
13366
|
}
|
|
13411
13367
|
return null;
|
|
13412
13368
|
}
|
|
13413
13369
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
13414
|
-
while (node !== void 0 && !
|
|
13370
|
+
while (node !== void 0 && !ts59.isFunctionDeclaration(node)) {
|
|
13415
13371
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
13416
13372
|
return null;
|
|
13417
13373
|
}
|
|
@@ -13428,7 +13384,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
13428
13384
|
return null;
|
|
13429
13385
|
}
|
|
13430
13386
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
13431
|
-
while (!
|
|
13387
|
+
while (!ts59.isFunctionDeclaration(node)) {
|
|
13432
13388
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
13433
13389
|
return null;
|
|
13434
13390
|
}
|
|
@@ -13438,8 +13394,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
13438
13394
|
}
|
|
13439
13395
|
}
|
|
13440
13396
|
const start = node.getFullStart();
|
|
13441
|
-
return
|
|
13442
|
-
if (kind !==
|
|
13397
|
+
return ts59.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
13398
|
+
if (kind !== ts59.SyntaxKind.MultiLineCommentTrivia) {
|
|
13443
13399
|
return null;
|
|
13444
13400
|
}
|
|
13445
13401
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -13456,29 +13412,29 @@ function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams, refl
|
|
|
13456
13412
|
throw new Error(`${node.name.text} requires an inline type constructor`);
|
|
13457
13413
|
}
|
|
13458
13414
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
13459
|
-
const rawType =
|
|
13415
|
+
const rawType = ts60.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
13460
13416
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
13461
13417
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
13462
13418
|
if (meta.body) {
|
|
13463
|
-
const fnType =
|
|
13464
|
-
const decl =
|
|
13465
|
-
const declList =
|
|
13466
|
-
return
|
|
13419
|
+
const fnType = ts60.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
13420
|
+
const decl = ts60.createVariableDeclaration(meta.fnName, fnType, ts60.createNonNullExpression(ts60.createNull()));
|
|
13421
|
+
const declList = ts60.createVariableDeclarationList([decl], ts60.NodeFlags.Const);
|
|
13422
|
+
return ts60.createVariableStatement(void 0, declList);
|
|
13467
13423
|
} else {
|
|
13468
|
-
return
|
|
13424
|
+
return ts60.createFunctionDeclaration(void 0, [ts60.createModifier(ts60.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
13469
13425
|
}
|
|
13470
13426
|
}
|
|
13471
13427
|
function generateInlineTypeCtor(node, meta) {
|
|
13472
13428
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
13473
|
-
const rawType =
|
|
13429
|
+
const rawType = ts60.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
13474
13430
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
13475
13431
|
let body = void 0;
|
|
13476
13432
|
if (meta.body) {
|
|
13477
|
-
body =
|
|
13478
|
-
|
|
13433
|
+
body = ts60.createBlock([
|
|
13434
|
+
ts60.createReturn(ts60.createNonNullExpression(ts60.createNull()))
|
|
13479
13435
|
]);
|
|
13480
13436
|
}
|
|
13481
|
-
return
|
|
13437
|
+
return ts60.createMethod(void 0, [ts60.createModifier(ts60.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
13482
13438
|
}
|
|
13483
13439
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
13484
13440
|
let initType = null;
|
|
@@ -13487,26 +13443,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
13487
13443
|
const coercedKeys = [];
|
|
13488
13444
|
for (const key of keys) {
|
|
13489
13445
|
if (!meta.coercedInputFields.has(key)) {
|
|
13490
|
-
plainKeys.push(
|
|
13446
|
+
plainKeys.push(ts60.createLiteralTypeNode(ts60.createStringLiteral(key)));
|
|
13491
13447
|
} else {
|
|
13492
|
-
coercedKeys.push(
|
|
13448
|
+
coercedKeys.push(ts60.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key), void 0));
|
|
13493
13449
|
}
|
|
13494
13450
|
}
|
|
13495
13451
|
if (plainKeys.length > 0) {
|
|
13496
|
-
const keyTypeUnion =
|
|
13497
|
-
initType =
|
|
13452
|
+
const keyTypeUnion = ts60.createUnionTypeNode(plainKeys);
|
|
13453
|
+
initType = ts60.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
13498
13454
|
}
|
|
13499
13455
|
if (coercedKeys.length > 0) {
|
|
13500
|
-
const coercedLiteral =
|
|
13501
|
-
initType = initType !== null ?
|
|
13456
|
+
const coercedLiteral = ts60.createTypeLiteralNode(coercedKeys);
|
|
13457
|
+
initType = initType !== null ? ts60.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
13502
13458
|
}
|
|
13503
13459
|
if (initType === null) {
|
|
13504
|
-
initType =
|
|
13460
|
+
initType = ts60.createTypeLiteralNode([]);
|
|
13505
13461
|
}
|
|
13506
|
-
return
|
|
13462
|
+
return ts60.createParameter(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
13507
13463
|
}
|
|
13508
13464
|
function generateGenericArgs(params) {
|
|
13509
|
-
return params.map((param) =>
|
|
13465
|
+
return params.map((param) => ts60.createTypeReferenceNode(param.name, void 0));
|
|
13510
13466
|
}
|
|
13511
13467
|
function requiresInlineTypeCtor(node, host) {
|
|
13512
13468
|
return !checkIfGenericTypeBoundsAreContextFree(node, host);
|
|
@@ -13517,7 +13473,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
13517
13473
|
}
|
|
13518
13474
|
return params.map((param) => {
|
|
13519
13475
|
if (param.default === void 0) {
|
|
13520
|
-
return
|
|
13476
|
+
return ts60.updateTypeParameterDeclaration(param, param.name, param.constraint, ts60.createKeywordTypeNode(ts60.SyntaxKind.AnyKeyword));
|
|
13521
13477
|
} else {
|
|
13522
13478
|
return param;
|
|
13523
13479
|
}
|
|
@@ -13549,13 +13505,13 @@ var Environment = class {
|
|
|
13549
13505
|
}
|
|
13550
13506
|
if (requiresInlineTypeCtor(node, this.reflector)) {
|
|
13551
13507
|
const ref = this.reference(dirRef);
|
|
13552
|
-
const typeCtorExpr =
|
|
13508
|
+
const typeCtorExpr = ts61.createPropertyAccess(ref, "ngTypeCtor");
|
|
13553
13509
|
this.typeCtors.set(node, typeCtorExpr);
|
|
13554
13510
|
return typeCtorExpr;
|
|
13555
13511
|
} else {
|
|
13556
13512
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
13557
13513
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
13558
|
-
if (!
|
|
13514
|
+
if (!ts61.isTypeReferenceNode(nodeTypeRef)) {
|
|
13559
13515
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
13560
13516
|
}
|
|
13561
13517
|
const meta = {
|
|
@@ -13571,7 +13527,7 @@ var Environment = class {
|
|
|
13571
13527
|
const typeParams = this.emitTypeParameters(node);
|
|
13572
13528
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams, this.reflector);
|
|
13573
13529
|
this.typeCtorStatements.push(typeCtor);
|
|
13574
|
-
const fnId =
|
|
13530
|
+
const fnId = ts61.createIdentifier(fnName);
|
|
13575
13531
|
this.typeCtors.set(node, fnId);
|
|
13576
13532
|
return fnId;
|
|
13577
13533
|
}
|
|
@@ -13581,7 +13537,7 @@ var Environment = class {
|
|
|
13581
13537
|
return this.pipeInsts.get(ref.node);
|
|
13582
13538
|
}
|
|
13583
13539
|
const pipeType = this.referenceType(ref);
|
|
13584
|
-
const pipeInstId =
|
|
13540
|
+
const pipeInstId = ts61.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
13585
13541
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
13586
13542
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
13587
13543
|
return pipeInstId;
|
|
@@ -13612,7 +13568,7 @@ var Environment = class {
|
|
|
13612
13568
|
|
|
13613
13569
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
13614
13570
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
13615
|
-
import
|
|
13571
|
+
import ts62 from "typescript";
|
|
13616
13572
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
13617
13573
|
constructor(resolver) {
|
|
13618
13574
|
this.resolver = resolver;
|
|
@@ -13626,7 +13582,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13626
13582
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
13627
13583
|
const value = ref.value.trim();
|
|
13628
13584
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
13629
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
13585
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
13630
13586
|
}
|
|
13631
13587
|
missingPipe(templateId, ast) {
|
|
13632
13588
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -13638,7 +13594,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13638
13594
|
if (sourceSpan === null) {
|
|
13639
13595
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
13640
13596
|
}
|
|
13641
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
13597
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
13642
13598
|
this.recordedPipes.add(ast);
|
|
13643
13599
|
}
|
|
13644
13600
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -13649,7 +13605,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13649
13605
|
if (sourceSpan === null) {
|
|
13650
13606
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
13651
13607
|
}
|
|
13652
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
13608
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
13653
13609
|
text: `The variable ${assignment.name} is declared here.`,
|
|
13654
13610
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
13655
13611
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -13659,7 +13615,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13659
13615
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
13660
13616
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
13661
13617
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
13662
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
13618
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
13663
13619
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
13664
13620
|
start: firstDecl.sourceSpan.start.offset,
|
|
13665
13621
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -13698,7 +13654,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13698
13654
|
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.
|
|
13699
13655
|
|
|
13700
13656
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
13701
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
13657
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts62.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
13702
13658
|
}
|
|
13703
13659
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
13704
13660
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -13732,7 +13688,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
13732
13688
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
13733
13689
|
});
|
|
13734
13690
|
}
|
|
13735
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
13691
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
13736
13692
|
}
|
|
13737
13693
|
};
|
|
13738
13694
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -13743,7 +13699,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
13743
13699
|
}
|
|
13744
13700
|
|
|
13745
13701
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
13746
|
-
import
|
|
13702
|
+
import ts63 from "typescript";
|
|
13747
13703
|
var TypeCheckShimGenerator = class {
|
|
13748
13704
|
constructor() {
|
|
13749
13705
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -13753,7 +13709,7 @@ var TypeCheckShimGenerator = class {
|
|
|
13753
13709
|
if (priorShimSf !== null) {
|
|
13754
13710
|
return priorShimSf;
|
|
13755
13711
|
}
|
|
13756
|
-
return
|
|
13712
|
+
return ts63.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts63.ScriptTarget.Latest, true, ts63.ScriptKind.TS);
|
|
13757
13713
|
}
|
|
13758
13714
|
static shimFor(fileName) {
|
|
13759
13715
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -13762,16 +13718,16 @@ var TypeCheckShimGenerator = class {
|
|
|
13762
13718
|
|
|
13763
13719
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
13764
13720
|
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, 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";
|
|
13765
|
-
import
|
|
13721
|
+
import ts66 from "typescript";
|
|
13766
13722
|
|
|
13767
13723
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
13768
13724
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
13769
|
-
import
|
|
13725
|
+
import ts64 from "typescript";
|
|
13770
13726
|
function wrapForDiagnostics(expr) {
|
|
13771
|
-
return
|
|
13727
|
+
return ts64.createParen(expr);
|
|
13772
13728
|
}
|
|
13773
13729
|
function wrapForTypeChecker(expr) {
|
|
13774
|
-
return
|
|
13730
|
+
return ts64.createParen(expr);
|
|
13775
13731
|
}
|
|
13776
13732
|
function addParseSpanInfo(node, span) {
|
|
13777
13733
|
let commentText;
|
|
@@ -13780,10 +13736,10 @@ function addParseSpanInfo(node, span) {
|
|
|
13780
13736
|
} else {
|
|
13781
13737
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
13782
13738
|
}
|
|
13783
|
-
|
|
13739
|
+
ts64.addSyntheticTrailingComment(node, ts64.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
13784
13740
|
}
|
|
13785
13741
|
function addTemplateId(tcb, id) {
|
|
13786
|
-
|
|
13742
|
+
ts64.addSyntheticLeadingComment(tcb, ts64.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
13787
13743
|
}
|
|
13788
13744
|
function shouldReportDiagnostic(diagnostic) {
|
|
13789
13745
|
const { code } = diagnostic;
|
|
@@ -13812,32 +13768,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
13812
13768
|
|
|
13813
13769
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
13814
13770
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
13815
|
-
import
|
|
13816
|
-
var NULL_AS_ANY =
|
|
13817
|
-
var UNDEFINED =
|
|
13771
|
+
import ts65 from "typescript";
|
|
13772
|
+
var NULL_AS_ANY = ts65.createAsExpression(ts65.createNull(), ts65.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword));
|
|
13773
|
+
var UNDEFINED = ts65.createIdentifier("undefined");
|
|
13818
13774
|
var UNARY_OPS = new Map([
|
|
13819
|
-
["+",
|
|
13820
|
-
["-",
|
|
13775
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
13776
|
+
["-", ts65.SyntaxKind.MinusToken]
|
|
13821
13777
|
]);
|
|
13822
13778
|
var BINARY_OPS = new Map([
|
|
13823
|
-
["+",
|
|
13824
|
-
["-",
|
|
13825
|
-
["<",
|
|
13826
|
-
[">",
|
|
13827
|
-
["<=",
|
|
13828
|
-
[">=",
|
|
13829
|
-
["==",
|
|
13830
|
-
["===",
|
|
13831
|
-
["*",
|
|
13832
|
-
["/",
|
|
13833
|
-
["%",
|
|
13834
|
-
["!=",
|
|
13835
|
-
["!==",
|
|
13836
|
-
["||",
|
|
13837
|
-
["&&",
|
|
13838
|
-
["&",
|
|
13839
|
-
["|",
|
|
13840
|
-
["??",
|
|
13779
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
13780
|
+
["-", ts65.SyntaxKind.MinusToken],
|
|
13781
|
+
["<", ts65.SyntaxKind.LessThanToken],
|
|
13782
|
+
[">", ts65.SyntaxKind.GreaterThanToken],
|
|
13783
|
+
["<=", ts65.SyntaxKind.LessThanEqualsToken],
|
|
13784
|
+
[">=", ts65.SyntaxKind.GreaterThanEqualsToken],
|
|
13785
|
+
["==", ts65.SyntaxKind.EqualsEqualsToken],
|
|
13786
|
+
["===", ts65.SyntaxKind.EqualsEqualsEqualsToken],
|
|
13787
|
+
["*", ts65.SyntaxKind.AsteriskToken],
|
|
13788
|
+
["/", ts65.SyntaxKind.SlashToken],
|
|
13789
|
+
["%", ts65.SyntaxKind.PercentToken],
|
|
13790
|
+
["!=", ts65.SyntaxKind.ExclamationEqualsToken],
|
|
13791
|
+
["!==", ts65.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
13792
|
+
["||", ts65.SyntaxKind.BarBarToken],
|
|
13793
|
+
["&&", ts65.SyntaxKind.AmpersandAmpersandToken],
|
|
13794
|
+
["&", ts65.SyntaxKind.AmpersandToken],
|
|
13795
|
+
["|", ts65.SyntaxKind.BarToken],
|
|
13796
|
+
["??", ts65.SyntaxKind.QuestionQuestionToken]
|
|
13841
13797
|
]);
|
|
13842
13798
|
function astToTypescript(ast, maybeResolve, config) {
|
|
13843
13799
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -13853,7 +13809,7 @@ var AstTranslator = class {
|
|
|
13853
13809
|
ast = ast.ast;
|
|
13854
13810
|
}
|
|
13855
13811
|
if (ast instanceof EmptyExpr2) {
|
|
13856
|
-
const res =
|
|
13812
|
+
const res = ts65.factory.createIdentifier("undefined");
|
|
13857
13813
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
13858
13814
|
return res;
|
|
13859
13815
|
}
|
|
@@ -13869,7 +13825,7 @@ var AstTranslator = class {
|
|
|
13869
13825
|
if (op === void 0) {
|
|
13870
13826
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
13871
13827
|
}
|
|
13872
|
-
const node = wrapForDiagnostics(
|
|
13828
|
+
const node = wrapForDiagnostics(ts65.createPrefix(op, expr));
|
|
13873
13829
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13874
13830
|
return node;
|
|
13875
13831
|
}
|
|
@@ -13880,13 +13836,13 @@ var AstTranslator = class {
|
|
|
13880
13836
|
if (op === void 0) {
|
|
13881
13837
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
13882
13838
|
}
|
|
13883
|
-
const node =
|
|
13839
|
+
const node = ts65.createBinary(lhs, op, rhs);
|
|
13884
13840
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13885
13841
|
return node;
|
|
13886
13842
|
}
|
|
13887
13843
|
visitChain(ast) {
|
|
13888
13844
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
13889
|
-
const node = wrapForDiagnostics(
|
|
13845
|
+
const node = wrapForDiagnostics(ts65.createCommaList(elements));
|
|
13890
13846
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13891
13847
|
return node;
|
|
13892
13848
|
}
|
|
@@ -13894,7 +13850,7 @@ var AstTranslator = class {
|
|
|
13894
13850
|
const condExpr = this.translate(ast.condition);
|
|
13895
13851
|
const trueExpr = this.translate(ast.trueExp);
|
|
13896
13852
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
13897
|
-
const node =
|
|
13853
|
+
const node = ts65.createParen(ts65.createConditional(condExpr, trueExpr, falseExpr));
|
|
13898
13854
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13899
13855
|
return node;
|
|
13900
13856
|
}
|
|
@@ -13905,26 +13861,26 @@ var AstTranslator = class {
|
|
|
13905
13861
|
throw new Error("Method not implemented.");
|
|
13906
13862
|
}
|
|
13907
13863
|
visitInterpolation(ast) {
|
|
13908
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
13864
|
+
return ast.expressions.reduce((lhs, ast2) => ts65.createBinary(lhs, ts65.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts65.createLiteral(""));
|
|
13909
13865
|
}
|
|
13910
13866
|
visitKeyedRead(ast) {
|
|
13911
13867
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13912
13868
|
const key = this.translate(ast.key);
|
|
13913
|
-
const node =
|
|
13869
|
+
const node = ts65.createElementAccess(receiver, key);
|
|
13914
13870
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13915
13871
|
return node;
|
|
13916
13872
|
}
|
|
13917
13873
|
visitKeyedWrite(ast) {
|
|
13918
13874
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13919
|
-
const left =
|
|
13875
|
+
const left = ts65.createElementAccess(receiver, this.translate(ast.key));
|
|
13920
13876
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
13921
|
-
const node = wrapForDiagnostics(
|
|
13877
|
+
const node = wrapForDiagnostics(ts65.createBinary(left, ts65.SyntaxKind.EqualsToken, right));
|
|
13922
13878
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13923
13879
|
return node;
|
|
13924
13880
|
}
|
|
13925
13881
|
visitLiteralArray(ast) {
|
|
13926
13882
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
13927
|
-
const literal2 =
|
|
13883
|
+
const literal2 = ts65.createArrayLiteral(elements);
|
|
13928
13884
|
const node = this.config.strictLiteralTypes ? literal2 : tsCastToAny(literal2);
|
|
13929
13885
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13930
13886
|
return node;
|
|
@@ -13932,9 +13888,9 @@ var AstTranslator = class {
|
|
|
13932
13888
|
visitLiteralMap(ast) {
|
|
13933
13889
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
13934
13890
|
const value = this.translate(ast.values[idx]);
|
|
13935
|
-
return
|
|
13891
|
+
return ts65.createPropertyAssignment(ts65.createStringLiteral(key), value);
|
|
13936
13892
|
});
|
|
13937
|
-
const literal2 =
|
|
13893
|
+
const literal2 = ts65.createObjectLiteral(properties, true);
|
|
13938
13894
|
const node = this.config.strictLiteralTypes ? literal2 : tsCastToAny(literal2);
|
|
13939
13895
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13940
13896
|
return node;
|
|
@@ -13942,18 +13898,18 @@ var AstTranslator = class {
|
|
|
13942
13898
|
visitLiteralPrimitive(ast) {
|
|
13943
13899
|
let node;
|
|
13944
13900
|
if (ast.value === void 0) {
|
|
13945
|
-
node =
|
|
13901
|
+
node = ts65.createIdentifier("undefined");
|
|
13946
13902
|
} else if (ast.value === null) {
|
|
13947
|
-
node =
|
|
13903
|
+
node = ts65.createNull();
|
|
13948
13904
|
} else {
|
|
13949
|
-
node =
|
|
13905
|
+
node = ts65.createLiteral(ast.value);
|
|
13950
13906
|
}
|
|
13951
13907
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13952
13908
|
return node;
|
|
13953
13909
|
}
|
|
13954
13910
|
visitNonNullAssert(ast) {
|
|
13955
13911
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
13956
|
-
const node =
|
|
13912
|
+
const node = ts65.createNonNullExpression(expr);
|
|
13957
13913
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13958
13914
|
return node;
|
|
13959
13915
|
}
|
|
@@ -13962,13 +13918,13 @@ var AstTranslator = class {
|
|
|
13962
13918
|
}
|
|
13963
13919
|
visitPrefixNot(ast) {
|
|
13964
13920
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
13965
|
-
const node =
|
|
13921
|
+
const node = ts65.createLogicalNot(expression);
|
|
13966
13922
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13967
13923
|
return node;
|
|
13968
13924
|
}
|
|
13969
13925
|
visitPropertyRead(ast) {
|
|
13970
13926
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13971
|
-
const name =
|
|
13927
|
+
const name = ts65.createPropertyAccess(receiver, ast.name);
|
|
13972
13928
|
addParseSpanInfo(name, ast.nameSpan);
|
|
13973
13929
|
const node = wrapForDiagnostics(name);
|
|
13974
13930
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -13976,12 +13932,12 @@ var AstTranslator = class {
|
|
|
13976
13932
|
}
|
|
13977
13933
|
visitPropertyWrite(ast) {
|
|
13978
13934
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13979
|
-
const left =
|
|
13935
|
+
const left = ts65.createPropertyAccess(receiver, ast.name);
|
|
13980
13936
|
addParseSpanInfo(left, ast.nameSpan);
|
|
13981
13937
|
const leftWithPath = wrapForDiagnostics(left);
|
|
13982
13938
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
13983
13939
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
13984
|
-
const node = wrapForDiagnostics(
|
|
13940
|
+
const node = wrapForDiagnostics(ts65.createBinary(leftWithPath, ts65.SyntaxKind.EqualsToken, right));
|
|
13985
13941
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13986
13942
|
return node;
|
|
13987
13943
|
}
|
|
@@ -13992,13 +13948,13 @@ var AstTranslator = class {
|
|
|
13992
13948
|
let node;
|
|
13993
13949
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13994
13950
|
if (this.config.strictSafeNavigationTypes) {
|
|
13995
|
-
const expr =
|
|
13951
|
+
const expr = ts65.createPropertyAccess(ts65.createNonNullExpression(receiver), ast.name);
|
|
13996
13952
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
13997
|
-
node =
|
|
13953
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
13998
13954
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
13999
|
-
node =
|
|
13955
|
+
node = ts65.createPropertyAccess(tsCastToAny(receiver), ast.name);
|
|
14000
13956
|
} else {
|
|
14001
|
-
const expr =
|
|
13957
|
+
const expr = ts65.createPropertyAccess(ts65.createNonNullExpression(receiver), ast.name);
|
|
14002
13958
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
14003
13959
|
node = tsCastToAny(expr);
|
|
14004
13960
|
}
|
|
@@ -14010,13 +13966,13 @@ var AstTranslator = class {
|
|
|
14010
13966
|
const key = this.translate(ast.key);
|
|
14011
13967
|
let node;
|
|
14012
13968
|
if (this.config.strictSafeNavigationTypes) {
|
|
14013
|
-
const expr =
|
|
13969
|
+
const expr = ts65.createElementAccess(ts65.createNonNullExpression(receiver), key);
|
|
14014
13970
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
14015
|
-
node =
|
|
13971
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
14016
13972
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14017
|
-
node =
|
|
13973
|
+
node = ts65.createElementAccess(tsCastToAny(receiver), key);
|
|
14018
13974
|
} else {
|
|
14019
|
-
const expr =
|
|
13975
|
+
const expr = ts65.createElementAccess(ts65.createNonNullExpression(receiver), key);
|
|
14020
13976
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
14021
13977
|
node = tsCastToAny(expr);
|
|
14022
13978
|
}
|
|
@@ -14029,15 +13985,15 @@ var AstTranslator = class {
|
|
|
14029
13985
|
let node;
|
|
14030
13986
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
14031
13987
|
if (this.config.strictSafeNavigationTypes) {
|
|
14032
|
-
const call =
|
|
14033
|
-
node =
|
|
13988
|
+
const call = ts65.createCall(ts65.createNonNullExpression(expr), void 0, args2);
|
|
13989
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, call, UNDEFINED));
|
|
14034
13990
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14035
|
-
node =
|
|
13991
|
+
node = ts65.createCall(tsCastToAny(expr), void 0, args2);
|
|
14036
13992
|
} else {
|
|
14037
|
-
node = tsCastToAny(
|
|
13993
|
+
node = tsCastToAny(ts65.createCall(ts65.createNonNullExpression(expr), void 0, args2));
|
|
14038
13994
|
}
|
|
14039
13995
|
} else {
|
|
14040
|
-
node =
|
|
13996
|
+
node = ts65.createCall(expr, void 0, args2);
|
|
14041
13997
|
}
|
|
14042
13998
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14043
13999
|
return node;
|
|
@@ -14149,7 +14105,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
14149
14105
|
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
14150
14106
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
14151
14107
|
const ctxRawType = env.referenceType(ref);
|
|
14152
|
-
if (!
|
|
14108
|
+
if (!ts66.isTypeReferenceNode(ctxRawType)) {
|
|
14153
14109
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
14154
14110
|
}
|
|
14155
14111
|
let typeParameters = void 0;
|
|
@@ -14161,25 +14117,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
14161
14117
|
switch (genericContextBehavior) {
|
|
14162
14118
|
case TcbGenericContextBehavior.UseEmitter:
|
|
14163
14119
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
14164
|
-
typeArguments = typeParameters.map((param) =>
|
|
14120
|
+
typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
|
|
14165
14121
|
break;
|
|
14166
14122
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
14167
14123
|
typeParameters = [...ref.node.typeParameters];
|
|
14168
|
-
typeArguments = typeParameters.map((param) =>
|
|
14124
|
+
typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
|
|
14169
14125
|
break;
|
|
14170
14126
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
14171
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
14127
|
+
typeArguments = ref.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14172
14128
|
break;
|
|
14173
14129
|
}
|
|
14174
14130
|
}
|
|
14175
14131
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
14176
14132
|
const scopeStatements = scope.render();
|
|
14177
|
-
const innerBody =
|
|
14133
|
+
const innerBody = ts66.createBlock([
|
|
14178
14134
|
...env.getPreludeStatements(),
|
|
14179
14135
|
...scopeStatements
|
|
14180
14136
|
]);
|
|
14181
|
-
const body =
|
|
14182
|
-
const fnDecl =
|
|
14137
|
+
const body = ts66.createBlock([ts66.createIf(ts66.createTrue(), innerBody, void 0)]);
|
|
14138
|
+
const fnDecl = ts66.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
14183
14139
|
addTemplateId(fnDecl, meta.id);
|
|
14184
14140
|
return fnDecl;
|
|
14185
14141
|
}
|
|
@@ -14220,7 +14176,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
14220
14176
|
execute() {
|
|
14221
14177
|
const ctx = this.scope.resolve(this.template);
|
|
14222
14178
|
const id = this.tcb.allocateId();
|
|
14223
|
-
const initializer =
|
|
14179
|
+
const initializer = ts66.createPropertyAccess(ctx, this.variable.value || "$implicit");
|
|
14224
14180
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
14225
14181
|
let variable;
|
|
14226
14182
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -14243,7 +14199,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
14243
14199
|
}
|
|
14244
14200
|
execute() {
|
|
14245
14201
|
const ctx = this.tcb.allocateId();
|
|
14246
|
-
const type =
|
|
14202
|
+
const type = ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword);
|
|
14247
14203
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
14248
14204
|
return ctx;
|
|
14249
14205
|
}
|
|
@@ -14296,16 +14252,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
14296
14252
|
}
|
|
14297
14253
|
let guard = null;
|
|
14298
14254
|
if (directiveGuards.length > 0) {
|
|
14299
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
14255
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts66.createBinary(expr, ts66.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
14300
14256
|
}
|
|
14301
14257
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
14302
14258
|
const statements = tmplScope.render();
|
|
14303
14259
|
if (statements.length === 0) {
|
|
14304
14260
|
return null;
|
|
14305
14261
|
}
|
|
14306
|
-
let tmplBlock =
|
|
14262
|
+
let tmplBlock = ts66.createBlock(statements);
|
|
14307
14263
|
if (guard !== null) {
|
|
14308
|
-
tmplBlock =
|
|
14264
|
+
tmplBlock = ts66.createIf(guard, tmplBlock);
|
|
14309
14265
|
}
|
|
14310
14266
|
this.scope.addStatement(tmplBlock);
|
|
14311
14267
|
return null;
|
|
@@ -14323,7 +14279,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
14323
14279
|
}
|
|
14324
14280
|
execute() {
|
|
14325
14281
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
14326
|
-
this.scope.addStatement(
|
|
14282
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14327
14283
|
return null;
|
|
14328
14284
|
}
|
|
14329
14285
|
};
|
|
@@ -14345,11 +14301,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
14345
14301
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
14346
14302
|
type = rawType;
|
|
14347
14303
|
} else {
|
|
14348
|
-
if (!
|
|
14304
|
+
if (!ts66.isTypeReferenceNode(rawType)) {
|
|
14349
14305
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
14350
14306
|
}
|
|
14351
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
14352
|
-
type =
|
|
14307
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14308
|
+
type = ts66.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
14353
14309
|
}
|
|
14354
14310
|
const id = this.tcb.allocateId();
|
|
14355
14311
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -14390,11 +14346,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
14390
14346
|
const id = this.tcb.allocateId();
|
|
14391
14347
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
14392
14348
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
14393
|
-
initializer =
|
|
14349
|
+
initializer = ts66.createAsExpression(initializer, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14394
14350
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
14395
|
-
initializer =
|
|
14396
|
-
initializer =
|
|
14397
|
-
initializer =
|
|
14351
|
+
initializer = ts66.createAsExpression(initializer, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14352
|
+
initializer = ts66.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
14353
|
+
initializer = ts66.createParen(initializer);
|
|
14398
14354
|
}
|
|
14399
14355
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
14400
14356
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -14484,7 +14440,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14484
14440
|
let target;
|
|
14485
14441
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
14486
14442
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
14487
|
-
if (!
|
|
14443
|
+
if (!ts66.isTypeReferenceNode(dirTypeRef)) {
|
|
14488
14444
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
14489
14445
|
}
|
|
14490
14446
|
const id = this.tcb.allocateId();
|
|
@@ -14499,10 +14455,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14499
14455
|
}
|
|
14500
14456
|
const id = this.tcb.allocateId();
|
|
14501
14457
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
14502
|
-
if (!
|
|
14458
|
+
if (!ts66.isTypeReferenceNode(dirTypeRef)) {
|
|
14503
14459
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
14504
14460
|
}
|
|
14505
|
-
const type =
|
|
14461
|
+
const type = ts66.createIndexedAccessTypeNode(ts66.createTypeQueryNode(dirId), ts66.createLiteralTypeNode(ts66.createStringLiteral(fieldName)));
|
|
14506
14462
|
const temp = tsDeclareVariable(id, type);
|
|
14507
14463
|
this.scope.addStatement(temp);
|
|
14508
14464
|
target = id;
|
|
@@ -14510,18 +14466,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14510
14466
|
if (dirId === null) {
|
|
14511
14467
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
14512
14468
|
}
|
|
14513
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
14469
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts66.createElementAccess(dirId, ts66.createStringLiteral(fieldName)) : ts66.createPropertyAccess(dirId, ts66.createIdentifier(fieldName));
|
|
14514
14470
|
}
|
|
14515
14471
|
if (input.attribute.keySpan !== void 0) {
|
|
14516
14472
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
14517
14473
|
}
|
|
14518
|
-
assignment =
|
|
14474
|
+
assignment = ts66.createBinary(target, ts66.SyntaxKind.EqualsToken, assignment);
|
|
14519
14475
|
}
|
|
14520
14476
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
14521
14477
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
14522
14478
|
markIgnoreDiagnostics(assignment);
|
|
14523
14479
|
}
|
|
14524
|
-
this.scope.addStatement(
|
|
14480
|
+
this.scope.addStatement(ts66.createExpressionStatement(assignment));
|
|
14525
14481
|
}
|
|
14526
14482
|
return null;
|
|
14527
14483
|
}
|
|
@@ -14540,7 +14496,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
14540
14496
|
execute() {
|
|
14541
14497
|
const id = this.tcb.allocateId();
|
|
14542
14498
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
14543
|
-
const circularPlaceholder =
|
|
14499
|
+
const circularPlaceholder = ts66.createCall(typeCtor, void 0, [ts66.createNonNullExpression(ts66.createNull())]);
|
|
14544
14500
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
14545
14501
|
return id;
|
|
14546
14502
|
}
|
|
@@ -14606,15 +14562,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
14606
14562
|
elId = this.scope.resolve(this.element);
|
|
14607
14563
|
}
|
|
14608
14564
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
14609
|
-
const prop =
|
|
14610
|
-
const stmt =
|
|
14565
|
+
const prop = ts66.createElementAccess(elId, ts66.createStringLiteral(propertyName));
|
|
14566
|
+
const stmt = ts66.createBinary(prop, ts66.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
14611
14567
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
14612
|
-
this.scope.addStatement(
|
|
14568
|
+
this.scope.addStatement(ts66.createExpressionStatement(stmt));
|
|
14613
14569
|
} else {
|
|
14614
|
-
this.scope.addStatement(
|
|
14570
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14615
14571
|
}
|
|
14616
14572
|
} else {
|
|
14617
|
-
this.scope.addStatement(
|
|
14573
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14618
14574
|
}
|
|
14619
14575
|
}
|
|
14620
14576
|
return null;
|
|
@@ -14646,18 +14602,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
14646
14602
|
if (dirId === null) {
|
|
14647
14603
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
14648
14604
|
}
|
|
14649
|
-
const outputField =
|
|
14605
|
+
const outputField = ts66.createElementAccess(dirId, ts66.createStringLiteral(field));
|
|
14650
14606
|
addParseSpanInfo(outputField, output.keySpan);
|
|
14651
14607
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
14652
14608
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
14653
|
-
const subscribeFn =
|
|
14654
|
-
const call =
|
|
14609
|
+
const subscribeFn = ts66.createPropertyAccess(outputField, "subscribe");
|
|
14610
|
+
const call = ts66.createCall(subscribeFn, void 0, [handler]);
|
|
14655
14611
|
addParseSpanInfo(call, output.sourceSpan);
|
|
14656
|
-
this.scope.addStatement(
|
|
14612
|
+
this.scope.addStatement(ts66.createExpressionStatement(call));
|
|
14657
14613
|
} else {
|
|
14658
|
-
this.scope.addStatement(
|
|
14614
|
+
this.scope.addStatement(ts66.createExpressionStatement(outputField));
|
|
14659
14615
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
14660
|
-
this.scope.addStatement(
|
|
14616
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14661
14617
|
}
|
|
14662
14618
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
14663
14619
|
}
|
|
@@ -14690,20 +14646,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
14690
14646
|
if (output.type === 1) {
|
|
14691
14647
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
14692
14648
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
14693
|
-
this.scope.addStatement(
|
|
14649
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14694
14650
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
14695
14651
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
14696
14652
|
if (elId === null) {
|
|
14697
14653
|
elId = this.scope.resolve(this.element);
|
|
14698
14654
|
}
|
|
14699
|
-
const propertyAccess =
|
|
14655
|
+
const propertyAccess = ts66.createPropertyAccess(elId, "addEventListener");
|
|
14700
14656
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
14701
|
-
const call =
|
|
14657
|
+
const call = ts66.createCall(propertyAccess, void 0, [ts66.createStringLiteral(output.name), handler]);
|
|
14702
14658
|
addParseSpanInfo(call, output.sourceSpan);
|
|
14703
|
-
this.scope.addStatement(
|
|
14659
|
+
this.scope.addStatement(ts66.createExpressionStatement(call));
|
|
14704
14660
|
} else {
|
|
14705
14661
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
14706
|
-
this.scope.addStatement(
|
|
14662
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14707
14663
|
}
|
|
14708
14664
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
14709
14665
|
}
|
|
@@ -14717,15 +14673,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
14717
14673
|
this.optional = false;
|
|
14718
14674
|
}
|
|
14719
14675
|
execute() {
|
|
14720
|
-
const ctx =
|
|
14721
|
-
const ctxDot =
|
|
14676
|
+
const ctx = ts66.createIdentifier("ctx");
|
|
14677
|
+
const ctxDot = ts66.createPropertyAccess(ctx, "");
|
|
14722
14678
|
markIgnoreDiagnostics(ctxDot);
|
|
14723
14679
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
14724
|
-
this.scope.addStatement(
|
|
14680
|
+
this.scope.addStatement(ts66.createExpressionStatement(ctxDot));
|
|
14725
14681
|
return null;
|
|
14726
14682
|
}
|
|
14727
14683
|
};
|
|
14728
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
14684
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts66.createNonNullExpression(ts66.createNull());
|
|
14729
14685
|
var Context2 = class {
|
|
14730
14686
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
14731
14687
|
this.env = env;
|
|
@@ -14738,7 +14694,7 @@ var Context2 = class {
|
|
|
14738
14694
|
this.nextId = 1;
|
|
14739
14695
|
}
|
|
14740
14696
|
allocateId() {
|
|
14741
|
-
return
|
|
14697
|
+
return ts66.createIdentifier(`_t${this.nextId++}`);
|
|
14742
14698
|
}
|
|
14743
14699
|
getPipeByName(name) {
|
|
14744
14700
|
if (!this.pipes.has(name)) {
|
|
@@ -14790,8 +14746,8 @@ var Scope = class {
|
|
|
14790
14746
|
resolve(node, directive) {
|
|
14791
14747
|
const res = this.resolveLocal(node, directive);
|
|
14792
14748
|
if (res !== null) {
|
|
14793
|
-
const clone =
|
|
14794
|
-
|
|
14749
|
+
const clone = ts66.getMutableClone(res);
|
|
14750
|
+
ts66.setSyntheticTrailingComments(clone, []);
|
|
14795
14751
|
return clone;
|
|
14796
14752
|
} else if (this.parent !== null) {
|
|
14797
14753
|
return this.parent.resolve(node, directive);
|
|
@@ -14819,7 +14775,7 @@ var Scope = class {
|
|
|
14819
14775
|
} else if (parentGuards === null) {
|
|
14820
14776
|
return this.guard;
|
|
14821
14777
|
} else {
|
|
14822
|
-
return
|
|
14778
|
+
return ts66.createBinary(parentGuards, ts66.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
14823
14779
|
}
|
|
14824
14780
|
}
|
|
14825
14781
|
resolveLocal(ref, directive) {
|
|
@@ -14999,8 +14955,8 @@ var Scope = class {
|
|
|
14999
14955
|
}
|
|
15000
14956
|
};
|
|
15001
14957
|
function tcbCtxParam(node, name, typeArguments) {
|
|
15002
|
-
const type =
|
|
15003
|
-
return
|
|
14958
|
+
const type = ts66.factory.createTypeReferenceNode(name, typeArguments);
|
|
14959
|
+
return ts66.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
15004
14960
|
}
|
|
15005
14961
|
function tcbExpression(ast, tcb, scope) {
|
|
15006
14962
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -15023,11 +14979,11 @@ var TcbExpressionTranslator = class {
|
|
|
15023
14979
|
return null;
|
|
15024
14980
|
}
|
|
15025
14981
|
const expr = this.translate(ast.value);
|
|
15026
|
-
const result =
|
|
14982
|
+
const result = ts66.createParen(ts66.createBinary(target, ts66.SyntaxKind.EqualsToken, expr));
|
|
15027
14983
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15028
14984
|
return result;
|
|
15029
14985
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
15030
|
-
return
|
|
14986
|
+
return ts66.createIdentifier("ctx");
|
|
15031
14987
|
} else if (ast instanceof BindingPipe) {
|
|
15032
14988
|
const expr = this.translate(ast.exp);
|
|
15033
14989
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -15039,19 +14995,19 @@ var TcbExpressionTranslator = class {
|
|
|
15039
14995
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
15040
14996
|
}
|
|
15041
14997
|
const args2 = ast.args.map((arg) => this.translate(arg));
|
|
15042
|
-
let methodAccess =
|
|
14998
|
+
let methodAccess = ts66.factory.createPropertyAccessExpression(pipe, "transform");
|
|
15043
14999
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
15044
15000
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
15045
|
-
methodAccess =
|
|
15001
|
+
methodAccess = ts66.factory.createAsExpression(methodAccess, ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
15046
15002
|
}
|
|
15047
|
-
const result =
|
|
15003
|
+
const result = ts66.createCall(methodAccess, void 0, [expr, ...args2]);
|
|
15048
15004
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15049
15005
|
return result;
|
|
15050
15006
|
} else if (ast instanceof Call2 && (ast.receiver instanceof PropertyRead2 || ast.receiver instanceof SafePropertyRead3) && !(ast.receiver.receiver instanceof ThisReceiver)) {
|
|
15051
15007
|
if (ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
15052
15008
|
const expr = this.translate(ast.args[0]);
|
|
15053
|
-
const exprAsAny =
|
|
15054
|
-
const result =
|
|
15009
|
+
const exprAsAny = ts66.createAsExpression(expr, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
15010
|
+
const result = ts66.createParen(exprAsAny);
|
|
15055
15011
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15056
15012
|
return result;
|
|
15057
15013
|
}
|
|
@@ -15062,7 +15018,7 @@ var TcbExpressionTranslator = class {
|
|
|
15062
15018
|
const method = wrapForDiagnostics(receiver);
|
|
15063
15019
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
15064
15020
|
const args2 = ast.args.map((arg) => this.translate(arg));
|
|
15065
|
-
const node =
|
|
15021
|
+
const node = ts66.createCall(method, void 0, args2);
|
|
15066
15022
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
15067
15023
|
return node;
|
|
15068
15024
|
} else {
|
|
@@ -15082,17 +15038,17 @@ var TcbExpressionTranslator = class {
|
|
|
15082
15038
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
15083
15039
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
15084
15040
|
const members = inputs.map((input) => {
|
|
15085
|
-
const propertyName =
|
|
15041
|
+
const propertyName = ts66.createStringLiteral(input.field);
|
|
15086
15042
|
if (input.type === "binding") {
|
|
15087
15043
|
const expr = widenBinding(input.expression, tcb);
|
|
15088
|
-
const assignment =
|
|
15044
|
+
const assignment = ts66.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
15089
15045
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
15090
15046
|
return assignment;
|
|
15091
15047
|
} else {
|
|
15092
|
-
return
|
|
15048
|
+
return ts66.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
15093
15049
|
}
|
|
15094
15050
|
});
|
|
15095
|
-
return
|
|
15051
|
+
return ts66.createCall(typeCtor, void 0, [ts66.createObjectLiteral(members)]);
|
|
15096
15052
|
}
|
|
15097
15053
|
function getBoundInputs(directive, node, tcb) {
|
|
15098
15054
|
const boundInputs = [];
|
|
@@ -15118,17 +15074,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
15118
15074
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
15119
15075
|
return tcbExpression(attr.value, tcb, scope);
|
|
15120
15076
|
} else {
|
|
15121
|
-
return
|
|
15077
|
+
return ts66.createStringLiteral(attr.value);
|
|
15122
15078
|
}
|
|
15123
15079
|
}
|
|
15124
15080
|
function widenBinding(expr, tcb) {
|
|
15125
15081
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
15126
15082
|
return tsCastToAny(expr);
|
|
15127
15083
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
15128
|
-
if (
|
|
15084
|
+
if (ts66.isObjectLiteralExpression(expr) || ts66.isArrayLiteralExpression(expr)) {
|
|
15129
15085
|
return expr;
|
|
15130
15086
|
} else {
|
|
15131
|
-
return
|
|
15087
|
+
return ts66.createNonNullExpression(expr);
|
|
15132
15088
|
}
|
|
15133
15089
|
} else {
|
|
15134
15090
|
return expr;
|
|
@@ -15141,18 +15097,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
15141
15097
|
if (eventType === 0) {
|
|
15142
15098
|
eventParamType = void 0;
|
|
15143
15099
|
} else if (eventType === 1) {
|
|
15144
|
-
eventParamType =
|
|
15100
|
+
eventParamType = ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword);
|
|
15145
15101
|
} else {
|
|
15146
15102
|
eventParamType = eventType;
|
|
15147
15103
|
}
|
|
15148
15104
|
const guards = scope.guards();
|
|
15149
|
-
let body =
|
|
15105
|
+
let body = ts66.createExpressionStatement(handler);
|
|
15150
15106
|
if (guards !== null) {
|
|
15151
|
-
body =
|
|
15107
|
+
body = ts66.createIf(guards, body);
|
|
15152
15108
|
}
|
|
15153
|
-
const eventParam =
|
|
15109
|
+
const eventParam = ts66.createParameter(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
15154
15110
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
15155
|
-
return
|
|
15111
|
+
return ts66.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword), ts66.createBlock([body]));
|
|
15156
15112
|
}
|
|
15157
15113
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
15158
15114
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -15180,7 +15136,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
15180
15136
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
15181
15137
|
resolve(ast) {
|
|
15182
15138
|
if (ast instanceof PropertyRead2 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
15183
|
-
const event =
|
|
15139
|
+
const event = ts66.createIdentifier(EVENT_PARAMETER);
|
|
15184
15140
|
addParseSpanInfo(event, ast.nameSpan);
|
|
15185
15141
|
return event;
|
|
15186
15142
|
}
|
|
@@ -15189,32 +15145,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
15189
15145
|
};
|
|
15190
15146
|
|
|
15191
15147
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
15192
|
-
import
|
|
15148
|
+
import ts67 from "typescript";
|
|
15193
15149
|
var TypeCheckFile = class extends Environment {
|
|
15194
15150
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
15195
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
15151
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts67.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts67.ScriptTarget.Latest, true));
|
|
15196
15152
|
this.fileName = fileName;
|
|
15197
15153
|
this.nextTcbId = 1;
|
|
15198
15154
|
this.tcbStatements = [];
|
|
15199
15155
|
}
|
|
15200
15156
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
15201
|
-
const fnId =
|
|
15157
|
+
const fnId = ts67.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
15202
15158
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
15203
15159
|
this.tcbStatements.push(fn);
|
|
15204
15160
|
}
|
|
15205
15161
|
render(removeComments) {
|
|
15206
15162
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
15207
|
-
const printer =
|
|
15163
|
+
const printer = ts67.createPrinter({ removeComments });
|
|
15208
15164
|
source += "\n";
|
|
15209
15165
|
for (const stmt of this.pipeInstStatements) {
|
|
15210
|
-
source += printer.printNode(
|
|
15166
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15211
15167
|
}
|
|
15212
15168
|
for (const stmt of this.typeCtorStatements) {
|
|
15213
|
-
source += printer.printNode(
|
|
15169
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15214
15170
|
}
|
|
15215
15171
|
source += "\n";
|
|
15216
15172
|
for (const stmt of this.tcbStatements) {
|
|
15217
|
-
source += printer.printNode(
|
|
15173
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15218
15174
|
}
|
|
15219
15175
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
15220
15176
|
return source;
|
|
@@ -15322,7 +15278,7 @@ var TypeCheckContextImpl = class {
|
|
|
15322
15278
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
15323
15279
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
15324
15280
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
15325
|
-
const printer =
|
|
15281
|
+
const printer = ts68.createPrinter({ omitTrailingSemicolon: true });
|
|
15326
15282
|
let code = textParts[0];
|
|
15327
15283
|
ops.forEach((op, idx) => {
|
|
15328
15284
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -15403,7 +15359,7 @@ var TypeCheckContextImpl = class {
|
|
|
15403
15359
|
if (span.start.offset === span.end.offset) {
|
|
15404
15360
|
span.end.offset++;
|
|
15405
15361
|
}
|
|
15406
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
15362
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts68.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error2.msg);
|
|
15407
15363
|
});
|
|
15408
15364
|
}
|
|
15409
15365
|
};
|
|
@@ -15421,9 +15377,9 @@ var InlineTcbOp = class {
|
|
|
15421
15377
|
}
|
|
15422
15378
|
execute(im, sf, refEmitter, printer) {
|
|
15423
15379
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
15424
|
-
const fnName =
|
|
15380
|
+
const fnName = ts68.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
15425
15381
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
15426
|
-
return printer.printNode(
|
|
15382
|
+
return printer.printNode(ts68.EmitHint.Unspecified, fn, sf);
|
|
15427
15383
|
}
|
|
15428
15384
|
};
|
|
15429
15385
|
var TypeCtorOp = class {
|
|
@@ -15436,7 +15392,7 @@ var TypeCtorOp = class {
|
|
|
15436
15392
|
}
|
|
15437
15393
|
execute(im, sf, refEmitter, printer) {
|
|
15438
15394
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
15439
|
-
return printer.printNode(
|
|
15395
|
+
return printer.printNode(ts68.EmitHint.Unspecified, tcb, sf);
|
|
15440
15396
|
}
|
|
15441
15397
|
};
|
|
15442
15398
|
function orderOps(op1, op2) {
|
|
@@ -15551,7 +15507,7 @@ var TemplateSourceManager = class {
|
|
|
15551
15507
|
|
|
15552
15508
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
15553
15509
|
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead3, PropertyWrite as PropertyWrite3, 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";
|
|
15554
|
-
import
|
|
15510
|
+
import ts69 from "typescript";
|
|
15555
15511
|
var SymbolBuilder = class {
|
|
15556
15512
|
constructor(shimPath, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
15557
15513
|
this.shimPath = shimPath;
|
|
@@ -15594,7 +15550,7 @@ var SymbolBuilder = class {
|
|
|
15594
15550
|
getSymbolOfElement(element) {
|
|
15595
15551
|
var _a;
|
|
15596
15552
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
15597
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
15553
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts69.isVariableDeclaration });
|
|
15598
15554
|
if (node === null) {
|
|
15599
15555
|
return null;
|
|
15600
15556
|
}
|
|
@@ -15613,12 +15569,12 @@ var SymbolBuilder = class {
|
|
|
15613
15569
|
var _a;
|
|
15614
15570
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
15615
15571
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
15616
|
-
const isDirectiveDeclaration = (node) => (
|
|
15572
|
+
const isDirectiveDeclaration = (node) => (ts69.isTypeNode(node) || ts69.isIdentifier(node)) && ts69.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
15617
15573
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
15618
15574
|
return nodes.map((node) => {
|
|
15619
15575
|
var _a2;
|
|
15620
15576
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
15621
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
15577
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts69.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
15622
15578
|
return null;
|
|
15623
15579
|
}
|
|
15624
15580
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -15687,17 +15643,17 @@ var SymbolBuilder = class {
|
|
|
15687
15643
|
if (!isAccessExpression(n)) {
|
|
15688
15644
|
return false;
|
|
15689
15645
|
}
|
|
15690
|
-
if (
|
|
15646
|
+
if (ts69.isPropertyAccessExpression(n)) {
|
|
15691
15647
|
return n.name.getText() === expectedAccess;
|
|
15692
15648
|
} else {
|
|
15693
|
-
return
|
|
15649
|
+
return ts69.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
15694
15650
|
}
|
|
15695
15651
|
}
|
|
15696
15652
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
15697
15653
|
const bindings = [];
|
|
15698
15654
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
15699
15655
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
15700
|
-
if (!
|
|
15656
|
+
if (!ts69.isPropertyAccessExpression(outputFieldAccess)) {
|
|
15701
15657
|
continue;
|
|
15702
15658
|
}
|
|
15703
15659
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -15716,7 +15672,7 @@ var SymbolBuilder = class {
|
|
|
15716
15672
|
shimLocation: { shimPath: this.shimPath, positionInShimFile }
|
|
15717
15673
|
});
|
|
15718
15674
|
} else {
|
|
15719
|
-
if (!
|
|
15675
|
+
if (!ts69.isElementAccessExpression(outputFieldAccess)) {
|
|
15720
15676
|
continue;
|
|
15721
15677
|
}
|
|
15722
15678
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -15784,11 +15740,11 @@ var SymbolBuilder = class {
|
|
|
15784
15740
|
return null;
|
|
15785
15741
|
}
|
|
15786
15742
|
const [declaration] = tsSymbol.declarations;
|
|
15787
|
-
if (!
|
|
15743
|
+
if (!ts69.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
15788
15744
|
return null;
|
|
15789
15745
|
}
|
|
15790
15746
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
15791
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
15747
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts69.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
15792
15748
|
return null;
|
|
15793
15749
|
}
|
|
15794
15750
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -15804,7 +15760,7 @@ var SymbolBuilder = class {
|
|
|
15804
15760
|
};
|
|
15805
15761
|
}
|
|
15806
15762
|
getSymbolOfVariable(variable) {
|
|
15807
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
15763
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts69.isVariableDeclaration });
|
|
15808
15764
|
if (node === null || node.initializer === void 0) {
|
|
15809
15765
|
return null;
|
|
15810
15766
|
}
|
|
@@ -15826,11 +15782,11 @@ var SymbolBuilder = class {
|
|
|
15826
15782
|
}
|
|
15827
15783
|
getSymbolOfReference(ref) {
|
|
15828
15784
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
15829
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
15785
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts69.isVariableDeclaration });
|
|
15830
15786
|
if (node === null || target === null || node.initializer === void 0) {
|
|
15831
15787
|
return null;
|
|
15832
15788
|
}
|
|
15833
|
-
const originalDeclaration =
|
|
15789
|
+
const originalDeclaration = ts69.isParenthesizedExpression(node.initializer) && ts69.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
15834
15790
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
15835
15791
|
return null;
|
|
15836
15792
|
}
|
|
@@ -15853,7 +15809,7 @@ var SymbolBuilder = class {
|
|
|
15853
15809
|
referenceVarLocation: referenceVarShimLocation
|
|
15854
15810
|
};
|
|
15855
15811
|
} else {
|
|
15856
|
-
if (!
|
|
15812
|
+
if (!ts69.isClassDeclaration(target.directive.ref.node)) {
|
|
15857
15813
|
return null;
|
|
15858
15814
|
}
|
|
15859
15815
|
return {
|
|
@@ -15868,7 +15824,7 @@ var SymbolBuilder = class {
|
|
|
15868
15824
|
}
|
|
15869
15825
|
}
|
|
15870
15826
|
getSymbolOfPipe(expression) {
|
|
15871
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
15827
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts69.isPropertyAccessExpression });
|
|
15872
15828
|
if (methodAccess === null) {
|
|
15873
15829
|
return null;
|
|
15874
15830
|
}
|
|
@@ -15907,7 +15863,7 @@ var SymbolBuilder = class {
|
|
|
15907
15863
|
}
|
|
15908
15864
|
let node = null;
|
|
15909
15865
|
if (expression instanceof PropertyRead3) {
|
|
15910
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
15866
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts69.isPropertyAccessExpression });
|
|
15911
15867
|
}
|
|
15912
15868
|
if (node === null) {
|
|
15913
15869
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -15915,10 +15871,10 @@ var SymbolBuilder = class {
|
|
|
15915
15871
|
if (node === null) {
|
|
15916
15872
|
return null;
|
|
15917
15873
|
}
|
|
15918
|
-
while (
|
|
15874
|
+
while (ts69.isParenthesizedExpression(node)) {
|
|
15919
15875
|
node = node.expression;
|
|
15920
15876
|
}
|
|
15921
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
15877
|
+
if (expression instanceof SafePropertyRead4 && ts69.isConditionalExpression(node)) {
|
|
15922
15878
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
15923
15879
|
if (whenTrueSymbol === null) {
|
|
15924
15880
|
return null;
|
|
@@ -15934,13 +15890,13 @@ var SymbolBuilder = class {
|
|
|
15934
15890
|
}
|
|
15935
15891
|
getSymbolOfTsNode(node) {
|
|
15936
15892
|
var _a;
|
|
15937
|
-
while (
|
|
15893
|
+
while (ts69.isParenthesizedExpression(node)) {
|
|
15938
15894
|
node = node.expression;
|
|
15939
15895
|
}
|
|
15940
15896
|
let tsSymbol;
|
|
15941
|
-
if (
|
|
15897
|
+
if (ts69.isPropertyAccessExpression(node)) {
|
|
15942
15898
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
15943
|
-
} else if (
|
|
15899
|
+
} else if (ts69.isElementAccessExpression(node)) {
|
|
15944
15900
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
15945
15901
|
} else {
|
|
15946
15902
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -15954,13 +15910,13 @@ var SymbolBuilder = class {
|
|
|
15954
15910
|
};
|
|
15955
15911
|
}
|
|
15956
15912
|
getShimPositionForNode(node) {
|
|
15957
|
-
if (
|
|
15913
|
+
if (ts69.isTypeReferenceNode(node)) {
|
|
15958
15914
|
return this.getShimPositionForNode(node.typeName);
|
|
15959
|
-
} else if (
|
|
15915
|
+
} else if (ts69.isQualifiedName(node)) {
|
|
15960
15916
|
return node.right.getStart();
|
|
15961
|
-
} else if (
|
|
15917
|
+
} else if (ts69.isPropertyAccessExpression(node)) {
|
|
15962
15918
|
return node.name.getStart();
|
|
15963
|
-
} else if (
|
|
15919
|
+
} else if (ts69.isElementAccessExpression(node)) {
|
|
15964
15920
|
return node.argumentExpression.getStart();
|
|
15965
15921
|
} else {
|
|
15966
15922
|
return node.getStart();
|
|
@@ -16511,7 +16467,7 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
16511
16467
|
|
|
16512
16468
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
16513
16469
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
16514
|
-
import
|
|
16470
|
+
import ts70 from "typescript";
|
|
16515
16471
|
|
|
16516
16472
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
16517
16473
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
@@ -16604,7 +16560,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
16604
16560
|
return [];
|
|
16605
16561
|
const boundSyntax = node.sourceSpan.toString();
|
|
16606
16562
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
16607
|
-
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, node.sourceSpan,
|
|
16563
|
+
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, node.sourceSpan, ts70.DiagnosticCategory.Warning, ErrorCode.INVALID_BANANA_IN_BOX, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'.
|
|
16608
16564
|
Find more at https://angular.io/guide/two-way-binding`);
|
|
16609
16565
|
return [diagnostic];
|
|
16610
16566
|
}
|
|
@@ -16612,7 +16568,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
16612
16568
|
|
|
16613
16569
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
16614
16570
|
import { Binary } from "@angular/compiler";
|
|
16615
|
-
import
|
|
16571
|
+
import ts71 from "typescript";
|
|
16616
16572
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
16617
16573
|
constructor() {
|
|
16618
16574
|
super(...arguments);
|
|
@@ -16633,7 +16589,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
16633
16589
|
return [];
|
|
16634
16590
|
}
|
|
16635
16591
|
const span = ctx.templateTypeChecker.getTemplateMappingAtShimLocation(symbol.shimLocation).span;
|
|
16636
|
-
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, span,
|
|
16592
|
+
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, span, ts71.DiagnosticCategory.Warning, ErrorCode.NULLISH_COALESCING_NOT_NULLABLE, `The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.`);
|
|
16637
16593
|
return [diagnostic];
|
|
16638
16594
|
}
|
|
16639
16595
|
};
|
|
@@ -16705,7 +16661,7 @@ var NgCompiler = class {
|
|
|
16705
16661
|
this.currentProgram = inputProgram;
|
|
16706
16662
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
16707
16663
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
16708
|
-
const moduleResolutionCache =
|
|
16664
|
+
const moduleResolutionCache = ts72.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
16709
16665
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
16710
16666
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
16711
16667
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -16761,7 +16717,7 @@ var NgCompiler = class {
|
|
|
16761
16717
|
}
|
|
16762
16718
|
for (const clazz of classesToUpdate) {
|
|
16763
16719
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
16764
|
-
if (!
|
|
16720
|
+
if (!ts72.isClassDeclaration(clazz)) {
|
|
16765
16721
|
continue;
|
|
16766
16722
|
}
|
|
16767
16723
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -16900,7 +16856,6 @@ var NgCompiler = class {
|
|
|
16900
16856
|
if (this.adapter.factoryTracker !== null) {
|
|
16901
16857
|
before.push(generatedFactoryTransform(this.adapter.factoryTracker.sourceInfo, importRewriter));
|
|
16902
16858
|
}
|
|
16903
|
-
before.push(ivySwitchTransform);
|
|
16904
16859
|
return { transformers: { before, afterDeclarations } };
|
|
16905
16860
|
}
|
|
16906
16861
|
getIndexedComponents() {
|
|
@@ -17171,17 +17126,17 @@ function isAngularCorePackage(program) {
|
|
|
17171
17126
|
return false;
|
|
17172
17127
|
}
|
|
17173
17128
|
return r3Symbols.statements.some((stmt) => {
|
|
17174
|
-
if (!
|
|
17129
|
+
if (!ts72.isVariableStatement(stmt)) {
|
|
17175
17130
|
return false;
|
|
17176
17131
|
}
|
|
17177
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
17132
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts72.SyntaxKind.ExportKeyword)) {
|
|
17178
17133
|
return false;
|
|
17179
17134
|
}
|
|
17180
17135
|
return stmt.declarationList.declarations.some((decl) => {
|
|
17181
|
-
if (!
|
|
17136
|
+
if (!ts72.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
17182
17137
|
return false;
|
|
17183
17138
|
}
|
|
17184
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
17139
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts72.SyntaxKind.TrueKeyword) {
|
|
17185
17140
|
return false;
|
|
17186
17141
|
}
|
|
17187
17142
|
return true;
|
|
@@ -17194,7 +17149,7 @@ function getR3SymbolsFile(program) {
|
|
|
17194
17149
|
function verifyCompatibleTypeCheckOptions(options) {
|
|
17195
17150
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
17196
17151
|
return {
|
|
17197
|
-
category:
|
|
17152
|
+
category: ts72.DiagnosticCategory.Error,
|
|
17198
17153
|
code: ngErrorCode(ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK),
|
|
17199
17154
|
file: void 0,
|
|
17200
17155
|
start: void 0,
|
|
@@ -17222,7 +17177,7 @@ var ReferenceGraphAdapter = class {
|
|
|
17222
17177
|
for (const { node } of references) {
|
|
17223
17178
|
let sourceFile = node.getSourceFile();
|
|
17224
17179
|
if (sourceFile === void 0) {
|
|
17225
|
-
sourceFile =
|
|
17180
|
+
sourceFile = ts72.getOriginalNode(node).getSourceFile();
|
|
17226
17181
|
}
|
|
17227
17182
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
17228
17183
|
this.graph.add(source, node);
|
|
@@ -17262,7 +17217,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
17262
17217
|
|
|
17263
17218
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
17264
17219
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
17265
|
-
import
|
|
17220
|
+
import ts75 from "typescript";
|
|
17266
17221
|
|
|
17267
17222
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
17268
17223
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -17320,7 +17275,7 @@ function getPathNormalizer(basePath) {
|
|
|
17320
17275
|
}
|
|
17321
17276
|
|
|
17322
17277
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
17323
|
-
import
|
|
17278
|
+
import ts73 from "typescript";
|
|
17324
17279
|
|
|
17325
17280
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/typescript_version.mjs
|
|
17326
17281
|
function toNumbers(value) {
|
|
@@ -17360,7 +17315,7 @@ function compareVersions(v1, v2) {
|
|
|
17360
17315
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
17361
17316
|
var MIN_TS_VERSION = "4.4.2";
|
|
17362
17317
|
var MAX_TS_VERSION = "4.5.0";
|
|
17363
|
-
var tsVersion =
|
|
17318
|
+
var tsVersion = ts73.version;
|
|
17364
17319
|
function checkVersion(version, minVersion, maxVersion) {
|
|
17365
17320
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
17366
17321
|
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
@@ -17371,7 +17326,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
17371
17326
|
}
|
|
17372
17327
|
|
|
17373
17328
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
17374
|
-
import
|
|
17329
|
+
import ts74 from "typescript";
|
|
17375
17330
|
var DelegatingCompilerHost2 = class {
|
|
17376
17331
|
constructor(delegate) {
|
|
17377
17332
|
this.delegate = delegate;
|
|
@@ -17460,7 +17415,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
17460
17415
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
17461
17416
|
if (entryPoint === null) {
|
|
17462
17417
|
diagnostics.push({
|
|
17463
|
-
category:
|
|
17418
|
+
category: ts74.DiagnosticCategory.Error,
|
|
17464
17419
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
17465
17420
|
file: void 0,
|
|
17466
17421
|
start: void 0,
|
|
@@ -17500,10 +17455,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
17500
17455
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
17501
17456
|
}
|
|
17502
17457
|
createCachedResolveModuleNamesFunction() {
|
|
17503
|
-
const moduleResolutionCache =
|
|
17458
|
+
const moduleResolutionCache = ts74.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
17504
17459
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
17505
17460
|
return moduleNames.map((moduleName) => {
|
|
17506
|
-
const module2 =
|
|
17461
|
+
const module2 = ts74.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
17507
17462
|
return module2.resolvedModule;
|
|
17508
17463
|
});
|
|
17509
17464
|
};
|
|
@@ -17524,7 +17479,7 @@ var NgtscProgram = class {
|
|
|
17524
17479
|
if (reuseProgram !== void 0) {
|
|
17525
17480
|
retagAllTsFiles(reuseProgram);
|
|
17526
17481
|
}
|
|
17527
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
17482
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts75.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
17528
17483
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
17529
17484
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
17530
17485
|
this.host.postProgramCreationCleanup();
|
|
@@ -17724,10 +17679,10 @@ function mergeEmitResults(emitResults) {
|
|
|
17724
17679
|
}
|
|
17725
17680
|
|
|
17726
17681
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/downlevel_decorators_transform.mjs
|
|
17727
|
-
import
|
|
17682
|
+
import ts77 from "typescript";
|
|
17728
17683
|
|
|
17729
17684
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.mjs
|
|
17730
|
-
import
|
|
17685
|
+
import ts76 from "typescript";
|
|
17731
17686
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
17732
17687
|
function loadIsReferencedAliasDeclarationPatch(context) {
|
|
17733
17688
|
if (!isTransformationContextWithEmitResolver(context)) {
|
|
@@ -17752,7 +17707,7 @@ function loadIsReferencedAliasDeclarationPatch(context) {
|
|
|
17752
17707
|
return emitResolver[patchedReferencedAliasesSymbol] = referencedAliases;
|
|
17753
17708
|
}
|
|
17754
17709
|
function isAliasImportDeclaration(node) {
|
|
17755
|
-
return
|
|
17710
|
+
return ts76.isImportSpecifier(node) || ts76.isNamespaceImport(node) || ts76.isImportClause(node);
|
|
17756
17711
|
}
|
|
17757
17712
|
function isTransformationContextWithEmitResolver(context) {
|
|
17758
17713
|
return context.getEmitResolver !== void 0;
|
|
@@ -17770,19 +17725,19 @@ function extractMetadataFromSingleDecorator(decorator, diagnostics) {
|
|
|
17770
17725
|
const metadataProperties = [];
|
|
17771
17726
|
const expr = decorator.expression;
|
|
17772
17727
|
switch (expr.kind) {
|
|
17773
|
-
case
|
|
17774
|
-
metadataProperties.push(
|
|
17728
|
+
case ts77.SyntaxKind.Identifier:
|
|
17729
|
+
metadataProperties.push(ts77.createPropertyAssignment("type", expr));
|
|
17775
17730
|
break;
|
|
17776
|
-
case
|
|
17731
|
+
case ts77.SyntaxKind.CallExpression:
|
|
17777
17732
|
const call = expr;
|
|
17778
|
-
metadataProperties.push(
|
|
17733
|
+
metadataProperties.push(ts77.createPropertyAssignment("type", call.expression));
|
|
17779
17734
|
if (call.arguments.length) {
|
|
17780
17735
|
const args2 = [];
|
|
17781
17736
|
for (const arg of call.arguments) {
|
|
17782
17737
|
args2.push(arg);
|
|
17783
17738
|
}
|
|
17784
|
-
const argsArrayLiteral =
|
|
17785
|
-
metadataProperties.push(
|
|
17739
|
+
const argsArrayLiteral = ts77.createArrayLiteral(ts77.createNodeArray(args2, true));
|
|
17740
|
+
metadataProperties.push(ts77.createPropertyAssignment("args", argsArrayLiteral));
|
|
17786
17741
|
}
|
|
17787
17742
|
break;
|
|
17788
17743
|
default:
|
|
@@ -17790,38 +17745,38 @@ function extractMetadataFromSingleDecorator(decorator, diagnostics) {
|
|
|
17790
17745
|
file: decorator.getSourceFile(),
|
|
17791
17746
|
start: decorator.getStart(),
|
|
17792
17747
|
length: decorator.getEnd() - decorator.getStart(),
|
|
17793
|
-
messageText: `${
|
|
17794
|
-
category:
|
|
17748
|
+
messageText: `${ts77.SyntaxKind[decorator.kind]} not implemented in gathering decorator metadata.`,
|
|
17749
|
+
category: ts77.DiagnosticCategory.Error,
|
|
17795
17750
|
code: 0
|
|
17796
17751
|
});
|
|
17797
17752
|
break;
|
|
17798
17753
|
}
|
|
17799
|
-
return
|
|
17754
|
+
return ts77.createObjectLiteral(metadataProperties);
|
|
17800
17755
|
}
|
|
17801
17756
|
function createCtorParametersClassProperty(diagnostics, entityNameToExpression, ctorParameters, isClosureCompilerEnabled) {
|
|
17802
17757
|
const params = [];
|
|
17803
17758
|
for (const ctorParam of ctorParameters) {
|
|
17804
17759
|
if (!ctorParam.type && ctorParam.decorators.length === 0) {
|
|
17805
|
-
params.push(
|
|
17760
|
+
params.push(ts77.createNull());
|
|
17806
17761
|
continue;
|
|
17807
17762
|
}
|
|
17808
17763
|
const paramType = ctorParam.type ? typeReferenceToExpression(entityNameToExpression, ctorParam.type) : void 0;
|
|
17809
|
-
const members = [
|
|
17764
|
+
const members = [ts77.createPropertyAssignment("type", paramType || ts77.createIdentifier("undefined"))];
|
|
17810
17765
|
const decorators = [];
|
|
17811
17766
|
for (const deco of ctorParam.decorators) {
|
|
17812
17767
|
decorators.push(extractMetadataFromSingleDecorator(deco, diagnostics));
|
|
17813
17768
|
}
|
|
17814
17769
|
if (decorators.length) {
|
|
17815
|
-
members.push(
|
|
17770
|
+
members.push(ts77.createPropertyAssignment("decorators", ts77.createArrayLiteral(decorators)));
|
|
17816
17771
|
}
|
|
17817
|
-
params.push(
|
|
17772
|
+
params.push(ts77.createObjectLiteral(members));
|
|
17818
17773
|
}
|
|
17819
|
-
const initializer =
|
|
17820
|
-
const ctorProp =
|
|
17774
|
+
const initializer = ts77.createArrowFunction(void 0, void 0, [], void 0, ts77.createToken(ts77.SyntaxKind.EqualsGreaterThanToken), ts77.createArrayLiteral(params, true));
|
|
17775
|
+
const ctorProp = ts77.createProperty(void 0, [ts77.createToken(ts77.SyntaxKind.StaticKeyword)], "ctorParameters", void 0, void 0, initializer);
|
|
17821
17776
|
if (isClosureCompilerEnabled) {
|
|
17822
|
-
|
|
17777
|
+
ts77.setSyntheticLeadingComments(ctorProp, [
|
|
17823
17778
|
{
|
|
17824
|
-
kind:
|
|
17779
|
+
kind: ts77.SyntaxKind.MultiLineCommentTrivia,
|
|
17825
17780
|
text: [
|
|
17826
17781
|
`*`,
|
|
17827
17782
|
` * @type {function(): !Array<(null|{`,
|
|
@@ -17841,53 +17796,53 @@ function createCtorParametersClassProperty(diagnostics, entityNameToExpression,
|
|
|
17841
17796
|
}
|
|
17842
17797
|
function typeReferenceToExpression(entityNameToExpression, node) {
|
|
17843
17798
|
let kind = node.kind;
|
|
17844
|
-
if (
|
|
17799
|
+
if (ts77.isLiteralTypeNode(node)) {
|
|
17845
17800
|
kind = node.literal.kind;
|
|
17846
17801
|
}
|
|
17847
17802
|
switch (kind) {
|
|
17848
|
-
case
|
|
17849
|
-
case
|
|
17850
|
-
return
|
|
17851
|
-
case
|
|
17852
|
-
case
|
|
17853
|
-
return
|
|
17854
|
-
case
|
|
17855
|
-
case
|
|
17856
|
-
case
|
|
17857
|
-
case
|
|
17858
|
-
return
|
|
17859
|
-
case
|
|
17860
|
-
case
|
|
17861
|
-
return
|
|
17862
|
-
case
|
|
17863
|
-
return
|
|
17864
|
-
case
|
|
17865
|
-
case
|
|
17866
|
-
return
|
|
17867
|
-
case
|
|
17803
|
+
case ts77.SyntaxKind.FunctionType:
|
|
17804
|
+
case ts77.SyntaxKind.ConstructorType:
|
|
17805
|
+
return ts77.createIdentifier("Function");
|
|
17806
|
+
case ts77.SyntaxKind.ArrayType:
|
|
17807
|
+
case ts77.SyntaxKind.TupleType:
|
|
17808
|
+
return ts77.createIdentifier("Array");
|
|
17809
|
+
case ts77.SyntaxKind.TypePredicate:
|
|
17810
|
+
case ts77.SyntaxKind.TrueKeyword:
|
|
17811
|
+
case ts77.SyntaxKind.FalseKeyword:
|
|
17812
|
+
case ts77.SyntaxKind.BooleanKeyword:
|
|
17813
|
+
return ts77.createIdentifier("Boolean");
|
|
17814
|
+
case ts77.SyntaxKind.StringLiteral:
|
|
17815
|
+
case ts77.SyntaxKind.StringKeyword:
|
|
17816
|
+
return ts77.createIdentifier("String");
|
|
17817
|
+
case ts77.SyntaxKind.ObjectKeyword:
|
|
17818
|
+
return ts77.createIdentifier("Object");
|
|
17819
|
+
case ts77.SyntaxKind.NumberKeyword:
|
|
17820
|
+
case ts77.SyntaxKind.NumericLiteral:
|
|
17821
|
+
return ts77.createIdentifier("Number");
|
|
17822
|
+
case ts77.SyntaxKind.TypeReference:
|
|
17868
17823
|
const typeRef = node;
|
|
17869
17824
|
return entityNameToExpression(typeRef.typeName);
|
|
17870
|
-
case
|
|
17871
|
-
const childTypeNodes = node.types.filter((t) => !(
|
|
17825
|
+
case ts77.SyntaxKind.UnionType:
|
|
17826
|
+
const childTypeNodes = node.types.filter((t) => !(ts77.isLiteralTypeNode(t) && t.literal.kind === ts77.SyntaxKind.NullKeyword));
|
|
17872
17827
|
return childTypeNodes.length === 1 ? typeReferenceToExpression(entityNameToExpression, childTypeNodes[0]) : void 0;
|
|
17873
17828
|
default:
|
|
17874
17829
|
return void 0;
|
|
17875
17830
|
}
|
|
17876
17831
|
}
|
|
17877
17832
|
function symbolIsRuntimeValue(typeChecker, symbol) {
|
|
17878
|
-
if (symbol.flags &
|
|
17833
|
+
if (symbol.flags & ts77.SymbolFlags.Alias) {
|
|
17879
17834
|
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
17880
17835
|
}
|
|
17881
|
-
return (symbol.flags &
|
|
17836
|
+
return (symbol.flags & ts77.SymbolFlags.Value & ts77.SymbolFlags.ConstEnumExcludes) !== 0;
|
|
17882
17837
|
}
|
|
17883
17838
|
function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore, isClosureCompilerEnabled, skipClassDecorators) {
|
|
17884
17839
|
function addJSDocTypeAnnotation(node, jsdocType) {
|
|
17885
17840
|
if (!isClosureCompilerEnabled) {
|
|
17886
17841
|
return;
|
|
17887
17842
|
}
|
|
17888
|
-
|
|
17843
|
+
ts77.setSyntheticLeadingComments(node, [
|
|
17889
17844
|
{
|
|
17890
|
-
kind:
|
|
17845
|
+
kind: ts77.SyntaxKind.MultiLineCommentTrivia,
|
|
17891
17846
|
text: `* @type {${jsdocType}} `,
|
|
17892
17847
|
pos: -1,
|
|
17893
17848
|
end: -1,
|
|
@@ -17896,19 +17851,19 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
17896
17851
|
]);
|
|
17897
17852
|
}
|
|
17898
17853
|
function createDecoratorClassProperty(decoratorList) {
|
|
17899
|
-
const modifier =
|
|
17900
|
-
const initializer =
|
|
17901
|
-
const prop =
|
|
17854
|
+
const modifier = ts77.createToken(ts77.SyntaxKind.StaticKeyword);
|
|
17855
|
+
const initializer = ts77.createArrayLiteral(decoratorList, true);
|
|
17856
|
+
const prop = ts77.createProperty(void 0, [modifier], "decorators", void 0, void 0, initializer);
|
|
17902
17857
|
addJSDocTypeAnnotation(prop, DECORATOR_INVOCATION_JSDOC_TYPE);
|
|
17903
17858
|
return prop;
|
|
17904
17859
|
}
|
|
17905
17860
|
function createPropDecoratorsClassProperty(diagnostics2, properties) {
|
|
17906
17861
|
const entries = [];
|
|
17907
17862
|
for (const [name, decorators] of properties.entries()) {
|
|
17908
|
-
entries.push(
|
|
17863
|
+
entries.push(ts77.createPropertyAssignment(name, ts77.createArrayLiteral(decorators.map((deco) => extractMetadataFromSingleDecorator(deco, diagnostics2)))));
|
|
17909
17864
|
}
|
|
17910
|
-
const initializer =
|
|
17911
|
-
const prop =
|
|
17865
|
+
const initializer = ts77.createObjectLiteral(entries, true);
|
|
17866
|
+
const prop = ts77.createProperty(void 0, [ts77.createToken(ts77.SyntaxKind.StaticKeyword)], "propDecorators", void 0, void 0, initializer);
|
|
17912
17867
|
addJSDocTypeAnnotation(prop, `!Object<string, ${DECORATOR_INVOCATION_JSDOC_TYPE}>`);
|
|
17913
17868
|
return prop;
|
|
17914
17869
|
}
|
|
@@ -17919,24 +17874,24 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
17919
17874
|
if (!symbol || !symbolIsRuntimeValue(typeChecker, symbol) || !symbol.declarations || symbol.declarations.length === 0) {
|
|
17920
17875
|
return void 0;
|
|
17921
17876
|
}
|
|
17922
|
-
if (
|
|
17877
|
+
if (ts77.isQualifiedName(name)) {
|
|
17923
17878
|
const containerExpr = entityNameToExpression(name.left);
|
|
17924
17879
|
if (containerExpr === void 0) {
|
|
17925
17880
|
return void 0;
|
|
17926
17881
|
}
|
|
17927
|
-
return
|
|
17882
|
+
return ts77.createPropertyAccess(containerExpr, name.right);
|
|
17928
17883
|
}
|
|
17929
17884
|
const decl = symbol.declarations[0];
|
|
17930
17885
|
if (isAliasImportDeclaration(decl)) {
|
|
17931
17886
|
referencedParameterTypes.add(decl);
|
|
17932
17887
|
if (decl.name !== void 0) {
|
|
17933
|
-
return
|
|
17888
|
+
return ts77.getMutableClone(decl.name);
|
|
17934
17889
|
}
|
|
17935
17890
|
}
|
|
17936
|
-
return
|
|
17891
|
+
return ts77.getMutableClone(name);
|
|
17937
17892
|
}
|
|
17938
17893
|
function transformClassElement(element) {
|
|
17939
|
-
element =
|
|
17894
|
+
element = ts77.visitEachChild(element, decoratorDownlevelVisitor, context);
|
|
17940
17895
|
const decoratorsToKeep = [];
|
|
17941
17896
|
const toLower = [];
|
|
17942
17897
|
const decorators = host.getDecoratorsOfDeclaration(element) || [];
|
|
@@ -17950,26 +17905,26 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
17950
17905
|
}
|
|
17951
17906
|
if (!toLower.length)
|
|
17952
17907
|
return [void 0, element, []];
|
|
17953
|
-
if (!element.name || !
|
|
17908
|
+
if (!element.name || !ts77.isIdentifier(element.name)) {
|
|
17954
17909
|
diagnostics.push({
|
|
17955
17910
|
file: element.getSourceFile(),
|
|
17956
17911
|
start: element.getStart(),
|
|
17957
17912
|
length: element.getEnd() - element.getStart(),
|
|
17958
17913
|
messageText: `Cannot process decorators for class element with non-analyzable name.`,
|
|
17959
|
-
category:
|
|
17914
|
+
category: ts77.DiagnosticCategory.Error,
|
|
17960
17915
|
code: 0
|
|
17961
17916
|
});
|
|
17962
17917
|
return [void 0, element, []];
|
|
17963
17918
|
}
|
|
17964
17919
|
const name = element.name.text;
|
|
17965
|
-
const mutable =
|
|
17966
|
-
mutable.decorators = decoratorsToKeep.length ?
|
|
17920
|
+
const mutable = ts77.getMutableClone(element);
|
|
17921
|
+
mutable.decorators = decoratorsToKeep.length ? ts77.setTextRange(ts77.createNodeArray(decoratorsToKeep), mutable.decorators) : void 0;
|
|
17967
17922
|
return [name, mutable, toLower];
|
|
17968
17923
|
}
|
|
17969
17924
|
function transformConstructor(ctor) {
|
|
17970
|
-
ctor =
|
|
17925
|
+
ctor = ts77.visitEachChild(ctor, decoratorDownlevelVisitor, context);
|
|
17971
17926
|
const newParameters = [];
|
|
17972
|
-
const oldParameters =
|
|
17927
|
+
const oldParameters = ctor.parameters;
|
|
17973
17928
|
const parametersInfo = [];
|
|
17974
17929
|
for (const param of oldParameters) {
|
|
17975
17930
|
const decoratorsToKeep = [];
|
|
@@ -17987,30 +17942,30 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
17987
17942
|
paramInfo.type = param.type;
|
|
17988
17943
|
}
|
|
17989
17944
|
parametersInfo.push(paramInfo);
|
|
17990
|
-
const newParam =
|
|
17945
|
+
const newParam = ts77.updateParameter(param, decoratorsToKeep.length ? decoratorsToKeep : void 0, param.modifiers, param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
|
|
17991
17946
|
newParameters.push(newParam);
|
|
17992
17947
|
}
|
|
17993
|
-
const updated =
|
|
17948
|
+
const updated = ts77.updateConstructor(ctor, ctor.decorators, ctor.modifiers, newParameters, ctor.body);
|
|
17994
17949
|
return [updated, parametersInfo];
|
|
17995
17950
|
}
|
|
17996
17951
|
function transformClassDeclaration(classDecl) {
|
|
17997
|
-
classDecl =
|
|
17952
|
+
classDecl = ts77.getMutableClone(classDecl);
|
|
17998
17953
|
const newMembers = [];
|
|
17999
17954
|
const decoratedProperties = new Map();
|
|
18000
17955
|
let classParameters = null;
|
|
18001
17956
|
for (const member of classDecl.members) {
|
|
18002
17957
|
switch (member.kind) {
|
|
18003
|
-
case
|
|
18004
|
-
case
|
|
18005
|
-
case
|
|
18006
|
-
case
|
|
17958
|
+
case ts77.SyntaxKind.PropertyDeclaration:
|
|
17959
|
+
case ts77.SyntaxKind.GetAccessor:
|
|
17960
|
+
case ts77.SyntaxKind.SetAccessor:
|
|
17961
|
+
case ts77.SyntaxKind.MethodDeclaration: {
|
|
18007
17962
|
const [name, newMember, decorators] = transformClassElement(member);
|
|
18008
17963
|
newMembers.push(newMember);
|
|
18009
17964
|
if (name)
|
|
18010
17965
|
decoratedProperties.set(name, decorators);
|
|
18011
17966
|
continue;
|
|
18012
17967
|
}
|
|
18013
|
-
case
|
|
17968
|
+
case ts77.SyntaxKind.Constructor: {
|
|
18014
17969
|
const ctor = member;
|
|
18015
17970
|
if (!ctor.body)
|
|
18016
17971
|
break;
|
|
@@ -18022,7 +17977,7 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18022
17977
|
default:
|
|
18023
17978
|
break;
|
|
18024
17979
|
}
|
|
18025
|
-
newMembers.push(
|
|
17980
|
+
newMembers.push(ts77.visitEachChild(member, decoratorDownlevelVisitor, context));
|
|
18026
17981
|
}
|
|
18027
17982
|
const decoratorsToKeep = new Set(classDecl.decorators);
|
|
18028
17983
|
const possibleAngularDecorators = host.getDecoratorsOfDeclaration(classDecl) || [];
|
|
@@ -18050,23 +18005,23 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18050
18005
|
if (decoratedProperties.size) {
|
|
18051
18006
|
newMembers.push(createPropDecoratorsClassProperty(diagnostics, decoratedProperties));
|
|
18052
18007
|
}
|
|
18053
|
-
const members =
|
|
18054
|
-
return
|
|
18008
|
+
const members = ts77.setTextRange(ts77.createNodeArray(newMembers, classDecl.members.hasTrailingComma), classDecl.members);
|
|
18009
|
+
return ts77.updateClassDeclaration(classDecl, decoratorsToKeep.size ? Array.from(decoratorsToKeep) : void 0, classDecl.modifiers, classDecl.name, classDecl.typeParameters, classDecl.heritageClauses, members);
|
|
18055
18010
|
}
|
|
18056
18011
|
function decoratorDownlevelVisitor(node) {
|
|
18057
|
-
if (
|
|
18012
|
+
if (ts77.isClassDeclaration(node)) {
|
|
18058
18013
|
return transformClassDeclaration(node);
|
|
18059
18014
|
}
|
|
18060
|
-
return
|
|
18015
|
+
return ts77.visitEachChild(node, decoratorDownlevelVisitor, context);
|
|
18061
18016
|
}
|
|
18062
18017
|
return (sf) => {
|
|
18063
|
-
return
|
|
18018
|
+
return ts77.visitEachChild(sf, decoratorDownlevelVisitor, context);
|
|
18064
18019
|
};
|
|
18065
18020
|
};
|
|
18066
18021
|
}
|
|
18067
18022
|
|
|
18068
18023
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/inline_resources.mjs
|
|
18069
|
-
import
|
|
18024
|
+
import ts78 from "typescript";
|
|
18070
18025
|
var PRECONDITIONS_TEXT = "angularCompilerOptions.enableResourceInlining requires all resources to be statically resolvable.";
|
|
18071
18026
|
function getResourceLoader(host, containingFileName) {
|
|
18072
18027
|
return {
|
|
@@ -18093,7 +18048,7 @@ var InlineResourcesMetadataTransformer = class {
|
|
|
18093
18048
|
start(sourceFile) {
|
|
18094
18049
|
const loader = getResourceLoader(this.host, sourceFile.fileName);
|
|
18095
18050
|
return (value, node) => {
|
|
18096
|
-
if (isClassMetadata(value) &&
|
|
18051
|
+
if (isClassMetadata(value) && ts78.isClassDeclaration(node) && value.decorators) {
|
|
18097
18052
|
value.decorators.forEach((d) => {
|
|
18098
18053
|
if (isMetadataSymbolicCallExpression(d) && isMetadataImportedSymbolReferenceExpression(d.expression) && d.expression.module === "@angular/core" && d.expression.name === "Component" && d.arguments) {
|
|
18099
18054
|
d.arguments = d.arguments.map(this.updateDecoratorMetadata.bind(this, loader));
|
|
@@ -18126,66 +18081,66 @@ function getInlineResourcesTransformFactory(program, host) {
|
|
|
18126
18081
|
return (context) => (sourceFile) => {
|
|
18127
18082
|
const loader = getResourceLoader(host, sourceFile.fileName);
|
|
18128
18083
|
const visitor = (node) => {
|
|
18129
|
-
if (!
|
|
18084
|
+
if (!ts78.isClassDeclaration(node)) {
|
|
18130
18085
|
return node;
|
|
18131
18086
|
}
|
|
18132
|
-
const newDecorators =
|
|
18133
|
-
if (
|
|
18087
|
+
const newDecorators = ts78.visitNodes(node.decorators, (node2) => {
|
|
18088
|
+
if (ts78.isDecorator(node2) && isComponentDecorator(node2, program.getTypeChecker())) {
|
|
18134
18089
|
return updateDecorator(node2, loader);
|
|
18135
18090
|
}
|
|
18136
18091
|
return node2;
|
|
18137
18092
|
});
|
|
18138
|
-
const newMembers =
|
|
18139
|
-
if (
|
|
18093
|
+
const newMembers = ts78.visitNodes(node.members, (node2) => {
|
|
18094
|
+
if (ts78.isClassElement(node2)) {
|
|
18140
18095
|
return updateAnnotations(node2, loader, program.getTypeChecker());
|
|
18141
18096
|
} else {
|
|
18142
18097
|
return node2;
|
|
18143
18098
|
}
|
|
18144
18099
|
});
|
|
18145
|
-
return
|
|
18100
|
+
return ts78.updateClassDeclaration(node, newDecorators, node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], newMembers);
|
|
18146
18101
|
};
|
|
18147
|
-
return
|
|
18102
|
+
return ts78.visitEachChild(sourceFile, visitor, context);
|
|
18148
18103
|
};
|
|
18149
18104
|
}
|
|
18150
18105
|
function updateDecorator(node, loader) {
|
|
18151
|
-
if (!
|
|
18106
|
+
if (!ts78.isCallExpression(node.expression)) {
|
|
18152
18107
|
return node;
|
|
18153
18108
|
}
|
|
18154
18109
|
const expr = node.expression;
|
|
18155
18110
|
const newArguments = updateComponentProperties(expr.arguments, loader);
|
|
18156
|
-
return
|
|
18111
|
+
return ts78.updateDecorator(node, ts78.updateCall(expr, expr.expression, expr.typeArguments, newArguments));
|
|
18157
18112
|
}
|
|
18158
18113
|
function updateAnnotations(node, loader, typeChecker) {
|
|
18159
|
-
if (!
|
|
18114
|
+
if (!ts78.isPropertyDeclaration(node) || !ts78.isIdentifier(node.name) || node.name.text !== "decorators" || !node.initializer || !ts78.isArrayLiteralExpression(node.initializer)) {
|
|
18160
18115
|
return node;
|
|
18161
18116
|
}
|
|
18162
18117
|
const newAnnotations = node.initializer.elements.map((annotation) => {
|
|
18163
|
-
if (!
|
|
18118
|
+
if (!ts78.isObjectLiteralExpression(annotation))
|
|
18164
18119
|
return annotation;
|
|
18165
18120
|
const decoratorType = annotation.properties.find((p2) => isIdentifierNamed(p2, "type"));
|
|
18166
|
-
if (!decoratorType || !
|
|
18121
|
+
if (!decoratorType || !ts78.isPropertyAssignment(decoratorType) || !ts78.isIdentifier(decoratorType.initializer) || !isComponentSymbol(decoratorType.initializer, typeChecker)) {
|
|
18167
18122
|
return annotation;
|
|
18168
18123
|
}
|
|
18169
18124
|
const newAnnotation = annotation.properties.map((prop) => {
|
|
18170
|
-
if (!isIdentifierNamed(prop, "args") || !
|
|
18125
|
+
if (!isIdentifierNamed(prop, "args") || !ts78.isPropertyAssignment(prop) || !ts78.isArrayLiteralExpression(prop.initializer))
|
|
18171
18126
|
return prop;
|
|
18172
|
-
const newDecoratorArgs =
|
|
18127
|
+
const newDecoratorArgs = ts78.updatePropertyAssignment(prop, prop.name, ts78.createArrayLiteral(updateComponentProperties(prop.initializer.elements, loader)));
|
|
18173
18128
|
return newDecoratorArgs;
|
|
18174
18129
|
});
|
|
18175
|
-
return
|
|
18130
|
+
return ts78.updateObjectLiteral(annotation, newAnnotation);
|
|
18176
18131
|
});
|
|
18177
|
-
return
|
|
18132
|
+
return ts78.updateProperty(node, node.decorators, node.modifiers, node.name, node.questionToken, node.type, ts78.updateArrayLiteral(node.initializer, newAnnotations));
|
|
18178
18133
|
}
|
|
18179
18134
|
function isIdentifierNamed(p2, name) {
|
|
18180
|
-
return !!p2.name &&
|
|
18135
|
+
return !!p2.name && ts78.isIdentifier(p2.name) && p2.name.text === name;
|
|
18181
18136
|
}
|
|
18182
18137
|
function isComponentDecorator(node, typeChecker) {
|
|
18183
|
-
if (!
|
|
18138
|
+
if (!ts78.isCallExpression(node.expression)) {
|
|
18184
18139
|
return false;
|
|
18185
18140
|
}
|
|
18186
18141
|
const callExpr = node.expression;
|
|
18187
18142
|
let identifier;
|
|
18188
|
-
if (
|
|
18143
|
+
if (ts78.isIdentifier(callExpr.expression)) {
|
|
18189
18144
|
identifier = callExpr.expression;
|
|
18190
18145
|
} else {
|
|
18191
18146
|
return false;
|
|
@@ -18193,7 +18148,7 @@ function isComponentDecorator(node, typeChecker) {
|
|
|
18193
18148
|
return isComponentSymbol(identifier, typeChecker);
|
|
18194
18149
|
}
|
|
18195
18150
|
function isComponentSymbol(identifier, typeChecker) {
|
|
18196
|
-
if (!
|
|
18151
|
+
if (!ts78.isIdentifier(identifier))
|
|
18197
18152
|
return false;
|
|
18198
18153
|
const symbol = typeChecker.getSymbolAtLocation(identifier);
|
|
18199
18154
|
if (!symbol || !symbol.declarations || !symbol.declarations.length) {
|
|
@@ -18201,7 +18156,7 @@ function isComponentSymbol(identifier, typeChecker) {
|
|
|
18201
18156
|
return false;
|
|
18202
18157
|
}
|
|
18203
18158
|
const declaration = symbol.declarations[0];
|
|
18204
|
-
if (!declaration || !
|
|
18159
|
+
if (!declaration || !ts78.isImportSpecifier(declaration)) {
|
|
18205
18160
|
return false;
|
|
18206
18161
|
}
|
|
18207
18162
|
const name = (declaration.propertyName || declaration.name).text;
|
|
@@ -18213,69 +18168,69 @@ function updateComponentProperties(args2, loader) {
|
|
|
18213
18168
|
return args2;
|
|
18214
18169
|
}
|
|
18215
18170
|
const componentArg = args2[0];
|
|
18216
|
-
if (!
|
|
18171
|
+
if (!ts78.isObjectLiteralExpression(componentArg)) {
|
|
18217
18172
|
return args2;
|
|
18218
18173
|
}
|
|
18219
18174
|
const newProperties = [];
|
|
18220
18175
|
const newStyleExprs = [];
|
|
18221
18176
|
componentArg.properties.forEach((prop) => {
|
|
18222
|
-
if (!
|
|
18177
|
+
if (!ts78.isPropertyAssignment(prop) || ts78.isComputedPropertyName(prop.name)) {
|
|
18223
18178
|
newProperties.push(prop);
|
|
18224
18179
|
return;
|
|
18225
18180
|
}
|
|
18226
18181
|
switch (prop.name.text) {
|
|
18227
18182
|
case "styles":
|
|
18228
|
-
if (!
|
|
18183
|
+
if (!ts78.isArrayLiteralExpression(prop.initializer)) {
|
|
18229
18184
|
throw new Error("styles takes an array argument");
|
|
18230
18185
|
}
|
|
18231
18186
|
newStyleExprs.push(...prop.initializer.elements);
|
|
18232
18187
|
break;
|
|
18233
18188
|
case "styleUrls":
|
|
18234
|
-
if (!
|
|
18189
|
+
if (!ts78.isArrayLiteralExpression(prop.initializer)) {
|
|
18235
18190
|
throw new Error("styleUrls takes an array argument");
|
|
18236
18191
|
}
|
|
18237
18192
|
newStyleExprs.push(...prop.initializer.elements.map((expr) => {
|
|
18238
|
-
if (!
|
|
18193
|
+
if (!ts78.isStringLiteral(expr) && !ts78.isNoSubstitutionTemplateLiteral(expr)) {
|
|
18239
18194
|
throw new Error("Can only accept string literal arguments to styleUrls. " + PRECONDITIONS_TEXT);
|
|
18240
18195
|
}
|
|
18241
18196
|
const styles = loader.get(expr.text);
|
|
18242
|
-
return
|
|
18197
|
+
return ts78.createLiteral(styles);
|
|
18243
18198
|
}));
|
|
18244
18199
|
break;
|
|
18245
18200
|
case "templateUrl":
|
|
18246
|
-
if (!
|
|
18201
|
+
if (!ts78.isStringLiteral(prop.initializer) && !ts78.isNoSubstitutionTemplateLiteral(prop.initializer)) {
|
|
18247
18202
|
throw new Error("Can only accept a string literal argument to templateUrl. " + PRECONDITIONS_TEXT);
|
|
18248
18203
|
}
|
|
18249
18204
|
const template = loader.get(prop.initializer.text);
|
|
18250
|
-
newProperties.push(
|
|
18205
|
+
newProperties.push(ts78.updatePropertyAssignment(prop, ts78.createIdentifier("template"), ts78.createLiteral(template)));
|
|
18251
18206
|
break;
|
|
18252
18207
|
default:
|
|
18253
18208
|
newProperties.push(prop);
|
|
18254
18209
|
}
|
|
18255
18210
|
});
|
|
18256
18211
|
if (newStyleExprs.length > 0) {
|
|
18257
|
-
const newStyles =
|
|
18212
|
+
const newStyles = ts78.createPropertyAssignment(ts78.createIdentifier("styles"), ts78.createArrayLiteral(newStyleExprs));
|
|
18258
18213
|
newProperties.push(newStyles);
|
|
18259
18214
|
}
|
|
18260
|
-
return
|
|
18215
|
+
return ts78.createNodeArray([ts78.updateObjectLiteral(componentArg, newProperties)]);
|
|
18261
18216
|
}
|
|
18262
18217
|
|
|
18263
18218
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/lower_expressions.mjs
|
|
18264
18219
|
import { createLoweredSymbol, isLoweredSymbol } from "@angular/compiler";
|
|
18265
|
-
import
|
|
18220
|
+
import ts79 from "typescript";
|
|
18266
18221
|
function toMap(items, select) {
|
|
18267
18222
|
return new Map(items.map((i) => [select(i), i]));
|
|
18268
18223
|
}
|
|
18269
18224
|
function isLexicalScope(node) {
|
|
18270
18225
|
switch (node.kind) {
|
|
18271
|
-
case
|
|
18272
|
-
case
|
|
18273
|
-
case
|
|
18274
|
-
case
|
|
18275
|
-
case
|
|
18276
|
-
case
|
|
18277
|
-
case
|
|
18278
|
-
case
|
|
18226
|
+
case ts79.SyntaxKind.ArrowFunction:
|
|
18227
|
+
case ts79.SyntaxKind.FunctionExpression:
|
|
18228
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18229
|
+
case ts79.SyntaxKind.ClassExpression:
|
|
18230
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18231
|
+
case ts79.SyntaxKind.FunctionType:
|
|
18232
|
+
case ts79.SyntaxKind.TypeLiteral:
|
|
18233
|
+
case ts79.SyntaxKind.ArrayType:
|
|
18279
18234
|
return true;
|
|
18280
18235
|
}
|
|
18281
18236
|
return false;
|
|
@@ -18292,17 +18247,17 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18292
18247
|
function topLevelStatement(node) {
|
|
18293
18248
|
const declarations = [];
|
|
18294
18249
|
function visitNode(node2) {
|
|
18295
|
-
const { pos: pos2, end: end2, kind, parent: originalParent } =
|
|
18250
|
+
const { pos: pos2, end: end2, kind, parent: originalParent } = ts79.getOriginalNode(node2);
|
|
18296
18251
|
const nodeRequest = requests.get(pos2);
|
|
18297
18252
|
if (nodeRequest && nodeRequest.kind == kind && nodeRequest.end == end2) {
|
|
18298
|
-
if (originalParent && originalParent.kind ===
|
|
18253
|
+
if (originalParent && originalParent.kind === ts79.SyntaxKind.VariableDeclaration) {
|
|
18299
18254
|
const varParent = originalParent;
|
|
18300
|
-
if (varParent.name.kind ===
|
|
18255
|
+
if (varParent.name.kind === ts79.SyntaxKind.Identifier) {
|
|
18301
18256
|
const varName = varParent.name.text;
|
|
18302
18257
|
const exportName2 = nodeRequest.name;
|
|
18303
18258
|
declarations.push({
|
|
18304
18259
|
name: exportName2,
|
|
18305
|
-
node:
|
|
18260
|
+
node: ts79.createIdentifier(varName),
|
|
18306
18261
|
order: 1
|
|
18307
18262
|
});
|
|
18308
18263
|
return node2;
|
|
@@ -18310,18 +18265,18 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18310
18265
|
}
|
|
18311
18266
|
const exportName = nodeRequest.name;
|
|
18312
18267
|
declarations.push({ name: exportName, node: node2, order: 0 });
|
|
18313
|
-
return
|
|
18268
|
+
return ts79.createIdentifier(exportName);
|
|
18314
18269
|
}
|
|
18315
18270
|
let result = node2;
|
|
18316
18271
|
if (shouldVisit(pos2, end2) && !isLexicalScope(node2)) {
|
|
18317
|
-
result =
|
|
18272
|
+
result = ts79.visitEachChild(node2, visitNode, context);
|
|
18318
18273
|
}
|
|
18319
18274
|
return result;
|
|
18320
18275
|
}
|
|
18321
|
-
const { pos, end } =
|
|
18276
|
+
const { pos, end } = ts79.getOriginalNode(node);
|
|
18322
18277
|
let resultStmt;
|
|
18323
18278
|
if (shouldVisit(pos, end)) {
|
|
18324
|
-
resultStmt =
|
|
18279
|
+
resultStmt = ts79.visitEachChild(node, visitNode, context);
|
|
18325
18280
|
} else {
|
|
18326
18281
|
resultStmt = node;
|
|
18327
18282
|
}
|
|
@@ -18350,20 +18305,20 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18350
18305
|
tmpStatements.push(statement);
|
|
18351
18306
|
}
|
|
18352
18307
|
});
|
|
18353
|
-
tmpStatements.push(
|
|
18308
|
+
tmpStatements.push(ts79.createExportDeclaration(void 0, void 0, ts79.createNamedExports(inserts.reduce((accumulator, insert) => [...accumulator, ...insert.declarations], []).map((declaration) => ts79.createExportSpecifier(void 0, declaration.name)))));
|
|
18354
18309
|
newStatements = tmpStatements;
|
|
18355
18310
|
}
|
|
18356
|
-
const newSf =
|
|
18357
|
-
if (!(sourceFile2.flags &
|
|
18358
|
-
newSf.flags &= ~
|
|
18311
|
+
const newSf = ts79.updateSourceFileNode(sourceFile2, ts79.setTextRange(ts79.createNodeArray(newStatements), sourceFile2.statements));
|
|
18312
|
+
if (!(sourceFile2.flags & ts79.NodeFlags.Synthesized)) {
|
|
18313
|
+
newSf.flags &= ~ts79.NodeFlags.Synthesized;
|
|
18359
18314
|
}
|
|
18360
18315
|
return newSf;
|
|
18361
18316
|
}
|
|
18362
18317
|
return visitSourceFile(sourceFile);
|
|
18363
18318
|
}
|
|
18364
18319
|
function createVariableStatementForDeclarations(declarations) {
|
|
18365
|
-
const varDecls = declarations.map((i) =>
|
|
18366
|
-
return
|
|
18320
|
+
const varDecls = declarations.map((i) => ts79.createVariableDeclaration(i.name, void 0, i.node));
|
|
18321
|
+
return ts79.createVariableStatement(void 0, ts79.createVariableDeclarationList(varDecls, ts79.NodeFlags.Const));
|
|
18367
18322
|
}
|
|
18368
18323
|
function getExpressionLoweringTransformFactory(requestsMap, program) {
|
|
18369
18324
|
return (context) => (sourceFile) => {
|
|
@@ -18380,18 +18335,18 @@ function getExpressionLoweringTransformFactory(requestsMap, program) {
|
|
|
18380
18335
|
function isEligibleForLowering(node) {
|
|
18381
18336
|
if (node) {
|
|
18382
18337
|
switch (node.kind) {
|
|
18383
|
-
case
|
|
18384
|
-
case
|
|
18338
|
+
case ts79.SyntaxKind.SourceFile:
|
|
18339
|
+
case ts79.SyntaxKind.Decorator:
|
|
18385
18340
|
return true;
|
|
18386
|
-
case
|
|
18387
|
-
case
|
|
18388
|
-
case
|
|
18389
|
-
case
|
|
18341
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18342
|
+
case ts79.SyntaxKind.InterfaceDeclaration:
|
|
18343
|
+
case ts79.SyntaxKind.EnumDeclaration:
|
|
18344
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18390
18345
|
return false;
|
|
18391
|
-
case
|
|
18392
|
-
const isExported3 = (
|
|
18346
|
+
case ts79.SyntaxKind.VariableDeclaration:
|
|
18347
|
+
const isExported3 = (ts79.getCombinedModifierFlags(node) & ts79.ModifierFlags.Export) == 0;
|
|
18393
18348
|
const varNode = node;
|
|
18394
|
-
return isExported3 || varNode.initializer !== void 0 && (
|
|
18349
|
+
return isExported3 || varNode.initializer !== void 0 && (ts79.isObjectLiteralExpression(varNode.initializer) || ts79.isArrayLiteralExpression(varNode.initializer) || ts79.isCallExpression(varNode.initializer));
|
|
18395
18350
|
}
|
|
18396
18351
|
return isEligibleForLowering(node.parent);
|
|
18397
18352
|
}
|
|
@@ -18404,9 +18359,9 @@ function isRewritten(value) {
|
|
|
18404
18359
|
return isMetadataGlobalReferenceExpression(value) && isLoweredSymbol(value.name);
|
|
18405
18360
|
}
|
|
18406
18361
|
function isLiteralFieldNamed(node, names) {
|
|
18407
|
-
if (node.parent && node.parent.kind ==
|
|
18362
|
+
if (node.parent && node.parent.kind == ts79.SyntaxKind.PropertyAssignment) {
|
|
18408
18363
|
const property = node.parent;
|
|
18409
|
-
if (property.parent && property.parent.kind ==
|
|
18364
|
+
if (property.parent && property.parent.kind == ts79.SyntaxKind.ObjectLiteralExpression && property.name && property.name.kind == ts79.SyntaxKind.Identifier) {
|
|
18410
18365
|
const propertyName = property.name;
|
|
18411
18366
|
return names.has(propertyName.text);
|
|
18412
18367
|
}
|
|
@@ -18442,7 +18397,7 @@ var LowerMetadataTransform = class {
|
|
|
18442
18397
|
const isExportedSymbol = (() => {
|
|
18443
18398
|
let exportTable;
|
|
18444
18399
|
return (node) => {
|
|
18445
|
-
if (node.kind ==
|
|
18400
|
+
if (node.kind == ts79.SyntaxKind.Identifier) {
|
|
18446
18401
|
const ident = node;
|
|
18447
18402
|
if (!exportTable) {
|
|
18448
18403
|
exportTable = createExportTableFor(sourceFile);
|
|
@@ -18453,7 +18408,7 @@ var LowerMetadataTransform = class {
|
|
|
18453
18408
|
};
|
|
18454
18409
|
})();
|
|
18455
18410
|
const isExportedPropertyAccess = (node) => {
|
|
18456
|
-
if (node.kind ===
|
|
18411
|
+
if (node.kind === ts79.SyntaxKind.PropertyAccessExpression) {
|
|
18457
18412
|
const pae = node;
|
|
18458
18413
|
if (isExportedSymbol(pae.expression)) {
|
|
18459
18414
|
return true;
|
|
@@ -18467,7 +18422,7 @@ var LowerMetadataTransform = class {
|
|
|
18467
18422
|
return false;
|
|
18468
18423
|
}
|
|
18469
18424
|
let lowerable = false;
|
|
18470
|
-
if ((node.kind ===
|
|
18425
|
+
if ((node.kind === ts79.SyntaxKind.ArrowFunction || node.kind === ts79.SyntaxKind.FunctionExpression) && isEligibleForLowering(node)) {
|
|
18471
18426
|
lowerable = true;
|
|
18472
18427
|
} else if (isLiteralFieldNamed(node, this.lowerableFieldNames) && isEligibleForLowering(node) && !isExportedSymbol(node) && !isExportedPropertyAccess(node)) {
|
|
18473
18428
|
lowerable = true;
|
|
@@ -18499,35 +18454,35 @@ var LowerMetadataTransform = class {
|
|
|
18499
18454
|
};
|
|
18500
18455
|
function createExportTableFor(sourceFile) {
|
|
18501
18456
|
const exportTable = new Set();
|
|
18502
|
-
|
|
18457
|
+
ts79.forEachChild(sourceFile, function scan(node) {
|
|
18503
18458
|
switch (node.kind) {
|
|
18504
|
-
case
|
|
18505
|
-
case
|
|
18506
|
-
case
|
|
18507
|
-
if ((
|
|
18459
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18460
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18461
|
+
case ts79.SyntaxKind.InterfaceDeclaration:
|
|
18462
|
+
if ((ts79.getCombinedModifierFlags(node) & ts79.ModifierFlags.Export) != 0) {
|
|
18508
18463
|
const classDeclaration = node;
|
|
18509
18464
|
const name = classDeclaration.name;
|
|
18510
18465
|
if (name)
|
|
18511
18466
|
exportTable.add(name.text);
|
|
18512
18467
|
}
|
|
18513
18468
|
break;
|
|
18514
|
-
case
|
|
18469
|
+
case ts79.SyntaxKind.VariableStatement:
|
|
18515
18470
|
const variableStatement = node;
|
|
18516
18471
|
for (const declaration of variableStatement.declarationList.declarations) {
|
|
18517
18472
|
scan(declaration);
|
|
18518
18473
|
}
|
|
18519
18474
|
break;
|
|
18520
|
-
case
|
|
18475
|
+
case ts79.SyntaxKind.VariableDeclaration:
|
|
18521
18476
|
const variableDeclaration = node;
|
|
18522
|
-
if ((
|
|
18477
|
+
if ((ts79.getCombinedModifierFlags(variableDeclaration) & ts79.ModifierFlags.Export) != 0 && variableDeclaration.name.kind == ts79.SyntaxKind.Identifier) {
|
|
18523
18478
|
const name = variableDeclaration.name;
|
|
18524
18479
|
exportTable.add(name.text);
|
|
18525
18480
|
}
|
|
18526
18481
|
break;
|
|
18527
|
-
case
|
|
18482
|
+
case ts79.SyntaxKind.ExportDeclaration:
|
|
18528
18483
|
const exportDeclaration = node;
|
|
18529
18484
|
const { moduleSpecifier, exportClause } = exportDeclaration;
|
|
18530
|
-
if (!moduleSpecifier && exportClause &&
|
|
18485
|
+
if (!moduleSpecifier && exportClause && ts79.isNamedExports(exportClause)) {
|
|
18531
18486
|
exportClause.elements.forEach((spec) => {
|
|
18532
18487
|
exportTable.add(spec.name.text);
|
|
18533
18488
|
});
|
|
@@ -18538,7 +18493,7 @@ function createExportTableFor(sourceFile) {
|
|
|
18538
18493
|
}
|
|
18539
18494
|
|
|
18540
18495
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/metadata_cache.mjs
|
|
18541
|
-
import
|
|
18496
|
+
import ts80 from "typescript";
|
|
18542
18497
|
var MetadataCache = class {
|
|
18543
18498
|
constructor(collector, strict, transformers) {
|
|
18544
18499
|
this.collector = collector;
|
|
@@ -18557,7 +18512,7 @@ var MetadataCache = class {
|
|
|
18557
18512
|
}
|
|
18558
18513
|
let substitute = void 0;
|
|
18559
18514
|
const declarationFile = sourceFile.isDeclarationFile;
|
|
18560
|
-
const moduleFile =
|
|
18515
|
+
const moduleFile = ts80.isExternalModule(sourceFile);
|
|
18561
18516
|
if (!declarationFile && moduleFile) {
|
|
18562
18517
|
for (let transform of this.transformers) {
|
|
18563
18518
|
const transformSubstitute = transform.start(sourceFile);
|
|
@@ -18579,11 +18534,11 @@ var MetadataCache = class {
|
|
|
18579
18534
|
};
|
|
18580
18535
|
|
|
18581
18536
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter_transform.mjs
|
|
18582
|
-
import
|
|
18537
|
+
import ts82 from "typescript";
|
|
18583
18538
|
|
|
18584
18539
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter.mjs
|
|
18585
18540
|
import { BinaryOperator as BinaryOperator2, BuiltinMethod, BuiltinVar, ClassStmt, ExternalExpr as ExternalExpr10, Statement, StmtModifier as StmtModifier2, UnaryOperator as UnaryOperator2 } from "@angular/compiler";
|
|
18586
|
-
import
|
|
18541
|
+
import ts81 from "typescript";
|
|
18587
18542
|
var METHOD_THIS_NAME = "this";
|
|
18588
18543
|
var CATCH_ERROR_NAME = "error";
|
|
18589
18544
|
var CATCH_STACK_NAME = "stack";
|
|
@@ -18597,12 +18552,12 @@ var TypeScriptNodeEmitter = class {
|
|
|
18597
18552
|
const statements = [].concat(...stmts.map((stmt) => stmt.visitStatement(converter, null)).filter((stmt) => stmt != null));
|
|
18598
18553
|
const sourceStatements = [...converter.getReexports(), ...converter.getImports(), ...statements];
|
|
18599
18554
|
if (preamble) {
|
|
18600
|
-
const preambleCommentHolder =
|
|
18601
|
-
|
|
18555
|
+
const preambleCommentHolder = ts81.createNotEmittedStatement(sourceFile);
|
|
18556
|
+
ts81.addSyntheticLeadingComment(preambleCommentHolder, ts81.SyntaxKind.MultiLineCommentTrivia, preamble, true);
|
|
18602
18557
|
sourceStatements.unshift(preambleCommentHolder);
|
|
18603
18558
|
}
|
|
18604
18559
|
converter.updateSourceMap(sourceStatements);
|
|
18605
|
-
const newSourceFile =
|
|
18560
|
+
const newSourceFile = ts81.updateSourceFileNode(sourceFile, sourceStatements);
|
|
18606
18561
|
return [newSourceFile, converter.getNodeMap()];
|
|
18607
18562
|
}
|
|
18608
18563
|
};
|
|
@@ -18615,7 +18570,7 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18615
18570
|
const classNames = new Set(classes.map((classStatement) => classStatement.name));
|
|
18616
18571
|
const prefix = prefixStatements.map((statement) => statement.visitStatement(converter, sourceFile));
|
|
18617
18572
|
let newStatements = sourceFile.statements.map((node) => {
|
|
18618
|
-
if (node.kind ==
|
|
18573
|
+
if (node.kind == ts81.SyntaxKind.ClassDeclaration) {
|
|
18619
18574
|
const classDeclaration = node;
|
|
18620
18575
|
const name = classDeclaration.name;
|
|
18621
18576
|
if (name) {
|
|
@@ -18623,9 +18578,9 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18623
18578
|
if (classStatement) {
|
|
18624
18579
|
classNames.delete(name.text);
|
|
18625
18580
|
const classMemberHolder = converter.visitDeclareClassStmt(classStatement);
|
|
18626
|
-
const newMethods = classMemberHolder.members.filter((member) => member.kind !==
|
|
18581
|
+
const newMethods = classMemberHolder.members.filter((member) => member.kind !== ts81.SyntaxKind.Constructor);
|
|
18627
18582
|
const newMembers = [...classDeclaration.members, ...newMethods];
|
|
18628
|
-
return
|
|
18583
|
+
return ts81.updateClassDeclaration(classDeclaration, classDeclaration.decorators, classDeclaration.modifiers, classDeclaration.name, classDeclaration.typeParameters, classDeclaration.heritageClauses || [], newMembers);
|
|
18629
18584
|
}
|
|
18630
18585
|
}
|
|
18631
18586
|
}
|
|
@@ -18634,13 +18589,13 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18634
18589
|
classNames.size == 0 || error(`${classNames.size == 1 ? "Class" : "Classes"} "${Array.from(classNames.keys()).join(", ")}" not generated`);
|
|
18635
18590
|
const imports = converter.getImports();
|
|
18636
18591
|
if (imports && imports.length) {
|
|
18637
|
-
const index = firstAfter(newStatements, (statement) => statement.kind ===
|
|
18592
|
+
const index = firstAfter(newStatements, (statement) => statement.kind === ts81.SyntaxKind.ImportDeclaration || statement.kind === ts81.SyntaxKind.ImportEqualsDeclaration);
|
|
18638
18593
|
newStatements = [...newStatements.slice(0, index), ...imports, ...prefix, ...newStatements.slice(index)];
|
|
18639
18594
|
} else {
|
|
18640
18595
|
newStatements = [...prefix, ...newStatements];
|
|
18641
18596
|
}
|
|
18642
18597
|
converter.updateSourceMap(newStatements);
|
|
18643
|
-
const newSourceFile =
|
|
18598
|
+
const newSourceFile = ts81.updateSourceFileNode(sourceFile, newStatements);
|
|
18644
18599
|
return [newSourceFile, converter.getNodeMap()];
|
|
18645
18600
|
}
|
|
18646
18601
|
function firstAfter(a, predicate) {
|
|
@@ -18667,20 +18622,20 @@ function escapeLiteral(value) {
|
|
|
18667
18622
|
}
|
|
18668
18623
|
function createLiteral(value) {
|
|
18669
18624
|
if (value === null) {
|
|
18670
|
-
return
|
|
18625
|
+
return ts81.createNull();
|
|
18671
18626
|
} else if (value === void 0) {
|
|
18672
|
-
return
|
|
18627
|
+
return ts81.createIdentifier("undefined");
|
|
18673
18628
|
} else {
|
|
18674
|
-
const result =
|
|
18675
|
-
if (
|
|
18676
|
-
result.kind =
|
|
18629
|
+
const result = ts81.createLiteral(value);
|
|
18630
|
+
if (ts81.isStringLiteral(result) && result.text.indexOf("\\") >= 0) {
|
|
18631
|
+
result.kind = ts81.SyntaxKind.NumericLiteral;
|
|
18677
18632
|
result.text = `"${escapeLiteral(result.text)}"`;
|
|
18678
18633
|
}
|
|
18679
18634
|
return result;
|
|
18680
18635
|
}
|
|
18681
18636
|
}
|
|
18682
18637
|
function isExportTypeStatement(statement) {
|
|
18683
|
-
return !!statement.modifiers && statement.modifiers.some((mod) => mod.kind ===
|
|
18638
|
+
return !!statement.modifiers && statement.modifiers.some((mod) => mod.kind === ts81.SyntaxKind.ExportKeyword);
|
|
18684
18639
|
}
|
|
18685
18640
|
var NodeEmitterVisitor = class {
|
|
18686
18641
|
constructor(annotateForClosureCompiler) {
|
|
@@ -18693,9 +18648,9 @@ var NodeEmitterVisitor = class {
|
|
|
18693
18648
|
}
|
|
18694
18649
|
loadExportedVariableIdentifiers(sourceFile) {
|
|
18695
18650
|
sourceFile.statements.forEach((statement) => {
|
|
18696
|
-
if (
|
|
18651
|
+
if (ts81.isVariableStatement(statement) && isExportTypeStatement(statement)) {
|
|
18697
18652
|
statement.declarationList.declarations.forEach((declaration) => {
|
|
18698
|
-
if (
|
|
18653
|
+
if (ts81.isIdentifier(declaration.name)) {
|
|
18699
18654
|
this._exportedVariableIdentifiers.set(declaration.name.text, declaration.name);
|
|
18700
18655
|
}
|
|
18701
18656
|
});
|
|
@@ -18703,10 +18658,10 @@ var NodeEmitterVisitor = class {
|
|
|
18703
18658
|
});
|
|
18704
18659
|
}
|
|
18705
18660
|
getReexports() {
|
|
18706
|
-
return Array.from(this._reexports.entries()).map(([exportedFilePath, reexports]) =>
|
|
18661
|
+
return Array.from(this._reexports.entries()).map(([exportedFilePath, reexports]) => ts81.createExportDeclaration(void 0, void 0, ts81.createNamedExports(reexports.map(({ name, as }) => ts81.createExportSpecifier(name, as))), createLiteral(exportedFilePath)));
|
|
18707
18662
|
}
|
|
18708
18663
|
getImports() {
|
|
18709
|
-
return Array.from(this._importsWithPrefixes.entries()).map(([namespace, prefix]) =>
|
|
18664
|
+
return Array.from(this._importsWithPrefixes.entries()).map(([namespace, prefix]) => ts81.createImportDeclaration(void 0, void 0, ts81.createImportClause(void 0, ts81.createNamespaceImport(ts81.createIdentifier(prefix))), createLiteral(namespace)));
|
|
18710
18665
|
}
|
|
18711
18666
|
getNodeMap() {
|
|
18712
18667
|
return this._nodeMap;
|
|
@@ -18718,12 +18673,12 @@ var NodeEmitterVisitor = class {
|
|
|
18718
18673
|
const recordLastSourceRange = () => {
|
|
18719
18674
|
if (lastRange && lastRangeStartNode && lastRangeEndNode) {
|
|
18720
18675
|
if (lastRangeStartNode == lastRangeEndNode) {
|
|
18721
|
-
|
|
18676
|
+
ts81.setSourceMapRange(lastRangeEndNode, lastRange);
|
|
18722
18677
|
} else {
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18678
|
+
ts81.setSourceMapRange(lastRangeStartNode, lastRange);
|
|
18679
|
+
ts81.setEmitFlags(lastRangeStartNode, ts81.EmitFlags.NoTrailingSourceMap);
|
|
18680
|
+
ts81.setSourceMapRange(lastRangeEndNode, lastRange);
|
|
18681
|
+
ts81.setEmitFlags(lastRangeEndNode, ts81.EmitFlags.NoLeadingSourceMap);
|
|
18727
18682
|
}
|
|
18728
18683
|
}
|
|
18729
18684
|
};
|
|
@@ -18740,7 +18695,7 @@ var NodeEmitterVisitor = class {
|
|
|
18740
18695
|
lastRangeEndNode = tsNode;
|
|
18741
18696
|
}
|
|
18742
18697
|
}
|
|
18743
|
-
|
|
18698
|
+
ts81.forEachChild(tsNode, visitNode);
|
|
18744
18699
|
};
|
|
18745
18700
|
statements.forEach(visitNode);
|
|
18746
18701
|
recordLastSourceRange();
|
|
@@ -18762,7 +18717,7 @@ var NodeEmitterVisitor = class {
|
|
|
18762
18717
|
if (file.url) {
|
|
18763
18718
|
let source = this._templateSources.get(file);
|
|
18764
18719
|
if (!source) {
|
|
18765
|
-
source =
|
|
18720
|
+
source = ts81.createSourceMapSource(file.url, file.content, (pos) => pos);
|
|
18766
18721
|
this._templateSources.set(file, source);
|
|
18767
18722
|
}
|
|
18768
18723
|
return { pos: span.start.offset, end: span.end.offset, source };
|
|
@@ -18774,7 +18729,7 @@ var NodeEmitterVisitor = class {
|
|
|
18774
18729
|
getModifiers(stmt) {
|
|
18775
18730
|
let modifiers = [];
|
|
18776
18731
|
if (stmt.hasModifier(StmtModifier2.Exported)) {
|
|
18777
|
-
modifiers.push(
|
|
18732
|
+
modifiers.push(ts81.createToken(ts81.SyntaxKind.ExportKeyword));
|
|
18778
18733
|
}
|
|
18779
18734
|
return modifiers;
|
|
18780
18735
|
}
|
|
@@ -18791,86 +18746,86 @@ var NodeEmitterVisitor = class {
|
|
|
18791
18746
|
return null;
|
|
18792
18747
|
}
|
|
18793
18748
|
}
|
|
18794
|
-
const varDeclList =
|
|
18749
|
+
const varDeclList = ts81.createVariableDeclarationList([ts81.createVariableDeclaration(ts81.createIdentifier(stmt.name), void 0, stmt.value && stmt.value.visitExpression(this, null) || void 0)]);
|
|
18795
18750
|
if (stmt.hasModifier(StmtModifier2.Exported)) {
|
|
18796
|
-
const tsVarStmt = this.postProcess(stmt,
|
|
18797
|
-
const exportStmt = this.postProcess(stmt,
|
|
18751
|
+
const tsVarStmt = this.postProcess(stmt, ts81.createVariableStatement([], varDeclList));
|
|
18752
|
+
const exportStmt = this.postProcess(stmt, ts81.createExportDeclaration(void 0, void 0, ts81.createNamedExports([ts81.createExportSpecifier(stmt.name, stmt.name)])));
|
|
18798
18753
|
return [tsVarStmt, exportStmt];
|
|
18799
18754
|
}
|
|
18800
|
-
return this.postProcess(stmt,
|
|
18755
|
+
return this.postProcess(stmt, ts81.createVariableStatement(this.getModifiers(stmt), varDeclList));
|
|
18801
18756
|
}
|
|
18802
18757
|
visitDeclareFunctionStmt(stmt) {
|
|
18803
|
-
return this.postProcess(stmt,
|
|
18758
|
+
return this.postProcess(stmt, ts81.createFunctionDeclaration(void 0, this.getModifiers(stmt), void 0, stmt.name, void 0, stmt.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), void 0, this._visitStatements(stmt.statements)));
|
|
18804
18759
|
}
|
|
18805
18760
|
visitExpressionStmt(stmt) {
|
|
18806
|
-
return this.postProcess(stmt,
|
|
18761
|
+
return this.postProcess(stmt, ts81.createStatement(stmt.expr.visitExpression(this, null)));
|
|
18807
18762
|
}
|
|
18808
18763
|
visitReturnStmt(stmt) {
|
|
18809
|
-
return this.postProcess(stmt,
|
|
18764
|
+
return this.postProcess(stmt, ts81.createReturn(stmt.value ? stmt.value.visitExpression(this, null) : void 0));
|
|
18810
18765
|
}
|
|
18811
18766
|
visitDeclareClassStmt(stmt) {
|
|
18812
18767
|
const modifiers = this.getModifiers(stmt);
|
|
18813
18768
|
const fields = stmt.fields.map((field) => {
|
|
18814
|
-
const property =
|
|
18769
|
+
const property = ts81.createProperty(void 0, translateModifiers(field.modifiers), field.name, void 0, void 0, field.initializer == null ? ts81.createNull() : field.initializer.visitExpression(this, null));
|
|
18815
18770
|
if (this.annotateForClosureCompiler) {
|
|
18816
|
-
|
|
18771
|
+
ts81.addSyntheticLeadingComment(property, ts81.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
|
|
18817
18772
|
}
|
|
18818
18773
|
return property;
|
|
18819
18774
|
});
|
|
18820
|
-
const getters = stmt.getters.map((getter) =>
|
|
18821
|
-
const constructor = stmt.constructorMethod && [
|
|
18822
|
-
const methods = stmt.methods.filter((method) => method.name).map((method) =>
|
|
18823
|
-
return this.postProcess(stmt,
|
|
18775
|
+
const getters = stmt.getters.map((getter) => ts81.createGetAccessor(void 0, void 0, getter.name, [], void 0, this._visitStatements(getter.body)));
|
|
18776
|
+
const constructor = stmt.constructorMethod && [ts81.createConstructor(void 0, void 0, stmt.constructorMethod.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), this._visitStatements(stmt.constructorMethod.body))] || [];
|
|
18777
|
+
const methods = stmt.methods.filter((method) => method.name).map((method) => ts81.createMethod(void 0, translateModifiers(method.modifiers), void 0, method.name, void 0, void 0, method.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), void 0, this._visitStatements(method.body)));
|
|
18778
|
+
return this.postProcess(stmt, ts81.createClassDeclaration(void 0, modifiers, stmt.name, void 0, stmt.parent && [ts81.createHeritageClause(ts81.SyntaxKind.ExtendsKeyword, [stmt.parent.visitExpression(this, null)])] || [], [...fields, ...getters, ...constructor, ...methods]));
|
|
18824
18779
|
}
|
|
18825
18780
|
visitIfStmt(stmt) {
|
|
18826
|
-
return this.postProcess(stmt,
|
|
18781
|
+
return this.postProcess(stmt, ts81.createIf(stmt.condition.visitExpression(this, null), this._visitStatements(stmt.trueCase), stmt.falseCase && stmt.falseCase.length && this._visitStatements(stmt.falseCase) || void 0));
|
|
18827
18782
|
}
|
|
18828
18783
|
visitTryCatchStmt(stmt) {
|
|
18829
|
-
return this.postProcess(stmt,
|
|
18784
|
+
return this.postProcess(stmt, ts81.createTry(this._visitStatements(stmt.bodyStmts), ts81.createCatchClause(CATCH_ERROR_NAME, this._visitStatementsPrefix([ts81.createVariableStatement(void 0, [ts81.createVariableDeclaration(CATCH_STACK_NAME, void 0, ts81.createPropertyAccess(ts81.createIdentifier(CATCH_ERROR_NAME), ts81.createIdentifier(CATCH_STACK_NAME)))])], stmt.catchStmts)), void 0));
|
|
18830
18785
|
}
|
|
18831
18786
|
visitThrowStmt(stmt) {
|
|
18832
|
-
return this.postProcess(stmt,
|
|
18787
|
+
return this.postProcess(stmt, ts81.createThrow(stmt.error.visitExpression(this, null)));
|
|
18833
18788
|
}
|
|
18834
18789
|
visitWrappedNodeExpr(expr) {
|
|
18835
18790
|
return this.postProcess(expr, expr.node);
|
|
18836
18791
|
}
|
|
18837
18792
|
visitTypeofExpr(expr) {
|
|
18838
|
-
const typeOf =
|
|
18793
|
+
const typeOf = ts81.createTypeOf(expr.expr.visitExpression(this, null));
|
|
18839
18794
|
return this.postProcess(expr, typeOf);
|
|
18840
18795
|
}
|
|
18841
18796
|
visitReadVarExpr(expr) {
|
|
18842
18797
|
switch (expr.builtin) {
|
|
18843
18798
|
case BuiltinVar.This:
|
|
18844
|
-
return this.postProcess(expr,
|
|
18799
|
+
return this.postProcess(expr, ts81.createIdentifier(METHOD_THIS_NAME));
|
|
18845
18800
|
case BuiltinVar.CatchError:
|
|
18846
|
-
return this.postProcess(expr,
|
|
18801
|
+
return this.postProcess(expr, ts81.createIdentifier(CATCH_ERROR_NAME));
|
|
18847
18802
|
case BuiltinVar.CatchStack:
|
|
18848
|
-
return this.postProcess(expr,
|
|
18803
|
+
return this.postProcess(expr, ts81.createIdentifier(CATCH_STACK_NAME));
|
|
18849
18804
|
case BuiltinVar.Super:
|
|
18850
|
-
return this.postProcess(expr,
|
|
18805
|
+
return this.postProcess(expr, ts81.createSuper());
|
|
18851
18806
|
}
|
|
18852
18807
|
if (expr.name) {
|
|
18853
|
-
return this.postProcess(expr,
|
|
18808
|
+
return this.postProcess(expr, ts81.createIdentifier(expr.name));
|
|
18854
18809
|
}
|
|
18855
18810
|
throw Error(`Unexpected ReadVarExpr form`);
|
|
18856
18811
|
}
|
|
18857
18812
|
visitWriteVarExpr(expr) {
|
|
18858
|
-
return this.postProcess(expr,
|
|
18813
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createIdentifier(expr.name), expr.value.visitExpression(this, null)));
|
|
18859
18814
|
}
|
|
18860
18815
|
visitWriteKeyExpr(expr) {
|
|
18861
|
-
return this.postProcess(expr,
|
|
18816
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createElementAccess(expr.receiver.visitExpression(this, null), expr.index.visitExpression(this, null)), expr.value.visitExpression(this, null)));
|
|
18862
18817
|
}
|
|
18863
18818
|
visitWritePropExpr(expr) {
|
|
18864
|
-
return this.postProcess(expr,
|
|
18819
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createPropertyAccess(expr.receiver.visitExpression(this, null), expr.name), expr.value.visitExpression(this, null)));
|
|
18865
18820
|
}
|
|
18866
18821
|
visitInvokeFunctionExpr(expr) {
|
|
18867
|
-
return this.postProcess(expr,
|
|
18822
|
+
return this.postProcess(expr, ts81.createCall(expr.fn.visitExpression(this, null), void 0, expr.args.map((arg) => arg.visitExpression(this, null))));
|
|
18868
18823
|
}
|
|
18869
18824
|
visitTaggedTemplateExpr(expr) {
|
|
18870
18825
|
throw new Error("tagged templates are not supported in pre-ivy mode.");
|
|
18871
18826
|
}
|
|
18872
18827
|
visitInstantiateExpr(expr) {
|
|
18873
|
-
return this.postProcess(expr,
|
|
18828
|
+
return this.postProcess(expr, ts81.createNew(expr.classExpr.visitExpression(this, null), void 0, expr.args.map((arg) => arg.visitExpression(this, null))));
|
|
18874
18829
|
}
|
|
18875
18830
|
visitLiteralExpr(expr) {
|
|
18876
18831
|
return this.postProcess(expr, createLiteral(expr.value));
|
|
@@ -18882,10 +18837,10 @@ var NodeEmitterVisitor = class {
|
|
|
18882
18837
|
return this.postProcess(expr, this._visitIdentifier(expr.value));
|
|
18883
18838
|
}
|
|
18884
18839
|
visitConditionalExpr(expr) {
|
|
18885
|
-
return this.postProcess(expr,
|
|
18840
|
+
return this.postProcess(expr, ts81.createParen(ts81.createConditional(expr.condition.visitExpression(this, null), expr.trueCase.visitExpression(this, null), expr.falseCase.visitExpression(this, null))));
|
|
18886
18841
|
}
|
|
18887
18842
|
visitNotExpr(expr) {
|
|
18888
|
-
return this.postProcess(expr,
|
|
18843
|
+
return this.postProcess(expr, ts81.createPrefix(ts81.SyntaxKind.ExclamationToken, expr.condition.visitExpression(this, null)));
|
|
18889
18844
|
}
|
|
18890
18845
|
visitAssertNotNullExpr(expr) {
|
|
18891
18846
|
return expr.condition.visitExpression(this, null);
|
|
@@ -18894,103 +18849,103 @@ var NodeEmitterVisitor = class {
|
|
|
18894
18849
|
return expr.value.visitExpression(this, null);
|
|
18895
18850
|
}
|
|
18896
18851
|
visitFunctionExpr(expr) {
|
|
18897
|
-
return this.postProcess(expr,
|
|
18852
|
+
return this.postProcess(expr, ts81.createFunctionExpression(void 0, void 0, expr.name || void 0, void 0, expr.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), void 0, this._visitStatements(expr.statements)));
|
|
18898
18853
|
}
|
|
18899
18854
|
visitUnaryOperatorExpr(expr) {
|
|
18900
18855
|
let unaryOperator;
|
|
18901
18856
|
switch (expr.operator) {
|
|
18902
18857
|
case UnaryOperator2.Minus:
|
|
18903
|
-
unaryOperator =
|
|
18858
|
+
unaryOperator = ts81.SyntaxKind.MinusToken;
|
|
18904
18859
|
break;
|
|
18905
18860
|
case UnaryOperator2.Plus:
|
|
18906
|
-
unaryOperator =
|
|
18861
|
+
unaryOperator = ts81.SyntaxKind.PlusToken;
|
|
18907
18862
|
break;
|
|
18908
18863
|
default:
|
|
18909
18864
|
throw new Error(`Unknown operator: ${expr.operator}`);
|
|
18910
18865
|
}
|
|
18911
|
-
const binary =
|
|
18912
|
-
return this.postProcess(expr, expr.parens ?
|
|
18866
|
+
const binary = ts81.createPrefix(unaryOperator, expr.expr.visitExpression(this, null));
|
|
18867
|
+
return this.postProcess(expr, expr.parens ? ts81.createParen(binary) : binary);
|
|
18913
18868
|
}
|
|
18914
18869
|
visitBinaryOperatorExpr(expr) {
|
|
18915
18870
|
let binaryOperator;
|
|
18916
18871
|
switch (expr.operator) {
|
|
18917
18872
|
case BinaryOperator2.And:
|
|
18918
|
-
binaryOperator =
|
|
18873
|
+
binaryOperator = ts81.SyntaxKind.AmpersandAmpersandToken;
|
|
18919
18874
|
break;
|
|
18920
18875
|
case BinaryOperator2.BitwiseAnd:
|
|
18921
|
-
binaryOperator =
|
|
18876
|
+
binaryOperator = ts81.SyntaxKind.AmpersandToken;
|
|
18922
18877
|
break;
|
|
18923
18878
|
case BinaryOperator2.Bigger:
|
|
18924
|
-
binaryOperator =
|
|
18879
|
+
binaryOperator = ts81.SyntaxKind.GreaterThanToken;
|
|
18925
18880
|
break;
|
|
18926
18881
|
case BinaryOperator2.BiggerEquals:
|
|
18927
|
-
binaryOperator =
|
|
18882
|
+
binaryOperator = ts81.SyntaxKind.GreaterThanEqualsToken;
|
|
18928
18883
|
break;
|
|
18929
18884
|
case BinaryOperator2.Divide:
|
|
18930
|
-
binaryOperator =
|
|
18885
|
+
binaryOperator = ts81.SyntaxKind.SlashToken;
|
|
18931
18886
|
break;
|
|
18932
18887
|
case BinaryOperator2.Equals:
|
|
18933
|
-
binaryOperator =
|
|
18888
|
+
binaryOperator = ts81.SyntaxKind.EqualsEqualsToken;
|
|
18934
18889
|
break;
|
|
18935
18890
|
case BinaryOperator2.Identical:
|
|
18936
|
-
binaryOperator =
|
|
18891
|
+
binaryOperator = ts81.SyntaxKind.EqualsEqualsEqualsToken;
|
|
18937
18892
|
break;
|
|
18938
18893
|
case BinaryOperator2.Lower:
|
|
18939
|
-
binaryOperator =
|
|
18894
|
+
binaryOperator = ts81.SyntaxKind.LessThanToken;
|
|
18940
18895
|
break;
|
|
18941
18896
|
case BinaryOperator2.LowerEquals:
|
|
18942
|
-
binaryOperator =
|
|
18897
|
+
binaryOperator = ts81.SyntaxKind.LessThanEqualsToken;
|
|
18943
18898
|
break;
|
|
18944
18899
|
case BinaryOperator2.Minus:
|
|
18945
|
-
binaryOperator =
|
|
18900
|
+
binaryOperator = ts81.SyntaxKind.MinusToken;
|
|
18946
18901
|
break;
|
|
18947
18902
|
case BinaryOperator2.Modulo:
|
|
18948
|
-
binaryOperator =
|
|
18903
|
+
binaryOperator = ts81.SyntaxKind.PercentToken;
|
|
18949
18904
|
break;
|
|
18950
18905
|
case BinaryOperator2.Multiply:
|
|
18951
|
-
binaryOperator =
|
|
18906
|
+
binaryOperator = ts81.SyntaxKind.AsteriskToken;
|
|
18952
18907
|
break;
|
|
18953
18908
|
case BinaryOperator2.NotEquals:
|
|
18954
|
-
binaryOperator =
|
|
18909
|
+
binaryOperator = ts81.SyntaxKind.ExclamationEqualsToken;
|
|
18955
18910
|
break;
|
|
18956
18911
|
case BinaryOperator2.NotIdentical:
|
|
18957
|
-
binaryOperator =
|
|
18912
|
+
binaryOperator = ts81.SyntaxKind.ExclamationEqualsEqualsToken;
|
|
18958
18913
|
break;
|
|
18959
18914
|
case BinaryOperator2.Or:
|
|
18960
|
-
binaryOperator =
|
|
18915
|
+
binaryOperator = ts81.SyntaxKind.BarBarToken;
|
|
18961
18916
|
break;
|
|
18962
18917
|
case BinaryOperator2.NullishCoalesce:
|
|
18963
|
-
binaryOperator =
|
|
18918
|
+
binaryOperator = ts81.SyntaxKind.QuestionQuestionToken;
|
|
18964
18919
|
break;
|
|
18965
18920
|
case BinaryOperator2.Plus:
|
|
18966
|
-
binaryOperator =
|
|
18921
|
+
binaryOperator = ts81.SyntaxKind.PlusToken;
|
|
18967
18922
|
break;
|
|
18968
18923
|
default:
|
|
18969
18924
|
throw new Error(`Unknown operator: ${expr.operator}`);
|
|
18970
18925
|
}
|
|
18971
|
-
const binary =
|
|
18972
|
-
return this.postProcess(expr, expr.parens ?
|
|
18926
|
+
const binary = ts81.createBinary(expr.lhs.visitExpression(this, null), binaryOperator, expr.rhs.visitExpression(this, null));
|
|
18927
|
+
return this.postProcess(expr, expr.parens ? ts81.createParen(binary) : binary);
|
|
18973
18928
|
}
|
|
18974
18929
|
visitReadPropExpr(expr) {
|
|
18975
|
-
return this.postProcess(expr,
|
|
18930
|
+
return this.postProcess(expr, ts81.createPropertyAccess(expr.receiver.visitExpression(this, null), expr.name));
|
|
18976
18931
|
}
|
|
18977
18932
|
visitReadKeyExpr(expr) {
|
|
18978
|
-
return this.postProcess(expr,
|
|
18933
|
+
return this.postProcess(expr, ts81.createElementAccess(expr.receiver.visitExpression(this, null), expr.index.visitExpression(this, null)));
|
|
18979
18934
|
}
|
|
18980
18935
|
visitLiteralArrayExpr(expr) {
|
|
18981
|
-
return this.postProcess(expr,
|
|
18936
|
+
return this.postProcess(expr, ts81.createArrayLiteral(expr.entries.map((entry) => entry.visitExpression(this, null))));
|
|
18982
18937
|
}
|
|
18983
18938
|
visitLiteralMapExpr(expr) {
|
|
18984
|
-
return this.postProcess(expr,
|
|
18939
|
+
return this.postProcess(expr, ts81.createObjectLiteral(expr.entries.map((entry) => ts81.createPropertyAssignment(entry.quoted || !_VALID_IDENTIFIER_RE.test(entry.key) ? ts81.createLiteral(entry.key) : entry.key, entry.value.visitExpression(this, null)))));
|
|
18985
18940
|
}
|
|
18986
18941
|
visitCommaExpr(expr) {
|
|
18987
|
-
return this.postProcess(expr, expr.parts.map((e) => e.visitExpression(this, null)).reduce((left, right) => left ?
|
|
18942
|
+
return this.postProcess(expr, expr.parts.map((e) => e.visitExpression(this, null)).reduce((left, right) => left ? ts81.createBinary(left, ts81.SyntaxKind.CommaToken, right) : right, null));
|
|
18988
18943
|
}
|
|
18989
18944
|
_visitStatements(statements) {
|
|
18990
18945
|
return this._visitStatementsPrefix([], statements);
|
|
18991
18946
|
}
|
|
18992
18947
|
_visitStatementsPrefix(prefix, statements) {
|
|
18993
|
-
return
|
|
18948
|
+
return ts81.createBlock([
|
|
18994
18949
|
...prefix,
|
|
18995
18950
|
...statements.map((stmt) => stmt.visitStatement(this, null)).filter((f) => f != null)
|
|
18996
18951
|
]);
|
|
@@ -19004,14 +18959,14 @@ var NodeEmitterVisitor = class {
|
|
|
19004
18959
|
prefix = `i${this._importsWithPrefixes.size}`;
|
|
19005
18960
|
this._importsWithPrefixes.set(moduleName, prefix);
|
|
19006
18961
|
}
|
|
19007
|
-
prefixIdent =
|
|
18962
|
+
prefixIdent = ts81.createIdentifier(prefix);
|
|
19008
18963
|
}
|
|
19009
18964
|
if (prefixIdent) {
|
|
19010
|
-
return
|
|
18965
|
+
return ts81.createPropertyAccess(prefixIdent, name);
|
|
19011
18966
|
} else {
|
|
19012
|
-
const id =
|
|
18967
|
+
const id = ts81.createIdentifier(name);
|
|
19013
18968
|
if (this._exportedVariableIdentifiers.has(name)) {
|
|
19014
|
-
|
|
18969
|
+
ts81.setOriginalNode(id, this._exportedVariableIdentifiers.get(name));
|
|
19015
18970
|
}
|
|
19016
18971
|
return id;
|
|
19017
18972
|
}
|
|
@@ -19020,13 +18975,13 @@ var NodeEmitterVisitor = class {
|
|
|
19020
18975
|
function modifierFromModifier(modifier) {
|
|
19021
18976
|
switch (modifier) {
|
|
19022
18977
|
case StmtModifier2.Exported:
|
|
19023
|
-
return
|
|
18978
|
+
return ts81.createToken(ts81.SyntaxKind.ExportKeyword);
|
|
19024
18979
|
case StmtModifier2.Final:
|
|
19025
|
-
return
|
|
18980
|
+
return ts81.createToken(ts81.SyntaxKind.ConstKeyword);
|
|
19026
18981
|
case StmtModifier2.Private:
|
|
19027
|
-
return
|
|
18982
|
+
return ts81.createToken(ts81.SyntaxKind.PrivateKeyword);
|
|
19028
18983
|
case StmtModifier2.Static:
|
|
19029
|
-
return
|
|
18984
|
+
return ts81.createToken(ts81.SyntaxKind.StaticKeyword);
|
|
19030
18985
|
}
|
|
19031
18986
|
}
|
|
19032
18987
|
function translateModifiers(modifiers) {
|
|
@@ -19056,9 +19011,9 @@ function getAngularEmitterTransformFactory(generatedFiles, program, annotateForC
|
|
|
19056
19011
|
const [newSourceFile] = emitter.updateSourceFile(sourceFile, g.stmts, preamble);
|
|
19057
19012
|
return newSourceFile;
|
|
19058
19013
|
} else if (GENERATED_FILES.test(sourceFile.fileName)) {
|
|
19059
|
-
const commentStmt =
|
|
19060
|
-
|
|
19061
|
-
return
|
|
19014
|
+
const commentStmt = ts82.createNotEmittedStatement(sourceFile);
|
|
19015
|
+
ts82.addSyntheticLeadingComment(commentStmt, ts82.SyntaxKind.MultiLineCommentTrivia, preamble, true);
|
|
19016
|
+
return ts82.updateSourceFileNode(sourceFile, [commentStmt]);
|
|
19062
19017
|
}
|
|
19063
19018
|
return sourceFile;
|
|
19064
19019
|
};
|
|
@@ -19066,11 +19021,11 @@ function getAngularEmitterTransformFactory(generatedFiles, program, annotateForC
|
|
|
19066
19021
|
}
|
|
19067
19022
|
function getFileoverviewComment2(sourceFile) {
|
|
19068
19023
|
const trivia = sourceFile.getFullText().substring(0, sourceFile.getStart());
|
|
19069
|
-
const leadingComments =
|
|
19024
|
+
const leadingComments = ts82.getLeadingCommentRanges(trivia, 0);
|
|
19070
19025
|
if (!leadingComments || leadingComments.length === 0)
|
|
19071
19026
|
return "";
|
|
19072
19027
|
const comment = leadingComments[0];
|
|
19073
|
-
if (comment.kind !==
|
|
19028
|
+
if (comment.kind !== ts82.SyntaxKind.MultiLineCommentTrivia)
|
|
19074
19029
|
return "";
|
|
19075
19030
|
if (sourceFile.getFullText().substring(comment.end, comment.end + 2) !== "\n\n")
|
|
19076
19031
|
return "";
|
|
@@ -19082,7 +19037,7 @@ function getFileoverviewComment2(sourceFile) {
|
|
|
19082
19037
|
|
|
19083
19038
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/r3_metadata_transform.mjs
|
|
19084
19039
|
import { ClassStmt as ClassStmt2, StmtModifier as StmtModifier3 } from "@angular/compiler";
|
|
19085
|
-
import
|
|
19040
|
+
import ts83 from "typescript";
|
|
19086
19041
|
var PartialModuleMetadataTransformer = class {
|
|
19087
19042
|
constructor(modules) {
|
|
19088
19043
|
this.moduleMap = new Map(modules.map((m) => [m.fileName, m]));
|
|
@@ -19093,7 +19048,7 @@ var PartialModuleMetadataTransformer = class {
|
|
|
19093
19048
|
const classMap = new Map(partialModule.statements.filter(isClassStmt).map((s) => [s.name, s]));
|
|
19094
19049
|
if (classMap.size > 0) {
|
|
19095
19050
|
return (value, node) => {
|
|
19096
|
-
if (isClassMetadata(value) && node.kind ===
|
|
19051
|
+
if (isClassMetadata(value) && node.kind === ts83.SyntaxKind.ClassDeclaration) {
|
|
19097
19052
|
const classDeclaration = node;
|
|
19098
19053
|
if (classDeclaration.name) {
|
|
19099
19054
|
const partialClass = classMap.get(classDeclaration.name.text);
|
|
@@ -19542,7 +19497,7 @@ var AngularCompilerProgram = class {
|
|
|
19542
19497
|
}
|
|
19543
19498
|
});
|
|
19544
19499
|
}
|
|
19545
|
-
const tmpProgram =
|
|
19500
|
+
const tmpProgram = ts84.createProgram(rootNames, this.options, this.hostAdapter, oldTsProgram);
|
|
19546
19501
|
if (tempProgramHandlerForTest !== null) {
|
|
19547
19502
|
tempProgramHandlerForTest(tmpProgram);
|
|
19548
19503
|
}
|
|
@@ -19572,7 +19527,7 @@ var AngularCompilerProgram = class {
|
|
|
19572
19527
|
}
|
|
19573
19528
|
}
|
|
19574
19529
|
});
|
|
19575
|
-
this._tsProgram =
|
|
19530
|
+
this._tsProgram = ts84.createProgram(rootNames, this.options, this.hostAdapter, tmpProgram);
|
|
19576
19531
|
if (tsStructureIsReused(this._tsProgram) !== 2) {
|
|
19577
19532
|
throw new Error(`Internal Error: The structure of the program changed during codegen.`);
|
|
19578
19533
|
}
|
|
@@ -19581,7 +19536,7 @@ var AngularCompilerProgram = class {
|
|
|
19581
19536
|
this._analyzedModules = emptyModules;
|
|
19582
19537
|
this.oldTsProgram = void 0;
|
|
19583
19538
|
this._hostAdapter.isSourceFile = () => false;
|
|
19584
|
-
this._tsProgram =
|
|
19539
|
+
this._tsProgram = ts84.createProgram(this.rootNames, this.options, this.hostAdapter);
|
|
19585
19540
|
if (isSyntaxError(e)) {
|
|
19586
19541
|
this._addStructuralDiagnostics(e);
|
|
19587
19542
|
return;
|
|
@@ -19595,7 +19550,7 @@ var AngularCompilerProgram = class {
|
|
|
19595
19550
|
} else {
|
|
19596
19551
|
diagnostics.push({
|
|
19597
19552
|
messageText: error2.toString(),
|
|
19598
|
-
category:
|
|
19553
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19599
19554
|
source: SOURCE,
|
|
19600
19555
|
code: DEFAULT_ERROR_CODE
|
|
19601
19556
|
});
|
|
@@ -19622,7 +19577,7 @@ var AngularCompilerProgram = class {
|
|
|
19622
19577
|
start: void 0,
|
|
19623
19578
|
length: void 0,
|
|
19624
19579
|
messageText: e.message,
|
|
19625
|
-
category:
|
|
19580
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19626
19581
|
source: SOURCE,
|
|
19627
19582
|
code: DEFAULT_ERROR_CODE
|
|
19628
19583
|
}];
|
|
@@ -19727,7 +19682,7 @@ function getNgOptionDiagnostics(options) {
|
|
|
19727
19682
|
default:
|
|
19728
19683
|
return [{
|
|
19729
19684
|
messageText: 'Angular compiler options "annotationsAs" only supports "static fields" and "decorators"',
|
|
19730
|
-
category:
|
|
19685
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19731
19686
|
source: SOURCE,
|
|
19732
19687
|
code: DEFAULT_ERROR_CODE
|
|
19733
19688
|
}];
|
|
@@ -19791,7 +19746,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19791
19746
|
file: diagnosticSourceOfSpan(e.span),
|
|
19792
19747
|
start: e.span.start.offset,
|
|
19793
19748
|
length: e.span.end.offset - e.span.start.offset,
|
|
19794
|
-
category:
|
|
19749
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19795
19750
|
source: SOURCE,
|
|
19796
19751
|
code: DEFAULT_ERROR_CODE
|
|
19797
19752
|
}));
|
|
@@ -19799,7 +19754,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19799
19754
|
return [{
|
|
19800
19755
|
messageText: error2.message,
|
|
19801
19756
|
chain: error2.chain && diagnosticChainFromFormattedDiagnosticChain(error2.chain),
|
|
19802
|
-
category:
|
|
19757
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19803
19758
|
source: SOURCE,
|
|
19804
19759
|
code: DEFAULT_ERROR_CODE,
|
|
19805
19760
|
position: error2.position
|
|
@@ -19818,7 +19773,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19818
19773
|
|
|
19819
19774
|
See https://angular.io/errors/NG6999 for more information.
|
|
19820
19775
|
`,
|
|
19821
|
-
category:
|
|
19776
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19822
19777
|
code: DEFAULT_ERROR_CODE,
|
|
19823
19778
|
source: SOURCE
|
|
19824
19779
|
}];
|
|
@@ -19826,7 +19781,7 @@ See https://angular.io/errors/NG6999 for more information.
|
|
|
19826
19781
|
}
|
|
19827
19782
|
return [{
|
|
19828
19783
|
messageText: error2.message,
|
|
19829
|
-
category:
|
|
19784
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19830
19785
|
code: DEFAULT_ERROR_CODE,
|
|
19831
19786
|
source: SOURCE
|
|
19832
19787
|
}];
|
|
@@ -19837,7 +19792,7 @@ function getDtsClass(program, fileName, className) {
|
|
|
19837
19792
|
return null;
|
|
19838
19793
|
}
|
|
19839
19794
|
for (const stmt of sf.statements) {
|
|
19840
|
-
if (!
|
|
19795
|
+
if (!ts84.isClassDeclaration(stmt)) {
|
|
19841
19796
|
continue;
|
|
19842
19797
|
}
|
|
19843
19798
|
if (stmt.name === void 0 || stmt.name.text !== className) {
|
|
@@ -19849,10 +19804,10 @@ function getDtsClass(program, fileName, className) {
|
|
|
19849
19804
|
}
|
|
19850
19805
|
function isIvyNgModule(clazz) {
|
|
19851
19806
|
for (const member of clazz.members) {
|
|
19852
|
-
if (!
|
|
19807
|
+
if (!ts84.isPropertyDeclaration(member)) {
|
|
19853
19808
|
continue;
|
|
19854
19809
|
}
|
|
19855
|
-
if (
|
|
19810
|
+
if (ts84.isIdentifier(member.name) && member.name.text === "\u0275mod") {
|
|
19856
19811
|
return true;
|
|
19857
19812
|
}
|
|
19858
19813
|
}
|
|
@@ -19861,9 +19816,9 @@ function isIvyNgModule(clazz) {
|
|
|
19861
19816
|
|
|
19862
19817
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
19863
19818
|
var defaultFormatHost = {
|
|
19864
|
-
getCurrentDirectory: () =>
|
|
19819
|
+
getCurrentDirectory: () => ts85.sys.getCurrentDirectory(),
|
|
19865
19820
|
getCanonicalFileName: (fileName) => fileName,
|
|
19866
|
-
getNewLine: () =>
|
|
19821
|
+
getNewLine: () => ts85.sys.newLine
|
|
19867
19822
|
};
|
|
19868
19823
|
function displayFileName(fileName, host) {
|
|
19869
19824
|
return relative(resolve(host.getCurrentDirectory()), resolve(host.getCanonicalFileName(fileName)));
|
|
@@ -19915,7 +19870,7 @@ function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
|
19915
19870
|
if (diags && diags.length) {
|
|
19916
19871
|
return diags.map((diagnostic) => {
|
|
19917
19872
|
if (isTsDiagnostic(diagnostic)) {
|
|
19918
|
-
return replaceTsWithNgInErrors(
|
|
19873
|
+
return replaceTsWithNgInErrors(ts85.formatDiagnosticsWithColorAndContext([diagnostic], host));
|
|
19919
19874
|
} else {
|
|
19920
19875
|
return formatDiagnostic(diagnostic, host);
|
|
19921
19876
|
}
|
|
@@ -19936,7 +19891,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
19936
19891
|
var _a;
|
|
19937
19892
|
try {
|
|
19938
19893
|
const fs5 = getFileSystem();
|
|
19939
|
-
const readConfigFile = (configFile) =>
|
|
19894
|
+
const readConfigFile = (configFile) => ts85.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
19940
19895
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
19941
19896
|
const { config: config2, error: error3 } = readConfigFile(configFile);
|
|
19942
19897
|
if (error3) {
|
|
@@ -19968,7 +19923,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
19968
19923
|
basePath
|
|
19969
19924
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
19970
19925
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
19971
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
19926
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts85.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
19972
19927
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
19973
19928
|
let emitFlags = EmitFlags.Default;
|
|
19974
19929
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -19980,7 +19935,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
19980
19935
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
19981
19936
|
} catch (e) {
|
|
19982
19937
|
const errors = [{
|
|
19983
|
-
category:
|
|
19938
|
+
category: ts85.DiagnosticCategory.Error,
|
|
19984
19939
|
messageText: e.stack,
|
|
19985
19940
|
file: void 0,
|
|
19986
19941
|
start: void 0,
|
|
@@ -19994,7 +19949,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
19994
19949
|
function createParseConfigHost(host, fs5 = getFileSystem()) {
|
|
19995
19950
|
return {
|
|
19996
19951
|
fileExists: host.exists.bind(host),
|
|
19997
|
-
readDirectory:
|
|
19952
|
+
readDirectory: ts85.sys.readDirectory,
|
|
19998
19953
|
readFile: host.readFile.bind(host),
|
|
19999
19954
|
useCaseSensitiveFileNames: fs5.isCaseSensitive()
|
|
20000
19955
|
};
|
|
@@ -20014,7 +19969,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
20014
19969
|
}
|
|
20015
19970
|
} else {
|
|
20016
19971
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
20017
|
-
const { resolvedModule } =
|
|
19972
|
+
const { resolvedModule } = ts85.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts85.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
20018
19973
|
if (resolvedModule) {
|
|
20019
19974
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
20020
19975
|
}
|
|
@@ -20024,7 +19979,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
20024
19979
|
function exitCodeFromResult(diags) {
|
|
20025
19980
|
if (!diags)
|
|
20026
19981
|
return 0;
|
|
20027
|
-
if (diags.every((diag) => diag.category !==
|
|
19982
|
+
if (diags.every((diag) => diag.category !== ts85.DiagnosticCategory.Error)) {
|
|
20028
19983
|
return 0;
|
|
20029
19984
|
}
|
|
20030
19985
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -20064,7 +20019,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
20064
20019
|
program = void 0;
|
|
20065
20020
|
code = UNKNOWN_ERROR_CODE;
|
|
20066
20021
|
}
|
|
20067
|
-
allDiagnostics.push({ category:
|
|
20022
|
+
allDiagnostics.push({ category: ts85.DiagnosticCategory.Error, messageText: errMsg, code, source: SOURCE });
|
|
20068
20023
|
return { diagnostics: allDiagnostics, program };
|
|
20069
20024
|
}
|
|
20070
20025
|
}
|
|
@@ -20085,7 +20040,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
20085
20040
|
return allDiagnostics;
|
|
20086
20041
|
}
|
|
20087
20042
|
function hasErrors(diags) {
|
|
20088
|
-
return diags.some((d) => d.category ===
|
|
20043
|
+
return diags.some((d) => d.category === ts85.DiagnosticCategory.Error);
|
|
20089
20044
|
}
|
|
20090
20045
|
|
|
20091
20046
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_watch.mjs
|
|
@@ -20095,7 +20050,7 @@ import {
|
|
|
20095
20050
|
import {
|
|
20096
20051
|
normalize as normalize4
|
|
20097
20052
|
} from "path";
|
|
20098
|
-
import
|
|
20053
|
+
import ts86 from "typescript";
|
|
20099
20054
|
function totalCompilationTimeDiagnostic(timeInMillis) {
|
|
20100
20055
|
let duration;
|
|
20101
20056
|
if (timeInMillis > 1e3) {
|
|
@@ -20104,7 +20059,7 @@ function totalCompilationTimeDiagnostic(timeInMillis) {
|
|
|
20104
20059
|
duration = `${timeInMillis}ms`;
|
|
20105
20060
|
}
|
|
20106
20061
|
return {
|
|
20107
|
-
category:
|
|
20062
|
+
category: ts86.DiagnosticCategory.Message,
|
|
20108
20063
|
messageText: `Total time: ${duration}`,
|
|
20109
20064
|
code: DEFAULT_ERROR_CODE,
|
|
20110
20065
|
source: SOURCE
|
|
@@ -20125,7 +20080,7 @@ function createPerformWatchHost(configFileName, reportDiagnostics, existingOptio
|
|
|
20125
20080
|
onFileChange: (options, listener, ready) => {
|
|
20126
20081
|
if (!options.basePath) {
|
|
20127
20082
|
reportDiagnostics([{
|
|
20128
|
-
category:
|
|
20083
|
+
category: ts86.DiagnosticCategory.Error,
|
|
20129
20084
|
messageText: "Invalid configuration option. baseDir not specified",
|
|
20130
20085
|
source: SOURCE,
|
|
20131
20086
|
code: DEFAULT_ERROR_CODE
|
|
@@ -20156,8 +20111,8 @@ function createPerformWatchHost(configFileName, reportDiagnostics, existingOptio
|
|
|
20156
20111
|
watcher.on("ready", ready);
|
|
20157
20112
|
return { close: () => watcher.close(), ready };
|
|
20158
20113
|
},
|
|
20159
|
-
setTimeout:
|
|
20160
|
-
clearTimeout:
|
|
20114
|
+
setTimeout: ts86.sys.clearTimeout && ts86.sys.setTimeout || setTimeout,
|
|
20115
|
+
clearTimeout: ts86.sys.setTimeout && ts86.sys.clearTimeout || clearTimeout
|
|
20161
20116
|
};
|
|
20162
20117
|
}
|
|
20163
20118
|
function performWatchCompilation(host) {
|
|
@@ -20368,7 +20323,7 @@ function readNgcCommandLineAndConfiguration(args2) {
|
|
|
20368
20323
|
return __spreadProps(__spreadValues({}, config), { watch: parsedArgs.watch });
|
|
20369
20324
|
}
|
|
20370
20325
|
function readCommandLineAndConfiguration(args2, existingOptions = {}, ngCmdLineOptions = []) {
|
|
20371
|
-
let cmdConfig =
|
|
20326
|
+
let cmdConfig = ts87.parseCommandLine(args2);
|
|
20372
20327
|
const project = cmdConfig.options.project || ".";
|
|
20373
20328
|
const cmdErrors = cmdConfig.errors.filter((e) => {
|
|
20374
20329
|
if (typeof e.messageText === "string") {
|
|
@@ -20402,18 +20357,18 @@ function readCommandLineAndConfiguration(args2, existingOptions = {}, ngCmdLineO
|
|
|
20402
20357
|
function getFormatDiagnosticsHost(options) {
|
|
20403
20358
|
const basePath = options ? options.basePath : void 0;
|
|
20404
20359
|
return {
|
|
20405
|
-
getCurrentDirectory: () => basePath ||
|
|
20360
|
+
getCurrentDirectory: () => basePath || ts87.sys.getCurrentDirectory(),
|
|
20406
20361
|
getCanonicalFileName: (fileName) => fileName.replace(/\\/g, "/"),
|
|
20407
20362
|
getNewLine: () => {
|
|
20408
20363
|
if (options && options.newLine !== void 0) {
|
|
20409
|
-
return options.newLine ===
|
|
20364
|
+
return options.newLine === ts87.NewLineKind.LineFeed ? "\n" : "\r\n";
|
|
20410
20365
|
}
|
|
20411
|
-
return
|
|
20366
|
+
return ts87.sys.newLine;
|
|
20412
20367
|
}
|
|
20413
20368
|
};
|
|
20414
20369
|
}
|
|
20415
20370
|
function reportErrorsAndExit(allDiagnostics, options, consoleError = console.error) {
|
|
20416
|
-
const errorsAndWarnings = allDiagnostics.filter((d) => d.category !==
|
|
20371
|
+
const errorsAndWarnings = allDiagnostics.filter((d) => d.category !== ts87.DiagnosticCategory.Message);
|
|
20417
20372
|
printDiagnostics(errorsAndWarnings, options, consoleError);
|
|
20418
20373
|
return exitCodeFromResult(allDiagnostics);
|
|
20419
20374
|
}
|