typescript 4.8.0-dev.20220809 → 4.9.0-dev.20220812
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/lib/lib.es2015.reflect.d.ts +25 -2
- package/lib/lib.es5.d.ts +13 -3
- package/lib/tsc.js +410 -177
- package/lib/tsserver.js +333 -159
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +333 -354
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +333 -354
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +333 -354
- package/lib/typingsInstaller.js +272 -130
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -105,11 +105,11 @@ var ts;
|
|
|
105
105
|
(function (ts) {
|
|
106
106
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
107
107
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
108
|
-
ts.versionMajorMinor = "4.
|
|
108
|
+
ts.versionMajorMinor = "4.9";
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220812";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -131,7 +131,11 @@ var ts;
|
|
|
131
131
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
132
132
|
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
133
133
|
// eslint-disable-next-line no-in-operator
|
|
134
|
-
|
|
134
|
+
var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
135
|
+
if (!constructor) {
|
|
136
|
+
throw new Error("No compatible Map implementation found.");
|
|
137
|
+
}
|
|
138
|
+
return constructor;
|
|
135
139
|
}
|
|
136
140
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
137
141
|
/**
|
|
@@ -141,23 +145,18 @@ var ts;
|
|
|
141
145
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
142
146
|
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
143
147
|
// eslint-disable-next-line no-in-operator
|
|
144
|
-
|
|
148
|
+
var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
149
|
+
if (!constructor) {
|
|
150
|
+
throw new Error("No compatible Set implementation found.");
|
|
151
|
+
}
|
|
152
|
+
return constructor;
|
|
145
153
|
}
|
|
146
154
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
147
155
|
})(NativeCollections || (NativeCollections = {}));
|
|
148
156
|
/* @internal */
|
|
149
|
-
ts.Map =
|
|
157
|
+
ts.Map = NativeCollections.tryGetNativeMap();
|
|
150
158
|
/* @internal */
|
|
151
|
-
ts.Set =
|
|
152
|
-
/* @internal */
|
|
153
|
-
function getCollectionImplementation(name, nativeFactory, shimFactory) {
|
|
154
|
-
var _a;
|
|
155
|
-
// NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it.
|
|
156
|
-
var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
|
|
157
|
-
if (constructor)
|
|
158
|
-
return constructor;
|
|
159
|
-
throw new Error("TypeScript requires an environment that provides a compatible native " + name + " implementation.");
|
|
160
|
-
}
|
|
159
|
+
ts.Set = NativeCollections.tryGetNativeSet();
|
|
161
160
|
})(ts || (ts = {}));
|
|
162
161
|
/* @internal */
|
|
163
162
|
var ts;
|
|
@@ -873,15 +872,18 @@ var ts;
|
|
|
873
872
|
function insertSorted(array, insert, compare, allowDuplicates) {
|
|
874
873
|
if (array.length === 0) {
|
|
875
874
|
array.push(insert);
|
|
876
|
-
return;
|
|
875
|
+
return true;
|
|
877
876
|
}
|
|
878
877
|
var insertIndex = binarySearch(array, insert, identity, compare);
|
|
879
878
|
if (insertIndex < 0) {
|
|
880
879
|
array.splice(~insertIndex, 0, insert);
|
|
880
|
+
return true;
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
if (allowDuplicates) {
|
|
883
883
|
array.splice(insertIndex, 0, insert);
|
|
884
|
+
return true;
|
|
884
885
|
}
|
|
886
|
+
return false;
|
|
885
887
|
}
|
|
886
888
|
ts.insertSorted = insertSorted;
|
|
887
889
|
function sortAndDeduplicate(array, comparer, equalityComparer) {
|
|
@@ -3561,6 +3563,8 @@ var ts;
|
|
|
3561
3563
|
typeof performance.mark === "function" &&
|
|
3562
3564
|
typeof performance.measure === "function" &&
|
|
3563
3565
|
typeof performance.now === "function" &&
|
|
3566
|
+
typeof performance.clearMarks === "function" &&
|
|
3567
|
+
typeof performance.clearMeasures === "function" &&
|
|
3564
3568
|
typeof PerformanceObserver === "function";
|
|
3565
3569
|
}
|
|
3566
3570
|
function tryGetWebPerformanceHooks() {
|
|
@@ -3605,7 +3609,9 @@ var ts;
|
|
|
3605
3609
|
if (end === "__performance.measure-fix__") {
|
|
3606
3610
|
nodePerformance_1.clearMarks("__performance.measure-fix__");
|
|
3607
3611
|
}
|
|
3608
|
-
}
|
|
3612
|
+
},
|
|
3613
|
+
clearMarks: function (name) { return nodePerformance_1.clearMarks(name); },
|
|
3614
|
+
clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); },
|
|
3609
3615
|
};
|
|
3610
3616
|
}
|
|
3611
3617
|
return {
|
|
@@ -3738,6 +3744,30 @@ var ts;
|
|
|
3738
3744
|
durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
|
|
3739
3745
|
}
|
|
3740
3746
|
performance.forEachMeasure = forEachMeasure;
|
|
3747
|
+
function forEachMark(cb) {
|
|
3748
|
+
marks.forEach(function (_time, markName) { return cb(markName); });
|
|
3749
|
+
}
|
|
3750
|
+
performance.forEachMark = forEachMark;
|
|
3751
|
+
function clearMeasures(name) {
|
|
3752
|
+
if (name !== undefined)
|
|
3753
|
+
durations.delete(name);
|
|
3754
|
+
else
|
|
3755
|
+
durations.clear();
|
|
3756
|
+
performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name);
|
|
3757
|
+
}
|
|
3758
|
+
performance.clearMeasures = clearMeasures;
|
|
3759
|
+
function clearMarks(name) {
|
|
3760
|
+
if (name !== undefined) {
|
|
3761
|
+
counts.delete(name);
|
|
3762
|
+
marks.delete(name);
|
|
3763
|
+
}
|
|
3764
|
+
else {
|
|
3765
|
+
counts.clear();
|
|
3766
|
+
marks.clear();
|
|
3767
|
+
}
|
|
3768
|
+
performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name);
|
|
3769
|
+
}
|
|
3770
|
+
performance.clearMarks = clearMarks;
|
|
3741
3771
|
/**
|
|
3742
3772
|
* Indicates whether the performance API is enabled.
|
|
3743
3773
|
*/
|
|
@@ -7842,12 +7872,9 @@ var ts;
|
|
|
7842
7872
|
* Normalize path separators, converting `\` into `/`.
|
|
7843
7873
|
*/
|
|
7844
7874
|
function normalizeSlashes(path) {
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
}
|
|
7849
|
-
backslashRegExp.lastIndex = index; // prime regex with known position
|
|
7850
|
-
return path.replace(backslashRegExp, ts.directorySeparator);
|
|
7875
|
+
return path.indexOf("\\") !== -1
|
|
7876
|
+
? path.replace(backslashRegExp, ts.directorySeparator)
|
|
7877
|
+
: path;
|
|
7851
7878
|
}
|
|
7852
7879
|
ts.normalizeSlashes = normalizeSlashes;
|
|
7853
7880
|
/**
|
|
@@ -9548,6 +9575,7 @@ var ts;
|
|
|
9548
9575
|
Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
|
|
9549
9576
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
|
|
9550
9577
|
Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
|
|
9578
|
+
Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
|
|
9551
9579
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
9552
9580
|
The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
9553
9581
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -19391,21 +19419,17 @@ var ts;
|
|
|
19391
19419
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19392
19420
|
}
|
|
19393
19421
|
ts.base64decode = base64decode;
|
|
19422
|
+
function readJsonOrUndefined(path, hostOrText) {
|
|
19423
|
+
var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
|
|
19424
|
+
if (!jsonText)
|
|
19425
|
+
return undefined;
|
|
19426
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19427
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19428
|
+
return !result.error ? result.config : undefined;
|
|
19429
|
+
}
|
|
19430
|
+
ts.readJsonOrUndefined = readJsonOrUndefined;
|
|
19394
19431
|
function readJson(path, host) {
|
|
19395
|
-
|
|
19396
|
-
var jsonText = host.readFile(path);
|
|
19397
|
-
if (!jsonText)
|
|
19398
|
-
return {};
|
|
19399
|
-
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19400
|
-
if (result.error) {
|
|
19401
|
-
return {};
|
|
19402
|
-
}
|
|
19403
|
-
return result.config;
|
|
19404
|
-
}
|
|
19405
|
-
catch (e) {
|
|
19406
|
-
// gracefully handle if readFile fails or returns not JSON
|
|
19407
|
-
return {};
|
|
19408
|
-
}
|
|
19432
|
+
return readJsonOrUndefined(path, host) || {};
|
|
19409
19433
|
}
|
|
19410
19434
|
ts.readJson = readJson;
|
|
19411
19435
|
function directoryProbablyExists(directoryName, host) {
|
|
@@ -27756,9 +27780,10 @@ var ts;
|
|
|
27756
27780
|
};
|
|
27757
27781
|
var buildInfo_1;
|
|
27758
27782
|
var getAndCacheBuildInfo_1 = function (getText) {
|
|
27783
|
+
var _a;
|
|
27759
27784
|
if (buildInfo_1 === undefined) {
|
|
27760
27785
|
var result = getText();
|
|
27761
|
-
buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
|
|
27786
|
+
buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
|
|
27762
27787
|
}
|
|
27763
27788
|
return buildInfo_1 || undefined;
|
|
27764
27789
|
};
|
|
@@ -45818,6 +45843,9 @@ var ts;
|
|
|
45818
45843
|
case 203 /* BindingElement */:
|
|
45819
45844
|
bindBindingElementFlow(node);
|
|
45820
45845
|
break;
|
|
45846
|
+
case 164 /* Parameter */:
|
|
45847
|
+
bindParameterFlow(node);
|
|
45848
|
+
break;
|
|
45821
45849
|
case 205 /* ObjectLiteralExpression */:
|
|
45822
45850
|
case 204 /* ArrayLiteralExpression */:
|
|
45823
45851
|
case 296 /* PropertyAssignment */:
|
|
@@ -46558,20 +46586,38 @@ var ts;
|
|
|
46558
46586
|
}
|
|
46559
46587
|
}
|
|
46560
46588
|
function bindBindingElementFlow(node) {
|
|
46561
|
-
|
|
46562
|
-
|
|
46563
|
-
|
|
46564
|
-
|
|
46565
|
-
|
|
46566
|
-
|
|
46567
|
-
|
|
46568
|
-
|
|
46569
|
-
|
|
46570
|
-
|
|
46589
|
+
// When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per:
|
|
46590
|
+
// - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization
|
|
46591
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46592
|
+
// - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization
|
|
46593
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46594
|
+
bind(node.dotDotDotToken);
|
|
46595
|
+
bind(node.propertyName);
|
|
46596
|
+
bindInitializer(node.initializer);
|
|
46597
|
+
bind(node.name);
|
|
46598
|
+
}
|
|
46599
|
+
function bindParameterFlow(node) {
|
|
46600
|
+
bindEach(node.modifiers);
|
|
46601
|
+
bind(node.dotDotDotToken);
|
|
46602
|
+
bind(node.questionToken);
|
|
46603
|
+
bind(node.type);
|
|
46604
|
+
bindInitializer(node.initializer);
|
|
46605
|
+
bind(node.name);
|
|
46606
|
+
}
|
|
46607
|
+
// a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759)
|
|
46608
|
+
function bindInitializer(node) {
|
|
46609
|
+
if (!node) {
|
|
46610
|
+
return;
|
|
46571
46611
|
}
|
|
46572
|
-
|
|
46573
|
-
|
|
46612
|
+
var entryFlow = currentFlow;
|
|
46613
|
+
bind(node);
|
|
46614
|
+
if (entryFlow === unreachableFlow || entryFlow === currentFlow) {
|
|
46615
|
+
return;
|
|
46574
46616
|
}
|
|
46617
|
+
var exitFlow = createBranchLabel();
|
|
46618
|
+
addAntecedent(exitFlow, entryFlow);
|
|
46619
|
+
addAntecedent(exitFlow, currentFlow);
|
|
46620
|
+
currentFlow = finishFlowLabel(exitFlow);
|
|
46575
46621
|
}
|
|
46576
46622
|
function bindJSDocTypeAlias(node) {
|
|
46577
46623
|
bind(node.tagName);
|
|
@@ -49742,7 +49788,7 @@ var ts;
|
|
|
49742
49788
|
if (unidirectional === void 0) { unidirectional = false; }
|
|
49743
49789
|
source.forEach(function (sourceSymbol, id) {
|
|
49744
49790
|
var targetSymbol = target.get(id);
|
|
49745
|
-
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
|
|
49791
|
+
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
|
|
49746
49792
|
});
|
|
49747
49793
|
}
|
|
49748
49794
|
function mergeModuleAugmentation(moduleName) {
|
|
@@ -56533,11 +56579,9 @@ var ts;
|
|
|
56533
56579
|
return getReturnTypeOfSignature(getterSignature);
|
|
56534
56580
|
}
|
|
56535
56581
|
}
|
|
56536
|
-
|
|
56537
|
-
|
|
56538
|
-
|
|
56539
|
-
return type_1;
|
|
56540
|
-
}
|
|
56582
|
+
var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration);
|
|
56583
|
+
if (parameterTypeOfTypeTag)
|
|
56584
|
+
return parameterTypeOfTypeTag;
|
|
56541
56585
|
// Use contextual parameter type if one is available
|
|
56542
56586
|
var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
56543
56587
|
if (type) {
|
|
@@ -57113,9 +57157,9 @@ var ts;
|
|
|
57113
57157
|
if (typeNode === undefined) {
|
|
57114
57158
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
57115
57159
|
}
|
|
57116
|
-
var
|
|
57160
|
+
var type_1 = getTypeOfNode(typeNode);
|
|
57117
57161
|
// an errorType will make `checkTryStatement` issue an error
|
|
57118
|
-
return isTypeAny(
|
|
57162
|
+
return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
|
|
57119
57163
|
}
|
|
57120
57164
|
// Handle export default expressions
|
|
57121
57165
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
@@ -57325,11 +57369,11 @@ var ts;
|
|
|
57325
57369
|
return errorType;
|
|
57326
57370
|
}
|
|
57327
57371
|
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
|
|
57328
|
-
var
|
|
57372
|
+
var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
57329
57373
|
if (!popTypeResolution()) {
|
|
57330
57374
|
return reportCircularityError(symbol);
|
|
57331
57375
|
}
|
|
57332
|
-
return
|
|
57376
|
+
return type_2;
|
|
57333
57377
|
}
|
|
57334
57378
|
}
|
|
57335
57379
|
var type = createObjectType(16 /* Anonymous */, symbol);
|
|
@@ -59552,10 +59596,10 @@ var ts;
|
|
|
59552
59596
|
var baseTypes = [];
|
|
59553
59597
|
var different = false;
|
|
59554
59598
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
59555
|
-
var
|
|
59556
|
-
var baseType = getBaseConstraint(
|
|
59599
|
+
var type_3 = types_7[_i];
|
|
59600
|
+
var baseType = getBaseConstraint(type_3);
|
|
59557
59601
|
if (baseType) {
|
|
59558
|
-
if (baseType !==
|
|
59602
|
+
if (baseType !== type_3) {
|
|
59559
59603
|
different = true;
|
|
59560
59604
|
}
|
|
59561
59605
|
baseTypes.push(baseType);
|
|
@@ -60346,7 +60390,12 @@ var ts;
|
|
|
60346
60390
|
continue;
|
|
60347
60391
|
}
|
|
60348
60392
|
}
|
|
60349
|
-
|
|
60393
|
+
// If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters.
|
|
60394
|
+
// Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible.
|
|
60395
|
+
result.push((!ts.isFunctionExpressionOrArrowFunction(decl) &&
|
|
60396
|
+
!ts.isObjectLiteralMethod(decl) &&
|
|
60397
|
+
getSignatureOfTypeTag(decl)) ||
|
|
60398
|
+
getSignatureFromDeclaration(decl));
|
|
60350
60399
|
}
|
|
60351
60400
|
return result;
|
|
60352
60401
|
}
|
|
@@ -60377,7 +60426,7 @@ var ts;
|
|
|
60377
60426
|
else {
|
|
60378
60427
|
var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
60379
60428
|
var jsdocPredicate = void 0;
|
|
60380
|
-
if (!type
|
|
60429
|
+
if (!type) {
|
|
60381
60430
|
var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
|
|
60382
60431
|
if (jsdocSignature && signature !== jsdocSignature) {
|
|
60383
60432
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
@@ -64403,15 +64452,14 @@ var ts;
|
|
|
64403
64452
|
return false;
|
|
64404
64453
|
}
|
|
64405
64454
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
64406
|
-
return
|
|
64407
|
-
(ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
|
|
64455
|
+
return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
64408
64456
|
}
|
|
64409
64457
|
function hasContextSensitiveReturnExpression(node) {
|
|
64410
64458
|
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
|
|
64411
64459
|
return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* Block */ && isContextSensitive(node.body);
|
|
64412
64460
|
}
|
|
64413
64461
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
64414
|
-
return (ts.
|
|
64462
|
+
return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
|
|
64415
64463
|
isContextSensitiveFunctionLikeDeclaration(func);
|
|
64416
64464
|
}
|
|
64417
64465
|
function getTypeWithoutSignatures(type) {
|
|
@@ -73469,9 +73517,11 @@ var ts;
|
|
|
73469
73517
|
case 1 /* ExportsProperty */:
|
|
73470
73518
|
case 6 /* Prototype */:
|
|
73471
73519
|
case 3 /* PrototypeProperty */:
|
|
73472
|
-
var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73473
|
-
// falls through
|
|
73474
73520
|
case 2 /* ModuleExports */:
|
|
73521
|
+
var valueDeclaration = void 0;
|
|
73522
|
+
if (kind !== 2 /* ModuleExports */) {
|
|
73523
|
+
valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73524
|
+
}
|
|
73475
73525
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
|
|
73476
73526
|
var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
73477
73527
|
return annotated ? getTypeFromTypeNode(annotated) : undefined;
|
|
@@ -73949,9 +73999,16 @@ var ts;
|
|
|
73949
73999
|
if (!isErrorType(intrinsicClassAttribs)) {
|
|
73950
74000
|
var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
|
|
73951
74001
|
var hostClassType = getReturnTypeOfSignature(sig);
|
|
73952
|
-
|
|
73953
|
-
|
|
73954
|
-
|
|
74002
|
+
var libraryManagedAttributeType = void 0;
|
|
74003
|
+
if (typeParams) {
|
|
74004
|
+
// apply JSX.IntrinsicClassElements<hostClassType, ...>
|
|
74005
|
+
var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
|
|
74006
|
+
libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
|
|
74007
|
+
}
|
|
74008
|
+
// or JSX.IntrinsicClassElements has no generics.
|
|
74009
|
+
else
|
|
74010
|
+
libraryManagedAttributeType = intrinsicClassAttribs;
|
|
74011
|
+
apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
|
|
73955
74012
|
}
|
|
73956
74013
|
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
|
|
73957
74014
|
if (!isErrorType(intrinsicAttribs)) {
|
|
@@ -77778,12 +77835,15 @@ var ts;
|
|
|
77778
77835
|
return false;
|
|
77779
77836
|
}
|
|
77780
77837
|
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
|
|
77781
|
-
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77838
|
+
(ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77782
77839
|
undefined;
|
|
77783
77840
|
if (func) {
|
|
77784
|
-
// If the node has a @class tag, treat it like a constructor.
|
|
77841
|
+
// If the node has a @class or @constructor tag, treat it like a constructor.
|
|
77785
77842
|
if (ts.getJSDocClassTag(node))
|
|
77786
77843
|
return true;
|
|
77844
|
+
// If the node is a property of an object literal.
|
|
77845
|
+
if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
|
|
77846
|
+
return false;
|
|
77787
77847
|
// If the symbol of the node has members, treat it like a constructor.
|
|
77788
77848
|
var symbol = getSymbolOfNode(func);
|
|
77789
77849
|
return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
|
|
@@ -78031,8 +78091,8 @@ var ts;
|
|
|
78031
78091
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
78032
78092
|
var synthType = type;
|
|
78033
78093
|
if (!synthType.defaultOnlyType) {
|
|
78034
|
-
var
|
|
78035
|
-
synthType.defaultOnlyType =
|
|
78094
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
78095
|
+
synthType.defaultOnlyType = type_4;
|
|
78036
78096
|
}
|
|
78037
78097
|
return synthType.defaultOnlyType;
|
|
78038
78098
|
}
|
|
@@ -87369,6 +87429,12 @@ var ts;
|
|
|
87369
87429
|
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
87370
87430
|
}
|
|
87371
87431
|
}
|
|
87432
|
+
if (result && isJSDoc_1) {
|
|
87433
|
+
var container = ts.getJSDocHost(name);
|
|
87434
|
+
if (container && ts.isEnumMember(container) && container === result.valueDeclaration) {
|
|
87435
|
+
return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result;
|
|
87436
|
+
}
|
|
87437
|
+
}
|
|
87372
87438
|
return result;
|
|
87373
87439
|
}
|
|
87374
87440
|
else if (ts.isPrivateIdentifier(name)) {
|
|
@@ -107530,6 +107596,13 @@ var ts;
|
|
|
107530
107596
|
ts.Debug.assert(importVariableName !== undefined);
|
|
107531
107597
|
// save import into the local
|
|
107532
107598
|
statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
|
|
107599
|
+
if (ts.hasSyntacticModifier(entry, 1 /* Export */)) {
|
|
107600
|
+
statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction,
|
|
107601
|
+
/*typeArguments*/ undefined, [
|
|
107602
|
+
factory.createStringLiteral(ts.idText(importVariableName)),
|
|
107603
|
+
parameterName,
|
|
107604
|
+
])));
|
|
107605
|
+
}
|
|
107533
107606
|
break;
|
|
107534
107607
|
case 272 /* ExportDeclaration */:
|
|
107535
107608
|
ts.Debug.assert(importVariableName !== undefined);
|
|
@@ -110372,8 +110445,12 @@ var ts;
|
|
|
110372
110445
|
}
|
|
110373
110446
|
var previousNeedsDeclare = needsDeclare;
|
|
110374
110447
|
switch (input.kind) {
|
|
110375
|
-
case 259 /* TypeAliasDeclaration */:
|
|
110376
|
-
|
|
110448
|
+
case 259 /* TypeAliasDeclaration */: {
|
|
110449
|
+
needsDeclare = false;
|
|
110450
|
+
var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
|
|
110451
|
+
needsDeclare = previousNeedsDeclare;
|
|
110452
|
+
return clean;
|
|
110453
|
+
}
|
|
110377
110454
|
case 258 /* InterfaceDeclaration */: {
|
|
110378
110455
|
return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
|
|
110379
110456
|
}
|
|
@@ -111877,8 +111954,8 @@ var ts;
|
|
|
111877
111954
|
}
|
|
111878
111955
|
ts.getBuildInfoText = getBuildInfoText;
|
|
111879
111956
|
/*@internal*/
|
|
111880
|
-
function getBuildInfo(buildInfoText) {
|
|
111881
|
-
return
|
|
111957
|
+
function getBuildInfo(buildInfoFile, buildInfoText) {
|
|
111958
|
+
return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
|
|
111882
111959
|
}
|
|
111883
111960
|
ts.getBuildInfo = getBuildInfo;
|
|
111884
111961
|
/*@internal*/
|
|
@@ -111956,17 +112033,16 @@ var ts;
|
|
|
111956
112033
|
var buildInfo;
|
|
111957
112034
|
if (host.getBuildInfo) {
|
|
111958
112035
|
// If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
|
|
111959
|
-
|
|
111960
|
-
if (!hostBuildInfo)
|
|
111961
|
-
return buildInfoPath;
|
|
111962
|
-
buildInfo = hostBuildInfo;
|
|
112036
|
+
buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
111963
112037
|
}
|
|
111964
112038
|
else {
|
|
111965
112039
|
var buildInfoText = host.readFile(buildInfoPath);
|
|
111966
112040
|
if (!buildInfoText)
|
|
111967
112041
|
return buildInfoPath;
|
|
111968
|
-
buildInfo = getBuildInfo(buildInfoText);
|
|
112042
|
+
buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
|
|
111969
112043
|
}
|
|
112044
|
+
if (!buildInfo)
|
|
112045
|
+
return buildInfoPath;
|
|
111970
112046
|
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
|
|
111971
112047
|
return buildInfoPath;
|
|
111972
112048
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
@@ -116624,7 +116700,16 @@ var ts;
|
|
|
116624
116700
|
return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
|
|
116625
116701
|
}
|
|
116626
116702
|
function getCachedFileSystemEntriesForBaseDir(path) {
|
|
116627
|
-
|
|
116703
|
+
var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path));
|
|
116704
|
+
if (!entries) {
|
|
116705
|
+
return entries;
|
|
116706
|
+
}
|
|
116707
|
+
// If we're looking for the base directory, we're definitely going to search the entries
|
|
116708
|
+
if (!entries.sortedAndCanonicalizedFiles) {
|
|
116709
|
+
entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort();
|
|
116710
|
+
entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort();
|
|
116711
|
+
}
|
|
116712
|
+
return entries;
|
|
116628
116713
|
}
|
|
116629
116714
|
function getBaseNameOfFileName(fileName) {
|
|
116630
116715
|
return ts.getBaseFileName(ts.normalizePath(fileName));
|
|
@@ -116667,21 +116752,10 @@ var ts;
|
|
|
116667
116752
|
return undefined;
|
|
116668
116753
|
}
|
|
116669
116754
|
}
|
|
116670
|
-
function fileNameEqual(name1, name2) {
|
|
116671
|
-
return getCanonicalFileName(name1) === getCanonicalFileName(name2);
|
|
116672
|
-
}
|
|
116673
116755
|
function hasEntry(entries, name) {
|
|
116674
|
-
|
|
116675
|
-
|
|
116676
|
-
|
|
116677
|
-
if (hasEntry(entries, baseName)) {
|
|
116678
|
-
if (!isValid) {
|
|
116679
|
-
return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
|
|
116680
|
-
}
|
|
116681
|
-
}
|
|
116682
|
-
else if (isValid) {
|
|
116683
|
-
return entries.push(baseName);
|
|
116684
|
-
}
|
|
116756
|
+
// Case-sensitive comparison since already canonicalized
|
|
116757
|
+
var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive);
|
|
116758
|
+
return index >= 0;
|
|
116685
116759
|
}
|
|
116686
116760
|
function writeFile(fileName, data, writeByteOrderMark) {
|
|
116687
116761
|
var path = toPath(fileName);
|
|
@@ -116694,7 +116768,7 @@ var ts;
|
|
|
116694
116768
|
function fileExists(fileName) {
|
|
116695
116769
|
var path = toPath(fileName);
|
|
116696
116770
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116697
|
-
return result && hasEntry(result.
|
|
116771
|
+
return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) ||
|
|
116698
116772
|
host.fileExists(fileName);
|
|
116699
116773
|
}
|
|
116700
116774
|
function directoryExists(dirPath) {
|
|
@@ -116704,9 +116778,14 @@ var ts;
|
|
|
116704
116778
|
function createDirectory(dirPath) {
|
|
116705
116779
|
var path = toPath(dirPath);
|
|
116706
116780
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116707
|
-
var baseFileName = getBaseNameOfFileName(dirPath);
|
|
116708
116781
|
if (result) {
|
|
116709
|
-
|
|
116782
|
+
var baseName = getBaseNameOfFileName(dirPath);
|
|
116783
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116784
|
+
var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories;
|
|
116785
|
+
// Case-sensitive comparison since already canonicalized
|
|
116786
|
+
if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116787
|
+
result.directories.push(baseName);
|
|
116788
|
+
}
|
|
116710
116789
|
}
|
|
116711
116790
|
host.createDirectory(dirPath);
|
|
116712
116791
|
}
|
|
@@ -116775,7 +116854,7 @@ var ts;
|
|
|
116775
116854
|
fileExists: host.fileExists(fileOrDirectoryPath),
|
|
116776
116855
|
directoryExists: host.directoryExists(fileOrDirectoryPath)
|
|
116777
116856
|
};
|
|
116778
|
-
if (fsQueryResult.directoryExists || hasEntry(parentResult.
|
|
116857
|
+
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
116779
116858
|
// Folder added or removed, clear the cache instead of updating the folder and its structure
|
|
116780
116859
|
clearCache();
|
|
116781
116860
|
}
|
|
@@ -116795,7 +116874,23 @@ var ts;
|
|
|
116795
116874
|
}
|
|
116796
116875
|
}
|
|
116797
116876
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
|
|
116798
|
-
|
|
116877
|
+
var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
|
|
116878
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116879
|
+
if (fileExists) {
|
|
116880
|
+
// Case-sensitive comparison since already canonicalized
|
|
116881
|
+
if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116882
|
+
parentResult.files.push(baseName);
|
|
116883
|
+
}
|
|
116884
|
+
}
|
|
116885
|
+
else {
|
|
116886
|
+
// Case-sensitive comparison since already canonicalized
|
|
116887
|
+
var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive);
|
|
116888
|
+
if (sortedIndex >= 0) {
|
|
116889
|
+
canonicalizedFiles.splice(sortedIndex, 1);
|
|
116890
|
+
var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; });
|
|
116891
|
+
parentResult.files.splice(unsortedIndex, 1);
|
|
116892
|
+
}
|
|
116893
|
+
}
|
|
116799
116894
|
}
|
|
116800
116895
|
function clearCache() {
|
|
116801
116896
|
cachedReadDirectoryResult.clear();
|
|
@@ -125033,18 +125128,14 @@ var ts;
|
|
|
125033
125128
|
if (host.getBuildInfo) {
|
|
125034
125129
|
// host provides buildinfo, get it from there. This allows host to cache it
|
|
125035
125130
|
buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
|
|
125036
|
-
if (!buildInfo)
|
|
125037
|
-
return undefined;
|
|
125038
125131
|
}
|
|
125039
125132
|
else {
|
|
125040
125133
|
var content = host.readFile(buildInfoPath);
|
|
125041
125134
|
if (!content)
|
|
125042
125135
|
return undefined;
|
|
125043
|
-
buildInfo = ts.getBuildInfo(content);
|
|
125136
|
+
buildInfo = ts.getBuildInfo(buildInfoPath, content);
|
|
125044
125137
|
}
|
|
125045
|
-
if (buildInfo.version !== ts.version)
|
|
125046
|
-
return undefined;
|
|
125047
|
-
if (!buildInfo.program)
|
|
125138
|
+
if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
|
|
125048
125139
|
return undefined;
|
|
125049
125140
|
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125050
125141
|
}
|
|
@@ -125266,7 +125357,8 @@ var ts;
|
|
|
125266
125357
|
}
|
|
125267
125358
|
// All resolutions are invalid if user provided resolutions
|
|
125268
125359
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125269
|
-
|
|
125360
|
+
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
125361
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125270
125362
|
if (hasChangedConfigFileParsingErrors) {
|
|
125271
125363
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125272
125364
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125285,6 +125377,11 @@ var ts;
|
|
|
125285
125377
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125286
125378
|
host.afterProgramCreate(builderProgram);
|
|
125287
125379
|
}
|
|
125380
|
+
compilerHost.readFile = originalReadFile;
|
|
125381
|
+
compilerHost.fileExists = originalFileExists;
|
|
125382
|
+
compilerHost.directoryExists = originalDirectoryExists;
|
|
125383
|
+
compilerHost.createDirectory = originalCreateDirectory;
|
|
125384
|
+
compilerHost.writeFile = originalWriteFile;
|
|
125288
125385
|
return builderProgram;
|
|
125289
125386
|
}
|
|
125290
125387
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125762,19 +125859,20 @@ var ts;
|
|
|
125762
125859
|
*/
|
|
125763
125860
|
UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
|
|
125764
125861
|
UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
|
|
125765
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125766
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125767
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125768
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125769
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125770
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125771
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125772
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125862
|
+
UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
|
|
125863
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
|
|
125864
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
|
|
125865
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
|
|
125866
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
|
|
125867
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
|
|
125868
|
+
UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
|
|
125869
|
+
UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
|
|
125870
|
+
UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
|
|
125773
125871
|
/**
|
|
125774
125872
|
* Projects with no outputs (i.e. "solution" files)
|
|
125775
125873
|
*/
|
|
125776
|
-
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] =
|
|
125777
|
-
UpToDateStatusType[UpToDateStatusType["ForceBuild"] =
|
|
125874
|
+
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
|
|
125875
|
+
UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
|
|
125778
125876
|
})(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
|
|
125779
125877
|
function resolveConfigFileProjectName(project) {
|
|
125780
125878
|
if (ts.fileExtensionIs(project, ".json" /* Json */)) {
|
|
@@ -125992,6 +126090,7 @@ var ts;
|
|
|
125992
126090
|
if (value) {
|
|
125993
126091
|
return isParsedCommandLine(value) ? value : undefined;
|
|
125994
126092
|
}
|
|
126093
|
+
ts.performance.mark("SolutionBuilder::beforeConfigFileParsing");
|
|
125995
126094
|
var diagnostic;
|
|
125996
126095
|
var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
|
|
125997
126096
|
var parsed;
|
|
@@ -126006,6 +126105,8 @@ var ts;
|
|
|
126006
126105
|
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
|
|
126007
126106
|
}
|
|
126008
126107
|
configFileCache.set(configFilePath, parsed || diagnostic);
|
|
126108
|
+
ts.performance.mark("SolutionBuilder::afterConfigFileParsing");
|
|
126109
|
+
ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing");
|
|
126009
126110
|
return parsed;
|
|
126010
126111
|
}
|
|
126011
126112
|
function resolveProjectName(state, name) {
|
|
@@ -126205,6 +126306,7 @@ var ts;
|
|
|
126205
126306
|
if (updateOutputFileStampsPending) {
|
|
126206
126307
|
updateOutputTimestamps(state, config, projectPath);
|
|
126207
126308
|
}
|
|
126309
|
+
ts.performance.mark("SolutionBuilder::Timestamps only updates");
|
|
126208
126310
|
return doneInvalidatedProject(state, projectPath);
|
|
126209
126311
|
}
|
|
126210
126312
|
};
|
|
@@ -126298,6 +126400,10 @@ var ts;
|
|
|
126298
126400
|
};
|
|
126299
126401
|
function done(cancellationToken, writeFile, customTransformers) {
|
|
126300
126402
|
executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
|
|
126403
|
+
if (kind === InvalidatedProjectKind.Build)
|
|
126404
|
+
ts.performance.mark("SolutionBuilder::Projects built");
|
|
126405
|
+
else
|
|
126406
|
+
ts.performance.mark("SolutionBuilder::Bundles updated");
|
|
126301
126407
|
return doneInvalidatedProject(state, projectPath);
|
|
126302
126408
|
}
|
|
126303
126409
|
function withProgramOrUndefined(action) {
|
|
@@ -126476,13 +126582,13 @@ var ts;
|
|
|
126476
126582
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
126477
126583
|
var emittedOutputs = new ts.Map();
|
|
126478
126584
|
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
126479
|
-
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
|
|
126585
|
+
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
|
|
126480
126586
|
outputFiles.forEach(function (_a) {
|
|
126481
126587
|
var _b, _c;
|
|
126482
126588
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126483
126589
|
emittedOutputs.set(toPath(state, name), name);
|
|
126484
126590
|
if (buildInfo) {
|
|
126485
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126591
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126486
126592
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126487
126593
|
}
|
|
126488
126594
|
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
@@ -126775,8 +126881,7 @@ var ts;
|
|
|
126775
126881
|
return existing.buildInfo || undefined;
|
|
126776
126882
|
}
|
|
126777
126883
|
var value = state.readFileWithCache(buildInfoPath);
|
|
126778
|
-
var buildInfo = value ? ts.getBuildInfo(value) : undefined;
|
|
126779
|
-
ts.Debug.assert(modifiedTime || !buildInfo);
|
|
126884
|
+
var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
|
|
126780
126885
|
state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
|
|
126781
126886
|
return buildInfo;
|
|
126782
126887
|
}
|
|
@@ -126861,7 +126966,14 @@ var ts;
|
|
|
126861
126966
|
missingOutputFileName: buildInfoPath
|
|
126862
126967
|
};
|
|
126863
126968
|
}
|
|
126864
|
-
var buildInfo =
|
|
126969
|
+
var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
|
|
126970
|
+
if (!buildInfo) {
|
|
126971
|
+
// Error reading buildInfo
|
|
126972
|
+
return {
|
|
126973
|
+
type: ts.UpToDateStatusType.ErrorReadingFile,
|
|
126974
|
+
fileName: buildInfoPath
|
|
126975
|
+
};
|
|
126976
|
+
}
|
|
126865
126977
|
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
|
|
126866
126978
|
return {
|
|
126867
126979
|
type: ts.UpToDateStatusType.TsVersionOutputOfDate,
|
|
@@ -127064,7 +127176,10 @@ var ts;
|
|
|
127064
127176
|
if (prior !== undefined) {
|
|
127065
127177
|
return prior;
|
|
127066
127178
|
}
|
|
127179
|
+
ts.performance.mark("SolutionBuilder::beforeUpToDateCheck");
|
|
127067
127180
|
var actual = getUpToDateStatusWorker(state, project, resolvedPath);
|
|
127181
|
+
ts.performance.mark("SolutionBuilder::afterUpToDateCheck");
|
|
127182
|
+
ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck");
|
|
127068
127183
|
state.projectStatus.set(resolvedPath, actual);
|
|
127069
127184
|
return actual;
|
|
127070
127185
|
}
|
|
@@ -127202,6 +127317,13 @@ var ts;
|
|
|
127202
127317
|
}
|
|
127203
127318
|
}
|
|
127204
127319
|
function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
|
|
127320
|
+
ts.performance.mark("SolutionBuilder::beforeBuild");
|
|
127321
|
+
var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
|
|
127322
|
+
ts.performance.mark("SolutionBuilder::afterBuild");
|
|
127323
|
+
ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
|
|
127324
|
+
return result;
|
|
127325
|
+
}
|
|
127326
|
+
function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
|
|
127205
127327
|
var buildOrder = getBuildOrderFor(state, project, onlyReferences);
|
|
127206
127328
|
if (!buildOrder)
|
|
127207
127329
|
return ts.ExitStatus.InvalidProject_OutputsSkipped;
|
|
@@ -127229,6 +127351,13 @@ var ts;
|
|
|
127229
127351
|
: ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
|
|
127230
127352
|
}
|
|
127231
127353
|
function clean(state, project, onlyReferences) {
|
|
127354
|
+
ts.performance.mark("SolutionBuilder::beforeClean");
|
|
127355
|
+
var result = cleanWorker(state, project, onlyReferences);
|
|
127356
|
+
ts.performance.mark("SolutionBuilder::afterClean");
|
|
127357
|
+
ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean");
|
|
127358
|
+
return result;
|
|
127359
|
+
}
|
|
127360
|
+
function cleanWorker(state, project, onlyReferences) {
|
|
127232
127361
|
var buildOrder = getBuildOrderFor(state, project, onlyReferences);
|
|
127233
127362
|
if (!buildOrder)
|
|
127234
127363
|
return ts.ExitStatus.InvalidProject_OutputsSkipped;
|
|
@@ -127302,6 +127431,14 @@ var ts;
|
|
|
127302
127431
|
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
127303
127432
|
}
|
|
127304
127433
|
function buildNextInvalidatedProject(state, changeDetected) {
|
|
127434
|
+
ts.performance.mark("SolutionBuilder::beforeBuild");
|
|
127435
|
+
var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
127436
|
+
ts.performance.mark("SolutionBuilder::afterBuild");
|
|
127437
|
+
ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
|
|
127438
|
+
if (buildOrder)
|
|
127439
|
+
reportErrorSummary(state, buildOrder);
|
|
127440
|
+
}
|
|
127441
|
+
function buildNextInvalidatedProjectWorker(state, changeDetected) {
|
|
127305
127442
|
state.timerToBuildInvalidatedProject = undefined;
|
|
127306
127443
|
if (state.reportFileChangeDetected) {
|
|
127307
127444
|
state.reportFileChangeDetected = false;
|
|
@@ -127334,7 +127471,7 @@ var ts;
|
|
|
127334
127471
|
}
|
|
127335
127472
|
}
|
|
127336
127473
|
disableCache(state);
|
|
127337
|
-
|
|
127474
|
+
return buildOrder;
|
|
127338
127475
|
}
|
|
127339
127476
|
function watchConfigFile(state, resolved, resolvedPath, parsed) {
|
|
127340
127477
|
if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
|
|
@@ -127389,6 +127526,7 @@ var ts;
|
|
|
127389
127526
|
function startWatching(state, buildOrder) {
|
|
127390
127527
|
if (!state.watchAllProjectsPending)
|
|
127391
127528
|
return;
|
|
127529
|
+
ts.performance.mark("SolutionBuilder::beforeWatcherCreation");
|
|
127392
127530
|
state.watchAllProjectsPending = false;
|
|
127393
127531
|
for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
|
|
127394
127532
|
var resolved = _a[_i];
|
|
@@ -127406,6 +127544,8 @@ var ts;
|
|
|
127406
127544
|
watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
|
|
127407
127545
|
}
|
|
127408
127546
|
}
|
|
127547
|
+
ts.performance.mark("SolutionBuilder::afterWatcherCreation");
|
|
127548
|
+
ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation");
|
|
127409
127549
|
}
|
|
127410
127550
|
function stopWatching(state) {
|
|
127411
127551
|
ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
|
|
@@ -127519,6 +127659,8 @@ var ts;
|
|
|
127519
127659
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
|
|
127520
127660
|
case ts.UpToDateStatusType.OutputMissing:
|
|
127521
127661
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
|
|
127662
|
+
case ts.UpToDateStatusType.ErrorReadingFile:
|
|
127663
|
+
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName));
|
|
127522
127664
|
case ts.UpToDateStatusType.OutOfDateBuildInfo:
|
|
127523
127665
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
|
|
127524
127666
|
case ts.UpToDateStatusType.UpToDate:
|
|
@@ -156553,6 +156695,15 @@ var ts;
|
|
|
156553
156695
|
ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
|
|
156554
156696
|
ts.Diagnostics.Cannot_find_name_0.code
|
|
156555
156697
|
];
|
|
156698
|
+
var InfoKind;
|
|
156699
|
+
(function (InfoKind) {
|
|
156700
|
+
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
156701
|
+
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
156702
|
+
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
156703
|
+
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
156704
|
+
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
156705
|
+
InfoKind[InfoKind["Signature"] = 5] = "Signature";
|
|
156706
|
+
})(InfoKind || (InfoKind = {}));
|
|
156556
156707
|
codefix.registerCodeFix({
|
|
156557
156708
|
errorCodes: errorCodes,
|
|
156558
156709
|
getCodeActions: function (context) {
|
|
@@ -156561,19 +156712,19 @@ var ts;
|
|
|
156561
156712
|
if (!info) {
|
|
156562
156713
|
return undefined;
|
|
156563
156714
|
}
|
|
156564
|
-
if (info.kind ===
|
|
156715
|
+
if (info.kind === InfoKind.ObjectLiteral) {
|
|
156565
156716
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); });
|
|
156566
156717
|
return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)];
|
|
156567
156718
|
}
|
|
156568
|
-
if (info.kind ===
|
|
156719
|
+
if (info.kind === InfoKind.JsxAttributes) {
|
|
156569
156720
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); });
|
|
156570
156721
|
return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)];
|
|
156571
156722
|
}
|
|
156572
|
-
if (info.kind ===
|
|
156723
|
+
if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) {
|
|
156573
156724
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
|
|
156574
156725
|
return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
|
|
156575
156726
|
}
|
|
156576
|
-
if (info.kind ===
|
|
156727
|
+
if (info.kind === InfoKind.Enum) {
|
|
156577
156728
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); });
|
|
156578
156729
|
return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)];
|
|
156579
156730
|
}
|
|
@@ -156591,20 +156742,20 @@ var ts;
|
|
|
156591
156742
|
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
156592
156743
|
return;
|
|
156593
156744
|
}
|
|
156594
|
-
if (fixId === fixMissingFunctionDeclaration && info.kind ===
|
|
156745
|
+
if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) {
|
|
156595
156746
|
addFunctionDeclaration(changes, context, info);
|
|
156596
156747
|
}
|
|
156597
|
-
else if (fixId === fixMissingProperties && info.kind ===
|
|
156748
|
+
else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) {
|
|
156598
156749
|
addObjectLiteralProperties(changes, context, info);
|
|
156599
156750
|
}
|
|
156600
|
-
else if (fixId === fixMissingAttributes && info.kind ===
|
|
156751
|
+
else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) {
|
|
156601
156752
|
addJsxAttributes(changes, context, info);
|
|
156602
156753
|
}
|
|
156603
156754
|
else {
|
|
156604
|
-
if (info.kind ===
|
|
156755
|
+
if (info.kind === InfoKind.Enum) {
|
|
156605
156756
|
addEnumMemberDeclaration(changes, checker, info);
|
|
156606
156757
|
}
|
|
156607
|
-
if (info.kind ===
|
|
156758
|
+
if (info.kind === InfoKind.TypeLikeDeclaration) {
|
|
156608
156759
|
var parentDeclaration = info.parentDeclaration, token_1 = info.token;
|
|
156609
156760
|
var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; });
|
|
156610
156761
|
if (!infos.some(function (i) { return i.token.text === token_1.text; })) {
|
|
@@ -156648,14 +156799,6 @@ var ts;
|
|
|
156648
156799
|
}));
|
|
156649
156800
|
},
|
|
156650
156801
|
});
|
|
156651
|
-
var InfoKind;
|
|
156652
|
-
(function (InfoKind) {
|
|
156653
|
-
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
156654
|
-
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
156655
|
-
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
156656
|
-
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
156657
|
-
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
156658
|
-
})(InfoKind || (InfoKind = {}));
|
|
156659
156802
|
function getInfo(sourceFile, tokenPos, errorCode, checker, program) {
|
|
156660
156803
|
// The identifier of the missing property. eg:
|
|
156661
156804
|
// this.missing = 1;
|
|
@@ -156677,7 +156820,7 @@ var ts;
|
|
|
156677
156820
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
156678
156821
|
if (!ts.length(properties))
|
|
156679
156822
|
return undefined;
|
|
156680
|
-
return { kind:
|
|
156823
|
+
return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent };
|
|
156681
156824
|
}
|
|
156682
156825
|
if (!ts.isMemberName(token))
|
|
156683
156826
|
return undefined;
|
|
@@ -156685,17 +156828,26 @@ var ts;
|
|
|
156685
156828
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
156686
156829
|
if (!ts.length(properties))
|
|
156687
156830
|
return undefined;
|
|
156688
|
-
return { kind:
|
|
156831
|
+
return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer };
|
|
156689
156832
|
}
|
|
156690
156833
|
if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) {
|
|
156691
156834
|
var target = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
156692
156835
|
var attributes = getUnmatchedAttributes(checker, target, token.parent);
|
|
156693
156836
|
if (!ts.length(attributes))
|
|
156694
156837
|
return undefined;
|
|
156695
|
-
return { kind:
|
|
156838
|
+
return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent };
|
|
156696
156839
|
}
|
|
156697
|
-
if (ts.isIdentifier(token)
|
|
156698
|
-
|
|
156840
|
+
if (ts.isIdentifier(token)) {
|
|
156841
|
+
var type = checker.getContextualType(token);
|
|
156842
|
+
if (type && ts.getObjectFlags(type) & 16 /* Anonymous */) {
|
|
156843
|
+
var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
|
156844
|
+
if (signature === undefined)
|
|
156845
|
+
return undefined;
|
|
156846
|
+
return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) };
|
|
156847
|
+
}
|
|
156848
|
+
if (ts.isCallExpression(parent) && parent.expression === token) {
|
|
156849
|
+
return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: findScope(token) };
|
|
156850
|
+
}
|
|
156699
156851
|
}
|
|
156700
156852
|
if (!ts.isPropertyAccessExpression(parent))
|
|
156701
156853
|
return undefined;
|
|
@@ -156707,13 +156859,13 @@ var ts;
|
|
|
156707
156859
|
var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
|
|
156708
156860
|
var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
|
|
156709
156861
|
if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
|
|
156710
|
-
return { kind:
|
|
156862
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleDeclaration };
|
|
156711
156863
|
}
|
|
156712
156864
|
var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
|
|
156713
156865
|
if (sourceFile.commonJsModuleIndicator)
|
|
156714
156866
|
return undefined;
|
|
156715
156867
|
if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
|
|
156716
|
-
return { kind:
|
|
156868
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleSourceFile };
|
|
156717
156869
|
}
|
|
156718
156870
|
}
|
|
156719
156871
|
var classDeclaration = ts.find(symbol.declarations, ts.isClassLike);
|
|
@@ -156731,11 +156883,11 @@ var ts;
|
|
|
156731
156883
|
(makeStatic ? 32 /* Static */ : 0 /* None */) | (ts.startsWithUnderscore(token.text) ? 8 /* Private */ : 0 /* None */);
|
|
156732
156884
|
var isJSFile = ts.isSourceFileJS(declSourceFile);
|
|
156733
156885
|
var call = ts.tryCast(parent.parent, ts.isCallExpression);
|
|
156734
|
-
return { kind:
|
|
156886
|
+
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
156735
156887
|
}
|
|
156736
156888
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
156737
156889
|
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
156738
|
-
return { kind:
|
|
156890
|
+
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
156739
156891
|
}
|
|
156740
156892
|
return undefined;
|
|
156741
156893
|
}
|
|
@@ -156911,9 +157063,17 @@ var ts;
|
|
|
156911
157063
|
});
|
|
156912
157064
|
}
|
|
156913
157065
|
function addFunctionDeclaration(changes, context, info) {
|
|
157066
|
+
var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences);
|
|
156914
157067
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
156915
|
-
var functionDeclaration =
|
|
156916
|
-
|
|
157068
|
+
var functionDeclaration = info.kind === InfoKind.Function
|
|
157069
|
+
? codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration)
|
|
157070
|
+
: codefix.createSignatureDeclarationFromSignature(256 /* FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder);
|
|
157071
|
+
if (functionDeclaration === undefined) {
|
|
157072
|
+
ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error.");
|
|
157073
|
+
}
|
|
157074
|
+
ts.isReturnStatement(info.parentDeclaration)
|
|
157075
|
+
? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true)
|
|
157076
|
+
: changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
156917
157077
|
importAdder.writeFixes(changes);
|
|
156918
157078
|
}
|
|
156919
157079
|
function addJsxAttributes(changes, context, info) {
|
|
@@ -157071,6 +157231,14 @@ var ts;
|
|
|
157071
157231
|
}
|
|
157072
157232
|
return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
|
|
157073
157233
|
}
|
|
157234
|
+
function findScope(node) {
|
|
157235
|
+
if (ts.findAncestor(node, ts.isJsxExpression)) {
|
|
157236
|
+
var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement);
|
|
157237
|
+
if (returnStatement)
|
|
157238
|
+
return returnStatement;
|
|
157239
|
+
}
|
|
157240
|
+
return ts.getSourceFileOfNode(node);
|
|
157241
|
+
}
|
|
157074
157242
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
157075
157243
|
})(ts || (ts = {}));
|
|
157076
157244
|
/* @internal */
|
|
@@ -159760,6 +159928,9 @@ var ts;
|
|
|
159760
159928
|
if (ts.isMethodDeclaration(signatureDeclaration)) {
|
|
159761
159929
|
return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body);
|
|
159762
159930
|
}
|
|
159931
|
+
if (ts.isFunctionDeclaration(signatureDeclaration)) {
|
|
159932
|
+
return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body);
|
|
159933
|
+
}
|
|
159763
159934
|
return undefined;
|
|
159764
159935
|
}
|
|
159765
159936
|
codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature;
|
|
@@ -167062,6 +167233,10 @@ var ts;
|
|
|
167062
167233
|
getCurrentDirectory: compilerHost.getCurrentDirectory,
|
|
167063
167234
|
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
167064
167235
|
};
|
|
167236
|
+
// The call to isProgramUptoDate below may refer back to documentRegistryBucketKey;
|
|
167237
|
+
// calculate this early so it's not undefined if downleveled to a var (or, if emitted
|
|
167238
|
+
// as a const variable without downleveling, doesn't crash).
|
|
167239
|
+
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167065
167240
|
// If the program is already up-to-date, we can reuse it
|
|
167066
167241
|
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
167067
167242
|
return;
|
|
@@ -167071,7 +167246,6 @@ var ts;
|
|
|
167071
167246
|
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
167072
167247
|
// the program points to old source files that have been invalidated because of
|
|
167073
167248
|
// incremental parsing.
|
|
167074
|
-
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167075
167249
|
var options = {
|
|
167076
167250
|
rootNames: rootFileNames,
|
|
167077
167251
|
options: newSettings,
|