@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
package/bundles/src/bin/ngc.js
CHANGED
|
@@ -396,12 +396,12 @@ function toggleCase(str) {
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/main.mjs
|
|
399
|
-
import
|
|
399
|
+
import ts87 from "typescript";
|
|
400
400
|
import yargs from "yargs";
|
|
401
401
|
|
|
402
402
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
403
403
|
import { isSyntaxError as isSyntaxError2 } from "@angular/compiler";
|
|
404
|
-
import
|
|
404
|
+
import ts85 from "typescript";
|
|
405
405
|
|
|
406
406
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
|
|
407
407
|
var ErrorCode;
|
|
@@ -3122,12 +3122,12 @@ import {
|
|
|
3122
3122
|
readFileSync as readFileSync2
|
|
3123
3123
|
} from "fs";
|
|
3124
3124
|
import * as path6 from "path";
|
|
3125
|
-
import
|
|
3125
|
+
import ts84 from "typescript";
|
|
3126
3126
|
|
|
3127
3127
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/translate_diagnostics.mjs
|
|
3128
3128
|
import ts10 from "typescript";
|
|
3129
3129
|
function translateDiagnostics(host, untranslatedDiagnostics) {
|
|
3130
|
-
const
|
|
3130
|
+
const ts88 = [];
|
|
3131
3131
|
const ng2 = [];
|
|
3132
3132
|
untranslatedDiagnostics.forEach((diagnostic) => {
|
|
3133
3133
|
if (diagnostic.file && diagnostic.start && GENERATED_FILES.test(diagnostic.file.fileName)) {
|
|
@@ -3146,10 +3146,10 @@ function translateDiagnostics(host, untranslatedDiagnostics) {
|
|
|
3146
3146
|
});
|
|
3147
3147
|
}
|
|
3148
3148
|
} else {
|
|
3149
|
-
|
|
3149
|
+
ts88.push(diagnostic);
|
|
3150
3150
|
}
|
|
3151
3151
|
});
|
|
3152
|
-
return { ts:
|
|
3152
|
+
return { ts: ts88, ng: ng2 };
|
|
3153
3153
|
}
|
|
3154
3154
|
function sourceSpanOf(host, source, start) {
|
|
3155
3155
|
const { line, character } = ts10.getLineAndCharacterOfPosition(source, start);
|
|
@@ -3160,7 +3160,7 @@ function diagnosticMessageToString(message) {
|
|
|
3160
3160
|
}
|
|
3161
3161
|
|
|
3162
3162
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
3163
|
-
import
|
|
3163
|
+
import ts72 from "typescript";
|
|
3164
3164
|
|
|
3165
3165
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/component.mjs
|
|
3166
3166
|
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";
|
|
@@ -5390,6 +5390,24 @@ var ArrayConcatBuiltinFn = class extends KnownFn {
|
|
|
5390
5390
|
return result;
|
|
5391
5391
|
}
|
|
5392
5392
|
};
|
|
5393
|
+
var StringConcatBuiltinFn = class extends KnownFn {
|
|
5394
|
+
constructor(lhs) {
|
|
5395
|
+
super();
|
|
5396
|
+
this.lhs = lhs;
|
|
5397
|
+
}
|
|
5398
|
+
evaluate(node, args) {
|
|
5399
|
+
let result = this.lhs;
|
|
5400
|
+
for (const arg of args) {
|
|
5401
|
+
const resolved = arg instanceof EnumValue ? arg.resolved : arg;
|
|
5402
|
+
if (typeof resolved === "string" || typeof resolved === "number" || typeof resolved === "boolean" || resolved == null) {
|
|
5403
|
+
result = result.concat(resolved);
|
|
5404
|
+
} else {
|
|
5405
|
+
return DynamicValue.fromUnknown(node);
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
return result;
|
|
5409
|
+
}
|
|
5410
|
+
};
|
|
5393
5411
|
var ObjectAssignBuiltinFn = class extends KnownFn {
|
|
5394
5412
|
evaluate(node, args) {
|
|
5395
5413
|
if (args.length === 0) {
|
|
@@ -5779,6 +5797,8 @@ var StaticInterpreter = class {
|
|
|
5779
5797
|
return DynamicValue.fromInvalidExpressionType(node, rhs);
|
|
5780
5798
|
}
|
|
5781
5799
|
return lhs[rhs];
|
|
5800
|
+
} else if (typeof lhs === "string" && rhs === "concat") {
|
|
5801
|
+
return new StringConcatBuiltinFn(lhs);
|
|
5782
5802
|
} else if (lhs instanceof Reference) {
|
|
5783
5803
|
const ref = lhs.node;
|
|
5784
5804
|
if (this.host.isClass(ref)) {
|
|
@@ -12649,70 +12669,6 @@ var TypeCheckScopeRegistry = class {
|
|
|
12649
12669
|
}
|
|
12650
12670
|
};
|
|
12651
12671
|
|
|
12652
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/switch/src/switch.mjs
|
|
12653
|
-
import ts52 from "typescript";
|
|
12654
|
-
var IVY_SWITCH_PRE_SUFFIX = "__PRE_R3__";
|
|
12655
|
-
var IVY_SWITCH_POST_SUFFIX = "__POST_R3__";
|
|
12656
|
-
function ivySwitchTransform(_) {
|
|
12657
|
-
return flipIvySwitchInFile;
|
|
12658
|
-
}
|
|
12659
|
-
function flipIvySwitchInFile(sf) {
|
|
12660
|
-
let newStatements = void 0;
|
|
12661
|
-
for (let i = 0; i < sf.statements.length; i++) {
|
|
12662
|
-
const statement = sf.statements[i];
|
|
12663
|
-
if (!ts52.isVariableStatement(statement) || !hasIvySwitches(statement)) {
|
|
12664
|
-
continue;
|
|
12665
|
-
}
|
|
12666
|
-
if (newStatements === void 0) {
|
|
12667
|
-
newStatements = [...sf.statements];
|
|
12668
|
-
}
|
|
12669
|
-
newStatements[i] = flipIvySwitchesInVariableStatement(statement, sf.statements);
|
|
12670
|
-
}
|
|
12671
|
-
if (newStatements !== void 0) {
|
|
12672
|
-
return ts52.updateSourceFileNode(sf, newStatements);
|
|
12673
|
-
}
|
|
12674
|
-
return sf;
|
|
12675
|
-
}
|
|
12676
|
-
function findPostSwitchIdentifier(statements, name) {
|
|
12677
|
-
for (const stmt of statements) {
|
|
12678
|
-
if (ts52.isVariableStatement(stmt)) {
|
|
12679
|
-
const decl = stmt.declarationList.declarations.find((decl2) => ts52.isIdentifier(decl2.name) && decl2.name.text === name);
|
|
12680
|
-
if (decl !== void 0) {
|
|
12681
|
-
return decl.name;
|
|
12682
|
-
}
|
|
12683
|
-
} else if (ts52.isFunctionDeclaration(stmt) || ts52.isClassDeclaration(stmt)) {
|
|
12684
|
-
if (stmt.name !== void 0 && ts52.isIdentifier(stmt.name) && stmt.name.text === name) {
|
|
12685
|
-
return stmt.name;
|
|
12686
|
-
}
|
|
12687
|
-
}
|
|
12688
|
-
}
|
|
12689
|
-
return null;
|
|
12690
|
-
}
|
|
12691
|
-
function flipIvySwitchesInVariableStatement(stmt, statements) {
|
|
12692
|
-
const newDeclarations = [...stmt.declarationList.declarations];
|
|
12693
|
-
for (let i = 0; i < newDeclarations.length; i++) {
|
|
12694
|
-
const decl = newDeclarations[i];
|
|
12695
|
-
if (decl.initializer === void 0 || !ts52.isIdentifier(decl.initializer)) {
|
|
12696
|
-
continue;
|
|
12697
|
-
}
|
|
12698
|
-
if (!decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX)) {
|
|
12699
|
-
continue;
|
|
12700
|
-
}
|
|
12701
|
-
const postSwitchName = decl.initializer.text.replace(IVY_SWITCH_PRE_SUFFIX, IVY_SWITCH_POST_SUFFIX);
|
|
12702
|
-
const newIdentifier = findPostSwitchIdentifier(statements, postSwitchName);
|
|
12703
|
-
if (newIdentifier === null) {
|
|
12704
|
-
throw new Error(`Unable to find identifier ${postSwitchName} in ${stmt.getSourceFile().fileName} for the Ivy switch.`);
|
|
12705
|
-
}
|
|
12706
|
-
newDeclarations[i] = ts52.updateVariableDeclaration(decl, decl.name, decl.type, newIdentifier);
|
|
12707
|
-
}
|
|
12708
|
-
const newDeclList = ts52.updateVariableDeclarationList(stmt.declarationList, newDeclarations);
|
|
12709
|
-
const newStmt = ts52.updateVariableStatement(stmt, stmt.modifiers, newDeclList);
|
|
12710
|
-
return newStmt;
|
|
12711
|
-
}
|
|
12712
|
-
function hasIvySwitches(stmt) {
|
|
12713
|
-
return stmt.declarationList.declarations.some((decl) => decl.initializer !== void 0 && ts52.isIdentifier(decl.initializer) && decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX));
|
|
12714
|
-
}
|
|
12715
|
-
|
|
12716
12672
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
12717
12673
|
import { CssSelector as CssSelector3, DomElementSchemaRegistry as DomElementSchemaRegistry3 } from "@angular/compiler";
|
|
12718
12674
|
|
|
@@ -12747,7 +12703,7 @@ var SymbolKind;
|
|
|
12747
12703
|
})(SymbolKind || (SymbolKind = {}));
|
|
12748
12704
|
|
|
12749
12705
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
12750
|
-
import
|
|
12706
|
+
import ts52 from "typescript";
|
|
12751
12707
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
12752
12708
|
if (mapping.type === "direct") {
|
|
12753
12709
|
let relatedInformation = void 0;
|
|
@@ -12755,7 +12711,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12755
12711
|
relatedInformation = [];
|
|
12756
12712
|
for (const relatedMessage of relatedMessages) {
|
|
12757
12713
|
relatedInformation.push({
|
|
12758
|
-
category:
|
|
12714
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12759
12715
|
code: 0,
|
|
12760
12716
|
file: relatedMessage.sourceFile,
|
|
12761
12717
|
start: relatedMessage.start,
|
|
@@ -12780,12 +12736,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12780
12736
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
12781
12737
|
const componentName = mapping.componentClass.name.text;
|
|
12782
12738
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
12783
|
-
const sf =
|
|
12739
|
+
const sf = ts52.createSourceFile(fileName, mapping.template, ts52.ScriptTarget.Latest, false, ts52.ScriptKind.JSX);
|
|
12784
12740
|
let relatedInformation = [];
|
|
12785
12741
|
if (relatedMessages !== void 0) {
|
|
12786
12742
|
for (const relatedMessage of relatedMessages) {
|
|
12787
12743
|
relatedInformation.push({
|
|
12788
|
-
category:
|
|
12744
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12789
12745
|
code: 0,
|
|
12790
12746
|
file: relatedMessage.sourceFile,
|
|
12791
12747
|
start: relatedMessage.start,
|
|
@@ -12795,7 +12751,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12795
12751
|
}
|
|
12796
12752
|
}
|
|
12797
12753
|
relatedInformation.push({
|
|
12798
|
-
category:
|
|
12754
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12799
12755
|
code: 0,
|
|
12800
12756
|
file: componentSf,
|
|
12801
12757
|
start: mapping.node.getStart(),
|
|
@@ -12838,15 +12794,15 @@ function allocateTemplateId(sf) {
|
|
|
12838
12794
|
|
|
12839
12795
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
12840
12796
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
12841
|
-
import
|
|
12797
|
+
import ts54 from "typescript";
|
|
12842
12798
|
|
|
12843
12799
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
12844
12800
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
12845
|
-
import
|
|
12801
|
+
import ts53 from "typescript";
|
|
12846
12802
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
12847
12803
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
12848
|
-
return
|
|
12849
|
-
if (kind !==
|
|
12804
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12805
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12850
12806
|
return null;
|
|
12851
12807
|
}
|
|
12852
12808
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -12869,15 +12825,15 @@ var ExpressionIdentifier;
|
|
|
12869
12825
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
12870
12826
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
12871
12827
|
function addExpressionIdentifier(node, identifier) {
|
|
12872
|
-
|
|
12828
|
+
ts53.addSyntheticTrailingComment(node, ts53.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
12873
12829
|
}
|
|
12874
12830
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
12875
12831
|
function markIgnoreDiagnostics(node) {
|
|
12876
|
-
|
|
12832
|
+
ts53.addSyntheticTrailingComment(node, ts53.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
12877
12833
|
}
|
|
12878
12834
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
12879
|
-
return
|
|
12880
|
-
if (kind !==
|
|
12835
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12836
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12881
12837
|
return null;
|
|
12882
12838
|
}
|
|
12883
12839
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -12951,8 +12907,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
12951
12907
|
return results;
|
|
12952
12908
|
}
|
|
12953
12909
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
12954
|
-
return
|
|
12955
|
-
if (kind !==
|
|
12910
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12911
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12956
12912
|
return false;
|
|
12957
12913
|
}
|
|
12958
12914
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -12969,7 +12925,7 @@ var CompletionEngine = class {
|
|
|
12969
12925
|
this.templateContextCache = new Map();
|
|
12970
12926
|
this.expressionCompletionCache = new Map();
|
|
12971
12927
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
12972
|
-
filter:
|
|
12928
|
+
filter: ts54.isPropertyAccessExpression,
|
|
12973
12929
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
12974
12930
|
});
|
|
12975
12931
|
if (globalRead !== null) {
|
|
@@ -12992,7 +12948,7 @@ var CompletionEngine = class {
|
|
|
12992
12948
|
let nodeContext = null;
|
|
12993
12949
|
if (node instanceof EmptyExpr) {
|
|
12994
12950
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
12995
|
-
filter:
|
|
12951
|
+
filter: ts54.isIdentifier,
|
|
12996
12952
|
withSpan: node.sourceSpan
|
|
12997
12953
|
});
|
|
12998
12954
|
if (nodeLocation !== null) {
|
|
@@ -13004,7 +12960,7 @@ var CompletionEngine = class {
|
|
|
13004
12960
|
}
|
|
13005
12961
|
if (node instanceof PropertyRead && node.receiver instanceof ImplicitReceiver2) {
|
|
13006
12962
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
13007
|
-
filter:
|
|
12963
|
+
filter: ts54.isPropertyAccessExpression,
|
|
13008
12964
|
withSpan: node.sourceSpan
|
|
13009
12965
|
});
|
|
13010
12966
|
if (nodeLocation) {
|
|
@@ -13027,21 +12983,21 @@ var CompletionEngine = class {
|
|
|
13027
12983
|
let tsExpr = null;
|
|
13028
12984
|
if (expr instanceof PropertyRead || expr instanceof PropertyWrite) {
|
|
13029
12985
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
13030
|
-
filter:
|
|
12986
|
+
filter: ts54.isPropertyAccessExpression,
|
|
13031
12987
|
withSpan: expr.nameSpan
|
|
13032
12988
|
});
|
|
13033
12989
|
} else if (expr instanceof SafePropertyRead) {
|
|
13034
12990
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
13035
|
-
filter:
|
|
12991
|
+
filter: ts54.isParenthesizedExpression,
|
|
13036
12992
|
withSpan: expr.sourceSpan
|
|
13037
12993
|
});
|
|
13038
|
-
if (ternaryExpr === null || !
|
|
12994
|
+
if (ternaryExpr === null || !ts54.isConditionalExpression(ternaryExpr.expression)) {
|
|
13039
12995
|
return null;
|
|
13040
12996
|
}
|
|
13041
12997
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
13042
|
-
if (
|
|
12998
|
+
if (ts54.isPropertyAccessExpression(whenTrue)) {
|
|
13043
12999
|
tsExpr = whenTrue;
|
|
13044
|
-
} else if (
|
|
13000
|
+
} else if (ts54.isCallExpression(whenTrue) && ts54.isPropertyAccessExpression(whenTrue.expression)) {
|
|
13045
13001
|
tsExpr = whenTrue.expression;
|
|
13046
13002
|
}
|
|
13047
13003
|
}
|
|
@@ -13062,15 +13018,15 @@ var CompletionEngine = class {
|
|
|
13062
13018
|
let tsExpr = null;
|
|
13063
13019
|
if (expr instanceof TmplAstTextAttribute) {
|
|
13064
13020
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
13065
|
-
filter:
|
|
13021
|
+
filter: ts54.isParenthesizedExpression,
|
|
13066
13022
|
withSpan: expr.sourceSpan
|
|
13067
13023
|
});
|
|
13068
|
-
if (strNode !== null &&
|
|
13024
|
+
if (strNode !== null && ts54.isStringLiteral(strNode.expression)) {
|
|
13069
13025
|
tsExpr = strNode.expression;
|
|
13070
13026
|
}
|
|
13071
13027
|
} else {
|
|
13072
13028
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
13073
|
-
filter: (n) =>
|
|
13029
|
+
filter: (n) => ts54.isStringLiteral(n) || ts54.isNumericLiteral(n),
|
|
13074
13030
|
withSpan: expr.sourceSpan
|
|
13075
13031
|
});
|
|
13076
13032
|
}
|
|
@@ -13078,7 +13034,7 @@ var CompletionEngine = class {
|
|
|
13078
13034
|
return null;
|
|
13079
13035
|
}
|
|
13080
13036
|
let positionInShimFile = tsExpr.getEnd();
|
|
13081
|
-
if (
|
|
13037
|
+
if (ts54.isStringLiteral(tsExpr)) {
|
|
13082
13038
|
positionInShimFile -= 1;
|
|
13083
13039
|
}
|
|
13084
13040
|
const res = {
|
|
@@ -13112,11 +13068,11 @@ var CompletionEngine = class {
|
|
|
13112
13068
|
};
|
|
13113
13069
|
|
|
13114
13070
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
13115
|
-
import
|
|
13071
|
+
import ts68 from "typescript";
|
|
13116
13072
|
|
|
13117
13073
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
13118
13074
|
import { DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
13119
|
-
import
|
|
13075
|
+
import ts55 from "typescript";
|
|
13120
13076
|
var REGISTRY = new DomElementSchemaRegistry2();
|
|
13121
13077
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
13122
13078
|
var RegistryDomSchemaChecker = class {
|
|
@@ -13140,7 +13096,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13140
13096
|
} else {
|
|
13141
13097
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
13142
13098
|
}
|
|
13143
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
13099
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts55.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
13144
13100
|
this._diagnostics.push(diag);
|
|
13145
13101
|
}
|
|
13146
13102
|
}
|
|
@@ -13158,7 +13114,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13158
13114
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
13159
13115
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
13160
13116
|
}
|
|
13161
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
13117
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts55.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
13162
13118
|
this._diagnostics.push(diag);
|
|
13163
13119
|
}
|
|
13164
13120
|
}
|
|
@@ -13166,62 +13122,62 @@ var RegistryDomSchemaChecker = class {
|
|
|
13166
13122
|
|
|
13167
13123
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
13168
13124
|
import { ExpressionType, ExternalExpr as ExternalExpr9 } from "@angular/compiler";
|
|
13169
|
-
import
|
|
13125
|
+
import ts61 from "typescript";
|
|
13170
13126
|
|
|
13171
13127
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
13172
|
-
import
|
|
13128
|
+
import ts56 from "typescript";
|
|
13173
13129
|
var SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13130
|
+
ts56.SyntaxKind.ParenthesizedExpression,
|
|
13131
|
+
ts56.SyntaxKind.Identifier,
|
|
13132
|
+
ts56.SyntaxKind.CallExpression,
|
|
13133
|
+
ts56.SyntaxKind.NonNullExpression,
|
|
13134
|
+
ts56.SyntaxKind.ElementAccessExpression,
|
|
13135
|
+
ts56.SyntaxKind.PropertyAccessExpression,
|
|
13136
|
+
ts56.SyntaxKind.ArrayLiteralExpression,
|
|
13137
|
+
ts56.SyntaxKind.ObjectLiteralExpression,
|
|
13138
|
+
ts56.SyntaxKind.StringLiteral,
|
|
13139
|
+
ts56.SyntaxKind.NumericLiteral,
|
|
13140
|
+
ts56.SyntaxKind.TrueKeyword,
|
|
13141
|
+
ts56.SyntaxKind.FalseKeyword,
|
|
13142
|
+
ts56.SyntaxKind.NullKeyword,
|
|
13143
|
+
ts56.SyntaxKind.UndefinedKeyword
|
|
13188
13144
|
]);
|
|
13189
13145
|
function tsCastToAny(expr) {
|
|
13190
13146
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
13191
|
-
expr =
|
|
13147
|
+
expr = ts56.createParen(expr);
|
|
13192
13148
|
}
|
|
13193
|
-
return
|
|
13149
|
+
return ts56.createParen(ts56.createAsExpression(expr, ts56.createKeywordTypeNode(ts56.SyntaxKind.AnyKeyword)));
|
|
13194
13150
|
}
|
|
13195
13151
|
function tsCreateElement(tagName) {
|
|
13196
|
-
const createElement =
|
|
13197
|
-
return
|
|
13152
|
+
const createElement = ts56.createPropertyAccess(ts56.createIdentifier("document"), "createElement");
|
|
13153
|
+
return ts56.createCall(createElement, void 0, [ts56.createLiteral(tagName)]);
|
|
13198
13154
|
}
|
|
13199
13155
|
function tsDeclareVariable(id, type) {
|
|
13200
|
-
const decl =
|
|
13201
|
-
return
|
|
13156
|
+
const decl = ts56.createVariableDeclaration(id, type, ts56.createNonNullExpression(ts56.createNull()));
|
|
13157
|
+
return ts56.createVariableStatement(void 0, [decl]);
|
|
13202
13158
|
}
|
|
13203
13159
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
13204
|
-
return
|
|
13160
|
+
return ts56.createTypeQueryNode(ts56.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
13205
13161
|
}
|
|
13206
13162
|
function tsCreateVariable(id, initializer) {
|
|
13207
|
-
const decl =
|
|
13208
|
-
return
|
|
13163
|
+
const decl = ts56.createVariableDeclaration(id, void 0, initializer);
|
|
13164
|
+
return ts56.createVariableStatement(void 0, [decl]);
|
|
13209
13165
|
}
|
|
13210
13166
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
13211
|
-
const methodAccess =
|
|
13212
|
-
return
|
|
13167
|
+
const methodAccess = ts56.createPropertyAccess(receiver, methodName);
|
|
13168
|
+
return ts56.createCall(methodAccess, void 0, args);
|
|
13213
13169
|
}
|
|
13214
13170
|
function checkIfClassIsExported(node) {
|
|
13215
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
13171
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts56.SyntaxKind.ExportKeyword)) {
|
|
13216
13172
|
return true;
|
|
13217
|
-
} else if (node.parent !== void 0 &&
|
|
13173
|
+
} else if (node.parent !== void 0 && ts56.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
13218
13174
|
return true;
|
|
13219
13175
|
}
|
|
13220
13176
|
return false;
|
|
13221
13177
|
}
|
|
13222
13178
|
function checkIfFileHasExport(sf, name) {
|
|
13223
13179
|
for (const stmt of sf.statements) {
|
|
13224
|
-
if (
|
|
13180
|
+
if (ts56.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts56.isNamedExports(stmt.exportClause)) {
|
|
13225
13181
|
for (const element of stmt.exportClause.elements) {
|
|
13226
13182
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
13227
13183
|
return true;
|
|
@@ -13234,20 +13190,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
13234
13190
|
return false;
|
|
13235
13191
|
}
|
|
13236
13192
|
function isAccessExpression(node) {
|
|
13237
|
-
return
|
|
13193
|
+
return ts56.isPropertyAccessExpression(node) || ts56.isElementAccessExpression(node);
|
|
13238
13194
|
}
|
|
13239
13195
|
|
|
13240
13196
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
13241
|
-
import
|
|
13197
|
+
import ts60 from "typescript";
|
|
13242
13198
|
|
|
13243
13199
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
13244
|
-
import
|
|
13200
|
+
import ts59 from "typescript";
|
|
13245
13201
|
|
|
13246
13202
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
13247
|
-
import
|
|
13203
|
+
import ts58 from "typescript";
|
|
13248
13204
|
|
|
13249
13205
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
13250
|
-
import
|
|
13206
|
+
import ts57 from "typescript";
|
|
13251
13207
|
var INELIGIBLE = {};
|
|
13252
13208
|
function canEmitType(type, resolver) {
|
|
13253
13209
|
return canEmitTypeWorker(type);
|
|
@@ -13255,13 +13211,13 @@ function canEmitType(type, resolver) {
|
|
|
13255
13211
|
return visitNode(type2) !== INELIGIBLE;
|
|
13256
13212
|
}
|
|
13257
13213
|
function visitNode(node) {
|
|
13258
|
-
if (
|
|
13214
|
+
if (ts57.isImportTypeNode(node)) {
|
|
13259
13215
|
return INELIGIBLE;
|
|
13260
13216
|
}
|
|
13261
|
-
if (
|
|
13217
|
+
if (ts57.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
13262
13218
|
return INELIGIBLE;
|
|
13263
13219
|
} else {
|
|
13264
|
-
return
|
|
13220
|
+
return ts57.forEachChild(node, visitNode);
|
|
13265
13221
|
}
|
|
13266
13222
|
}
|
|
13267
13223
|
function canEmitTypeReference(type2) {
|
|
@@ -13283,22 +13239,22 @@ var TypeEmitter = class {
|
|
|
13283
13239
|
emitType(type) {
|
|
13284
13240
|
const typeReferenceTransformer = (context) => {
|
|
13285
13241
|
const visitNode = (node) => {
|
|
13286
|
-
if (
|
|
13242
|
+
if (ts57.isImportTypeNode(node)) {
|
|
13287
13243
|
throw new Error("Unable to emit import type");
|
|
13288
13244
|
}
|
|
13289
|
-
if (
|
|
13245
|
+
if (ts57.isTypeReferenceNode(node)) {
|
|
13290
13246
|
return this.emitTypeReference(node);
|
|
13291
|
-
} else if (
|
|
13292
|
-
const clone =
|
|
13293
|
-
|
|
13247
|
+
} else if (ts57.isLiteralExpression(node)) {
|
|
13248
|
+
const clone = ts57.getMutableClone(node);
|
|
13249
|
+
ts57.setTextRange(clone, { pos: -1, end: -1 });
|
|
13294
13250
|
return clone;
|
|
13295
13251
|
} else {
|
|
13296
|
-
return
|
|
13252
|
+
return ts57.visitEachChild(node, visitNode, context);
|
|
13297
13253
|
}
|
|
13298
13254
|
};
|
|
13299
|
-
return (node) =>
|
|
13255
|
+
return (node) => ts57.visitNode(node, visitNode);
|
|
13300
13256
|
};
|
|
13301
|
-
return
|
|
13257
|
+
return ts57.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
13302
13258
|
}
|
|
13303
13259
|
emitTypeReference(type) {
|
|
13304
13260
|
const reference = this.resolver(type);
|
|
@@ -13307,17 +13263,17 @@ var TypeEmitter = class {
|
|
|
13307
13263
|
}
|
|
13308
13264
|
let typeArguments = void 0;
|
|
13309
13265
|
if (type.typeArguments !== void 0) {
|
|
13310
|
-
typeArguments =
|
|
13266
|
+
typeArguments = ts57.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
13311
13267
|
}
|
|
13312
13268
|
let typeName = type.typeName;
|
|
13313
13269
|
if (reference instanceof Reference) {
|
|
13314
13270
|
const emittedType = this.emitReference(reference);
|
|
13315
|
-
if (!
|
|
13316
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
13271
|
+
if (!ts57.isTypeReferenceNode(emittedType)) {
|
|
13272
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts57.SyntaxKind[emittedType.kind]}`);
|
|
13317
13273
|
}
|
|
13318
13274
|
typeName = emittedType.typeName;
|
|
13319
13275
|
}
|
|
13320
|
-
return
|
|
13276
|
+
return ts57.updateTypeReferenceNode(type, typeName, typeArguments);
|
|
13321
13277
|
}
|
|
13322
13278
|
};
|
|
13323
13279
|
|
|
@@ -13349,11 +13305,11 @@ var TypeParameterEmitter = class {
|
|
|
13349
13305
|
return this.typeParameters.map((typeParam) => {
|
|
13350
13306
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
13351
13307
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
13352
|
-
return
|
|
13308
|
+
return ts58.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
13353
13309
|
});
|
|
13354
13310
|
}
|
|
13355
13311
|
resolveTypeReference(type) {
|
|
13356
|
-
const target =
|
|
13312
|
+
const target = ts58.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
13357
13313
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
13358
13314
|
if (declaration === null || declaration.node === null) {
|
|
13359
13315
|
return null;
|
|
@@ -13374,7 +13330,7 @@ var TypeParameterEmitter = class {
|
|
|
13374
13330
|
return new Reference(declaration.node, owningModule2);
|
|
13375
13331
|
}
|
|
13376
13332
|
isTopLevelExport(decl) {
|
|
13377
|
-
if (decl.parent === void 0 || !
|
|
13333
|
+
if (decl.parent === void 0 || !ts58.isSourceFile(decl.parent)) {
|
|
13378
13334
|
return false;
|
|
13379
13335
|
}
|
|
13380
13336
|
return this.reflector.isStaticallyExported(decl);
|
|
@@ -13417,14 +13373,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
13417
13373
|
}
|
|
13418
13374
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
13419
13375
|
for (const stmt of file.statements) {
|
|
13420
|
-
if (
|
|
13376
|
+
if (ts59.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
13421
13377
|
return stmt;
|
|
13422
13378
|
}
|
|
13423
13379
|
}
|
|
13424
13380
|
return null;
|
|
13425
13381
|
}
|
|
13426
13382
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
13427
|
-
while (node !== void 0 && !
|
|
13383
|
+
while (node !== void 0 && !ts59.isFunctionDeclaration(node)) {
|
|
13428
13384
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
13429
13385
|
return null;
|
|
13430
13386
|
}
|
|
@@ -13441,7 +13397,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
13441
13397
|
return null;
|
|
13442
13398
|
}
|
|
13443
13399
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
13444
|
-
while (!
|
|
13400
|
+
while (!ts59.isFunctionDeclaration(node)) {
|
|
13445
13401
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
13446
13402
|
return null;
|
|
13447
13403
|
}
|
|
@@ -13451,8 +13407,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
13451
13407
|
}
|
|
13452
13408
|
}
|
|
13453
13409
|
const start = node.getFullStart();
|
|
13454
|
-
return
|
|
13455
|
-
if (kind !==
|
|
13410
|
+
return ts59.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
13411
|
+
if (kind !== ts59.SyntaxKind.MultiLineCommentTrivia) {
|
|
13456
13412
|
return null;
|
|
13457
13413
|
}
|
|
13458
13414
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -13469,29 +13425,29 @@ function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams, refl
|
|
|
13469
13425
|
throw new Error(`${node.name.text} requires an inline type constructor`);
|
|
13470
13426
|
}
|
|
13471
13427
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
13472
|
-
const rawType =
|
|
13428
|
+
const rawType = ts60.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
13473
13429
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
13474
13430
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
13475
13431
|
if (meta.body) {
|
|
13476
|
-
const fnType =
|
|
13477
|
-
const decl =
|
|
13478
|
-
const declList =
|
|
13479
|
-
return
|
|
13432
|
+
const fnType = ts60.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
13433
|
+
const decl = ts60.createVariableDeclaration(meta.fnName, fnType, ts60.createNonNullExpression(ts60.createNull()));
|
|
13434
|
+
const declList = ts60.createVariableDeclarationList([decl], ts60.NodeFlags.Const);
|
|
13435
|
+
return ts60.createVariableStatement(void 0, declList);
|
|
13480
13436
|
} else {
|
|
13481
|
-
return
|
|
13437
|
+
return ts60.createFunctionDeclaration(void 0, [ts60.createModifier(ts60.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
13482
13438
|
}
|
|
13483
13439
|
}
|
|
13484
13440
|
function generateInlineTypeCtor(node, meta) {
|
|
13485
13441
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
13486
|
-
const rawType =
|
|
13442
|
+
const rawType = ts60.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
13487
13443
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
13488
13444
|
let body = void 0;
|
|
13489
13445
|
if (meta.body) {
|
|
13490
|
-
body =
|
|
13491
|
-
|
|
13446
|
+
body = ts60.createBlock([
|
|
13447
|
+
ts60.createReturn(ts60.createNonNullExpression(ts60.createNull()))
|
|
13492
13448
|
]);
|
|
13493
13449
|
}
|
|
13494
|
-
return
|
|
13450
|
+
return ts60.createMethod(void 0, [ts60.createModifier(ts60.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
13495
13451
|
}
|
|
13496
13452
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
13497
13453
|
let initType = null;
|
|
@@ -13500,26 +13456,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
13500
13456
|
const coercedKeys = [];
|
|
13501
13457
|
for (const key of keys) {
|
|
13502
13458
|
if (!meta.coercedInputFields.has(key)) {
|
|
13503
|
-
plainKeys.push(
|
|
13459
|
+
plainKeys.push(ts60.createLiteralTypeNode(ts60.createStringLiteral(key)));
|
|
13504
13460
|
} else {
|
|
13505
|
-
coercedKeys.push(
|
|
13461
|
+
coercedKeys.push(ts60.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key), void 0));
|
|
13506
13462
|
}
|
|
13507
13463
|
}
|
|
13508
13464
|
if (plainKeys.length > 0) {
|
|
13509
|
-
const keyTypeUnion =
|
|
13510
|
-
initType =
|
|
13465
|
+
const keyTypeUnion = ts60.createUnionTypeNode(plainKeys);
|
|
13466
|
+
initType = ts60.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
13511
13467
|
}
|
|
13512
13468
|
if (coercedKeys.length > 0) {
|
|
13513
|
-
const coercedLiteral =
|
|
13514
|
-
initType = initType !== null ?
|
|
13469
|
+
const coercedLiteral = ts60.createTypeLiteralNode(coercedKeys);
|
|
13470
|
+
initType = initType !== null ? ts60.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
13515
13471
|
}
|
|
13516
13472
|
if (initType === null) {
|
|
13517
|
-
initType =
|
|
13473
|
+
initType = ts60.createTypeLiteralNode([]);
|
|
13518
13474
|
}
|
|
13519
|
-
return
|
|
13475
|
+
return ts60.createParameter(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
13520
13476
|
}
|
|
13521
13477
|
function generateGenericArgs(params) {
|
|
13522
|
-
return params.map((param) =>
|
|
13478
|
+
return params.map((param) => ts60.createTypeReferenceNode(param.name, void 0));
|
|
13523
13479
|
}
|
|
13524
13480
|
function requiresInlineTypeCtor(node, host) {
|
|
13525
13481
|
return !checkIfGenericTypeBoundsAreContextFree(node, host);
|
|
@@ -13530,7 +13486,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
13530
13486
|
}
|
|
13531
13487
|
return params.map((param) => {
|
|
13532
13488
|
if (param.default === void 0) {
|
|
13533
|
-
return
|
|
13489
|
+
return ts60.updateTypeParameterDeclaration(param, param.name, param.constraint, ts60.createKeywordTypeNode(ts60.SyntaxKind.AnyKeyword));
|
|
13534
13490
|
} else {
|
|
13535
13491
|
return param;
|
|
13536
13492
|
}
|
|
@@ -13562,13 +13518,13 @@ var Environment = class {
|
|
|
13562
13518
|
}
|
|
13563
13519
|
if (requiresInlineTypeCtor(node, this.reflector)) {
|
|
13564
13520
|
const ref = this.reference(dirRef);
|
|
13565
|
-
const typeCtorExpr =
|
|
13521
|
+
const typeCtorExpr = ts61.createPropertyAccess(ref, "ngTypeCtor");
|
|
13566
13522
|
this.typeCtors.set(node, typeCtorExpr);
|
|
13567
13523
|
return typeCtorExpr;
|
|
13568
13524
|
} else {
|
|
13569
13525
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
13570
13526
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
13571
|
-
if (!
|
|
13527
|
+
if (!ts61.isTypeReferenceNode(nodeTypeRef)) {
|
|
13572
13528
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
13573
13529
|
}
|
|
13574
13530
|
const meta = {
|
|
@@ -13584,7 +13540,7 @@ var Environment = class {
|
|
|
13584
13540
|
const typeParams = this.emitTypeParameters(node);
|
|
13585
13541
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams, this.reflector);
|
|
13586
13542
|
this.typeCtorStatements.push(typeCtor);
|
|
13587
|
-
const fnId =
|
|
13543
|
+
const fnId = ts61.createIdentifier(fnName);
|
|
13588
13544
|
this.typeCtors.set(node, fnId);
|
|
13589
13545
|
return fnId;
|
|
13590
13546
|
}
|
|
@@ -13594,7 +13550,7 @@ var Environment = class {
|
|
|
13594
13550
|
return this.pipeInsts.get(ref.node);
|
|
13595
13551
|
}
|
|
13596
13552
|
const pipeType = this.referenceType(ref);
|
|
13597
|
-
const pipeInstId =
|
|
13553
|
+
const pipeInstId = ts61.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
13598
13554
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
13599
13555
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
13600
13556
|
return pipeInstId;
|
|
@@ -13625,7 +13581,7 @@ var Environment = class {
|
|
|
13625
13581
|
|
|
13626
13582
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
13627
13583
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
13628
|
-
import
|
|
13584
|
+
import ts62 from "typescript";
|
|
13629
13585
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
13630
13586
|
constructor(resolver) {
|
|
13631
13587
|
this.resolver = resolver;
|
|
@@ -13639,7 +13595,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13639
13595
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
13640
13596
|
const value = ref.value.trim();
|
|
13641
13597
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
13642
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
13598
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
13643
13599
|
}
|
|
13644
13600
|
missingPipe(templateId, ast) {
|
|
13645
13601
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -13651,7 +13607,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13651
13607
|
if (sourceSpan === null) {
|
|
13652
13608
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
13653
13609
|
}
|
|
13654
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
13610
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
13655
13611
|
this.recordedPipes.add(ast);
|
|
13656
13612
|
}
|
|
13657
13613
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -13662,7 +13618,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13662
13618
|
if (sourceSpan === null) {
|
|
13663
13619
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
13664
13620
|
}
|
|
13665
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
13621
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
13666
13622
|
text: `The variable ${assignment.name} is declared here.`,
|
|
13667
13623
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
13668
13624
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -13672,7 +13628,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13672
13628
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
13673
13629
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
13674
13630
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
13675
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
13631
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
13676
13632
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
13677
13633
|
start: firstDecl.sourceSpan.start.offset,
|
|
13678
13634
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -13711,7 +13667,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13711
13667
|
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.
|
|
13712
13668
|
|
|
13713
13669
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
13714
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
13670
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts62.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
13715
13671
|
}
|
|
13716
13672
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
13717
13673
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -13745,7 +13701,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
13745
13701
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
13746
13702
|
});
|
|
13747
13703
|
}
|
|
13748
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
13704
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
13749
13705
|
}
|
|
13750
13706
|
};
|
|
13751
13707
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -13756,7 +13712,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
13756
13712
|
}
|
|
13757
13713
|
|
|
13758
13714
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
13759
|
-
import
|
|
13715
|
+
import ts63 from "typescript";
|
|
13760
13716
|
var TypeCheckShimGenerator = class {
|
|
13761
13717
|
constructor() {
|
|
13762
13718
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -13766,7 +13722,7 @@ var TypeCheckShimGenerator = class {
|
|
|
13766
13722
|
if (priorShimSf !== null) {
|
|
13767
13723
|
return priorShimSf;
|
|
13768
13724
|
}
|
|
13769
|
-
return
|
|
13725
|
+
return ts63.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts63.ScriptTarget.Latest, true, ts63.ScriptKind.TS);
|
|
13770
13726
|
}
|
|
13771
13727
|
static shimFor(fileName) {
|
|
13772
13728
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -13775,16 +13731,16 @@ var TypeCheckShimGenerator = class {
|
|
|
13775
13731
|
|
|
13776
13732
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
13777
13733
|
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";
|
|
13778
|
-
import
|
|
13734
|
+
import ts66 from "typescript";
|
|
13779
13735
|
|
|
13780
13736
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
13781
13737
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
13782
|
-
import
|
|
13738
|
+
import ts64 from "typescript";
|
|
13783
13739
|
function wrapForDiagnostics(expr) {
|
|
13784
|
-
return
|
|
13740
|
+
return ts64.createParen(expr);
|
|
13785
13741
|
}
|
|
13786
13742
|
function wrapForTypeChecker(expr) {
|
|
13787
|
-
return
|
|
13743
|
+
return ts64.createParen(expr);
|
|
13788
13744
|
}
|
|
13789
13745
|
function addParseSpanInfo(node, span) {
|
|
13790
13746
|
let commentText;
|
|
@@ -13793,10 +13749,10 @@ function addParseSpanInfo(node, span) {
|
|
|
13793
13749
|
} else {
|
|
13794
13750
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
13795
13751
|
}
|
|
13796
|
-
|
|
13752
|
+
ts64.addSyntheticTrailingComment(node, ts64.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
13797
13753
|
}
|
|
13798
13754
|
function addTemplateId(tcb, id) {
|
|
13799
|
-
|
|
13755
|
+
ts64.addSyntheticLeadingComment(tcb, ts64.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
13800
13756
|
}
|
|
13801
13757
|
function shouldReportDiagnostic(diagnostic) {
|
|
13802
13758
|
const { code } = diagnostic;
|
|
@@ -13825,32 +13781,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
13825
13781
|
|
|
13826
13782
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
13827
13783
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
13828
|
-
import
|
|
13829
|
-
var NULL_AS_ANY =
|
|
13830
|
-
var UNDEFINED =
|
|
13784
|
+
import ts65 from "typescript";
|
|
13785
|
+
var NULL_AS_ANY = ts65.createAsExpression(ts65.createNull(), ts65.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword));
|
|
13786
|
+
var UNDEFINED = ts65.createIdentifier("undefined");
|
|
13831
13787
|
var UNARY_OPS = new Map([
|
|
13832
|
-
["+",
|
|
13833
|
-
["-",
|
|
13788
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
13789
|
+
["-", ts65.SyntaxKind.MinusToken]
|
|
13834
13790
|
]);
|
|
13835
13791
|
var BINARY_OPS = new Map([
|
|
13836
|
-
["+",
|
|
13837
|
-
["-",
|
|
13838
|
-
["<",
|
|
13839
|
-
[">",
|
|
13840
|
-
["<=",
|
|
13841
|
-
[">=",
|
|
13842
|
-
["==",
|
|
13843
|
-
["===",
|
|
13844
|
-
["*",
|
|
13845
|
-
["/",
|
|
13846
|
-
["%",
|
|
13847
|
-
["!=",
|
|
13848
|
-
["!==",
|
|
13849
|
-
["||",
|
|
13850
|
-
["&&",
|
|
13851
|
-
["&",
|
|
13852
|
-
["|",
|
|
13853
|
-
["??",
|
|
13792
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
13793
|
+
["-", ts65.SyntaxKind.MinusToken],
|
|
13794
|
+
["<", ts65.SyntaxKind.LessThanToken],
|
|
13795
|
+
[">", ts65.SyntaxKind.GreaterThanToken],
|
|
13796
|
+
["<=", ts65.SyntaxKind.LessThanEqualsToken],
|
|
13797
|
+
[">=", ts65.SyntaxKind.GreaterThanEqualsToken],
|
|
13798
|
+
["==", ts65.SyntaxKind.EqualsEqualsToken],
|
|
13799
|
+
["===", ts65.SyntaxKind.EqualsEqualsEqualsToken],
|
|
13800
|
+
["*", ts65.SyntaxKind.AsteriskToken],
|
|
13801
|
+
["/", ts65.SyntaxKind.SlashToken],
|
|
13802
|
+
["%", ts65.SyntaxKind.PercentToken],
|
|
13803
|
+
["!=", ts65.SyntaxKind.ExclamationEqualsToken],
|
|
13804
|
+
["!==", ts65.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
13805
|
+
["||", ts65.SyntaxKind.BarBarToken],
|
|
13806
|
+
["&&", ts65.SyntaxKind.AmpersandAmpersandToken],
|
|
13807
|
+
["&", ts65.SyntaxKind.AmpersandToken],
|
|
13808
|
+
["|", ts65.SyntaxKind.BarToken],
|
|
13809
|
+
["??", ts65.SyntaxKind.QuestionQuestionToken]
|
|
13854
13810
|
]);
|
|
13855
13811
|
function astToTypescript(ast, maybeResolve, config) {
|
|
13856
13812
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -13866,7 +13822,7 @@ var AstTranslator = class {
|
|
|
13866
13822
|
ast = ast.ast;
|
|
13867
13823
|
}
|
|
13868
13824
|
if (ast instanceof EmptyExpr2) {
|
|
13869
|
-
const res =
|
|
13825
|
+
const res = ts65.factory.createIdentifier("undefined");
|
|
13870
13826
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
13871
13827
|
return res;
|
|
13872
13828
|
}
|
|
@@ -13882,7 +13838,7 @@ var AstTranslator = class {
|
|
|
13882
13838
|
if (op === void 0) {
|
|
13883
13839
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
13884
13840
|
}
|
|
13885
|
-
const node = wrapForDiagnostics(
|
|
13841
|
+
const node = wrapForDiagnostics(ts65.createPrefix(op, expr));
|
|
13886
13842
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13887
13843
|
return node;
|
|
13888
13844
|
}
|
|
@@ -13893,13 +13849,13 @@ var AstTranslator = class {
|
|
|
13893
13849
|
if (op === void 0) {
|
|
13894
13850
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
13895
13851
|
}
|
|
13896
|
-
const node =
|
|
13852
|
+
const node = ts65.createBinary(lhs, op, rhs);
|
|
13897
13853
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13898
13854
|
return node;
|
|
13899
13855
|
}
|
|
13900
13856
|
visitChain(ast) {
|
|
13901
13857
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
13902
|
-
const node = wrapForDiagnostics(
|
|
13858
|
+
const node = wrapForDiagnostics(ts65.createCommaList(elements));
|
|
13903
13859
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13904
13860
|
return node;
|
|
13905
13861
|
}
|
|
@@ -13907,7 +13863,7 @@ var AstTranslator = class {
|
|
|
13907
13863
|
const condExpr = this.translate(ast.condition);
|
|
13908
13864
|
const trueExpr = this.translate(ast.trueExp);
|
|
13909
13865
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
13910
|
-
const node =
|
|
13866
|
+
const node = ts65.createParen(ts65.createConditional(condExpr, trueExpr, falseExpr));
|
|
13911
13867
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13912
13868
|
return node;
|
|
13913
13869
|
}
|
|
@@ -13918,26 +13874,26 @@ var AstTranslator = class {
|
|
|
13918
13874
|
throw new Error("Method not implemented.");
|
|
13919
13875
|
}
|
|
13920
13876
|
visitInterpolation(ast) {
|
|
13921
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
13877
|
+
return ast.expressions.reduce((lhs, ast2) => ts65.createBinary(lhs, ts65.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts65.createLiteral(""));
|
|
13922
13878
|
}
|
|
13923
13879
|
visitKeyedRead(ast) {
|
|
13924
13880
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13925
13881
|
const key = this.translate(ast.key);
|
|
13926
|
-
const node =
|
|
13882
|
+
const node = ts65.createElementAccess(receiver, key);
|
|
13927
13883
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13928
13884
|
return node;
|
|
13929
13885
|
}
|
|
13930
13886
|
visitKeyedWrite(ast) {
|
|
13931
13887
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13932
|
-
const left =
|
|
13888
|
+
const left = ts65.createElementAccess(receiver, this.translate(ast.key));
|
|
13933
13889
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
13934
|
-
const node = wrapForDiagnostics(
|
|
13890
|
+
const node = wrapForDiagnostics(ts65.createBinary(left, ts65.SyntaxKind.EqualsToken, right));
|
|
13935
13891
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13936
13892
|
return node;
|
|
13937
13893
|
}
|
|
13938
13894
|
visitLiteralArray(ast) {
|
|
13939
13895
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
13940
|
-
const literal2 =
|
|
13896
|
+
const literal2 = ts65.createArrayLiteral(elements);
|
|
13941
13897
|
const node = this.config.strictLiteralTypes ? literal2 : tsCastToAny(literal2);
|
|
13942
13898
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13943
13899
|
return node;
|
|
@@ -13945,9 +13901,9 @@ var AstTranslator = class {
|
|
|
13945
13901
|
visitLiteralMap(ast) {
|
|
13946
13902
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
13947
13903
|
const value = this.translate(ast.values[idx]);
|
|
13948
|
-
return
|
|
13904
|
+
return ts65.createPropertyAssignment(ts65.createStringLiteral(key), value);
|
|
13949
13905
|
});
|
|
13950
|
-
const literal2 =
|
|
13906
|
+
const literal2 = ts65.createObjectLiteral(properties, true);
|
|
13951
13907
|
const node = this.config.strictLiteralTypes ? literal2 : tsCastToAny(literal2);
|
|
13952
13908
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13953
13909
|
return node;
|
|
@@ -13955,18 +13911,18 @@ var AstTranslator = class {
|
|
|
13955
13911
|
visitLiteralPrimitive(ast) {
|
|
13956
13912
|
let node;
|
|
13957
13913
|
if (ast.value === void 0) {
|
|
13958
|
-
node =
|
|
13914
|
+
node = ts65.createIdentifier("undefined");
|
|
13959
13915
|
} else if (ast.value === null) {
|
|
13960
|
-
node =
|
|
13916
|
+
node = ts65.createNull();
|
|
13961
13917
|
} else {
|
|
13962
|
-
node =
|
|
13918
|
+
node = ts65.createLiteral(ast.value);
|
|
13963
13919
|
}
|
|
13964
13920
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13965
13921
|
return node;
|
|
13966
13922
|
}
|
|
13967
13923
|
visitNonNullAssert(ast) {
|
|
13968
13924
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
13969
|
-
const node =
|
|
13925
|
+
const node = ts65.createNonNullExpression(expr);
|
|
13970
13926
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13971
13927
|
return node;
|
|
13972
13928
|
}
|
|
@@ -13975,13 +13931,13 @@ var AstTranslator = class {
|
|
|
13975
13931
|
}
|
|
13976
13932
|
visitPrefixNot(ast) {
|
|
13977
13933
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
13978
|
-
const node =
|
|
13934
|
+
const node = ts65.createLogicalNot(expression);
|
|
13979
13935
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13980
13936
|
return node;
|
|
13981
13937
|
}
|
|
13982
13938
|
visitPropertyRead(ast) {
|
|
13983
13939
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13984
|
-
const name =
|
|
13940
|
+
const name = ts65.createPropertyAccess(receiver, ast.name);
|
|
13985
13941
|
addParseSpanInfo(name, ast.nameSpan);
|
|
13986
13942
|
const node = wrapForDiagnostics(name);
|
|
13987
13943
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -13989,12 +13945,12 @@ var AstTranslator = class {
|
|
|
13989
13945
|
}
|
|
13990
13946
|
visitPropertyWrite(ast) {
|
|
13991
13947
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
13992
|
-
const left =
|
|
13948
|
+
const left = ts65.createPropertyAccess(receiver, ast.name);
|
|
13993
13949
|
addParseSpanInfo(left, ast.nameSpan);
|
|
13994
13950
|
const leftWithPath = wrapForDiagnostics(left);
|
|
13995
13951
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
13996
13952
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
13997
|
-
const node = wrapForDiagnostics(
|
|
13953
|
+
const node = wrapForDiagnostics(ts65.createBinary(leftWithPath, ts65.SyntaxKind.EqualsToken, right));
|
|
13998
13954
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13999
13955
|
return node;
|
|
14000
13956
|
}
|
|
@@ -14005,13 +13961,13 @@ var AstTranslator = class {
|
|
|
14005
13961
|
let node;
|
|
14006
13962
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
14007
13963
|
if (this.config.strictSafeNavigationTypes) {
|
|
14008
|
-
const expr =
|
|
13964
|
+
const expr = ts65.createPropertyAccess(ts65.createNonNullExpression(receiver), ast.name);
|
|
14009
13965
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
14010
|
-
node =
|
|
13966
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
14011
13967
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14012
|
-
node =
|
|
13968
|
+
node = ts65.createPropertyAccess(tsCastToAny(receiver), ast.name);
|
|
14013
13969
|
} else {
|
|
14014
|
-
const expr =
|
|
13970
|
+
const expr = ts65.createPropertyAccess(ts65.createNonNullExpression(receiver), ast.name);
|
|
14015
13971
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
14016
13972
|
node = tsCastToAny(expr);
|
|
14017
13973
|
}
|
|
@@ -14023,13 +13979,13 @@ var AstTranslator = class {
|
|
|
14023
13979
|
const key = this.translate(ast.key);
|
|
14024
13980
|
let node;
|
|
14025
13981
|
if (this.config.strictSafeNavigationTypes) {
|
|
14026
|
-
const expr =
|
|
13982
|
+
const expr = ts65.createElementAccess(ts65.createNonNullExpression(receiver), key);
|
|
14027
13983
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
14028
|
-
node =
|
|
13984
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
14029
13985
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14030
|
-
node =
|
|
13986
|
+
node = ts65.createElementAccess(tsCastToAny(receiver), key);
|
|
14031
13987
|
} else {
|
|
14032
|
-
const expr =
|
|
13988
|
+
const expr = ts65.createElementAccess(ts65.createNonNullExpression(receiver), key);
|
|
14033
13989
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
14034
13990
|
node = tsCastToAny(expr);
|
|
14035
13991
|
}
|
|
@@ -14042,15 +13998,15 @@ var AstTranslator = class {
|
|
|
14042
13998
|
let node;
|
|
14043
13999
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
14044
14000
|
if (this.config.strictSafeNavigationTypes) {
|
|
14045
|
-
const call =
|
|
14046
|
-
node =
|
|
14001
|
+
const call = ts65.createCall(ts65.createNonNullExpression(expr), void 0, args);
|
|
14002
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, call, UNDEFINED));
|
|
14047
14003
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14048
|
-
node =
|
|
14004
|
+
node = ts65.createCall(tsCastToAny(expr), void 0, args);
|
|
14049
14005
|
} else {
|
|
14050
|
-
node = tsCastToAny(
|
|
14006
|
+
node = tsCastToAny(ts65.createCall(ts65.createNonNullExpression(expr), void 0, args));
|
|
14051
14007
|
}
|
|
14052
14008
|
} else {
|
|
14053
|
-
node =
|
|
14009
|
+
node = ts65.createCall(expr, void 0, args);
|
|
14054
14010
|
}
|
|
14055
14011
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14056
14012
|
return node;
|
|
@@ -14162,7 +14118,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
14162
14118
|
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
14163
14119
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
14164
14120
|
const ctxRawType = env.referenceType(ref);
|
|
14165
|
-
if (!
|
|
14121
|
+
if (!ts66.isTypeReferenceNode(ctxRawType)) {
|
|
14166
14122
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
14167
14123
|
}
|
|
14168
14124
|
let typeParameters = void 0;
|
|
@@ -14174,25 +14130,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
14174
14130
|
switch (genericContextBehavior) {
|
|
14175
14131
|
case TcbGenericContextBehavior.UseEmitter:
|
|
14176
14132
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
14177
|
-
typeArguments = typeParameters.map((param) =>
|
|
14133
|
+
typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
|
|
14178
14134
|
break;
|
|
14179
14135
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
14180
14136
|
typeParameters = [...ref.node.typeParameters];
|
|
14181
|
-
typeArguments = typeParameters.map((param) =>
|
|
14137
|
+
typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
|
|
14182
14138
|
break;
|
|
14183
14139
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
14184
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
14140
|
+
typeArguments = ref.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14185
14141
|
break;
|
|
14186
14142
|
}
|
|
14187
14143
|
}
|
|
14188
14144
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
14189
14145
|
const scopeStatements = scope.render();
|
|
14190
|
-
const innerBody =
|
|
14146
|
+
const innerBody = ts66.createBlock([
|
|
14191
14147
|
...env.getPreludeStatements(),
|
|
14192
14148
|
...scopeStatements
|
|
14193
14149
|
]);
|
|
14194
|
-
const body =
|
|
14195
|
-
const fnDecl =
|
|
14150
|
+
const body = ts66.createBlock([ts66.createIf(ts66.createTrue(), innerBody, void 0)]);
|
|
14151
|
+
const fnDecl = ts66.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
14196
14152
|
addTemplateId(fnDecl, meta.id);
|
|
14197
14153
|
return fnDecl;
|
|
14198
14154
|
}
|
|
@@ -14233,7 +14189,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
14233
14189
|
execute() {
|
|
14234
14190
|
const ctx = this.scope.resolve(this.template);
|
|
14235
14191
|
const id = this.tcb.allocateId();
|
|
14236
|
-
const initializer =
|
|
14192
|
+
const initializer = ts66.createPropertyAccess(ctx, this.variable.value || "$implicit");
|
|
14237
14193
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
14238
14194
|
let variable;
|
|
14239
14195
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -14256,7 +14212,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
14256
14212
|
}
|
|
14257
14213
|
execute() {
|
|
14258
14214
|
const ctx = this.tcb.allocateId();
|
|
14259
|
-
const type =
|
|
14215
|
+
const type = ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword);
|
|
14260
14216
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
14261
14217
|
return ctx;
|
|
14262
14218
|
}
|
|
@@ -14309,16 +14265,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
14309
14265
|
}
|
|
14310
14266
|
let guard = null;
|
|
14311
14267
|
if (directiveGuards.length > 0) {
|
|
14312
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
14268
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts66.createBinary(expr, ts66.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
14313
14269
|
}
|
|
14314
14270
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
14315
14271
|
const statements = tmplScope.render();
|
|
14316
14272
|
if (statements.length === 0) {
|
|
14317
14273
|
return null;
|
|
14318
14274
|
}
|
|
14319
|
-
let tmplBlock =
|
|
14275
|
+
let tmplBlock = ts66.createBlock(statements);
|
|
14320
14276
|
if (guard !== null) {
|
|
14321
|
-
tmplBlock =
|
|
14277
|
+
tmplBlock = ts66.createIf(guard, tmplBlock);
|
|
14322
14278
|
}
|
|
14323
14279
|
this.scope.addStatement(tmplBlock);
|
|
14324
14280
|
return null;
|
|
@@ -14336,7 +14292,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
14336
14292
|
}
|
|
14337
14293
|
execute() {
|
|
14338
14294
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
14339
|
-
this.scope.addStatement(
|
|
14295
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14340
14296
|
return null;
|
|
14341
14297
|
}
|
|
14342
14298
|
};
|
|
@@ -14358,11 +14314,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
14358
14314
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
14359
14315
|
type = rawType;
|
|
14360
14316
|
} else {
|
|
14361
|
-
if (!
|
|
14317
|
+
if (!ts66.isTypeReferenceNode(rawType)) {
|
|
14362
14318
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
14363
14319
|
}
|
|
14364
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
14365
|
-
type =
|
|
14320
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14321
|
+
type = ts66.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
14366
14322
|
}
|
|
14367
14323
|
const id = this.tcb.allocateId();
|
|
14368
14324
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -14403,11 +14359,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
14403
14359
|
const id = this.tcb.allocateId();
|
|
14404
14360
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
14405
14361
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
14406
|
-
initializer =
|
|
14362
|
+
initializer = ts66.createAsExpression(initializer, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14407
14363
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
14408
|
-
initializer =
|
|
14409
|
-
initializer =
|
|
14410
|
-
initializer =
|
|
14364
|
+
initializer = ts66.createAsExpression(initializer, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14365
|
+
initializer = ts66.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
14366
|
+
initializer = ts66.createParen(initializer);
|
|
14411
14367
|
}
|
|
14412
14368
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
14413
14369
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -14497,7 +14453,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14497
14453
|
let target;
|
|
14498
14454
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
14499
14455
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
14500
|
-
if (!
|
|
14456
|
+
if (!ts66.isTypeReferenceNode(dirTypeRef)) {
|
|
14501
14457
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
14502
14458
|
}
|
|
14503
14459
|
const id = this.tcb.allocateId();
|
|
@@ -14512,10 +14468,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14512
14468
|
}
|
|
14513
14469
|
const id = this.tcb.allocateId();
|
|
14514
14470
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
14515
|
-
if (!
|
|
14471
|
+
if (!ts66.isTypeReferenceNode(dirTypeRef)) {
|
|
14516
14472
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
14517
14473
|
}
|
|
14518
|
-
const type =
|
|
14474
|
+
const type = ts66.createIndexedAccessTypeNode(ts66.createTypeQueryNode(dirId), ts66.createLiteralTypeNode(ts66.createStringLiteral(fieldName)));
|
|
14519
14475
|
const temp = tsDeclareVariable(id, type);
|
|
14520
14476
|
this.scope.addStatement(temp);
|
|
14521
14477
|
target = id;
|
|
@@ -14523,18 +14479,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14523
14479
|
if (dirId === null) {
|
|
14524
14480
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
14525
14481
|
}
|
|
14526
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
14482
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts66.createElementAccess(dirId, ts66.createStringLiteral(fieldName)) : ts66.createPropertyAccess(dirId, ts66.createIdentifier(fieldName));
|
|
14527
14483
|
}
|
|
14528
14484
|
if (input.attribute.keySpan !== void 0) {
|
|
14529
14485
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
14530
14486
|
}
|
|
14531
|
-
assignment =
|
|
14487
|
+
assignment = ts66.createBinary(target, ts66.SyntaxKind.EqualsToken, assignment);
|
|
14532
14488
|
}
|
|
14533
14489
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
14534
14490
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
14535
14491
|
markIgnoreDiagnostics(assignment);
|
|
14536
14492
|
}
|
|
14537
|
-
this.scope.addStatement(
|
|
14493
|
+
this.scope.addStatement(ts66.createExpressionStatement(assignment));
|
|
14538
14494
|
}
|
|
14539
14495
|
return null;
|
|
14540
14496
|
}
|
|
@@ -14553,7 +14509,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
14553
14509
|
execute() {
|
|
14554
14510
|
const id = this.tcb.allocateId();
|
|
14555
14511
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
14556
|
-
const circularPlaceholder =
|
|
14512
|
+
const circularPlaceholder = ts66.createCall(typeCtor, void 0, [ts66.createNonNullExpression(ts66.createNull())]);
|
|
14557
14513
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
14558
14514
|
return id;
|
|
14559
14515
|
}
|
|
@@ -14619,15 +14575,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
14619
14575
|
elId = this.scope.resolve(this.element);
|
|
14620
14576
|
}
|
|
14621
14577
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
14622
|
-
const prop =
|
|
14623
|
-
const stmt =
|
|
14578
|
+
const prop = ts66.createElementAccess(elId, ts66.createStringLiteral(propertyName));
|
|
14579
|
+
const stmt = ts66.createBinary(prop, ts66.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
14624
14580
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
14625
|
-
this.scope.addStatement(
|
|
14581
|
+
this.scope.addStatement(ts66.createExpressionStatement(stmt));
|
|
14626
14582
|
} else {
|
|
14627
|
-
this.scope.addStatement(
|
|
14583
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14628
14584
|
}
|
|
14629
14585
|
} else {
|
|
14630
|
-
this.scope.addStatement(
|
|
14586
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14631
14587
|
}
|
|
14632
14588
|
}
|
|
14633
14589
|
return null;
|
|
@@ -14659,18 +14615,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
14659
14615
|
if (dirId === null) {
|
|
14660
14616
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
14661
14617
|
}
|
|
14662
|
-
const outputField =
|
|
14618
|
+
const outputField = ts66.createElementAccess(dirId, ts66.createStringLiteral(field));
|
|
14663
14619
|
addParseSpanInfo(outputField, output.keySpan);
|
|
14664
14620
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
14665
14621
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
14666
|
-
const subscribeFn =
|
|
14667
|
-
const call =
|
|
14622
|
+
const subscribeFn = ts66.createPropertyAccess(outputField, "subscribe");
|
|
14623
|
+
const call = ts66.createCall(subscribeFn, void 0, [handler]);
|
|
14668
14624
|
addParseSpanInfo(call, output.sourceSpan);
|
|
14669
|
-
this.scope.addStatement(
|
|
14625
|
+
this.scope.addStatement(ts66.createExpressionStatement(call));
|
|
14670
14626
|
} else {
|
|
14671
|
-
this.scope.addStatement(
|
|
14627
|
+
this.scope.addStatement(ts66.createExpressionStatement(outputField));
|
|
14672
14628
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
14673
|
-
this.scope.addStatement(
|
|
14629
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14674
14630
|
}
|
|
14675
14631
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
14676
14632
|
}
|
|
@@ -14703,20 +14659,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
14703
14659
|
if (output.type === 1) {
|
|
14704
14660
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
14705
14661
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
14706
|
-
this.scope.addStatement(
|
|
14662
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14707
14663
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
14708
14664
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
14709
14665
|
if (elId === null) {
|
|
14710
14666
|
elId = this.scope.resolve(this.element);
|
|
14711
14667
|
}
|
|
14712
|
-
const propertyAccess =
|
|
14668
|
+
const propertyAccess = ts66.createPropertyAccess(elId, "addEventListener");
|
|
14713
14669
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
14714
|
-
const call =
|
|
14670
|
+
const call = ts66.createCall(propertyAccess, void 0, [ts66.createStringLiteral(output.name), handler]);
|
|
14715
14671
|
addParseSpanInfo(call, output.sourceSpan);
|
|
14716
|
-
this.scope.addStatement(
|
|
14672
|
+
this.scope.addStatement(ts66.createExpressionStatement(call));
|
|
14717
14673
|
} else {
|
|
14718
14674
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
14719
|
-
this.scope.addStatement(
|
|
14675
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14720
14676
|
}
|
|
14721
14677
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
14722
14678
|
}
|
|
@@ -14730,15 +14686,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
14730
14686
|
this.optional = false;
|
|
14731
14687
|
}
|
|
14732
14688
|
execute() {
|
|
14733
|
-
const ctx =
|
|
14734
|
-
const ctxDot =
|
|
14689
|
+
const ctx = ts66.createIdentifier("ctx");
|
|
14690
|
+
const ctxDot = ts66.createPropertyAccess(ctx, "");
|
|
14735
14691
|
markIgnoreDiagnostics(ctxDot);
|
|
14736
14692
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
14737
|
-
this.scope.addStatement(
|
|
14693
|
+
this.scope.addStatement(ts66.createExpressionStatement(ctxDot));
|
|
14738
14694
|
return null;
|
|
14739
14695
|
}
|
|
14740
14696
|
};
|
|
14741
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
14697
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts66.createNonNullExpression(ts66.createNull());
|
|
14742
14698
|
var Context2 = class {
|
|
14743
14699
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
14744
14700
|
this.env = env;
|
|
@@ -14751,7 +14707,7 @@ var Context2 = class {
|
|
|
14751
14707
|
this.nextId = 1;
|
|
14752
14708
|
}
|
|
14753
14709
|
allocateId() {
|
|
14754
|
-
return
|
|
14710
|
+
return ts66.createIdentifier(`_t${this.nextId++}`);
|
|
14755
14711
|
}
|
|
14756
14712
|
getPipeByName(name) {
|
|
14757
14713
|
if (!this.pipes.has(name)) {
|
|
@@ -14803,8 +14759,8 @@ var Scope = class {
|
|
|
14803
14759
|
resolve(node, directive) {
|
|
14804
14760
|
const res = this.resolveLocal(node, directive);
|
|
14805
14761
|
if (res !== null) {
|
|
14806
|
-
const clone =
|
|
14807
|
-
|
|
14762
|
+
const clone = ts66.getMutableClone(res);
|
|
14763
|
+
ts66.setSyntheticTrailingComments(clone, []);
|
|
14808
14764
|
return clone;
|
|
14809
14765
|
} else if (this.parent !== null) {
|
|
14810
14766
|
return this.parent.resolve(node, directive);
|
|
@@ -14832,7 +14788,7 @@ var Scope = class {
|
|
|
14832
14788
|
} else if (parentGuards === null) {
|
|
14833
14789
|
return this.guard;
|
|
14834
14790
|
} else {
|
|
14835
|
-
return
|
|
14791
|
+
return ts66.createBinary(parentGuards, ts66.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
14836
14792
|
}
|
|
14837
14793
|
}
|
|
14838
14794
|
resolveLocal(ref, directive) {
|
|
@@ -15012,8 +14968,8 @@ var Scope = class {
|
|
|
15012
14968
|
}
|
|
15013
14969
|
};
|
|
15014
14970
|
function tcbCtxParam(node, name, typeArguments) {
|
|
15015
|
-
const type =
|
|
15016
|
-
return
|
|
14971
|
+
const type = ts66.factory.createTypeReferenceNode(name, typeArguments);
|
|
14972
|
+
return ts66.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
15017
14973
|
}
|
|
15018
14974
|
function tcbExpression(ast, tcb, scope) {
|
|
15019
14975
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -15036,11 +14992,11 @@ var TcbExpressionTranslator = class {
|
|
|
15036
14992
|
return null;
|
|
15037
14993
|
}
|
|
15038
14994
|
const expr = this.translate(ast.value);
|
|
15039
|
-
const result =
|
|
14995
|
+
const result = ts66.createParen(ts66.createBinary(target, ts66.SyntaxKind.EqualsToken, expr));
|
|
15040
14996
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15041
14997
|
return result;
|
|
15042
14998
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
15043
|
-
return
|
|
14999
|
+
return ts66.createIdentifier("ctx");
|
|
15044
15000
|
} else if (ast instanceof BindingPipe) {
|
|
15045
15001
|
const expr = this.translate(ast.exp);
|
|
15046
15002
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -15052,19 +15008,19 @@ var TcbExpressionTranslator = class {
|
|
|
15052
15008
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
15053
15009
|
}
|
|
15054
15010
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
15055
|
-
let methodAccess =
|
|
15011
|
+
let methodAccess = ts66.factory.createPropertyAccessExpression(pipe, "transform");
|
|
15056
15012
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
15057
15013
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
15058
|
-
methodAccess =
|
|
15014
|
+
methodAccess = ts66.factory.createAsExpression(methodAccess, ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
15059
15015
|
}
|
|
15060
|
-
const result =
|
|
15016
|
+
const result = ts66.createCall(methodAccess, void 0, [expr, ...args]);
|
|
15061
15017
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15062
15018
|
return result;
|
|
15063
15019
|
} else if (ast instanceof Call2 && (ast.receiver instanceof PropertyRead2 || ast.receiver instanceof SafePropertyRead3) && !(ast.receiver.receiver instanceof ThisReceiver)) {
|
|
15064
15020
|
if (ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
15065
15021
|
const expr = this.translate(ast.args[0]);
|
|
15066
|
-
const exprAsAny =
|
|
15067
|
-
const result =
|
|
15022
|
+
const exprAsAny = ts66.createAsExpression(expr, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
15023
|
+
const result = ts66.createParen(exprAsAny);
|
|
15068
15024
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15069
15025
|
return result;
|
|
15070
15026
|
}
|
|
@@ -15075,7 +15031,7 @@ var TcbExpressionTranslator = class {
|
|
|
15075
15031
|
const method = wrapForDiagnostics(receiver);
|
|
15076
15032
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
15077
15033
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
15078
|
-
const node =
|
|
15034
|
+
const node = ts66.createCall(method, void 0, args);
|
|
15079
15035
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
15080
15036
|
return node;
|
|
15081
15037
|
} else {
|
|
@@ -15095,17 +15051,17 @@ var TcbExpressionTranslator = class {
|
|
|
15095
15051
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
15096
15052
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
15097
15053
|
const members = inputs.map((input) => {
|
|
15098
|
-
const propertyName =
|
|
15054
|
+
const propertyName = ts66.createStringLiteral(input.field);
|
|
15099
15055
|
if (input.type === "binding") {
|
|
15100
15056
|
const expr = widenBinding(input.expression, tcb);
|
|
15101
|
-
const assignment =
|
|
15057
|
+
const assignment = ts66.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
15102
15058
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
15103
15059
|
return assignment;
|
|
15104
15060
|
} else {
|
|
15105
|
-
return
|
|
15061
|
+
return ts66.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
15106
15062
|
}
|
|
15107
15063
|
});
|
|
15108
|
-
return
|
|
15064
|
+
return ts66.createCall(typeCtor, void 0, [ts66.createObjectLiteral(members)]);
|
|
15109
15065
|
}
|
|
15110
15066
|
function getBoundInputs(directive, node, tcb) {
|
|
15111
15067
|
const boundInputs = [];
|
|
@@ -15131,17 +15087,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
15131
15087
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
15132
15088
|
return tcbExpression(attr.value, tcb, scope);
|
|
15133
15089
|
} else {
|
|
15134
|
-
return
|
|
15090
|
+
return ts66.createStringLiteral(attr.value);
|
|
15135
15091
|
}
|
|
15136
15092
|
}
|
|
15137
15093
|
function widenBinding(expr, tcb) {
|
|
15138
15094
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
15139
15095
|
return tsCastToAny(expr);
|
|
15140
15096
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
15141
|
-
if (
|
|
15097
|
+
if (ts66.isObjectLiteralExpression(expr) || ts66.isArrayLiteralExpression(expr)) {
|
|
15142
15098
|
return expr;
|
|
15143
15099
|
} else {
|
|
15144
|
-
return
|
|
15100
|
+
return ts66.createNonNullExpression(expr);
|
|
15145
15101
|
}
|
|
15146
15102
|
} else {
|
|
15147
15103
|
return expr;
|
|
@@ -15154,18 +15110,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
15154
15110
|
if (eventType === 0) {
|
|
15155
15111
|
eventParamType = void 0;
|
|
15156
15112
|
} else if (eventType === 1) {
|
|
15157
|
-
eventParamType =
|
|
15113
|
+
eventParamType = ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword);
|
|
15158
15114
|
} else {
|
|
15159
15115
|
eventParamType = eventType;
|
|
15160
15116
|
}
|
|
15161
15117
|
const guards = scope.guards();
|
|
15162
|
-
let body =
|
|
15118
|
+
let body = ts66.createExpressionStatement(handler);
|
|
15163
15119
|
if (guards !== null) {
|
|
15164
|
-
body =
|
|
15120
|
+
body = ts66.createIf(guards, body);
|
|
15165
15121
|
}
|
|
15166
|
-
const eventParam =
|
|
15122
|
+
const eventParam = ts66.createParameter(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
15167
15123
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
15168
|
-
return
|
|
15124
|
+
return ts66.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword), ts66.createBlock([body]));
|
|
15169
15125
|
}
|
|
15170
15126
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
15171
15127
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -15193,7 +15149,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
15193
15149
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
15194
15150
|
resolve(ast) {
|
|
15195
15151
|
if (ast instanceof PropertyRead2 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
15196
|
-
const event =
|
|
15152
|
+
const event = ts66.createIdentifier(EVENT_PARAMETER);
|
|
15197
15153
|
addParseSpanInfo(event, ast.nameSpan);
|
|
15198
15154
|
return event;
|
|
15199
15155
|
}
|
|
@@ -15202,32 +15158,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
15202
15158
|
};
|
|
15203
15159
|
|
|
15204
15160
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
15205
|
-
import
|
|
15161
|
+
import ts67 from "typescript";
|
|
15206
15162
|
var TypeCheckFile = class extends Environment {
|
|
15207
15163
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
15208
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
15164
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts67.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts67.ScriptTarget.Latest, true));
|
|
15209
15165
|
this.fileName = fileName;
|
|
15210
15166
|
this.nextTcbId = 1;
|
|
15211
15167
|
this.tcbStatements = [];
|
|
15212
15168
|
}
|
|
15213
15169
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
15214
|
-
const fnId =
|
|
15170
|
+
const fnId = ts67.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
15215
15171
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
15216
15172
|
this.tcbStatements.push(fn);
|
|
15217
15173
|
}
|
|
15218
15174
|
render(removeComments) {
|
|
15219
15175
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
15220
|
-
const printer =
|
|
15176
|
+
const printer = ts67.createPrinter({ removeComments });
|
|
15221
15177
|
source += "\n";
|
|
15222
15178
|
for (const stmt of this.pipeInstStatements) {
|
|
15223
|
-
source += printer.printNode(
|
|
15179
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15224
15180
|
}
|
|
15225
15181
|
for (const stmt of this.typeCtorStatements) {
|
|
15226
|
-
source += printer.printNode(
|
|
15182
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15227
15183
|
}
|
|
15228
15184
|
source += "\n";
|
|
15229
15185
|
for (const stmt of this.tcbStatements) {
|
|
15230
|
-
source += printer.printNode(
|
|
15186
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15231
15187
|
}
|
|
15232
15188
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
15233
15189
|
return source;
|
|
@@ -15335,7 +15291,7 @@ var TypeCheckContextImpl = class {
|
|
|
15335
15291
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
15336
15292
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
15337
15293
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
15338
|
-
const printer =
|
|
15294
|
+
const printer = ts68.createPrinter({ omitTrailingSemicolon: true });
|
|
15339
15295
|
let code = textParts[0];
|
|
15340
15296
|
ops.forEach((op, idx) => {
|
|
15341
15297
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -15416,7 +15372,7 @@ var TypeCheckContextImpl = class {
|
|
|
15416
15372
|
if (span.start.offset === span.end.offset) {
|
|
15417
15373
|
span.end.offset++;
|
|
15418
15374
|
}
|
|
15419
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
15375
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts68.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error2.msg);
|
|
15420
15376
|
});
|
|
15421
15377
|
}
|
|
15422
15378
|
};
|
|
@@ -15434,9 +15390,9 @@ var InlineTcbOp = class {
|
|
|
15434
15390
|
}
|
|
15435
15391
|
execute(im, sf, refEmitter, printer) {
|
|
15436
15392
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
15437
|
-
const fnName =
|
|
15393
|
+
const fnName = ts68.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
15438
15394
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
15439
|
-
return printer.printNode(
|
|
15395
|
+
return printer.printNode(ts68.EmitHint.Unspecified, fn, sf);
|
|
15440
15396
|
}
|
|
15441
15397
|
};
|
|
15442
15398
|
var TypeCtorOp = class {
|
|
@@ -15449,7 +15405,7 @@ var TypeCtorOp = class {
|
|
|
15449
15405
|
}
|
|
15450
15406
|
execute(im, sf, refEmitter, printer) {
|
|
15451
15407
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
15452
|
-
return printer.printNode(
|
|
15408
|
+
return printer.printNode(ts68.EmitHint.Unspecified, tcb, sf);
|
|
15453
15409
|
}
|
|
15454
15410
|
};
|
|
15455
15411
|
function orderOps(op1, op2) {
|
|
@@ -15564,7 +15520,7 @@ var TemplateSourceManager = class {
|
|
|
15564
15520
|
|
|
15565
15521
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
15566
15522
|
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";
|
|
15567
|
-
import
|
|
15523
|
+
import ts69 from "typescript";
|
|
15568
15524
|
var SymbolBuilder = class {
|
|
15569
15525
|
constructor(shimPath, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
15570
15526
|
this.shimPath = shimPath;
|
|
@@ -15607,7 +15563,7 @@ var SymbolBuilder = class {
|
|
|
15607
15563
|
getSymbolOfElement(element) {
|
|
15608
15564
|
var _a;
|
|
15609
15565
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
15610
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
15566
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts69.isVariableDeclaration });
|
|
15611
15567
|
if (node === null) {
|
|
15612
15568
|
return null;
|
|
15613
15569
|
}
|
|
@@ -15626,12 +15582,12 @@ var SymbolBuilder = class {
|
|
|
15626
15582
|
var _a;
|
|
15627
15583
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
15628
15584
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
15629
|
-
const isDirectiveDeclaration = (node) => (
|
|
15585
|
+
const isDirectiveDeclaration = (node) => (ts69.isTypeNode(node) || ts69.isIdentifier(node)) && ts69.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
15630
15586
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
15631
15587
|
return nodes.map((node) => {
|
|
15632
15588
|
var _a2;
|
|
15633
15589
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
15634
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
15590
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts69.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
15635
15591
|
return null;
|
|
15636
15592
|
}
|
|
15637
15593
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -15700,17 +15656,17 @@ var SymbolBuilder = class {
|
|
|
15700
15656
|
if (!isAccessExpression(n)) {
|
|
15701
15657
|
return false;
|
|
15702
15658
|
}
|
|
15703
|
-
if (
|
|
15659
|
+
if (ts69.isPropertyAccessExpression(n)) {
|
|
15704
15660
|
return n.name.getText() === expectedAccess;
|
|
15705
15661
|
} else {
|
|
15706
|
-
return
|
|
15662
|
+
return ts69.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
15707
15663
|
}
|
|
15708
15664
|
}
|
|
15709
15665
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
15710
15666
|
const bindings = [];
|
|
15711
15667
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
15712
15668
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
15713
|
-
if (!
|
|
15669
|
+
if (!ts69.isPropertyAccessExpression(outputFieldAccess)) {
|
|
15714
15670
|
continue;
|
|
15715
15671
|
}
|
|
15716
15672
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -15729,7 +15685,7 @@ var SymbolBuilder = class {
|
|
|
15729
15685
|
shimLocation: { shimPath: this.shimPath, positionInShimFile }
|
|
15730
15686
|
});
|
|
15731
15687
|
} else {
|
|
15732
|
-
if (!
|
|
15688
|
+
if (!ts69.isElementAccessExpression(outputFieldAccess)) {
|
|
15733
15689
|
continue;
|
|
15734
15690
|
}
|
|
15735
15691
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -15797,11 +15753,11 @@ var SymbolBuilder = class {
|
|
|
15797
15753
|
return null;
|
|
15798
15754
|
}
|
|
15799
15755
|
const [declaration] = tsSymbol.declarations;
|
|
15800
|
-
if (!
|
|
15756
|
+
if (!ts69.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
15801
15757
|
return null;
|
|
15802
15758
|
}
|
|
15803
15759
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
15804
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
15760
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts69.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
15805
15761
|
return null;
|
|
15806
15762
|
}
|
|
15807
15763
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -15817,7 +15773,7 @@ var SymbolBuilder = class {
|
|
|
15817
15773
|
};
|
|
15818
15774
|
}
|
|
15819
15775
|
getSymbolOfVariable(variable) {
|
|
15820
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
15776
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts69.isVariableDeclaration });
|
|
15821
15777
|
if (node === null || node.initializer === void 0) {
|
|
15822
15778
|
return null;
|
|
15823
15779
|
}
|
|
@@ -15839,11 +15795,11 @@ var SymbolBuilder = class {
|
|
|
15839
15795
|
}
|
|
15840
15796
|
getSymbolOfReference(ref) {
|
|
15841
15797
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
15842
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
15798
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts69.isVariableDeclaration });
|
|
15843
15799
|
if (node === null || target === null || node.initializer === void 0) {
|
|
15844
15800
|
return null;
|
|
15845
15801
|
}
|
|
15846
|
-
const originalDeclaration =
|
|
15802
|
+
const originalDeclaration = ts69.isParenthesizedExpression(node.initializer) && ts69.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
15847
15803
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
15848
15804
|
return null;
|
|
15849
15805
|
}
|
|
@@ -15866,7 +15822,7 @@ var SymbolBuilder = class {
|
|
|
15866
15822
|
referenceVarLocation: referenceVarShimLocation
|
|
15867
15823
|
};
|
|
15868
15824
|
} else {
|
|
15869
|
-
if (!
|
|
15825
|
+
if (!ts69.isClassDeclaration(target.directive.ref.node)) {
|
|
15870
15826
|
return null;
|
|
15871
15827
|
}
|
|
15872
15828
|
return {
|
|
@@ -15881,7 +15837,7 @@ var SymbolBuilder = class {
|
|
|
15881
15837
|
}
|
|
15882
15838
|
}
|
|
15883
15839
|
getSymbolOfPipe(expression) {
|
|
15884
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
15840
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts69.isPropertyAccessExpression });
|
|
15885
15841
|
if (methodAccess === null) {
|
|
15886
15842
|
return null;
|
|
15887
15843
|
}
|
|
@@ -15920,7 +15876,7 @@ var SymbolBuilder = class {
|
|
|
15920
15876
|
}
|
|
15921
15877
|
let node = null;
|
|
15922
15878
|
if (expression instanceof PropertyRead3) {
|
|
15923
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
15879
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts69.isPropertyAccessExpression });
|
|
15924
15880
|
}
|
|
15925
15881
|
if (node === null) {
|
|
15926
15882
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -15928,10 +15884,10 @@ var SymbolBuilder = class {
|
|
|
15928
15884
|
if (node === null) {
|
|
15929
15885
|
return null;
|
|
15930
15886
|
}
|
|
15931
|
-
while (
|
|
15887
|
+
while (ts69.isParenthesizedExpression(node)) {
|
|
15932
15888
|
node = node.expression;
|
|
15933
15889
|
}
|
|
15934
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
15890
|
+
if (expression instanceof SafePropertyRead4 && ts69.isConditionalExpression(node)) {
|
|
15935
15891
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
15936
15892
|
if (whenTrueSymbol === null) {
|
|
15937
15893
|
return null;
|
|
@@ -15947,13 +15903,13 @@ var SymbolBuilder = class {
|
|
|
15947
15903
|
}
|
|
15948
15904
|
getSymbolOfTsNode(node) {
|
|
15949
15905
|
var _a;
|
|
15950
|
-
while (
|
|
15906
|
+
while (ts69.isParenthesizedExpression(node)) {
|
|
15951
15907
|
node = node.expression;
|
|
15952
15908
|
}
|
|
15953
15909
|
let tsSymbol;
|
|
15954
|
-
if (
|
|
15910
|
+
if (ts69.isPropertyAccessExpression(node)) {
|
|
15955
15911
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
15956
|
-
} else if (
|
|
15912
|
+
} else if (ts69.isElementAccessExpression(node)) {
|
|
15957
15913
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
15958
15914
|
} else {
|
|
15959
15915
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -15967,13 +15923,13 @@ var SymbolBuilder = class {
|
|
|
15967
15923
|
};
|
|
15968
15924
|
}
|
|
15969
15925
|
getShimPositionForNode(node) {
|
|
15970
|
-
if (
|
|
15926
|
+
if (ts69.isTypeReferenceNode(node)) {
|
|
15971
15927
|
return this.getShimPositionForNode(node.typeName);
|
|
15972
|
-
} else if (
|
|
15928
|
+
} else if (ts69.isQualifiedName(node)) {
|
|
15973
15929
|
return node.right.getStart();
|
|
15974
|
-
} else if (
|
|
15930
|
+
} else if (ts69.isPropertyAccessExpression(node)) {
|
|
15975
15931
|
return node.name.getStart();
|
|
15976
|
-
} else if (
|
|
15932
|
+
} else if (ts69.isElementAccessExpression(node)) {
|
|
15977
15933
|
return node.argumentExpression.getStart();
|
|
15978
15934
|
} else {
|
|
15979
15935
|
return node.getStart();
|
|
@@ -16524,7 +16480,7 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
16524
16480
|
|
|
16525
16481
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
16526
16482
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
16527
|
-
import
|
|
16483
|
+
import ts70 from "typescript";
|
|
16528
16484
|
|
|
16529
16485
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
16530
16486
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
@@ -16617,7 +16573,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
16617
16573
|
return [];
|
|
16618
16574
|
const boundSyntax = node.sourceSpan.toString();
|
|
16619
16575
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
16620
|
-
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, node.sourceSpan,
|
|
16576
|
+
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}'.
|
|
16621
16577
|
Find more at https://angular.io/guide/two-way-binding`);
|
|
16622
16578
|
return [diagnostic];
|
|
16623
16579
|
}
|
|
@@ -16625,7 +16581,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
16625
16581
|
|
|
16626
16582
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
16627
16583
|
import { Binary } from "@angular/compiler";
|
|
16628
|
-
import
|
|
16584
|
+
import ts71 from "typescript";
|
|
16629
16585
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
16630
16586
|
constructor() {
|
|
16631
16587
|
super(...arguments);
|
|
@@ -16646,7 +16602,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
16646
16602
|
return [];
|
|
16647
16603
|
}
|
|
16648
16604
|
const span = ctx.templateTypeChecker.getTemplateMappingAtShimLocation(symbol.shimLocation).span;
|
|
16649
|
-
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, span,
|
|
16605
|
+
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.`);
|
|
16650
16606
|
return [diagnostic];
|
|
16651
16607
|
}
|
|
16652
16608
|
};
|
|
@@ -16718,7 +16674,7 @@ var NgCompiler = class {
|
|
|
16718
16674
|
this.currentProgram = inputProgram;
|
|
16719
16675
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
16720
16676
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
16721
|
-
const moduleResolutionCache =
|
|
16677
|
+
const moduleResolutionCache = ts72.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
16722
16678
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
16723
16679
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
16724
16680
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -16774,7 +16730,7 @@ var NgCompiler = class {
|
|
|
16774
16730
|
}
|
|
16775
16731
|
for (const clazz of classesToUpdate) {
|
|
16776
16732
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
16777
|
-
if (!
|
|
16733
|
+
if (!ts72.isClassDeclaration(clazz)) {
|
|
16778
16734
|
continue;
|
|
16779
16735
|
}
|
|
16780
16736
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -16913,7 +16869,6 @@ var NgCompiler = class {
|
|
|
16913
16869
|
if (this.adapter.factoryTracker !== null) {
|
|
16914
16870
|
before.push(generatedFactoryTransform(this.adapter.factoryTracker.sourceInfo, importRewriter));
|
|
16915
16871
|
}
|
|
16916
|
-
before.push(ivySwitchTransform);
|
|
16917
16872
|
return { transformers: { before, afterDeclarations } };
|
|
16918
16873
|
}
|
|
16919
16874
|
getIndexedComponents() {
|
|
@@ -17184,17 +17139,17 @@ function isAngularCorePackage(program) {
|
|
|
17184
17139
|
return false;
|
|
17185
17140
|
}
|
|
17186
17141
|
return r3Symbols.statements.some((stmt) => {
|
|
17187
|
-
if (!
|
|
17142
|
+
if (!ts72.isVariableStatement(stmt)) {
|
|
17188
17143
|
return false;
|
|
17189
17144
|
}
|
|
17190
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
17145
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts72.SyntaxKind.ExportKeyword)) {
|
|
17191
17146
|
return false;
|
|
17192
17147
|
}
|
|
17193
17148
|
return stmt.declarationList.declarations.some((decl) => {
|
|
17194
|
-
if (!
|
|
17149
|
+
if (!ts72.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
17195
17150
|
return false;
|
|
17196
17151
|
}
|
|
17197
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
17152
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts72.SyntaxKind.TrueKeyword) {
|
|
17198
17153
|
return false;
|
|
17199
17154
|
}
|
|
17200
17155
|
return true;
|
|
@@ -17207,7 +17162,7 @@ function getR3SymbolsFile(program) {
|
|
|
17207
17162
|
function verifyCompatibleTypeCheckOptions(options) {
|
|
17208
17163
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
17209
17164
|
return {
|
|
17210
|
-
category:
|
|
17165
|
+
category: ts72.DiagnosticCategory.Error,
|
|
17211
17166
|
code: ngErrorCode(ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK),
|
|
17212
17167
|
file: void 0,
|
|
17213
17168
|
start: void 0,
|
|
@@ -17235,7 +17190,7 @@ var ReferenceGraphAdapter = class {
|
|
|
17235
17190
|
for (const { node } of references) {
|
|
17236
17191
|
let sourceFile = node.getSourceFile();
|
|
17237
17192
|
if (sourceFile === void 0) {
|
|
17238
|
-
sourceFile =
|
|
17193
|
+
sourceFile = ts72.getOriginalNode(node).getSourceFile();
|
|
17239
17194
|
}
|
|
17240
17195
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
17241
17196
|
this.graph.add(source, node);
|
|
@@ -17275,7 +17230,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
17275
17230
|
|
|
17276
17231
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
17277
17232
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
17278
|
-
import
|
|
17233
|
+
import ts75 from "typescript";
|
|
17279
17234
|
|
|
17280
17235
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
17281
17236
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -17333,7 +17288,7 @@ function getPathNormalizer(basePath) {
|
|
|
17333
17288
|
}
|
|
17334
17289
|
|
|
17335
17290
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
17336
|
-
import
|
|
17291
|
+
import ts73 from "typescript";
|
|
17337
17292
|
|
|
17338
17293
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/typescript_version.mjs
|
|
17339
17294
|
function toNumbers(value) {
|
|
@@ -17373,7 +17328,7 @@ function compareVersions(v1, v2) {
|
|
|
17373
17328
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
17374
17329
|
var MIN_TS_VERSION = "4.4.2";
|
|
17375
17330
|
var MAX_TS_VERSION = "4.5.0";
|
|
17376
|
-
var tsVersion =
|
|
17331
|
+
var tsVersion = ts73.version;
|
|
17377
17332
|
function checkVersion(version, minVersion, maxVersion) {
|
|
17378
17333
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
17379
17334
|
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
@@ -17384,7 +17339,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
17384
17339
|
}
|
|
17385
17340
|
|
|
17386
17341
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
17387
|
-
import
|
|
17342
|
+
import ts74 from "typescript";
|
|
17388
17343
|
var DelegatingCompilerHost2 = class {
|
|
17389
17344
|
constructor(delegate) {
|
|
17390
17345
|
this.delegate = delegate;
|
|
@@ -17473,7 +17428,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
17473
17428
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
17474
17429
|
if (entryPoint === null) {
|
|
17475
17430
|
diagnostics.push({
|
|
17476
|
-
category:
|
|
17431
|
+
category: ts74.DiagnosticCategory.Error,
|
|
17477
17432
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
17478
17433
|
file: void 0,
|
|
17479
17434
|
start: void 0,
|
|
@@ -17513,10 +17468,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
17513
17468
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
17514
17469
|
}
|
|
17515
17470
|
createCachedResolveModuleNamesFunction() {
|
|
17516
|
-
const moduleResolutionCache =
|
|
17471
|
+
const moduleResolutionCache = ts74.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
17517
17472
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
17518
17473
|
return moduleNames.map((moduleName) => {
|
|
17519
|
-
const module2 =
|
|
17474
|
+
const module2 = ts74.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
17520
17475
|
return module2.resolvedModule;
|
|
17521
17476
|
});
|
|
17522
17477
|
};
|
|
@@ -17537,7 +17492,7 @@ var NgtscProgram = class {
|
|
|
17537
17492
|
if (reuseProgram !== void 0) {
|
|
17538
17493
|
retagAllTsFiles(reuseProgram);
|
|
17539
17494
|
}
|
|
17540
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
17495
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts75.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
17541
17496
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
17542
17497
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
17543
17498
|
this.host.postProgramCreationCleanup();
|
|
@@ -17737,10 +17692,10 @@ function mergeEmitResults(emitResults) {
|
|
|
17737
17692
|
}
|
|
17738
17693
|
|
|
17739
17694
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/downlevel_decorators_transform.mjs
|
|
17740
|
-
import
|
|
17695
|
+
import ts77 from "typescript";
|
|
17741
17696
|
|
|
17742
17697
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.mjs
|
|
17743
|
-
import
|
|
17698
|
+
import ts76 from "typescript";
|
|
17744
17699
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
17745
17700
|
function loadIsReferencedAliasDeclarationPatch(context) {
|
|
17746
17701
|
if (!isTransformationContextWithEmitResolver(context)) {
|
|
@@ -17765,7 +17720,7 @@ function loadIsReferencedAliasDeclarationPatch(context) {
|
|
|
17765
17720
|
return emitResolver[patchedReferencedAliasesSymbol] = referencedAliases;
|
|
17766
17721
|
}
|
|
17767
17722
|
function isAliasImportDeclaration(node) {
|
|
17768
|
-
return
|
|
17723
|
+
return ts76.isImportSpecifier(node) || ts76.isNamespaceImport(node) || ts76.isImportClause(node);
|
|
17769
17724
|
}
|
|
17770
17725
|
function isTransformationContextWithEmitResolver(context) {
|
|
17771
17726
|
return context.getEmitResolver !== void 0;
|
|
@@ -17783,19 +17738,19 @@ function extractMetadataFromSingleDecorator(decorator, diagnostics) {
|
|
|
17783
17738
|
const metadataProperties = [];
|
|
17784
17739
|
const expr = decorator.expression;
|
|
17785
17740
|
switch (expr.kind) {
|
|
17786
|
-
case
|
|
17787
|
-
metadataProperties.push(
|
|
17741
|
+
case ts77.SyntaxKind.Identifier:
|
|
17742
|
+
metadataProperties.push(ts77.createPropertyAssignment("type", expr));
|
|
17788
17743
|
break;
|
|
17789
|
-
case
|
|
17744
|
+
case ts77.SyntaxKind.CallExpression:
|
|
17790
17745
|
const call = expr;
|
|
17791
|
-
metadataProperties.push(
|
|
17746
|
+
metadataProperties.push(ts77.createPropertyAssignment("type", call.expression));
|
|
17792
17747
|
if (call.arguments.length) {
|
|
17793
17748
|
const args = [];
|
|
17794
17749
|
for (const arg of call.arguments) {
|
|
17795
17750
|
args.push(arg);
|
|
17796
17751
|
}
|
|
17797
|
-
const argsArrayLiteral =
|
|
17798
|
-
metadataProperties.push(
|
|
17752
|
+
const argsArrayLiteral = ts77.createArrayLiteral(ts77.createNodeArray(args, true));
|
|
17753
|
+
metadataProperties.push(ts77.createPropertyAssignment("args", argsArrayLiteral));
|
|
17799
17754
|
}
|
|
17800
17755
|
break;
|
|
17801
17756
|
default:
|
|
@@ -17803,38 +17758,38 @@ function extractMetadataFromSingleDecorator(decorator, diagnostics) {
|
|
|
17803
17758
|
file: decorator.getSourceFile(),
|
|
17804
17759
|
start: decorator.getStart(),
|
|
17805
17760
|
length: decorator.getEnd() - decorator.getStart(),
|
|
17806
|
-
messageText: `${
|
|
17807
|
-
category:
|
|
17761
|
+
messageText: `${ts77.SyntaxKind[decorator.kind]} not implemented in gathering decorator metadata.`,
|
|
17762
|
+
category: ts77.DiagnosticCategory.Error,
|
|
17808
17763
|
code: 0
|
|
17809
17764
|
});
|
|
17810
17765
|
break;
|
|
17811
17766
|
}
|
|
17812
|
-
return
|
|
17767
|
+
return ts77.createObjectLiteral(metadataProperties);
|
|
17813
17768
|
}
|
|
17814
17769
|
function createCtorParametersClassProperty(diagnostics, entityNameToExpression, ctorParameters, isClosureCompilerEnabled) {
|
|
17815
17770
|
const params = [];
|
|
17816
17771
|
for (const ctorParam of ctorParameters) {
|
|
17817
17772
|
if (!ctorParam.type && ctorParam.decorators.length === 0) {
|
|
17818
|
-
params.push(
|
|
17773
|
+
params.push(ts77.createNull());
|
|
17819
17774
|
continue;
|
|
17820
17775
|
}
|
|
17821
17776
|
const paramType = ctorParam.type ? typeReferenceToExpression(entityNameToExpression, ctorParam.type) : void 0;
|
|
17822
|
-
const members = [
|
|
17777
|
+
const members = [ts77.createPropertyAssignment("type", paramType || ts77.createIdentifier("undefined"))];
|
|
17823
17778
|
const decorators = [];
|
|
17824
17779
|
for (const deco of ctorParam.decorators) {
|
|
17825
17780
|
decorators.push(extractMetadataFromSingleDecorator(deco, diagnostics));
|
|
17826
17781
|
}
|
|
17827
17782
|
if (decorators.length) {
|
|
17828
|
-
members.push(
|
|
17783
|
+
members.push(ts77.createPropertyAssignment("decorators", ts77.createArrayLiteral(decorators)));
|
|
17829
17784
|
}
|
|
17830
|
-
params.push(
|
|
17785
|
+
params.push(ts77.createObjectLiteral(members));
|
|
17831
17786
|
}
|
|
17832
|
-
const initializer =
|
|
17833
|
-
const ctorProp =
|
|
17787
|
+
const initializer = ts77.createArrowFunction(void 0, void 0, [], void 0, ts77.createToken(ts77.SyntaxKind.EqualsGreaterThanToken), ts77.createArrayLiteral(params, true));
|
|
17788
|
+
const ctorProp = ts77.createProperty(void 0, [ts77.createToken(ts77.SyntaxKind.StaticKeyword)], "ctorParameters", void 0, void 0, initializer);
|
|
17834
17789
|
if (isClosureCompilerEnabled) {
|
|
17835
|
-
|
|
17790
|
+
ts77.setSyntheticLeadingComments(ctorProp, [
|
|
17836
17791
|
{
|
|
17837
|
-
kind:
|
|
17792
|
+
kind: ts77.SyntaxKind.MultiLineCommentTrivia,
|
|
17838
17793
|
text: [
|
|
17839
17794
|
`*`,
|
|
17840
17795
|
` * @type {function(): !Array<(null|{`,
|
|
@@ -17854,53 +17809,53 @@ function createCtorParametersClassProperty(diagnostics, entityNameToExpression,
|
|
|
17854
17809
|
}
|
|
17855
17810
|
function typeReferenceToExpression(entityNameToExpression, node) {
|
|
17856
17811
|
let kind = node.kind;
|
|
17857
|
-
if (
|
|
17812
|
+
if (ts77.isLiteralTypeNode(node)) {
|
|
17858
17813
|
kind = node.literal.kind;
|
|
17859
17814
|
}
|
|
17860
17815
|
switch (kind) {
|
|
17861
|
-
case
|
|
17862
|
-
case
|
|
17863
|
-
return
|
|
17864
|
-
case
|
|
17865
|
-
case
|
|
17866
|
-
return
|
|
17867
|
-
case
|
|
17868
|
-
case
|
|
17869
|
-
case
|
|
17870
|
-
case
|
|
17871
|
-
return
|
|
17872
|
-
case
|
|
17873
|
-
case
|
|
17874
|
-
return
|
|
17875
|
-
case
|
|
17876
|
-
return
|
|
17877
|
-
case
|
|
17878
|
-
case
|
|
17879
|
-
return
|
|
17880
|
-
case
|
|
17816
|
+
case ts77.SyntaxKind.FunctionType:
|
|
17817
|
+
case ts77.SyntaxKind.ConstructorType:
|
|
17818
|
+
return ts77.createIdentifier("Function");
|
|
17819
|
+
case ts77.SyntaxKind.ArrayType:
|
|
17820
|
+
case ts77.SyntaxKind.TupleType:
|
|
17821
|
+
return ts77.createIdentifier("Array");
|
|
17822
|
+
case ts77.SyntaxKind.TypePredicate:
|
|
17823
|
+
case ts77.SyntaxKind.TrueKeyword:
|
|
17824
|
+
case ts77.SyntaxKind.FalseKeyword:
|
|
17825
|
+
case ts77.SyntaxKind.BooleanKeyword:
|
|
17826
|
+
return ts77.createIdentifier("Boolean");
|
|
17827
|
+
case ts77.SyntaxKind.StringLiteral:
|
|
17828
|
+
case ts77.SyntaxKind.StringKeyword:
|
|
17829
|
+
return ts77.createIdentifier("String");
|
|
17830
|
+
case ts77.SyntaxKind.ObjectKeyword:
|
|
17831
|
+
return ts77.createIdentifier("Object");
|
|
17832
|
+
case ts77.SyntaxKind.NumberKeyword:
|
|
17833
|
+
case ts77.SyntaxKind.NumericLiteral:
|
|
17834
|
+
return ts77.createIdentifier("Number");
|
|
17835
|
+
case ts77.SyntaxKind.TypeReference:
|
|
17881
17836
|
const typeRef = node;
|
|
17882
17837
|
return entityNameToExpression(typeRef.typeName);
|
|
17883
|
-
case
|
|
17884
|
-
const childTypeNodes = node.types.filter((t) => !(
|
|
17838
|
+
case ts77.SyntaxKind.UnionType:
|
|
17839
|
+
const childTypeNodes = node.types.filter((t) => !(ts77.isLiteralTypeNode(t) && t.literal.kind === ts77.SyntaxKind.NullKeyword));
|
|
17885
17840
|
return childTypeNodes.length === 1 ? typeReferenceToExpression(entityNameToExpression, childTypeNodes[0]) : void 0;
|
|
17886
17841
|
default:
|
|
17887
17842
|
return void 0;
|
|
17888
17843
|
}
|
|
17889
17844
|
}
|
|
17890
17845
|
function symbolIsRuntimeValue(typeChecker, symbol) {
|
|
17891
|
-
if (symbol.flags &
|
|
17846
|
+
if (symbol.flags & ts77.SymbolFlags.Alias) {
|
|
17892
17847
|
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
17893
17848
|
}
|
|
17894
|
-
return (symbol.flags &
|
|
17849
|
+
return (symbol.flags & ts77.SymbolFlags.Value & ts77.SymbolFlags.ConstEnumExcludes) !== 0;
|
|
17895
17850
|
}
|
|
17896
17851
|
function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore, isClosureCompilerEnabled, skipClassDecorators) {
|
|
17897
17852
|
function addJSDocTypeAnnotation(node, jsdocType) {
|
|
17898
17853
|
if (!isClosureCompilerEnabled) {
|
|
17899
17854
|
return;
|
|
17900
17855
|
}
|
|
17901
|
-
|
|
17856
|
+
ts77.setSyntheticLeadingComments(node, [
|
|
17902
17857
|
{
|
|
17903
|
-
kind:
|
|
17858
|
+
kind: ts77.SyntaxKind.MultiLineCommentTrivia,
|
|
17904
17859
|
text: `* @type {${jsdocType}} `,
|
|
17905
17860
|
pos: -1,
|
|
17906
17861
|
end: -1,
|
|
@@ -17909,19 +17864,19 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
17909
17864
|
]);
|
|
17910
17865
|
}
|
|
17911
17866
|
function createDecoratorClassProperty(decoratorList) {
|
|
17912
|
-
const modifier =
|
|
17913
|
-
const initializer =
|
|
17914
|
-
const prop =
|
|
17867
|
+
const modifier = ts77.createToken(ts77.SyntaxKind.StaticKeyword);
|
|
17868
|
+
const initializer = ts77.createArrayLiteral(decoratorList, true);
|
|
17869
|
+
const prop = ts77.createProperty(void 0, [modifier], "decorators", void 0, void 0, initializer);
|
|
17915
17870
|
addJSDocTypeAnnotation(prop, DECORATOR_INVOCATION_JSDOC_TYPE);
|
|
17916
17871
|
return prop;
|
|
17917
17872
|
}
|
|
17918
17873
|
function createPropDecoratorsClassProperty(diagnostics2, properties) {
|
|
17919
17874
|
const entries = [];
|
|
17920
17875
|
for (const [name, decorators] of properties.entries()) {
|
|
17921
|
-
entries.push(
|
|
17876
|
+
entries.push(ts77.createPropertyAssignment(name, ts77.createArrayLiteral(decorators.map((deco) => extractMetadataFromSingleDecorator(deco, diagnostics2)))));
|
|
17922
17877
|
}
|
|
17923
|
-
const initializer =
|
|
17924
|
-
const prop =
|
|
17878
|
+
const initializer = ts77.createObjectLiteral(entries, true);
|
|
17879
|
+
const prop = ts77.createProperty(void 0, [ts77.createToken(ts77.SyntaxKind.StaticKeyword)], "propDecorators", void 0, void 0, initializer);
|
|
17925
17880
|
addJSDocTypeAnnotation(prop, `!Object<string, ${DECORATOR_INVOCATION_JSDOC_TYPE}>`);
|
|
17926
17881
|
return prop;
|
|
17927
17882
|
}
|
|
@@ -17932,24 +17887,24 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
17932
17887
|
if (!symbol || !symbolIsRuntimeValue(typeChecker, symbol) || !symbol.declarations || symbol.declarations.length === 0) {
|
|
17933
17888
|
return void 0;
|
|
17934
17889
|
}
|
|
17935
|
-
if (
|
|
17890
|
+
if (ts77.isQualifiedName(name)) {
|
|
17936
17891
|
const containerExpr = entityNameToExpression(name.left);
|
|
17937
17892
|
if (containerExpr === void 0) {
|
|
17938
17893
|
return void 0;
|
|
17939
17894
|
}
|
|
17940
|
-
return
|
|
17895
|
+
return ts77.createPropertyAccess(containerExpr, name.right);
|
|
17941
17896
|
}
|
|
17942
17897
|
const decl = symbol.declarations[0];
|
|
17943
17898
|
if (isAliasImportDeclaration(decl)) {
|
|
17944
17899
|
referencedParameterTypes.add(decl);
|
|
17945
17900
|
if (decl.name !== void 0) {
|
|
17946
|
-
return
|
|
17901
|
+
return ts77.getMutableClone(decl.name);
|
|
17947
17902
|
}
|
|
17948
17903
|
}
|
|
17949
|
-
return
|
|
17904
|
+
return ts77.getMutableClone(name);
|
|
17950
17905
|
}
|
|
17951
17906
|
function transformClassElement(element) {
|
|
17952
|
-
element =
|
|
17907
|
+
element = ts77.visitEachChild(element, decoratorDownlevelVisitor, context);
|
|
17953
17908
|
const decoratorsToKeep = [];
|
|
17954
17909
|
const toLower = [];
|
|
17955
17910
|
const decorators = host.getDecoratorsOfDeclaration(element) || [];
|
|
@@ -17963,26 +17918,26 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
17963
17918
|
}
|
|
17964
17919
|
if (!toLower.length)
|
|
17965
17920
|
return [void 0, element, []];
|
|
17966
|
-
if (!element.name || !
|
|
17921
|
+
if (!element.name || !ts77.isIdentifier(element.name)) {
|
|
17967
17922
|
diagnostics.push({
|
|
17968
17923
|
file: element.getSourceFile(),
|
|
17969
17924
|
start: element.getStart(),
|
|
17970
17925
|
length: element.getEnd() - element.getStart(),
|
|
17971
17926
|
messageText: `Cannot process decorators for class element with non-analyzable name.`,
|
|
17972
|
-
category:
|
|
17927
|
+
category: ts77.DiagnosticCategory.Error,
|
|
17973
17928
|
code: 0
|
|
17974
17929
|
});
|
|
17975
17930
|
return [void 0, element, []];
|
|
17976
17931
|
}
|
|
17977
17932
|
const name = element.name.text;
|
|
17978
|
-
const mutable =
|
|
17979
|
-
mutable.decorators = decoratorsToKeep.length ?
|
|
17933
|
+
const mutable = ts77.getMutableClone(element);
|
|
17934
|
+
mutable.decorators = decoratorsToKeep.length ? ts77.setTextRange(ts77.createNodeArray(decoratorsToKeep), mutable.decorators) : void 0;
|
|
17980
17935
|
return [name, mutable, toLower];
|
|
17981
17936
|
}
|
|
17982
17937
|
function transformConstructor(ctor) {
|
|
17983
|
-
ctor =
|
|
17938
|
+
ctor = ts77.visitEachChild(ctor, decoratorDownlevelVisitor, context);
|
|
17984
17939
|
const newParameters = [];
|
|
17985
|
-
const oldParameters =
|
|
17940
|
+
const oldParameters = ctor.parameters;
|
|
17986
17941
|
const parametersInfo = [];
|
|
17987
17942
|
for (const param of oldParameters) {
|
|
17988
17943
|
const decoratorsToKeep = [];
|
|
@@ -18000,30 +17955,30 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18000
17955
|
paramInfo.type = param.type;
|
|
18001
17956
|
}
|
|
18002
17957
|
parametersInfo.push(paramInfo);
|
|
18003
|
-
const newParam =
|
|
17958
|
+
const newParam = ts77.updateParameter(param, decoratorsToKeep.length ? decoratorsToKeep : void 0, param.modifiers, param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
|
|
18004
17959
|
newParameters.push(newParam);
|
|
18005
17960
|
}
|
|
18006
|
-
const updated =
|
|
17961
|
+
const updated = ts77.updateConstructor(ctor, ctor.decorators, ctor.modifiers, newParameters, ctor.body);
|
|
18007
17962
|
return [updated, parametersInfo];
|
|
18008
17963
|
}
|
|
18009
17964
|
function transformClassDeclaration(classDecl) {
|
|
18010
|
-
classDecl =
|
|
17965
|
+
classDecl = ts77.getMutableClone(classDecl);
|
|
18011
17966
|
const newMembers = [];
|
|
18012
17967
|
const decoratedProperties = new Map();
|
|
18013
17968
|
let classParameters = null;
|
|
18014
17969
|
for (const member of classDecl.members) {
|
|
18015
17970
|
switch (member.kind) {
|
|
18016
|
-
case
|
|
18017
|
-
case
|
|
18018
|
-
case
|
|
18019
|
-
case
|
|
17971
|
+
case ts77.SyntaxKind.PropertyDeclaration:
|
|
17972
|
+
case ts77.SyntaxKind.GetAccessor:
|
|
17973
|
+
case ts77.SyntaxKind.SetAccessor:
|
|
17974
|
+
case ts77.SyntaxKind.MethodDeclaration: {
|
|
18020
17975
|
const [name, newMember, decorators] = transformClassElement(member);
|
|
18021
17976
|
newMembers.push(newMember);
|
|
18022
17977
|
if (name)
|
|
18023
17978
|
decoratedProperties.set(name, decorators);
|
|
18024
17979
|
continue;
|
|
18025
17980
|
}
|
|
18026
|
-
case
|
|
17981
|
+
case ts77.SyntaxKind.Constructor: {
|
|
18027
17982
|
const ctor = member;
|
|
18028
17983
|
if (!ctor.body)
|
|
18029
17984
|
break;
|
|
@@ -18035,7 +17990,7 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18035
17990
|
default:
|
|
18036
17991
|
break;
|
|
18037
17992
|
}
|
|
18038
|
-
newMembers.push(
|
|
17993
|
+
newMembers.push(ts77.visitEachChild(member, decoratorDownlevelVisitor, context));
|
|
18039
17994
|
}
|
|
18040
17995
|
const decoratorsToKeep = new Set(classDecl.decorators);
|
|
18041
17996
|
const possibleAngularDecorators = host.getDecoratorsOfDeclaration(classDecl) || [];
|
|
@@ -18063,23 +18018,23 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18063
18018
|
if (decoratedProperties.size) {
|
|
18064
18019
|
newMembers.push(createPropDecoratorsClassProperty(diagnostics, decoratedProperties));
|
|
18065
18020
|
}
|
|
18066
|
-
const members =
|
|
18067
|
-
return
|
|
18021
|
+
const members = ts77.setTextRange(ts77.createNodeArray(newMembers, classDecl.members.hasTrailingComma), classDecl.members);
|
|
18022
|
+
return ts77.updateClassDeclaration(classDecl, decoratorsToKeep.size ? Array.from(decoratorsToKeep) : void 0, classDecl.modifiers, classDecl.name, classDecl.typeParameters, classDecl.heritageClauses, members);
|
|
18068
18023
|
}
|
|
18069
18024
|
function decoratorDownlevelVisitor(node) {
|
|
18070
|
-
if (
|
|
18025
|
+
if (ts77.isClassDeclaration(node)) {
|
|
18071
18026
|
return transformClassDeclaration(node);
|
|
18072
18027
|
}
|
|
18073
|
-
return
|
|
18028
|
+
return ts77.visitEachChild(node, decoratorDownlevelVisitor, context);
|
|
18074
18029
|
}
|
|
18075
18030
|
return (sf) => {
|
|
18076
|
-
return
|
|
18031
|
+
return ts77.visitEachChild(sf, decoratorDownlevelVisitor, context);
|
|
18077
18032
|
};
|
|
18078
18033
|
};
|
|
18079
18034
|
}
|
|
18080
18035
|
|
|
18081
18036
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/inline_resources.mjs
|
|
18082
|
-
import
|
|
18037
|
+
import ts78 from "typescript";
|
|
18083
18038
|
var PRECONDITIONS_TEXT = "angularCompilerOptions.enableResourceInlining requires all resources to be statically resolvable.";
|
|
18084
18039
|
function getResourceLoader(host, containingFileName) {
|
|
18085
18040
|
return {
|
|
@@ -18106,7 +18061,7 @@ var InlineResourcesMetadataTransformer = class {
|
|
|
18106
18061
|
start(sourceFile) {
|
|
18107
18062
|
const loader = getResourceLoader(this.host, sourceFile.fileName);
|
|
18108
18063
|
return (value, node) => {
|
|
18109
|
-
if (isClassMetadata(value) &&
|
|
18064
|
+
if (isClassMetadata(value) && ts78.isClassDeclaration(node) && value.decorators) {
|
|
18110
18065
|
value.decorators.forEach((d) => {
|
|
18111
18066
|
if (isMetadataSymbolicCallExpression(d) && isMetadataImportedSymbolReferenceExpression(d.expression) && d.expression.module === "@angular/core" && d.expression.name === "Component" && d.arguments) {
|
|
18112
18067
|
d.arguments = d.arguments.map(this.updateDecoratorMetadata.bind(this, loader));
|
|
@@ -18139,66 +18094,66 @@ function getInlineResourcesTransformFactory(program, host) {
|
|
|
18139
18094
|
return (context) => (sourceFile) => {
|
|
18140
18095
|
const loader = getResourceLoader(host, sourceFile.fileName);
|
|
18141
18096
|
const visitor = (node) => {
|
|
18142
|
-
if (!
|
|
18097
|
+
if (!ts78.isClassDeclaration(node)) {
|
|
18143
18098
|
return node;
|
|
18144
18099
|
}
|
|
18145
|
-
const newDecorators =
|
|
18146
|
-
if (
|
|
18100
|
+
const newDecorators = ts78.visitNodes(node.decorators, (node2) => {
|
|
18101
|
+
if (ts78.isDecorator(node2) && isComponentDecorator(node2, program.getTypeChecker())) {
|
|
18147
18102
|
return updateDecorator(node2, loader);
|
|
18148
18103
|
}
|
|
18149
18104
|
return node2;
|
|
18150
18105
|
});
|
|
18151
|
-
const newMembers =
|
|
18152
|
-
if (
|
|
18106
|
+
const newMembers = ts78.visitNodes(node.members, (node2) => {
|
|
18107
|
+
if (ts78.isClassElement(node2)) {
|
|
18153
18108
|
return updateAnnotations(node2, loader, program.getTypeChecker());
|
|
18154
18109
|
} else {
|
|
18155
18110
|
return node2;
|
|
18156
18111
|
}
|
|
18157
18112
|
});
|
|
18158
|
-
return
|
|
18113
|
+
return ts78.updateClassDeclaration(node, newDecorators, node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], newMembers);
|
|
18159
18114
|
};
|
|
18160
|
-
return
|
|
18115
|
+
return ts78.visitEachChild(sourceFile, visitor, context);
|
|
18161
18116
|
};
|
|
18162
18117
|
}
|
|
18163
18118
|
function updateDecorator(node, loader) {
|
|
18164
|
-
if (!
|
|
18119
|
+
if (!ts78.isCallExpression(node.expression)) {
|
|
18165
18120
|
return node;
|
|
18166
18121
|
}
|
|
18167
18122
|
const expr = node.expression;
|
|
18168
18123
|
const newArguments = updateComponentProperties(expr.arguments, loader);
|
|
18169
|
-
return
|
|
18124
|
+
return ts78.updateDecorator(node, ts78.updateCall(expr, expr.expression, expr.typeArguments, newArguments));
|
|
18170
18125
|
}
|
|
18171
18126
|
function updateAnnotations(node, loader, typeChecker) {
|
|
18172
|
-
if (!
|
|
18127
|
+
if (!ts78.isPropertyDeclaration(node) || !ts78.isIdentifier(node.name) || node.name.text !== "decorators" || !node.initializer || !ts78.isArrayLiteralExpression(node.initializer)) {
|
|
18173
18128
|
return node;
|
|
18174
18129
|
}
|
|
18175
18130
|
const newAnnotations = node.initializer.elements.map((annotation) => {
|
|
18176
|
-
if (!
|
|
18131
|
+
if (!ts78.isObjectLiteralExpression(annotation))
|
|
18177
18132
|
return annotation;
|
|
18178
18133
|
const decoratorType = annotation.properties.find((p2) => isIdentifierNamed(p2, "type"));
|
|
18179
|
-
if (!decoratorType || !
|
|
18134
|
+
if (!decoratorType || !ts78.isPropertyAssignment(decoratorType) || !ts78.isIdentifier(decoratorType.initializer) || !isComponentSymbol(decoratorType.initializer, typeChecker)) {
|
|
18180
18135
|
return annotation;
|
|
18181
18136
|
}
|
|
18182
18137
|
const newAnnotation = annotation.properties.map((prop) => {
|
|
18183
|
-
if (!isIdentifierNamed(prop, "args") || !
|
|
18138
|
+
if (!isIdentifierNamed(prop, "args") || !ts78.isPropertyAssignment(prop) || !ts78.isArrayLiteralExpression(prop.initializer))
|
|
18184
18139
|
return prop;
|
|
18185
|
-
const newDecoratorArgs =
|
|
18140
|
+
const newDecoratorArgs = ts78.updatePropertyAssignment(prop, prop.name, ts78.createArrayLiteral(updateComponentProperties(prop.initializer.elements, loader)));
|
|
18186
18141
|
return newDecoratorArgs;
|
|
18187
18142
|
});
|
|
18188
|
-
return
|
|
18143
|
+
return ts78.updateObjectLiteral(annotation, newAnnotation);
|
|
18189
18144
|
});
|
|
18190
|
-
return
|
|
18145
|
+
return ts78.updateProperty(node, node.decorators, node.modifiers, node.name, node.questionToken, node.type, ts78.updateArrayLiteral(node.initializer, newAnnotations));
|
|
18191
18146
|
}
|
|
18192
18147
|
function isIdentifierNamed(p2, name) {
|
|
18193
|
-
return !!p2.name &&
|
|
18148
|
+
return !!p2.name && ts78.isIdentifier(p2.name) && p2.name.text === name;
|
|
18194
18149
|
}
|
|
18195
18150
|
function isComponentDecorator(node, typeChecker) {
|
|
18196
|
-
if (!
|
|
18151
|
+
if (!ts78.isCallExpression(node.expression)) {
|
|
18197
18152
|
return false;
|
|
18198
18153
|
}
|
|
18199
18154
|
const callExpr = node.expression;
|
|
18200
18155
|
let identifier;
|
|
18201
|
-
if (
|
|
18156
|
+
if (ts78.isIdentifier(callExpr.expression)) {
|
|
18202
18157
|
identifier = callExpr.expression;
|
|
18203
18158
|
} else {
|
|
18204
18159
|
return false;
|
|
@@ -18206,7 +18161,7 @@ function isComponentDecorator(node, typeChecker) {
|
|
|
18206
18161
|
return isComponentSymbol(identifier, typeChecker);
|
|
18207
18162
|
}
|
|
18208
18163
|
function isComponentSymbol(identifier, typeChecker) {
|
|
18209
|
-
if (!
|
|
18164
|
+
if (!ts78.isIdentifier(identifier))
|
|
18210
18165
|
return false;
|
|
18211
18166
|
const symbol = typeChecker.getSymbolAtLocation(identifier);
|
|
18212
18167
|
if (!symbol || !symbol.declarations || !symbol.declarations.length) {
|
|
@@ -18214,7 +18169,7 @@ function isComponentSymbol(identifier, typeChecker) {
|
|
|
18214
18169
|
return false;
|
|
18215
18170
|
}
|
|
18216
18171
|
const declaration = symbol.declarations[0];
|
|
18217
|
-
if (!declaration || !
|
|
18172
|
+
if (!declaration || !ts78.isImportSpecifier(declaration)) {
|
|
18218
18173
|
return false;
|
|
18219
18174
|
}
|
|
18220
18175
|
const name = (declaration.propertyName || declaration.name).text;
|
|
@@ -18226,69 +18181,69 @@ function updateComponentProperties(args, loader) {
|
|
|
18226
18181
|
return args;
|
|
18227
18182
|
}
|
|
18228
18183
|
const componentArg = args[0];
|
|
18229
|
-
if (!
|
|
18184
|
+
if (!ts78.isObjectLiteralExpression(componentArg)) {
|
|
18230
18185
|
return args;
|
|
18231
18186
|
}
|
|
18232
18187
|
const newProperties = [];
|
|
18233
18188
|
const newStyleExprs = [];
|
|
18234
18189
|
componentArg.properties.forEach((prop) => {
|
|
18235
|
-
if (!
|
|
18190
|
+
if (!ts78.isPropertyAssignment(prop) || ts78.isComputedPropertyName(prop.name)) {
|
|
18236
18191
|
newProperties.push(prop);
|
|
18237
18192
|
return;
|
|
18238
18193
|
}
|
|
18239
18194
|
switch (prop.name.text) {
|
|
18240
18195
|
case "styles":
|
|
18241
|
-
if (!
|
|
18196
|
+
if (!ts78.isArrayLiteralExpression(prop.initializer)) {
|
|
18242
18197
|
throw new Error("styles takes an array argument");
|
|
18243
18198
|
}
|
|
18244
18199
|
newStyleExprs.push(...prop.initializer.elements);
|
|
18245
18200
|
break;
|
|
18246
18201
|
case "styleUrls":
|
|
18247
|
-
if (!
|
|
18202
|
+
if (!ts78.isArrayLiteralExpression(prop.initializer)) {
|
|
18248
18203
|
throw new Error("styleUrls takes an array argument");
|
|
18249
18204
|
}
|
|
18250
18205
|
newStyleExprs.push(...prop.initializer.elements.map((expr) => {
|
|
18251
|
-
if (!
|
|
18206
|
+
if (!ts78.isStringLiteral(expr) && !ts78.isNoSubstitutionTemplateLiteral(expr)) {
|
|
18252
18207
|
throw new Error("Can only accept string literal arguments to styleUrls. " + PRECONDITIONS_TEXT);
|
|
18253
18208
|
}
|
|
18254
18209
|
const styles = loader.get(expr.text);
|
|
18255
|
-
return
|
|
18210
|
+
return ts78.createLiteral(styles);
|
|
18256
18211
|
}));
|
|
18257
18212
|
break;
|
|
18258
18213
|
case "templateUrl":
|
|
18259
|
-
if (!
|
|
18214
|
+
if (!ts78.isStringLiteral(prop.initializer) && !ts78.isNoSubstitutionTemplateLiteral(prop.initializer)) {
|
|
18260
18215
|
throw new Error("Can only accept a string literal argument to templateUrl. " + PRECONDITIONS_TEXT);
|
|
18261
18216
|
}
|
|
18262
18217
|
const template = loader.get(prop.initializer.text);
|
|
18263
|
-
newProperties.push(
|
|
18218
|
+
newProperties.push(ts78.updatePropertyAssignment(prop, ts78.createIdentifier("template"), ts78.createLiteral(template)));
|
|
18264
18219
|
break;
|
|
18265
18220
|
default:
|
|
18266
18221
|
newProperties.push(prop);
|
|
18267
18222
|
}
|
|
18268
18223
|
});
|
|
18269
18224
|
if (newStyleExprs.length > 0) {
|
|
18270
|
-
const newStyles =
|
|
18225
|
+
const newStyles = ts78.createPropertyAssignment(ts78.createIdentifier("styles"), ts78.createArrayLiteral(newStyleExprs));
|
|
18271
18226
|
newProperties.push(newStyles);
|
|
18272
18227
|
}
|
|
18273
|
-
return
|
|
18228
|
+
return ts78.createNodeArray([ts78.updateObjectLiteral(componentArg, newProperties)]);
|
|
18274
18229
|
}
|
|
18275
18230
|
|
|
18276
18231
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/lower_expressions.mjs
|
|
18277
18232
|
import { createLoweredSymbol, isLoweredSymbol } from "@angular/compiler";
|
|
18278
|
-
import
|
|
18233
|
+
import ts79 from "typescript";
|
|
18279
18234
|
function toMap(items, select) {
|
|
18280
18235
|
return new Map(items.map((i) => [select(i), i]));
|
|
18281
18236
|
}
|
|
18282
18237
|
function isLexicalScope(node) {
|
|
18283
18238
|
switch (node.kind) {
|
|
18284
|
-
case
|
|
18285
|
-
case
|
|
18286
|
-
case
|
|
18287
|
-
case
|
|
18288
|
-
case
|
|
18289
|
-
case
|
|
18290
|
-
case
|
|
18291
|
-
case
|
|
18239
|
+
case ts79.SyntaxKind.ArrowFunction:
|
|
18240
|
+
case ts79.SyntaxKind.FunctionExpression:
|
|
18241
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18242
|
+
case ts79.SyntaxKind.ClassExpression:
|
|
18243
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18244
|
+
case ts79.SyntaxKind.FunctionType:
|
|
18245
|
+
case ts79.SyntaxKind.TypeLiteral:
|
|
18246
|
+
case ts79.SyntaxKind.ArrayType:
|
|
18292
18247
|
return true;
|
|
18293
18248
|
}
|
|
18294
18249
|
return false;
|
|
@@ -18305,17 +18260,17 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18305
18260
|
function topLevelStatement(node) {
|
|
18306
18261
|
const declarations = [];
|
|
18307
18262
|
function visitNode(node2) {
|
|
18308
|
-
const { pos: pos2, end: end2, kind, parent: originalParent } =
|
|
18263
|
+
const { pos: pos2, end: end2, kind, parent: originalParent } = ts79.getOriginalNode(node2);
|
|
18309
18264
|
const nodeRequest = requests.get(pos2);
|
|
18310
18265
|
if (nodeRequest && nodeRequest.kind == kind && nodeRequest.end == end2) {
|
|
18311
|
-
if (originalParent && originalParent.kind ===
|
|
18266
|
+
if (originalParent && originalParent.kind === ts79.SyntaxKind.VariableDeclaration) {
|
|
18312
18267
|
const varParent = originalParent;
|
|
18313
|
-
if (varParent.name.kind ===
|
|
18268
|
+
if (varParent.name.kind === ts79.SyntaxKind.Identifier) {
|
|
18314
18269
|
const varName = varParent.name.text;
|
|
18315
18270
|
const exportName2 = nodeRequest.name;
|
|
18316
18271
|
declarations.push({
|
|
18317
18272
|
name: exportName2,
|
|
18318
|
-
node:
|
|
18273
|
+
node: ts79.createIdentifier(varName),
|
|
18319
18274
|
order: 1
|
|
18320
18275
|
});
|
|
18321
18276
|
return node2;
|
|
@@ -18323,18 +18278,18 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18323
18278
|
}
|
|
18324
18279
|
const exportName = nodeRequest.name;
|
|
18325
18280
|
declarations.push({ name: exportName, node: node2, order: 0 });
|
|
18326
|
-
return
|
|
18281
|
+
return ts79.createIdentifier(exportName);
|
|
18327
18282
|
}
|
|
18328
18283
|
let result = node2;
|
|
18329
18284
|
if (shouldVisit(pos2, end2) && !isLexicalScope(node2)) {
|
|
18330
|
-
result =
|
|
18285
|
+
result = ts79.visitEachChild(node2, visitNode, context);
|
|
18331
18286
|
}
|
|
18332
18287
|
return result;
|
|
18333
18288
|
}
|
|
18334
|
-
const { pos, end } =
|
|
18289
|
+
const { pos, end } = ts79.getOriginalNode(node);
|
|
18335
18290
|
let resultStmt;
|
|
18336
18291
|
if (shouldVisit(pos, end)) {
|
|
18337
|
-
resultStmt =
|
|
18292
|
+
resultStmt = ts79.visitEachChild(node, visitNode, context);
|
|
18338
18293
|
} else {
|
|
18339
18294
|
resultStmt = node;
|
|
18340
18295
|
}
|
|
@@ -18363,20 +18318,20 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18363
18318
|
tmpStatements.push(statement);
|
|
18364
18319
|
}
|
|
18365
18320
|
});
|
|
18366
|
-
tmpStatements.push(
|
|
18321
|
+
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)))));
|
|
18367
18322
|
newStatements = tmpStatements;
|
|
18368
18323
|
}
|
|
18369
|
-
const newSf =
|
|
18370
|
-
if (!(sourceFile2.flags &
|
|
18371
|
-
newSf.flags &= ~
|
|
18324
|
+
const newSf = ts79.updateSourceFileNode(sourceFile2, ts79.setTextRange(ts79.createNodeArray(newStatements), sourceFile2.statements));
|
|
18325
|
+
if (!(sourceFile2.flags & ts79.NodeFlags.Synthesized)) {
|
|
18326
|
+
newSf.flags &= ~ts79.NodeFlags.Synthesized;
|
|
18372
18327
|
}
|
|
18373
18328
|
return newSf;
|
|
18374
18329
|
}
|
|
18375
18330
|
return visitSourceFile(sourceFile);
|
|
18376
18331
|
}
|
|
18377
18332
|
function createVariableStatementForDeclarations(declarations) {
|
|
18378
|
-
const varDecls = declarations.map((i) =>
|
|
18379
|
-
return
|
|
18333
|
+
const varDecls = declarations.map((i) => ts79.createVariableDeclaration(i.name, void 0, i.node));
|
|
18334
|
+
return ts79.createVariableStatement(void 0, ts79.createVariableDeclarationList(varDecls, ts79.NodeFlags.Const));
|
|
18380
18335
|
}
|
|
18381
18336
|
function getExpressionLoweringTransformFactory(requestsMap, program) {
|
|
18382
18337
|
return (context) => (sourceFile) => {
|
|
@@ -18393,18 +18348,18 @@ function getExpressionLoweringTransformFactory(requestsMap, program) {
|
|
|
18393
18348
|
function isEligibleForLowering(node) {
|
|
18394
18349
|
if (node) {
|
|
18395
18350
|
switch (node.kind) {
|
|
18396
|
-
case
|
|
18397
|
-
case
|
|
18351
|
+
case ts79.SyntaxKind.SourceFile:
|
|
18352
|
+
case ts79.SyntaxKind.Decorator:
|
|
18398
18353
|
return true;
|
|
18399
|
-
case
|
|
18400
|
-
case
|
|
18401
|
-
case
|
|
18402
|
-
case
|
|
18354
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18355
|
+
case ts79.SyntaxKind.InterfaceDeclaration:
|
|
18356
|
+
case ts79.SyntaxKind.EnumDeclaration:
|
|
18357
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18403
18358
|
return false;
|
|
18404
|
-
case
|
|
18405
|
-
const isExported3 = (
|
|
18359
|
+
case ts79.SyntaxKind.VariableDeclaration:
|
|
18360
|
+
const isExported3 = (ts79.getCombinedModifierFlags(node) & ts79.ModifierFlags.Export) == 0;
|
|
18406
18361
|
const varNode = node;
|
|
18407
|
-
return isExported3 || varNode.initializer !== void 0 && (
|
|
18362
|
+
return isExported3 || varNode.initializer !== void 0 && (ts79.isObjectLiteralExpression(varNode.initializer) || ts79.isArrayLiteralExpression(varNode.initializer) || ts79.isCallExpression(varNode.initializer));
|
|
18408
18363
|
}
|
|
18409
18364
|
return isEligibleForLowering(node.parent);
|
|
18410
18365
|
}
|
|
@@ -18417,9 +18372,9 @@ function isRewritten(value) {
|
|
|
18417
18372
|
return isMetadataGlobalReferenceExpression(value) && isLoweredSymbol(value.name);
|
|
18418
18373
|
}
|
|
18419
18374
|
function isLiteralFieldNamed(node, names) {
|
|
18420
|
-
if (node.parent && node.parent.kind ==
|
|
18375
|
+
if (node.parent && node.parent.kind == ts79.SyntaxKind.PropertyAssignment) {
|
|
18421
18376
|
const property = node.parent;
|
|
18422
|
-
if (property.parent && property.parent.kind ==
|
|
18377
|
+
if (property.parent && property.parent.kind == ts79.SyntaxKind.ObjectLiteralExpression && property.name && property.name.kind == ts79.SyntaxKind.Identifier) {
|
|
18423
18378
|
const propertyName = property.name;
|
|
18424
18379
|
return names.has(propertyName.text);
|
|
18425
18380
|
}
|
|
@@ -18455,7 +18410,7 @@ var LowerMetadataTransform = class {
|
|
|
18455
18410
|
const isExportedSymbol = (() => {
|
|
18456
18411
|
let exportTable;
|
|
18457
18412
|
return (node) => {
|
|
18458
|
-
if (node.kind ==
|
|
18413
|
+
if (node.kind == ts79.SyntaxKind.Identifier) {
|
|
18459
18414
|
const ident = node;
|
|
18460
18415
|
if (!exportTable) {
|
|
18461
18416
|
exportTable = createExportTableFor(sourceFile);
|
|
@@ -18466,7 +18421,7 @@ var LowerMetadataTransform = class {
|
|
|
18466
18421
|
};
|
|
18467
18422
|
})();
|
|
18468
18423
|
const isExportedPropertyAccess = (node) => {
|
|
18469
|
-
if (node.kind ===
|
|
18424
|
+
if (node.kind === ts79.SyntaxKind.PropertyAccessExpression) {
|
|
18470
18425
|
const pae = node;
|
|
18471
18426
|
if (isExportedSymbol(pae.expression)) {
|
|
18472
18427
|
return true;
|
|
@@ -18480,7 +18435,7 @@ var LowerMetadataTransform = class {
|
|
|
18480
18435
|
return false;
|
|
18481
18436
|
}
|
|
18482
18437
|
let lowerable = false;
|
|
18483
|
-
if ((node.kind ===
|
|
18438
|
+
if ((node.kind === ts79.SyntaxKind.ArrowFunction || node.kind === ts79.SyntaxKind.FunctionExpression) && isEligibleForLowering(node)) {
|
|
18484
18439
|
lowerable = true;
|
|
18485
18440
|
} else if (isLiteralFieldNamed(node, this.lowerableFieldNames) && isEligibleForLowering(node) && !isExportedSymbol(node) && !isExportedPropertyAccess(node)) {
|
|
18486
18441
|
lowerable = true;
|
|
@@ -18512,35 +18467,35 @@ var LowerMetadataTransform = class {
|
|
|
18512
18467
|
};
|
|
18513
18468
|
function createExportTableFor(sourceFile) {
|
|
18514
18469
|
const exportTable = new Set();
|
|
18515
|
-
|
|
18470
|
+
ts79.forEachChild(sourceFile, function scan(node) {
|
|
18516
18471
|
switch (node.kind) {
|
|
18517
|
-
case
|
|
18518
|
-
case
|
|
18519
|
-
case
|
|
18520
|
-
if ((
|
|
18472
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18473
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18474
|
+
case ts79.SyntaxKind.InterfaceDeclaration:
|
|
18475
|
+
if ((ts79.getCombinedModifierFlags(node) & ts79.ModifierFlags.Export) != 0) {
|
|
18521
18476
|
const classDeclaration = node;
|
|
18522
18477
|
const name = classDeclaration.name;
|
|
18523
18478
|
if (name)
|
|
18524
18479
|
exportTable.add(name.text);
|
|
18525
18480
|
}
|
|
18526
18481
|
break;
|
|
18527
|
-
case
|
|
18482
|
+
case ts79.SyntaxKind.VariableStatement:
|
|
18528
18483
|
const variableStatement = node;
|
|
18529
18484
|
for (const declaration of variableStatement.declarationList.declarations) {
|
|
18530
18485
|
scan(declaration);
|
|
18531
18486
|
}
|
|
18532
18487
|
break;
|
|
18533
|
-
case
|
|
18488
|
+
case ts79.SyntaxKind.VariableDeclaration:
|
|
18534
18489
|
const variableDeclaration = node;
|
|
18535
|
-
if ((
|
|
18490
|
+
if ((ts79.getCombinedModifierFlags(variableDeclaration) & ts79.ModifierFlags.Export) != 0 && variableDeclaration.name.kind == ts79.SyntaxKind.Identifier) {
|
|
18536
18491
|
const name = variableDeclaration.name;
|
|
18537
18492
|
exportTable.add(name.text);
|
|
18538
18493
|
}
|
|
18539
18494
|
break;
|
|
18540
|
-
case
|
|
18495
|
+
case ts79.SyntaxKind.ExportDeclaration:
|
|
18541
18496
|
const exportDeclaration = node;
|
|
18542
18497
|
const { moduleSpecifier, exportClause } = exportDeclaration;
|
|
18543
|
-
if (!moduleSpecifier && exportClause &&
|
|
18498
|
+
if (!moduleSpecifier && exportClause && ts79.isNamedExports(exportClause)) {
|
|
18544
18499
|
exportClause.elements.forEach((spec) => {
|
|
18545
18500
|
exportTable.add(spec.name.text);
|
|
18546
18501
|
});
|
|
@@ -18551,7 +18506,7 @@ function createExportTableFor(sourceFile) {
|
|
|
18551
18506
|
}
|
|
18552
18507
|
|
|
18553
18508
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/metadata_cache.mjs
|
|
18554
|
-
import
|
|
18509
|
+
import ts80 from "typescript";
|
|
18555
18510
|
var MetadataCache = class {
|
|
18556
18511
|
constructor(collector, strict, transformers) {
|
|
18557
18512
|
this.collector = collector;
|
|
@@ -18570,7 +18525,7 @@ var MetadataCache = class {
|
|
|
18570
18525
|
}
|
|
18571
18526
|
let substitute = void 0;
|
|
18572
18527
|
const declarationFile = sourceFile.isDeclarationFile;
|
|
18573
|
-
const moduleFile =
|
|
18528
|
+
const moduleFile = ts80.isExternalModule(sourceFile);
|
|
18574
18529
|
if (!declarationFile && moduleFile) {
|
|
18575
18530
|
for (let transform of this.transformers) {
|
|
18576
18531
|
const transformSubstitute = transform.start(sourceFile);
|
|
@@ -18592,11 +18547,11 @@ var MetadataCache = class {
|
|
|
18592
18547
|
};
|
|
18593
18548
|
|
|
18594
18549
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter_transform.mjs
|
|
18595
|
-
import
|
|
18550
|
+
import ts82 from "typescript";
|
|
18596
18551
|
|
|
18597
18552
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter.mjs
|
|
18598
18553
|
import { BinaryOperator as BinaryOperator2, BuiltinMethod, BuiltinVar, ClassStmt, ExternalExpr as ExternalExpr10, Statement, StmtModifier as StmtModifier2, UnaryOperator as UnaryOperator2 } from "@angular/compiler";
|
|
18599
|
-
import
|
|
18554
|
+
import ts81 from "typescript";
|
|
18600
18555
|
var METHOD_THIS_NAME = "this";
|
|
18601
18556
|
var CATCH_ERROR_NAME = "error";
|
|
18602
18557
|
var CATCH_STACK_NAME = "stack";
|
|
@@ -18610,12 +18565,12 @@ var TypeScriptNodeEmitter = class {
|
|
|
18610
18565
|
const statements = [].concat(...stmts.map((stmt) => stmt.visitStatement(converter, null)).filter((stmt) => stmt != null));
|
|
18611
18566
|
const sourceStatements = [...converter.getReexports(), ...converter.getImports(), ...statements];
|
|
18612
18567
|
if (preamble) {
|
|
18613
|
-
const preambleCommentHolder =
|
|
18614
|
-
|
|
18568
|
+
const preambleCommentHolder = ts81.createNotEmittedStatement(sourceFile);
|
|
18569
|
+
ts81.addSyntheticLeadingComment(preambleCommentHolder, ts81.SyntaxKind.MultiLineCommentTrivia, preamble, true);
|
|
18615
18570
|
sourceStatements.unshift(preambleCommentHolder);
|
|
18616
18571
|
}
|
|
18617
18572
|
converter.updateSourceMap(sourceStatements);
|
|
18618
|
-
const newSourceFile =
|
|
18573
|
+
const newSourceFile = ts81.updateSourceFileNode(sourceFile, sourceStatements);
|
|
18619
18574
|
return [newSourceFile, converter.getNodeMap()];
|
|
18620
18575
|
}
|
|
18621
18576
|
};
|
|
@@ -18628,7 +18583,7 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18628
18583
|
const classNames = new Set(classes.map((classStatement) => classStatement.name));
|
|
18629
18584
|
const prefix = prefixStatements.map((statement) => statement.visitStatement(converter, sourceFile));
|
|
18630
18585
|
let newStatements = sourceFile.statements.map((node) => {
|
|
18631
|
-
if (node.kind ==
|
|
18586
|
+
if (node.kind == ts81.SyntaxKind.ClassDeclaration) {
|
|
18632
18587
|
const classDeclaration = node;
|
|
18633
18588
|
const name = classDeclaration.name;
|
|
18634
18589
|
if (name) {
|
|
@@ -18636,9 +18591,9 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18636
18591
|
if (classStatement) {
|
|
18637
18592
|
classNames.delete(name.text);
|
|
18638
18593
|
const classMemberHolder = converter.visitDeclareClassStmt(classStatement);
|
|
18639
|
-
const newMethods = classMemberHolder.members.filter((member) => member.kind !==
|
|
18594
|
+
const newMethods = classMemberHolder.members.filter((member) => member.kind !== ts81.SyntaxKind.Constructor);
|
|
18640
18595
|
const newMembers = [...classDeclaration.members, ...newMethods];
|
|
18641
|
-
return
|
|
18596
|
+
return ts81.updateClassDeclaration(classDeclaration, classDeclaration.decorators, classDeclaration.modifiers, classDeclaration.name, classDeclaration.typeParameters, classDeclaration.heritageClauses || [], newMembers);
|
|
18642
18597
|
}
|
|
18643
18598
|
}
|
|
18644
18599
|
}
|
|
@@ -18647,13 +18602,13 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18647
18602
|
classNames.size == 0 || error(`${classNames.size == 1 ? "Class" : "Classes"} "${Array.from(classNames.keys()).join(", ")}" not generated`);
|
|
18648
18603
|
const imports = converter.getImports();
|
|
18649
18604
|
if (imports && imports.length) {
|
|
18650
|
-
const index = firstAfter(newStatements, (statement) => statement.kind ===
|
|
18605
|
+
const index = firstAfter(newStatements, (statement) => statement.kind === ts81.SyntaxKind.ImportDeclaration || statement.kind === ts81.SyntaxKind.ImportEqualsDeclaration);
|
|
18651
18606
|
newStatements = [...newStatements.slice(0, index), ...imports, ...prefix, ...newStatements.slice(index)];
|
|
18652
18607
|
} else {
|
|
18653
18608
|
newStatements = [...prefix, ...newStatements];
|
|
18654
18609
|
}
|
|
18655
18610
|
converter.updateSourceMap(newStatements);
|
|
18656
|
-
const newSourceFile =
|
|
18611
|
+
const newSourceFile = ts81.updateSourceFileNode(sourceFile, newStatements);
|
|
18657
18612
|
return [newSourceFile, converter.getNodeMap()];
|
|
18658
18613
|
}
|
|
18659
18614
|
function firstAfter(a, predicate) {
|
|
@@ -18680,20 +18635,20 @@ function escapeLiteral(value) {
|
|
|
18680
18635
|
}
|
|
18681
18636
|
function createLiteral(value) {
|
|
18682
18637
|
if (value === null) {
|
|
18683
|
-
return
|
|
18638
|
+
return ts81.createNull();
|
|
18684
18639
|
} else if (value === void 0) {
|
|
18685
|
-
return
|
|
18640
|
+
return ts81.createIdentifier("undefined");
|
|
18686
18641
|
} else {
|
|
18687
|
-
const result =
|
|
18688
|
-
if (
|
|
18689
|
-
result.kind =
|
|
18642
|
+
const result = ts81.createLiteral(value);
|
|
18643
|
+
if (ts81.isStringLiteral(result) && result.text.indexOf("\\") >= 0) {
|
|
18644
|
+
result.kind = ts81.SyntaxKind.NumericLiteral;
|
|
18690
18645
|
result.text = `"${escapeLiteral(result.text)}"`;
|
|
18691
18646
|
}
|
|
18692
18647
|
return result;
|
|
18693
18648
|
}
|
|
18694
18649
|
}
|
|
18695
18650
|
function isExportTypeStatement(statement) {
|
|
18696
|
-
return !!statement.modifiers && statement.modifiers.some((mod) => mod.kind ===
|
|
18651
|
+
return !!statement.modifiers && statement.modifiers.some((mod) => mod.kind === ts81.SyntaxKind.ExportKeyword);
|
|
18697
18652
|
}
|
|
18698
18653
|
var NodeEmitterVisitor = class {
|
|
18699
18654
|
constructor(annotateForClosureCompiler) {
|
|
@@ -18706,9 +18661,9 @@ var NodeEmitterVisitor = class {
|
|
|
18706
18661
|
}
|
|
18707
18662
|
loadExportedVariableIdentifiers(sourceFile) {
|
|
18708
18663
|
sourceFile.statements.forEach((statement) => {
|
|
18709
|
-
if (
|
|
18664
|
+
if (ts81.isVariableStatement(statement) && isExportTypeStatement(statement)) {
|
|
18710
18665
|
statement.declarationList.declarations.forEach((declaration) => {
|
|
18711
|
-
if (
|
|
18666
|
+
if (ts81.isIdentifier(declaration.name)) {
|
|
18712
18667
|
this._exportedVariableIdentifiers.set(declaration.name.text, declaration.name);
|
|
18713
18668
|
}
|
|
18714
18669
|
});
|
|
@@ -18716,10 +18671,10 @@ var NodeEmitterVisitor = class {
|
|
|
18716
18671
|
});
|
|
18717
18672
|
}
|
|
18718
18673
|
getReexports() {
|
|
18719
|
-
return Array.from(this._reexports.entries()).map(([exportedFilePath, reexports]) =>
|
|
18674
|
+
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)));
|
|
18720
18675
|
}
|
|
18721
18676
|
getImports() {
|
|
18722
|
-
return Array.from(this._importsWithPrefixes.entries()).map(([namespace, prefix]) =>
|
|
18677
|
+
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)));
|
|
18723
18678
|
}
|
|
18724
18679
|
getNodeMap() {
|
|
18725
18680
|
return this._nodeMap;
|
|
@@ -18731,12 +18686,12 @@ var NodeEmitterVisitor = class {
|
|
|
18731
18686
|
const recordLastSourceRange = () => {
|
|
18732
18687
|
if (lastRange && lastRangeStartNode && lastRangeEndNode) {
|
|
18733
18688
|
if (lastRangeStartNode == lastRangeEndNode) {
|
|
18734
|
-
|
|
18689
|
+
ts81.setSourceMapRange(lastRangeEndNode, lastRange);
|
|
18735
18690
|
} else {
|
|
18736
|
-
|
|
18737
|
-
|
|
18738
|
-
|
|
18739
|
-
|
|
18691
|
+
ts81.setSourceMapRange(lastRangeStartNode, lastRange);
|
|
18692
|
+
ts81.setEmitFlags(lastRangeStartNode, ts81.EmitFlags.NoTrailingSourceMap);
|
|
18693
|
+
ts81.setSourceMapRange(lastRangeEndNode, lastRange);
|
|
18694
|
+
ts81.setEmitFlags(lastRangeEndNode, ts81.EmitFlags.NoLeadingSourceMap);
|
|
18740
18695
|
}
|
|
18741
18696
|
}
|
|
18742
18697
|
};
|
|
@@ -18753,7 +18708,7 @@ var NodeEmitterVisitor = class {
|
|
|
18753
18708
|
lastRangeEndNode = tsNode;
|
|
18754
18709
|
}
|
|
18755
18710
|
}
|
|
18756
|
-
|
|
18711
|
+
ts81.forEachChild(tsNode, visitNode);
|
|
18757
18712
|
};
|
|
18758
18713
|
statements.forEach(visitNode);
|
|
18759
18714
|
recordLastSourceRange();
|
|
@@ -18775,7 +18730,7 @@ var NodeEmitterVisitor = class {
|
|
|
18775
18730
|
if (file.url) {
|
|
18776
18731
|
let source = this._templateSources.get(file);
|
|
18777
18732
|
if (!source) {
|
|
18778
|
-
source =
|
|
18733
|
+
source = ts81.createSourceMapSource(file.url, file.content, (pos) => pos);
|
|
18779
18734
|
this._templateSources.set(file, source);
|
|
18780
18735
|
}
|
|
18781
18736
|
return { pos: span.start.offset, end: span.end.offset, source };
|
|
@@ -18787,7 +18742,7 @@ var NodeEmitterVisitor = class {
|
|
|
18787
18742
|
getModifiers(stmt) {
|
|
18788
18743
|
let modifiers = [];
|
|
18789
18744
|
if (stmt.hasModifier(StmtModifier2.Exported)) {
|
|
18790
|
-
modifiers.push(
|
|
18745
|
+
modifiers.push(ts81.createToken(ts81.SyntaxKind.ExportKeyword));
|
|
18791
18746
|
}
|
|
18792
18747
|
return modifiers;
|
|
18793
18748
|
}
|
|
@@ -18804,86 +18759,86 @@ var NodeEmitterVisitor = class {
|
|
|
18804
18759
|
return null;
|
|
18805
18760
|
}
|
|
18806
18761
|
}
|
|
18807
|
-
const varDeclList =
|
|
18762
|
+
const varDeclList = ts81.createVariableDeclarationList([ts81.createVariableDeclaration(ts81.createIdentifier(stmt.name), void 0, stmt.value && stmt.value.visitExpression(this, null) || void 0)]);
|
|
18808
18763
|
if (stmt.hasModifier(StmtModifier2.Exported)) {
|
|
18809
|
-
const tsVarStmt = this.postProcess(stmt,
|
|
18810
|
-
const exportStmt = this.postProcess(stmt,
|
|
18764
|
+
const tsVarStmt = this.postProcess(stmt, ts81.createVariableStatement([], varDeclList));
|
|
18765
|
+
const exportStmt = this.postProcess(stmt, ts81.createExportDeclaration(void 0, void 0, ts81.createNamedExports([ts81.createExportSpecifier(stmt.name, stmt.name)])));
|
|
18811
18766
|
return [tsVarStmt, exportStmt];
|
|
18812
18767
|
}
|
|
18813
|
-
return this.postProcess(stmt,
|
|
18768
|
+
return this.postProcess(stmt, ts81.createVariableStatement(this.getModifiers(stmt), varDeclList));
|
|
18814
18769
|
}
|
|
18815
18770
|
visitDeclareFunctionStmt(stmt) {
|
|
18816
|
-
return this.postProcess(stmt,
|
|
18771
|
+
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)));
|
|
18817
18772
|
}
|
|
18818
18773
|
visitExpressionStmt(stmt) {
|
|
18819
|
-
return this.postProcess(stmt,
|
|
18774
|
+
return this.postProcess(stmt, ts81.createStatement(stmt.expr.visitExpression(this, null)));
|
|
18820
18775
|
}
|
|
18821
18776
|
visitReturnStmt(stmt) {
|
|
18822
|
-
return this.postProcess(stmt,
|
|
18777
|
+
return this.postProcess(stmt, ts81.createReturn(stmt.value ? stmt.value.visitExpression(this, null) : void 0));
|
|
18823
18778
|
}
|
|
18824
18779
|
visitDeclareClassStmt(stmt) {
|
|
18825
18780
|
const modifiers = this.getModifiers(stmt);
|
|
18826
18781
|
const fields = stmt.fields.map((field) => {
|
|
18827
|
-
const property =
|
|
18782
|
+
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));
|
|
18828
18783
|
if (this.annotateForClosureCompiler) {
|
|
18829
|
-
|
|
18784
|
+
ts81.addSyntheticLeadingComment(property, ts81.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
|
|
18830
18785
|
}
|
|
18831
18786
|
return property;
|
|
18832
18787
|
});
|
|
18833
|
-
const getters = stmt.getters.map((getter) =>
|
|
18834
|
-
const constructor = stmt.constructorMethod && [
|
|
18835
|
-
const methods = stmt.methods.filter((method) => method.name).map((method) =>
|
|
18836
|
-
return this.postProcess(stmt,
|
|
18788
|
+
const getters = stmt.getters.map((getter) => ts81.createGetAccessor(void 0, void 0, getter.name, [], void 0, this._visitStatements(getter.body)));
|
|
18789
|
+
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))] || [];
|
|
18790
|
+
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)));
|
|
18791
|
+
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]));
|
|
18837
18792
|
}
|
|
18838
18793
|
visitIfStmt(stmt) {
|
|
18839
|
-
return this.postProcess(stmt,
|
|
18794
|
+
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));
|
|
18840
18795
|
}
|
|
18841
18796
|
visitTryCatchStmt(stmt) {
|
|
18842
|
-
return this.postProcess(stmt,
|
|
18797
|
+
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));
|
|
18843
18798
|
}
|
|
18844
18799
|
visitThrowStmt(stmt) {
|
|
18845
|
-
return this.postProcess(stmt,
|
|
18800
|
+
return this.postProcess(stmt, ts81.createThrow(stmt.error.visitExpression(this, null)));
|
|
18846
18801
|
}
|
|
18847
18802
|
visitWrappedNodeExpr(expr) {
|
|
18848
18803
|
return this.postProcess(expr, expr.node);
|
|
18849
18804
|
}
|
|
18850
18805
|
visitTypeofExpr(expr) {
|
|
18851
|
-
const typeOf =
|
|
18806
|
+
const typeOf = ts81.createTypeOf(expr.expr.visitExpression(this, null));
|
|
18852
18807
|
return this.postProcess(expr, typeOf);
|
|
18853
18808
|
}
|
|
18854
18809
|
visitReadVarExpr(expr) {
|
|
18855
18810
|
switch (expr.builtin) {
|
|
18856
18811
|
case BuiltinVar.This:
|
|
18857
|
-
return this.postProcess(expr,
|
|
18812
|
+
return this.postProcess(expr, ts81.createIdentifier(METHOD_THIS_NAME));
|
|
18858
18813
|
case BuiltinVar.CatchError:
|
|
18859
|
-
return this.postProcess(expr,
|
|
18814
|
+
return this.postProcess(expr, ts81.createIdentifier(CATCH_ERROR_NAME));
|
|
18860
18815
|
case BuiltinVar.CatchStack:
|
|
18861
|
-
return this.postProcess(expr,
|
|
18816
|
+
return this.postProcess(expr, ts81.createIdentifier(CATCH_STACK_NAME));
|
|
18862
18817
|
case BuiltinVar.Super:
|
|
18863
|
-
return this.postProcess(expr,
|
|
18818
|
+
return this.postProcess(expr, ts81.createSuper());
|
|
18864
18819
|
}
|
|
18865
18820
|
if (expr.name) {
|
|
18866
|
-
return this.postProcess(expr,
|
|
18821
|
+
return this.postProcess(expr, ts81.createIdentifier(expr.name));
|
|
18867
18822
|
}
|
|
18868
18823
|
throw Error(`Unexpected ReadVarExpr form`);
|
|
18869
18824
|
}
|
|
18870
18825
|
visitWriteVarExpr(expr) {
|
|
18871
|
-
return this.postProcess(expr,
|
|
18826
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createIdentifier(expr.name), expr.value.visitExpression(this, null)));
|
|
18872
18827
|
}
|
|
18873
18828
|
visitWriteKeyExpr(expr) {
|
|
18874
|
-
return this.postProcess(expr,
|
|
18829
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createElementAccess(expr.receiver.visitExpression(this, null), expr.index.visitExpression(this, null)), expr.value.visitExpression(this, null)));
|
|
18875
18830
|
}
|
|
18876
18831
|
visitWritePropExpr(expr) {
|
|
18877
|
-
return this.postProcess(expr,
|
|
18832
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createPropertyAccess(expr.receiver.visitExpression(this, null), expr.name), expr.value.visitExpression(this, null)));
|
|
18878
18833
|
}
|
|
18879
18834
|
visitInvokeFunctionExpr(expr) {
|
|
18880
|
-
return this.postProcess(expr,
|
|
18835
|
+
return this.postProcess(expr, ts81.createCall(expr.fn.visitExpression(this, null), void 0, expr.args.map((arg) => arg.visitExpression(this, null))));
|
|
18881
18836
|
}
|
|
18882
18837
|
visitTaggedTemplateExpr(expr) {
|
|
18883
18838
|
throw new Error("tagged templates are not supported in pre-ivy mode.");
|
|
18884
18839
|
}
|
|
18885
18840
|
visitInstantiateExpr(expr) {
|
|
18886
|
-
return this.postProcess(expr,
|
|
18841
|
+
return this.postProcess(expr, ts81.createNew(expr.classExpr.visitExpression(this, null), void 0, expr.args.map((arg) => arg.visitExpression(this, null))));
|
|
18887
18842
|
}
|
|
18888
18843
|
visitLiteralExpr(expr) {
|
|
18889
18844
|
return this.postProcess(expr, createLiteral(expr.value));
|
|
@@ -18895,10 +18850,10 @@ var NodeEmitterVisitor = class {
|
|
|
18895
18850
|
return this.postProcess(expr, this._visitIdentifier(expr.value));
|
|
18896
18851
|
}
|
|
18897
18852
|
visitConditionalExpr(expr) {
|
|
18898
|
-
return this.postProcess(expr,
|
|
18853
|
+
return this.postProcess(expr, ts81.createParen(ts81.createConditional(expr.condition.visitExpression(this, null), expr.trueCase.visitExpression(this, null), expr.falseCase.visitExpression(this, null))));
|
|
18899
18854
|
}
|
|
18900
18855
|
visitNotExpr(expr) {
|
|
18901
|
-
return this.postProcess(expr,
|
|
18856
|
+
return this.postProcess(expr, ts81.createPrefix(ts81.SyntaxKind.ExclamationToken, expr.condition.visitExpression(this, null)));
|
|
18902
18857
|
}
|
|
18903
18858
|
visitAssertNotNullExpr(expr) {
|
|
18904
18859
|
return expr.condition.visitExpression(this, null);
|
|
@@ -18907,103 +18862,103 @@ var NodeEmitterVisitor = class {
|
|
|
18907
18862
|
return expr.value.visitExpression(this, null);
|
|
18908
18863
|
}
|
|
18909
18864
|
visitFunctionExpr(expr) {
|
|
18910
|
-
return this.postProcess(expr,
|
|
18865
|
+
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)));
|
|
18911
18866
|
}
|
|
18912
18867
|
visitUnaryOperatorExpr(expr) {
|
|
18913
18868
|
let unaryOperator;
|
|
18914
18869
|
switch (expr.operator) {
|
|
18915
18870
|
case UnaryOperator2.Minus:
|
|
18916
|
-
unaryOperator =
|
|
18871
|
+
unaryOperator = ts81.SyntaxKind.MinusToken;
|
|
18917
18872
|
break;
|
|
18918
18873
|
case UnaryOperator2.Plus:
|
|
18919
|
-
unaryOperator =
|
|
18874
|
+
unaryOperator = ts81.SyntaxKind.PlusToken;
|
|
18920
18875
|
break;
|
|
18921
18876
|
default:
|
|
18922
18877
|
throw new Error(`Unknown operator: ${expr.operator}`);
|
|
18923
18878
|
}
|
|
18924
|
-
const binary =
|
|
18925
|
-
return this.postProcess(expr, expr.parens ?
|
|
18879
|
+
const binary = ts81.createPrefix(unaryOperator, expr.expr.visitExpression(this, null));
|
|
18880
|
+
return this.postProcess(expr, expr.parens ? ts81.createParen(binary) : binary);
|
|
18926
18881
|
}
|
|
18927
18882
|
visitBinaryOperatorExpr(expr) {
|
|
18928
18883
|
let binaryOperator;
|
|
18929
18884
|
switch (expr.operator) {
|
|
18930
18885
|
case BinaryOperator2.And:
|
|
18931
|
-
binaryOperator =
|
|
18886
|
+
binaryOperator = ts81.SyntaxKind.AmpersandAmpersandToken;
|
|
18932
18887
|
break;
|
|
18933
18888
|
case BinaryOperator2.BitwiseAnd:
|
|
18934
|
-
binaryOperator =
|
|
18889
|
+
binaryOperator = ts81.SyntaxKind.AmpersandToken;
|
|
18935
18890
|
break;
|
|
18936
18891
|
case BinaryOperator2.Bigger:
|
|
18937
|
-
binaryOperator =
|
|
18892
|
+
binaryOperator = ts81.SyntaxKind.GreaterThanToken;
|
|
18938
18893
|
break;
|
|
18939
18894
|
case BinaryOperator2.BiggerEquals:
|
|
18940
|
-
binaryOperator =
|
|
18895
|
+
binaryOperator = ts81.SyntaxKind.GreaterThanEqualsToken;
|
|
18941
18896
|
break;
|
|
18942
18897
|
case BinaryOperator2.Divide:
|
|
18943
|
-
binaryOperator =
|
|
18898
|
+
binaryOperator = ts81.SyntaxKind.SlashToken;
|
|
18944
18899
|
break;
|
|
18945
18900
|
case BinaryOperator2.Equals:
|
|
18946
|
-
binaryOperator =
|
|
18901
|
+
binaryOperator = ts81.SyntaxKind.EqualsEqualsToken;
|
|
18947
18902
|
break;
|
|
18948
18903
|
case BinaryOperator2.Identical:
|
|
18949
|
-
binaryOperator =
|
|
18904
|
+
binaryOperator = ts81.SyntaxKind.EqualsEqualsEqualsToken;
|
|
18950
18905
|
break;
|
|
18951
18906
|
case BinaryOperator2.Lower:
|
|
18952
|
-
binaryOperator =
|
|
18907
|
+
binaryOperator = ts81.SyntaxKind.LessThanToken;
|
|
18953
18908
|
break;
|
|
18954
18909
|
case BinaryOperator2.LowerEquals:
|
|
18955
|
-
binaryOperator =
|
|
18910
|
+
binaryOperator = ts81.SyntaxKind.LessThanEqualsToken;
|
|
18956
18911
|
break;
|
|
18957
18912
|
case BinaryOperator2.Minus:
|
|
18958
|
-
binaryOperator =
|
|
18913
|
+
binaryOperator = ts81.SyntaxKind.MinusToken;
|
|
18959
18914
|
break;
|
|
18960
18915
|
case BinaryOperator2.Modulo:
|
|
18961
|
-
binaryOperator =
|
|
18916
|
+
binaryOperator = ts81.SyntaxKind.PercentToken;
|
|
18962
18917
|
break;
|
|
18963
18918
|
case BinaryOperator2.Multiply:
|
|
18964
|
-
binaryOperator =
|
|
18919
|
+
binaryOperator = ts81.SyntaxKind.AsteriskToken;
|
|
18965
18920
|
break;
|
|
18966
18921
|
case BinaryOperator2.NotEquals:
|
|
18967
|
-
binaryOperator =
|
|
18922
|
+
binaryOperator = ts81.SyntaxKind.ExclamationEqualsToken;
|
|
18968
18923
|
break;
|
|
18969
18924
|
case BinaryOperator2.NotIdentical:
|
|
18970
|
-
binaryOperator =
|
|
18925
|
+
binaryOperator = ts81.SyntaxKind.ExclamationEqualsEqualsToken;
|
|
18971
18926
|
break;
|
|
18972
18927
|
case BinaryOperator2.Or:
|
|
18973
|
-
binaryOperator =
|
|
18928
|
+
binaryOperator = ts81.SyntaxKind.BarBarToken;
|
|
18974
18929
|
break;
|
|
18975
18930
|
case BinaryOperator2.NullishCoalesce:
|
|
18976
|
-
binaryOperator =
|
|
18931
|
+
binaryOperator = ts81.SyntaxKind.QuestionQuestionToken;
|
|
18977
18932
|
break;
|
|
18978
18933
|
case BinaryOperator2.Plus:
|
|
18979
|
-
binaryOperator =
|
|
18934
|
+
binaryOperator = ts81.SyntaxKind.PlusToken;
|
|
18980
18935
|
break;
|
|
18981
18936
|
default:
|
|
18982
18937
|
throw new Error(`Unknown operator: ${expr.operator}`);
|
|
18983
18938
|
}
|
|
18984
|
-
const binary =
|
|
18985
|
-
return this.postProcess(expr, expr.parens ?
|
|
18939
|
+
const binary = ts81.createBinary(expr.lhs.visitExpression(this, null), binaryOperator, expr.rhs.visitExpression(this, null));
|
|
18940
|
+
return this.postProcess(expr, expr.parens ? ts81.createParen(binary) : binary);
|
|
18986
18941
|
}
|
|
18987
18942
|
visitReadPropExpr(expr) {
|
|
18988
|
-
return this.postProcess(expr,
|
|
18943
|
+
return this.postProcess(expr, ts81.createPropertyAccess(expr.receiver.visitExpression(this, null), expr.name));
|
|
18989
18944
|
}
|
|
18990
18945
|
visitReadKeyExpr(expr) {
|
|
18991
|
-
return this.postProcess(expr,
|
|
18946
|
+
return this.postProcess(expr, ts81.createElementAccess(expr.receiver.visitExpression(this, null), expr.index.visitExpression(this, null)));
|
|
18992
18947
|
}
|
|
18993
18948
|
visitLiteralArrayExpr(expr) {
|
|
18994
|
-
return this.postProcess(expr,
|
|
18949
|
+
return this.postProcess(expr, ts81.createArrayLiteral(expr.entries.map((entry) => entry.visitExpression(this, null))));
|
|
18995
18950
|
}
|
|
18996
18951
|
visitLiteralMapExpr(expr) {
|
|
18997
|
-
return this.postProcess(expr,
|
|
18952
|
+
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)))));
|
|
18998
18953
|
}
|
|
18999
18954
|
visitCommaExpr(expr) {
|
|
19000
|
-
return this.postProcess(expr, expr.parts.map((e) => e.visitExpression(this, null)).reduce((left, right) => left ?
|
|
18955
|
+
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));
|
|
19001
18956
|
}
|
|
19002
18957
|
_visitStatements(statements) {
|
|
19003
18958
|
return this._visitStatementsPrefix([], statements);
|
|
19004
18959
|
}
|
|
19005
18960
|
_visitStatementsPrefix(prefix, statements) {
|
|
19006
|
-
return
|
|
18961
|
+
return ts81.createBlock([
|
|
19007
18962
|
...prefix,
|
|
19008
18963
|
...statements.map((stmt) => stmt.visitStatement(this, null)).filter((f) => f != null)
|
|
19009
18964
|
]);
|
|
@@ -19017,14 +18972,14 @@ var NodeEmitterVisitor = class {
|
|
|
19017
18972
|
prefix = `i${this._importsWithPrefixes.size}`;
|
|
19018
18973
|
this._importsWithPrefixes.set(moduleName, prefix);
|
|
19019
18974
|
}
|
|
19020
|
-
prefixIdent =
|
|
18975
|
+
prefixIdent = ts81.createIdentifier(prefix);
|
|
19021
18976
|
}
|
|
19022
18977
|
if (prefixIdent) {
|
|
19023
|
-
return
|
|
18978
|
+
return ts81.createPropertyAccess(prefixIdent, name);
|
|
19024
18979
|
} else {
|
|
19025
|
-
const id =
|
|
18980
|
+
const id = ts81.createIdentifier(name);
|
|
19026
18981
|
if (this._exportedVariableIdentifiers.has(name)) {
|
|
19027
|
-
|
|
18982
|
+
ts81.setOriginalNode(id, this._exportedVariableIdentifiers.get(name));
|
|
19028
18983
|
}
|
|
19029
18984
|
return id;
|
|
19030
18985
|
}
|
|
@@ -19033,13 +18988,13 @@ var NodeEmitterVisitor = class {
|
|
|
19033
18988
|
function modifierFromModifier(modifier) {
|
|
19034
18989
|
switch (modifier) {
|
|
19035
18990
|
case StmtModifier2.Exported:
|
|
19036
|
-
return
|
|
18991
|
+
return ts81.createToken(ts81.SyntaxKind.ExportKeyword);
|
|
19037
18992
|
case StmtModifier2.Final:
|
|
19038
|
-
return
|
|
18993
|
+
return ts81.createToken(ts81.SyntaxKind.ConstKeyword);
|
|
19039
18994
|
case StmtModifier2.Private:
|
|
19040
|
-
return
|
|
18995
|
+
return ts81.createToken(ts81.SyntaxKind.PrivateKeyword);
|
|
19041
18996
|
case StmtModifier2.Static:
|
|
19042
|
-
return
|
|
18997
|
+
return ts81.createToken(ts81.SyntaxKind.StaticKeyword);
|
|
19043
18998
|
}
|
|
19044
18999
|
}
|
|
19045
19000
|
function translateModifiers(modifiers) {
|
|
@@ -19069,9 +19024,9 @@ function getAngularEmitterTransformFactory(generatedFiles, program, annotateForC
|
|
|
19069
19024
|
const [newSourceFile] = emitter.updateSourceFile(sourceFile, g.stmts, preamble);
|
|
19070
19025
|
return newSourceFile;
|
|
19071
19026
|
} else if (GENERATED_FILES.test(sourceFile.fileName)) {
|
|
19072
|
-
const commentStmt =
|
|
19073
|
-
|
|
19074
|
-
return
|
|
19027
|
+
const commentStmt = ts82.createNotEmittedStatement(sourceFile);
|
|
19028
|
+
ts82.addSyntheticLeadingComment(commentStmt, ts82.SyntaxKind.MultiLineCommentTrivia, preamble, true);
|
|
19029
|
+
return ts82.updateSourceFileNode(sourceFile, [commentStmt]);
|
|
19075
19030
|
}
|
|
19076
19031
|
return sourceFile;
|
|
19077
19032
|
};
|
|
@@ -19079,11 +19034,11 @@ function getAngularEmitterTransformFactory(generatedFiles, program, annotateForC
|
|
|
19079
19034
|
}
|
|
19080
19035
|
function getFileoverviewComment2(sourceFile) {
|
|
19081
19036
|
const trivia = sourceFile.getFullText().substring(0, sourceFile.getStart());
|
|
19082
|
-
const leadingComments =
|
|
19037
|
+
const leadingComments = ts82.getLeadingCommentRanges(trivia, 0);
|
|
19083
19038
|
if (!leadingComments || leadingComments.length === 0)
|
|
19084
19039
|
return "";
|
|
19085
19040
|
const comment = leadingComments[0];
|
|
19086
|
-
if (comment.kind !==
|
|
19041
|
+
if (comment.kind !== ts82.SyntaxKind.MultiLineCommentTrivia)
|
|
19087
19042
|
return "";
|
|
19088
19043
|
if (sourceFile.getFullText().substring(comment.end, comment.end + 2) !== "\n\n")
|
|
19089
19044
|
return "";
|
|
@@ -19095,7 +19050,7 @@ function getFileoverviewComment2(sourceFile) {
|
|
|
19095
19050
|
|
|
19096
19051
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/r3_metadata_transform.mjs
|
|
19097
19052
|
import { ClassStmt as ClassStmt2, StmtModifier as StmtModifier3 } from "@angular/compiler";
|
|
19098
|
-
import
|
|
19053
|
+
import ts83 from "typescript";
|
|
19099
19054
|
var PartialModuleMetadataTransformer = class {
|
|
19100
19055
|
constructor(modules) {
|
|
19101
19056
|
this.moduleMap = new Map(modules.map((m) => [m.fileName, m]));
|
|
@@ -19106,7 +19061,7 @@ var PartialModuleMetadataTransformer = class {
|
|
|
19106
19061
|
const classMap = new Map(partialModule.statements.filter(isClassStmt).map((s) => [s.name, s]));
|
|
19107
19062
|
if (classMap.size > 0) {
|
|
19108
19063
|
return (value, node) => {
|
|
19109
|
-
if (isClassMetadata(value) && node.kind ===
|
|
19064
|
+
if (isClassMetadata(value) && node.kind === ts83.SyntaxKind.ClassDeclaration) {
|
|
19110
19065
|
const classDeclaration = node;
|
|
19111
19066
|
if (classDeclaration.name) {
|
|
19112
19067
|
const partialClass = classMap.get(classDeclaration.name.text);
|
|
@@ -19555,7 +19510,7 @@ var AngularCompilerProgram = class {
|
|
|
19555
19510
|
}
|
|
19556
19511
|
});
|
|
19557
19512
|
}
|
|
19558
|
-
const tmpProgram =
|
|
19513
|
+
const tmpProgram = ts84.createProgram(rootNames, this.options, this.hostAdapter, oldTsProgram);
|
|
19559
19514
|
if (tempProgramHandlerForTest !== null) {
|
|
19560
19515
|
tempProgramHandlerForTest(tmpProgram);
|
|
19561
19516
|
}
|
|
@@ -19585,7 +19540,7 @@ var AngularCompilerProgram = class {
|
|
|
19585
19540
|
}
|
|
19586
19541
|
}
|
|
19587
19542
|
});
|
|
19588
|
-
this._tsProgram =
|
|
19543
|
+
this._tsProgram = ts84.createProgram(rootNames, this.options, this.hostAdapter, tmpProgram);
|
|
19589
19544
|
if (tsStructureIsReused(this._tsProgram) !== 2) {
|
|
19590
19545
|
throw new Error(`Internal Error: The structure of the program changed during codegen.`);
|
|
19591
19546
|
}
|
|
@@ -19594,7 +19549,7 @@ var AngularCompilerProgram = class {
|
|
|
19594
19549
|
this._analyzedModules = emptyModules;
|
|
19595
19550
|
this.oldTsProgram = void 0;
|
|
19596
19551
|
this._hostAdapter.isSourceFile = () => false;
|
|
19597
|
-
this._tsProgram =
|
|
19552
|
+
this._tsProgram = ts84.createProgram(this.rootNames, this.options, this.hostAdapter);
|
|
19598
19553
|
if (isSyntaxError(e)) {
|
|
19599
19554
|
this._addStructuralDiagnostics(e);
|
|
19600
19555
|
return;
|
|
@@ -19608,7 +19563,7 @@ var AngularCompilerProgram = class {
|
|
|
19608
19563
|
} else {
|
|
19609
19564
|
diagnostics.push({
|
|
19610
19565
|
messageText: error2.toString(),
|
|
19611
|
-
category:
|
|
19566
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19612
19567
|
source: SOURCE,
|
|
19613
19568
|
code: DEFAULT_ERROR_CODE
|
|
19614
19569
|
});
|
|
@@ -19635,7 +19590,7 @@ var AngularCompilerProgram = class {
|
|
|
19635
19590
|
start: void 0,
|
|
19636
19591
|
length: void 0,
|
|
19637
19592
|
messageText: e.message,
|
|
19638
|
-
category:
|
|
19593
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19639
19594
|
source: SOURCE,
|
|
19640
19595
|
code: DEFAULT_ERROR_CODE
|
|
19641
19596
|
}];
|
|
@@ -19740,7 +19695,7 @@ function getNgOptionDiagnostics(options) {
|
|
|
19740
19695
|
default:
|
|
19741
19696
|
return [{
|
|
19742
19697
|
messageText: 'Angular compiler options "annotationsAs" only supports "static fields" and "decorators"',
|
|
19743
|
-
category:
|
|
19698
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19744
19699
|
source: SOURCE,
|
|
19745
19700
|
code: DEFAULT_ERROR_CODE
|
|
19746
19701
|
}];
|
|
@@ -19804,7 +19759,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19804
19759
|
file: diagnosticSourceOfSpan(e.span),
|
|
19805
19760
|
start: e.span.start.offset,
|
|
19806
19761
|
length: e.span.end.offset - e.span.start.offset,
|
|
19807
|
-
category:
|
|
19762
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19808
19763
|
source: SOURCE,
|
|
19809
19764
|
code: DEFAULT_ERROR_CODE
|
|
19810
19765
|
}));
|
|
@@ -19812,7 +19767,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19812
19767
|
return [{
|
|
19813
19768
|
messageText: error2.message,
|
|
19814
19769
|
chain: error2.chain && diagnosticChainFromFormattedDiagnosticChain(error2.chain),
|
|
19815
|
-
category:
|
|
19770
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19816
19771
|
source: SOURCE,
|
|
19817
19772
|
code: DEFAULT_ERROR_CODE,
|
|
19818
19773
|
position: error2.position
|
|
@@ -19831,7 +19786,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19831
19786
|
|
|
19832
19787
|
See https://angular.io/errors/NG6999 for more information.
|
|
19833
19788
|
`,
|
|
19834
|
-
category:
|
|
19789
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19835
19790
|
code: DEFAULT_ERROR_CODE,
|
|
19836
19791
|
source: SOURCE
|
|
19837
19792
|
}];
|
|
@@ -19839,7 +19794,7 @@ See https://angular.io/errors/NG6999 for more information.
|
|
|
19839
19794
|
}
|
|
19840
19795
|
return [{
|
|
19841
19796
|
messageText: error2.message,
|
|
19842
|
-
category:
|
|
19797
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19843
19798
|
code: DEFAULT_ERROR_CODE,
|
|
19844
19799
|
source: SOURCE
|
|
19845
19800
|
}];
|
|
@@ -19850,7 +19805,7 @@ function getDtsClass(program, fileName, className) {
|
|
|
19850
19805
|
return null;
|
|
19851
19806
|
}
|
|
19852
19807
|
for (const stmt of sf.statements) {
|
|
19853
|
-
if (!
|
|
19808
|
+
if (!ts84.isClassDeclaration(stmt)) {
|
|
19854
19809
|
continue;
|
|
19855
19810
|
}
|
|
19856
19811
|
if (stmt.name === void 0 || stmt.name.text !== className) {
|
|
@@ -19862,10 +19817,10 @@ function getDtsClass(program, fileName, className) {
|
|
|
19862
19817
|
}
|
|
19863
19818
|
function isIvyNgModule(clazz) {
|
|
19864
19819
|
for (const member of clazz.members) {
|
|
19865
|
-
if (!
|
|
19820
|
+
if (!ts84.isPropertyDeclaration(member)) {
|
|
19866
19821
|
continue;
|
|
19867
19822
|
}
|
|
19868
|
-
if (
|
|
19823
|
+
if (ts84.isIdentifier(member.name) && member.name.text === "\u0275mod") {
|
|
19869
19824
|
return true;
|
|
19870
19825
|
}
|
|
19871
19826
|
}
|
|
@@ -19874,9 +19829,9 @@ function isIvyNgModule(clazz) {
|
|
|
19874
19829
|
|
|
19875
19830
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
19876
19831
|
var defaultFormatHost = {
|
|
19877
|
-
getCurrentDirectory: () =>
|
|
19832
|
+
getCurrentDirectory: () => ts85.sys.getCurrentDirectory(),
|
|
19878
19833
|
getCanonicalFileName: (fileName) => fileName,
|
|
19879
|
-
getNewLine: () =>
|
|
19834
|
+
getNewLine: () => ts85.sys.newLine
|
|
19880
19835
|
};
|
|
19881
19836
|
function displayFileName(fileName, host) {
|
|
19882
19837
|
return relative(resolve(host.getCurrentDirectory()), resolve(host.getCanonicalFileName(fileName)));
|
|
@@ -19928,7 +19883,7 @@ function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
|
19928
19883
|
if (diags && diags.length) {
|
|
19929
19884
|
return diags.map((diagnostic) => {
|
|
19930
19885
|
if (isTsDiagnostic(diagnostic)) {
|
|
19931
|
-
return replaceTsWithNgInErrors(
|
|
19886
|
+
return replaceTsWithNgInErrors(ts85.formatDiagnosticsWithColorAndContext([diagnostic], host));
|
|
19932
19887
|
} else {
|
|
19933
19888
|
return formatDiagnostic(diagnostic, host);
|
|
19934
19889
|
}
|
|
@@ -19949,7 +19904,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
19949
19904
|
var _a;
|
|
19950
19905
|
try {
|
|
19951
19906
|
const fs5 = getFileSystem();
|
|
19952
|
-
const readConfigFile = (configFile) =>
|
|
19907
|
+
const readConfigFile = (configFile) => ts85.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
19953
19908
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
19954
19909
|
const { config: config2, error: error3 } = readConfigFile(configFile);
|
|
19955
19910
|
if (error3) {
|
|
@@ -19981,7 +19936,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
19981
19936
|
basePath
|
|
19982
19937
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
19983
19938
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
19984
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
19939
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts85.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
19985
19940
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
19986
19941
|
let emitFlags = EmitFlags.Default;
|
|
19987
19942
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -19993,7 +19948,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
19993
19948
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
19994
19949
|
} catch (e) {
|
|
19995
19950
|
const errors = [{
|
|
19996
|
-
category:
|
|
19951
|
+
category: ts85.DiagnosticCategory.Error,
|
|
19997
19952
|
messageText: e.stack,
|
|
19998
19953
|
file: void 0,
|
|
19999
19954
|
start: void 0,
|
|
@@ -20007,7 +19962,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
20007
19962
|
function createParseConfigHost(host, fs5 = getFileSystem()) {
|
|
20008
19963
|
return {
|
|
20009
19964
|
fileExists: host.exists.bind(host),
|
|
20010
|
-
readDirectory:
|
|
19965
|
+
readDirectory: ts85.sys.readDirectory,
|
|
20011
19966
|
readFile: host.readFile.bind(host),
|
|
20012
19967
|
useCaseSensitiveFileNames: fs5.isCaseSensitive()
|
|
20013
19968
|
};
|
|
@@ -20027,7 +19982,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
20027
19982
|
}
|
|
20028
19983
|
} else {
|
|
20029
19984
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
20030
|
-
const { resolvedModule } =
|
|
19985
|
+
const { resolvedModule } = ts85.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts85.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
20031
19986
|
if (resolvedModule) {
|
|
20032
19987
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
20033
19988
|
}
|
|
@@ -20037,7 +19992,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
20037
19992
|
function exitCodeFromResult(diags) {
|
|
20038
19993
|
if (!diags)
|
|
20039
19994
|
return 0;
|
|
20040
|
-
if (diags.every((diag) => diag.category !==
|
|
19995
|
+
if (diags.every((diag) => diag.category !== ts85.DiagnosticCategory.Error)) {
|
|
20041
19996
|
return 0;
|
|
20042
19997
|
}
|
|
20043
19998
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -20077,7 +20032,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
20077
20032
|
program = void 0;
|
|
20078
20033
|
code = UNKNOWN_ERROR_CODE;
|
|
20079
20034
|
}
|
|
20080
|
-
allDiagnostics.push({ category:
|
|
20035
|
+
allDiagnostics.push({ category: ts85.DiagnosticCategory.Error, messageText: errMsg, code, source: SOURCE });
|
|
20081
20036
|
return { diagnostics: allDiagnostics, program };
|
|
20082
20037
|
}
|
|
20083
20038
|
}
|
|
@@ -20098,7 +20053,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
20098
20053
|
return allDiagnostics;
|
|
20099
20054
|
}
|
|
20100
20055
|
function hasErrors(diags) {
|
|
20101
|
-
return diags.some((d) => d.category ===
|
|
20056
|
+
return diags.some((d) => d.category === ts85.DiagnosticCategory.Error);
|
|
20102
20057
|
}
|
|
20103
20058
|
|
|
20104
20059
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_watch.mjs
|
|
@@ -20108,7 +20063,7 @@ import {
|
|
|
20108
20063
|
import {
|
|
20109
20064
|
normalize as normalize4
|
|
20110
20065
|
} from "path";
|
|
20111
|
-
import
|
|
20066
|
+
import ts86 from "typescript";
|
|
20112
20067
|
function totalCompilationTimeDiagnostic(timeInMillis) {
|
|
20113
20068
|
let duration;
|
|
20114
20069
|
if (timeInMillis > 1e3) {
|
|
@@ -20117,7 +20072,7 @@ function totalCompilationTimeDiagnostic(timeInMillis) {
|
|
|
20117
20072
|
duration = `${timeInMillis}ms`;
|
|
20118
20073
|
}
|
|
20119
20074
|
return {
|
|
20120
|
-
category:
|
|
20075
|
+
category: ts86.DiagnosticCategory.Message,
|
|
20121
20076
|
messageText: `Total time: ${duration}`,
|
|
20122
20077
|
code: DEFAULT_ERROR_CODE,
|
|
20123
20078
|
source: SOURCE
|
|
@@ -20138,7 +20093,7 @@ function createPerformWatchHost(configFileName, reportDiagnostics, existingOptio
|
|
|
20138
20093
|
onFileChange: (options, listener, ready) => {
|
|
20139
20094
|
if (!options.basePath) {
|
|
20140
20095
|
reportDiagnostics([{
|
|
20141
|
-
category:
|
|
20096
|
+
category: ts86.DiagnosticCategory.Error,
|
|
20142
20097
|
messageText: "Invalid configuration option. baseDir not specified",
|
|
20143
20098
|
source: SOURCE,
|
|
20144
20099
|
code: DEFAULT_ERROR_CODE
|
|
@@ -20169,8 +20124,8 @@ function createPerformWatchHost(configFileName, reportDiagnostics, existingOptio
|
|
|
20169
20124
|
watcher.on("ready", ready);
|
|
20170
20125
|
return { close: () => watcher.close(), ready };
|
|
20171
20126
|
},
|
|
20172
|
-
setTimeout:
|
|
20173
|
-
clearTimeout:
|
|
20127
|
+
setTimeout: ts86.sys.clearTimeout && ts86.sys.setTimeout || setTimeout,
|
|
20128
|
+
clearTimeout: ts86.sys.setTimeout && ts86.sys.clearTimeout || clearTimeout
|
|
20174
20129
|
};
|
|
20175
20130
|
}
|
|
20176
20131
|
function performWatchCompilation(host) {
|
|
@@ -20381,7 +20336,7 @@ function readNgcCommandLineAndConfiguration(args) {
|
|
|
20381
20336
|
return __spreadProps(__spreadValues({}, config), { watch: parsedArgs.watch });
|
|
20382
20337
|
}
|
|
20383
20338
|
function readCommandLineAndConfiguration(args, existingOptions = {}, ngCmdLineOptions = []) {
|
|
20384
|
-
let cmdConfig =
|
|
20339
|
+
let cmdConfig = ts87.parseCommandLine(args);
|
|
20385
20340
|
const project = cmdConfig.options.project || ".";
|
|
20386
20341
|
const cmdErrors = cmdConfig.errors.filter((e) => {
|
|
20387
20342
|
if (typeof e.messageText === "string") {
|
|
@@ -20415,18 +20370,18 @@ function readCommandLineAndConfiguration(args, existingOptions = {}, ngCmdLineOp
|
|
|
20415
20370
|
function getFormatDiagnosticsHost(options) {
|
|
20416
20371
|
const basePath = options ? options.basePath : void 0;
|
|
20417
20372
|
return {
|
|
20418
|
-
getCurrentDirectory: () => basePath ||
|
|
20373
|
+
getCurrentDirectory: () => basePath || ts87.sys.getCurrentDirectory(),
|
|
20419
20374
|
getCanonicalFileName: (fileName) => fileName.replace(/\\/g, "/"),
|
|
20420
20375
|
getNewLine: () => {
|
|
20421
20376
|
if (options && options.newLine !== void 0) {
|
|
20422
|
-
return options.newLine ===
|
|
20377
|
+
return options.newLine === ts87.NewLineKind.LineFeed ? "\n" : "\r\n";
|
|
20423
20378
|
}
|
|
20424
|
-
return
|
|
20379
|
+
return ts87.sys.newLine;
|
|
20425
20380
|
}
|
|
20426
20381
|
};
|
|
20427
20382
|
}
|
|
20428
20383
|
function reportErrorsAndExit(allDiagnostics, options, consoleError = console.error) {
|
|
20429
|
-
const errorsAndWarnings = allDiagnostics.filter((d) => d.category !==
|
|
20384
|
+
const errorsAndWarnings = allDiagnostics.filter((d) => d.category !== ts87.DiagnosticCategory.Message);
|
|
20430
20385
|
printDiagnostics(errorsAndWarnings, options, consoleError);
|
|
20431
20386
|
return exitCodeFromResult(allDiagnostics);
|
|
20432
20387
|
}
|