typescript 4.8.0-dev.20220519 → 4.8.0-dev.20220520
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/tsc.js +2 -1
- package/lib/tsserver.js +109 -71
- package/lib/tsserverlibrary.js +109 -71
- package/lib/typescript.js +109 -71
- package/lib/typescriptServices.js +109 -71
- package/lib/typingsInstaller.js +2 -1
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220520";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -2432,6 +2432,7 @@ var ts;
|
|
|
2432
2432
|
startsWith(candidate, prefix) &&
|
|
2433
2433
|
endsWith(candidate, suffix);
|
|
2434
2434
|
}
|
|
2435
|
+
ts.isPatternMatch = isPatternMatch;
|
|
2435
2436
|
function and(f, g) {
|
|
2436
2437
|
return function (arg) { return f(arg) && g(arg); };
|
|
2437
2438
|
}
|
|
@@ -131657,6 +131658,7 @@ var ts;
|
|
|
131657
131658
|
* Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename.
|
|
131658
131659
|
*/
|
|
131659
131660
|
function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, _a, host, exclude, result) {
|
|
131661
|
+
var _b;
|
|
131660
131662
|
var extensions = _a.extensions, includeExtensionsOption = _a.includeExtensionsOption;
|
|
131661
131663
|
if (result === void 0) { result = []; }
|
|
131662
131664
|
if (fragment === undefined) {
|
|
@@ -131674,9 +131676,26 @@ var ts;
|
|
|
131674
131676
|
fragment = "." + ts.directorySeparator;
|
|
131675
131677
|
}
|
|
131676
131678
|
fragment = ts.ensureTrailingDirectorySeparator(fragment);
|
|
131677
|
-
// const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment)); // TODO(rbuckton): should use resolvePaths
|
|
131678
131679
|
var absolutePath = ts.resolvePath(scriptPath, fragment);
|
|
131679
131680
|
var baseDirectory = ts.hasTrailingDirectorySeparator(absolutePath) ? absolutePath : ts.getDirectoryPath(absolutePath);
|
|
131681
|
+
// check for a version redirect
|
|
131682
|
+
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131683
|
+
if (packageJsonPath) {
|
|
131684
|
+
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131685
|
+
var typesVersions = packageJson.typesVersions;
|
|
131686
|
+
if (typeof typesVersions === "object") {
|
|
131687
|
+
var versionPaths = (_b = ts.getPackageJsonTypesVersionsPaths(typesVersions)) === null || _b === void 0 ? void 0 : _b.paths;
|
|
131688
|
+
if (versionPaths) {
|
|
131689
|
+
var packageDirectory = ts.getDirectoryPath(packageJsonPath);
|
|
131690
|
+
var pathInPackage = absolutePath.slice(ts.ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
131691
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensions, versionPaths, host)) {
|
|
131692
|
+
// A true result means one of the `versionPaths` was matched, which will block relative resolution
|
|
131693
|
+
// to files and folders from here. All reachable paths given the pattern match are already added.
|
|
131694
|
+
return result;
|
|
131695
|
+
}
|
|
131696
|
+
}
|
|
131697
|
+
}
|
|
131698
|
+
}
|
|
131680
131699
|
var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
131681
131700
|
if (!ts.tryDirectoryExists(host, baseDirectory))
|
|
131682
131701
|
return result;
|
|
@@ -131718,48 +131737,62 @@ var ts;
|
|
|
131718
131737
|
// If possible, get folder completion as well
|
|
131719
131738
|
var directories = ts.tryGetDirectories(host, baseDirectory);
|
|
131720
131739
|
if (directories) {
|
|
131721
|
-
for (var
|
|
131722
|
-
var directory = directories_1[
|
|
131740
|
+
for (var _c = 0, directories_1 = directories; _c < directories_1.length; _c++) {
|
|
131741
|
+
var directory = directories_1[_c];
|
|
131723
131742
|
var directoryName = ts.getBaseFileName(ts.normalizePath(directory));
|
|
131724
131743
|
if (directoryName !== "@types") {
|
|
131725
131744
|
result.push(directoryResult(directoryName));
|
|
131726
131745
|
}
|
|
131727
131746
|
}
|
|
131728
131747
|
}
|
|
131729
|
-
// check for a version redirect
|
|
131730
|
-
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131731
|
-
if (packageJsonPath) {
|
|
131732
|
-
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131733
|
-
var typesVersions = packageJson.typesVersions;
|
|
131734
|
-
if (typeof typesVersions === "object") {
|
|
131735
|
-
var versionResult = ts.getPackageJsonTypesVersionsPaths(typesVersions);
|
|
131736
|
-
var versionPaths = versionResult && versionResult.paths;
|
|
131737
|
-
var rest = absolutePath.slice(ts.ensureTrailingDirectorySeparator(baseDirectory).length);
|
|
131738
|
-
if (versionPaths) {
|
|
131739
|
-
addCompletionEntriesFromPaths(result, rest, baseDirectory, extensions, versionPaths, host);
|
|
131740
|
-
}
|
|
131741
|
-
}
|
|
131742
|
-
}
|
|
131743
131748
|
return result;
|
|
131744
131749
|
}
|
|
131750
|
+
/** @returns whether `fragment` was a match for any `paths` (which should indicate whether any other path completions should be offered) */
|
|
131745
131751
|
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, fileExtensions, paths, host) {
|
|
131752
|
+
var _a;
|
|
131753
|
+
var pathResults = [];
|
|
131754
|
+
var matchedPathPrefixLength = -1;
|
|
131746
131755
|
for (var path in paths) {
|
|
131747
131756
|
if (!ts.hasProperty(paths, path))
|
|
131748
131757
|
continue;
|
|
131749
131758
|
var patterns = paths[path];
|
|
131750
131759
|
if (patterns) {
|
|
131751
|
-
var
|
|
131752
|
-
|
|
131753
|
-
|
|
131754
|
-
|
|
131755
|
-
|
|
131756
|
-
|
|
131757
|
-
|
|
131758
|
-
|
|
131759
|
-
|
|
131760
|
+
var pathPattern = ts.tryParsePattern(path);
|
|
131761
|
+
if (!pathPattern)
|
|
131762
|
+
continue;
|
|
131763
|
+
var isMatch = typeof pathPattern === "object" && ts.isPatternMatch(pathPattern, fragment);
|
|
131764
|
+
var isLongestMatch = isMatch && (matchedPathPrefixLength === undefined || pathPattern.prefix.length > matchedPathPrefixLength);
|
|
131765
|
+
if (isLongestMatch) {
|
|
131766
|
+
// If this is a higher priority match than anything we've seen so far, previous results from matches are invalid, e.g.
|
|
131767
|
+
// for `import {} from "some-package/|"` with a typesVersions:
|
|
131768
|
+
// {
|
|
131769
|
+
// "bar/*": ["bar/*"], // <-- 1. We add 'bar', but 'bar/*' doesn't match yet.
|
|
131770
|
+
// "*": ["dist/*"], // <-- 2. We match here and add files from dist. 'bar' is still ok because it didn't come from a match.
|
|
131771
|
+
// "foo/*": ["foo/*"] // <-- 3. We matched '*' earlier and added results from dist, but if 'foo/*' also matched,
|
|
131772
|
+
// } results in dist would not be visible. 'bar' still stands because it didn't come from a match.
|
|
131773
|
+
// This is especially important if `dist/foo` is a folder, because if we fail to clear results
|
|
131774
|
+
// added by the '*' match, after typing `"some-package/foo/|"` we would get file results from both
|
|
131775
|
+
// ./dist/foo and ./foo, when only the latter will actually be resolvable.
|
|
131776
|
+
// See pathCompletionsTypesVersionsWildcard6.ts.
|
|
131777
|
+
matchedPathPrefixLength = pathPattern.prefix.length;
|
|
131778
|
+
pathResults = pathResults.filter(function (r) { return !r.matchedPattern; });
|
|
131779
|
+
}
|
|
131780
|
+
if (typeof pathPattern === "string" || matchedPathPrefixLength === undefined || pathPattern.prefix.length >= matchedPathPrefixLength) {
|
|
131781
|
+
pathResults.push({
|
|
131782
|
+
matchedPattern: isMatch,
|
|
131783
|
+
results: getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host)
|
|
131784
|
+
.map(function (_a) {
|
|
131785
|
+
var name = _a.name, kind = _a.kind, extension = _a.extension;
|
|
131786
|
+
return nameAndKind(name, kind, extension);
|
|
131787
|
+
}),
|
|
131788
|
+
});
|
|
131760
131789
|
}
|
|
131761
131790
|
}
|
|
131762
131791
|
}
|
|
131792
|
+
var equatePaths = ((_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host)) ? ts.equateStringsCaseSensitive : ts.equateStringsCaseInsensitive;
|
|
131793
|
+
var equateResults = function (a, b) { return equatePaths(a.name, b.name); };
|
|
131794
|
+
pathResults.forEach(function (pathResult) { return pathResult.results.forEach(function (pathResult) { return ts.pushIfUnique(result, pathResult, equateResults); }); });
|
|
131795
|
+
return matchedPathPrefixLength > -1;
|
|
131763
131796
|
}
|
|
131764
131797
|
/**
|
|
131765
131798
|
* Check all of the declared modules and those in node modules. Possible sources of modules:
|
|
@@ -131791,7 +131824,7 @@ var ts;
|
|
|
131791
131824
|
// (But do if we didn't find anything, e.g. 'package.json' missing.)
|
|
131792
131825
|
var foundGlobal = false;
|
|
131793
131826
|
if (fragmentDirectory === undefined) {
|
|
131794
|
-
var
|
|
131827
|
+
var _loop_3 = function (moduleName) {
|
|
131795
131828
|
if (!result.some(function (entry) { return entry.name === moduleName; })) {
|
|
131796
131829
|
foundGlobal = true;
|
|
131797
131830
|
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
|
|
@@ -131799,7 +131832,7 @@ var ts;
|
|
|
131799
131832
|
};
|
|
131800
131833
|
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
|
|
131801
131834
|
var moduleName = _c[_b];
|
|
131802
|
-
|
|
131835
|
+
_loop_3(moduleName);
|
|
131803
131836
|
}
|
|
131804
131837
|
}
|
|
131805
131838
|
if (!foundGlobal) {
|
|
@@ -131879,11 +131912,16 @@ var ts;
|
|
|
131879
131912
|
}
|
|
131880
131913
|
var pathPrefix = path.slice(0, path.length - 1);
|
|
131881
131914
|
var remainingFragment = ts.tryRemovePrefix(fragment, pathPrefix);
|
|
131882
|
-
|
|
131883
|
-
|
|
131884
|
-
|
|
131915
|
+
if (remainingFragment === undefined) {
|
|
131916
|
+
var starIsFullPathComponent = path[path.length - 2] === "/";
|
|
131917
|
+
return starIsFullPathComponent ? justPathMappingName(pathPrefix) : ts.flatMap(patterns, function (pattern) { var _a; return (_a = getModulesForPathsPattern("", baseUrl, pattern, fileExtensions, host)) === null || _a === void 0 ? void 0 : _a.map(function (_a) {
|
|
131918
|
+
var name = _a.name, rest = __rest(_a, ["name"]);
|
|
131919
|
+
return (__assign({ name: pathPrefix + name }, rest));
|
|
131920
|
+
}); });
|
|
131921
|
+
}
|
|
131922
|
+
return ts.flatMap(patterns, function (pattern) { return getModulesForPathsPattern(remainingFragment, baseUrl, pattern, fileExtensions, host); });
|
|
131885
131923
|
function justPathMappingName(name) {
|
|
131886
|
-
return ts.startsWith(name, fragment) ? [directoryResult(name)] : ts.emptyArray;
|
|
131924
|
+
return ts.startsWith(name, fragment) ? [directoryResult(ts.removeTrailingDirectorySeparator(name))] : ts.emptyArray;
|
|
131887
131925
|
}
|
|
131888
131926
|
}
|
|
131889
131927
|
function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) {
|
|
@@ -137589,7 +137627,7 @@ var ts;
|
|
|
137589
137627
|
result = references;
|
|
137590
137628
|
continue;
|
|
137591
137629
|
}
|
|
137592
|
-
var
|
|
137630
|
+
var _loop_4 = function (entry) {
|
|
137593
137631
|
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
|
|
137594
137632
|
result.push(entry);
|
|
137595
137633
|
return "continue";
|
|
@@ -137621,7 +137659,7 @@ var ts;
|
|
|
137621
137659
|
};
|
|
137622
137660
|
for (var _b = 0, references_2 = references; _b < references_2.length; _b++) {
|
|
137623
137661
|
var entry = references_2[_b];
|
|
137624
|
-
|
|
137662
|
+
_loop_4(entry);
|
|
137625
137663
|
}
|
|
137626
137664
|
}
|
|
137627
137665
|
return result;
|
|
@@ -139649,7 +139687,7 @@ var ts;
|
|
|
139649
139687
|
}
|
|
139650
139688
|
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
|
|
139651
139689
|
var allFiles = program.getSourceFiles();
|
|
139652
|
-
var
|
|
139690
|
+
var _loop_5 = function (sourceFile) {
|
|
139653
139691
|
var newFromOld = oldToNew(sourceFile.fileName);
|
|
139654
139692
|
var newImportFromPath = newFromOld !== null && newFromOld !== void 0 ? newFromOld : sourceFile.fileName;
|
|
139655
139693
|
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
|
|
@@ -139681,7 +139719,7 @@ var ts;
|
|
|
139681
139719
|
};
|
|
139682
139720
|
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
|
|
139683
139721
|
var sourceFile = allFiles_1[_i];
|
|
139684
|
-
|
|
139722
|
+
_loop_5(sourceFile);
|
|
139685
139723
|
}
|
|
139686
139724
|
}
|
|
139687
139725
|
function combineNormal(pathA, pathB) {
|
|
@@ -140705,7 +140743,7 @@ var ts;
|
|
|
140705
140743
|
if (!patternMatcher)
|
|
140706
140744
|
return ts.emptyArray;
|
|
140707
140745
|
var rawItems = [];
|
|
140708
|
-
var
|
|
140746
|
+
var _loop_6 = function (sourceFile) {
|
|
140709
140747
|
cancellationToken.throwIfCancellationRequested();
|
|
140710
140748
|
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
|
|
140711
140749
|
return "continue";
|
|
@@ -140717,7 +140755,7 @@ var ts;
|
|
|
140717
140755
|
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
|
140718
140756
|
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
|
|
140719
140757
|
var sourceFile = sourceFiles_4[_i];
|
|
140720
|
-
|
|
140758
|
+
_loop_6(sourceFile);
|
|
140721
140759
|
}
|
|
140722
140760
|
rawItems.sort(compareNavigateToItems);
|
|
140723
140761
|
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
|
|
@@ -142782,13 +142820,13 @@ var ts;
|
|
|
142782
142820
|
// Assumes 'value' is already lowercase.
|
|
142783
142821
|
function indexOfIgnoringCase(str, value) {
|
|
142784
142822
|
var n = str.length - value.length;
|
|
142785
|
-
var
|
|
142823
|
+
var _loop_7 = function (start) {
|
|
142786
142824
|
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
|
|
142787
142825
|
return { value: start };
|
|
142788
142826
|
}
|
|
142789
142827
|
};
|
|
142790
142828
|
for (var start = 0; start <= n; start++) {
|
|
142791
|
-
var state_3 =
|
|
142829
|
+
var state_3 = _loop_7(start);
|
|
142792
142830
|
if (typeof state_3 === "object")
|
|
142793
142831
|
return state_3.value;
|
|
142794
142832
|
}
|
|
@@ -144207,7 +144245,7 @@ var ts;
|
|
|
144207
144245
|
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
|
|
144208
144246
|
}
|
|
144209
144247
|
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
|
|
144210
|
-
var
|
|
144248
|
+
var _loop_8 = function (n) {
|
|
144211
144249
|
// If the node is not a subspan of its parent, this is a big problem.
|
|
144212
144250
|
// There have been crashes that might be caused by this violation.
|
|
144213
144251
|
ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); });
|
|
@@ -144217,7 +144255,7 @@ var ts;
|
|
|
144217
144255
|
}
|
|
144218
144256
|
};
|
|
144219
144257
|
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
|
|
144220
|
-
var state_4 =
|
|
144258
|
+
var state_4 = _loop_8(n);
|
|
144221
144259
|
if (typeof state_4 === "object")
|
|
144222
144260
|
return state_4.value;
|
|
144223
144261
|
}
|
|
@@ -145816,7 +145854,7 @@ var ts;
|
|
|
145816
145854
|
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum ||
|
|
145817
145855
|
ts.filter(ts.optionDeclarations, function (o) { return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); });
|
|
145818
145856
|
options = ts.cloneCompilerOptions(options);
|
|
145819
|
-
var
|
|
145857
|
+
var _loop_9 = function (opt) {
|
|
145820
145858
|
if (!ts.hasProperty(options, opt.name)) {
|
|
145821
145859
|
return "continue";
|
|
145822
145860
|
}
|
|
@@ -145835,7 +145873,7 @@ var ts;
|
|
|
145835
145873
|
};
|
|
145836
145874
|
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
|
|
145837
145875
|
var opt = commandLineOptionsStringToEnum_1[_i];
|
|
145838
|
-
|
|
145876
|
+
_loop_9(opt);
|
|
145839
145877
|
}
|
|
145840
145878
|
return options;
|
|
145841
145879
|
}
|
|
@@ -149583,7 +149621,7 @@ var ts;
|
|
|
149583
149621
|
ChangeTracker.prototype.finishDeleteDeclarations = function () {
|
|
149584
149622
|
var _this = this;
|
|
149585
149623
|
var deletedNodesInLists = new ts.Set(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
|
|
149586
|
-
var
|
|
149624
|
+
var _loop_10 = function (sourceFile, node) {
|
|
149587
149625
|
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
|
|
149588
149626
|
if (ts.isArray(node)) {
|
|
149589
149627
|
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(sourceFile, node));
|
|
@@ -149596,7 +149634,7 @@ var ts;
|
|
|
149596
149634
|
var this_1 = this;
|
|
149597
149635
|
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
|
|
149598
149636
|
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
|
|
149599
|
-
|
|
149637
|
+
_loop_10(sourceFile, node);
|
|
149600
149638
|
}
|
|
149601
149639
|
deletedNodesInLists.forEach(function (node) {
|
|
149602
149640
|
var sourceFile = node.getSourceFile();
|
|
@@ -149684,14 +149722,14 @@ var ts;
|
|
|
149684
149722
|
// order changes by start position
|
|
149685
149723
|
// If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa.
|
|
149686
149724
|
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
|
|
149687
|
-
var
|
|
149725
|
+
var _loop_11 = function (i) {
|
|
149688
149726
|
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
|
|
149689
149727
|
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
|
|
149690
149728
|
});
|
|
149691
149729
|
};
|
|
149692
149730
|
// verify that change intervals do not overlap, except possibly at end points.
|
|
149693
149731
|
for (var i = 0; i < normalized.length - 1; i++) {
|
|
149694
|
-
|
|
149732
|
+
_loop_11(i);
|
|
149695
149733
|
}
|
|
149696
149734
|
var textChanges = ts.mapDefined(normalized, function (c) {
|
|
149697
149735
|
var span = ts.createTextSpanFromRange(c.range);
|
|
@@ -150600,7 +150638,7 @@ var ts;
|
|
|
150600
150638
|
}
|
|
150601
150639
|
var isCompleteFix = identifiers.isCompleteFix;
|
|
150602
150640
|
var initializers;
|
|
150603
|
-
var
|
|
150641
|
+
var _loop_12 = function (identifier) {
|
|
150604
150642
|
var symbol = checker.getSymbolAtLocation(identifier);
|
|
150605
150643
|
if (!symbol) {
|
|
150606
150644
|
return "continue";
|
|
@@ -150633,7 +150671,7 @@ var ts;
|
|
|
150633
150671
|
};
|
|
150634
150672
|
for (var _i = 0, _a = identifiers.identifiers; _i < _a.length; _i++) {
|
|
150635
150673
|
var identifier = _a[_i];
|
|
150636
|
-
|
|
150674
|
+
_loop_12(identifier);
|
|
150637
150675
|
}
|
|
150638
150676
|
return initializers && {
|
|
150639
150677
|
initializers: initializers,
|
|
@@ -151523,7 +151561,7 @@ var ts;
|
|
|
151523
151561
|
functionToConvert.getStart(sourceFile);
|
|
151524
151562
|
var options = functionToConvert.modifiers ? { prefix: " " } : { suffix: " " };
|
|
151525
151563
|
changes.insertModifierAt(sourceFile, pos, 131 /* AsyncKeyword */, options);
|
|
151526
|
-
var
|
|
151564
|
+
var _loop_13 = function (returnStatement) {
|
|
151527
151565
|
ts.forEachChild(returnStatement, function visit(node) {
|
|
151528
151566
|
if (ts.isCallExpression(node)) {
|
|
151529
151567
|
var newNodes = transformExpression(node, node, transformer, /*hasContinuation*/ false);
|
|
@@ -151545,7 +151583,7 @@ var ts;
|
|
|
151545
151583
|
};
|
|
151546
151584
|
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
|
|
151547
151585
|
var returnStatement = returnStatements_1[_i];
|
|
151548
|
-
var state_5 =
|
|
151586
|
+
var state_5 = _loop_13(returnStatement);
|
|
151549
151587
|
if (typeof state_5 === "object")
|
|
151550
151588
|
return state_5.value;
|
|
151551
151589
|
}
|
|
@@ -154793,7 +154831,7 @@ var ts;
|
|
|
154793
154831
|
});
|
|
154794
154832
|
typeDeclToMembers.forEach(function (infos, declaration) {
|
|
154795
154833
|
var supers = ts.isTypeLiteralNode(declaration) ? undefined : codefix.getAllSupers(declaration, checker);
|
|
154796
|
-
var
|
|
154834
|
+
var _loop_14 = function (info) {
|
|
154797
154835
|
// If some superclass added this property, don't add it again.
|
|
154798
154836
|
if (supers === null || supers === void 0 ? void 0 : supers.some(function (superClassOrInterface) {
|
|
154799
154837
|
var superInfos = typeDeclToMembers.get(superClassOrInterface);
|
|
@@ -154820,7 +154858,7 @@ var ts;
|
|
|
154820
154858
|
};
|
|
154821
154859
|
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
|
|
154822
154860
|
var info = infos_1[_i];
|
|
154823
|
-
|
|
154861
|
+
_loop_14(info);
|
|
154824
154862
|
}
|
|
154825
154863
|
});
|
|
154826
154864
|
}));
|
|
@@ -157583,7 +157621,7 @@ var ts;
|
|
|
157583
157621
|
function getSignatureFromCalls(calls) {
|
|
157584
157622
|
var parameters = [];
|
|
157585
157623
|
var length = Math.max.apply(Math, calls.map(function (c) { return c.argumentTypes.length; }));
|
|
157586
|
-
var
|
|
157624
|
+
var _loop_15 = function (i) {
|
|
157587
157625
|
var symbol = checker.createSymbol(1 /* FunctionScopedVariable */, ts.escapeLeadingUnderscores("arg" + i));
|
|
157588
157626
|
symbol.type = combineTypes(calls.map(function (call) { return call.argumentTypes[i] || checker.getUndefinedType(); }));
|
|
157589
157627
|
if (calls.some(function (call) { return call.argumentTypes[i] === undefined; })) {
|
|
@@ -157592,7 +157630,7 @@ var ts;
|
|
|
157592
157630
|
parameters.push(symbol);
|
|
157593
157631
|
};
|
|
157594
157632
|
for (var i = 0; i < length; i++) {
|
|
157595
|
-
|
|
157633
|
+
_loop_15(i);
|
|
157596
157634
|
}
|
|
157597
157635
|
var returnType = combineFromUsage(combineUsages(calls.map(function (call) { return call.return_; })));
|
|
157598
157636
|
return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, 0 /* None */);
|
|
@@ -159565,7 +159603,7 @@ var ts;
|
|
|
159565
159603
|
// Imports that need to be kept as named imports in the refactored code, to avoid changing the semantics.
|
|
159566
159604
|
// More specifically, those are named imports that appear in named exports in the original code, e.g. `a` in `import { a } from "m"; export { a }`.
|
|
159567
159605
|
var neededNamedImports = new ts.Set();
|
|
159568
|
-
var
|
|
159606
|
+
var _loop_16 = function (element) {
|
|
159569
159607
|
var propertyName = (element.propertyName || element.name).text;
|
|
159570
159608
|
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
|
|
159571
159609
|
var access = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(namespaceImportName), propertyName);
|
|
@@ -159582,7 +159620,7 @@ var ts;
|
|
|
159582
159620
|
};
|
|
159583
159621
|
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
|
|
159584
159622
|
var element = _a[_i];
|
|
159585
|
-
|
|
159623
|
+
_loop_16(element);
|
|
159586
159624
|
}
|
|
159587
159625
|
changes.replaceNode(sourceFile, toConvert, shouldUseDefault
|
|
159588
159626
|
? ts.factory.createIdentifier(namespaceImportName)
|
|
@@ -161480,7 +161518,7 @@ var ts;
|
|
|
161480
161518
|
: ts.getEnclosingBlockScopeContainer(scopes[0]);
|
|
161481
161519
|
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
|
|
161482
161520
|
}
|
|
161483
|
-
var
|
|
161521
|
+
var _loop_17 = function (i) {
|
|
161484
161522
|
var scopeUsages = usagesPerScope[i];
|
|
161485
161523
|
// Special case: in the innermost scope, all usages are available.
|
|
161486
161524
|
// (The computed value reflects the value at the top-level of the scope, but the
|
|
@@ -161523,7 +161561,7 @@ var ts;
|
|
|
161523
161561
|
}
|
|
161524
161562
|
};
|
|
161525
161563
|
for (var i = 0; i < scopes.length; i++) {
|
|
161526
|
-
|
|
161564
|
+
_loop_17(i);
|
|
161527
161565
|
}
|
|
161528
161566
|
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
|
|
161529
161567
|
function isInGenericContext(node) {
|
|
@@ -162226,10 +162264,10 @@ var ts;
|
|
|
162226
162264
|
}
|
|
162227
162265
|
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
|
|
162228
162266
|
var checker = program.getTypeChecker();
|
|
162229
|
-
var
|
|
162267
|
+
var _loop_18 = function (sourceFile) {
|
|
162230
162268
|
if (sourceFile === oldFile)
|
|
162231
162269
|
return "continue";
|
|
162232
|
-
var
|
|
162270
|
+
var _loop_19 = function (statement) {
|
|
162233
162271
|
forEachImportInStatement(statement, function (importNode) {
|
|
162234
162272
|
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
|
|
162235
162273
|
return;
|
|
@@ -162251,12 +162289,12 @@ var ts;
|
|
|
162251
162289
|
};
|
|
162252
162290
|
for (var _b = 0, _c = sourceFile.statements; _b < _c.length; _b++) {
|
|
162253
162291
|
var statement = _c[_b];
|
|
162254
|
-
|
|
162292
|
+
_loop_19(statement);
|
|
162255
162293
|
}
|
|
162256
162294
|
};
|
|
162257
162295
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
162258
162296
|
var sourceFile = _a[_i];
|
|
162259
|
-
|
|
162297
|
+
_loop_18(sourceFile);
|
|
162260
162298
|
}
|
|
162261
162299
|
}
|
|
162262
162300
|
function getNamespaceLikeImport(node) {
|
|
@@ -163620,7 +163658,7 @@ var ts;
|
|
|
163620
163658
|
var templateSpans = [];
|
|
163621
163659
|
var templateHead = ts.factory.createTemplateHead(headText, rawHeadText);
|
|
163622
163660
|
copyCommentFromStringLiterals(headIndexes, templateHead);
|
|
163623
|
-
var
|
|
163661
|
+
var _loop_20 = function (i) {
|
|
163624
163662
|
var currentNode = getExpressionFromParenthesesOrExpression(nodes[i]);
|
|
163625
163663
|
copyOperatorComments(i, currentNode);
|
|
163626
163664
|
var _c = concatConsecutiveString(i + 1, nodes), newIndex = _c[0], subsequentText = _c[1], rawSubsequentText = _c[2], stringIndexes = _c[3];
|
|
@@ -163649,7 +163687,7 @@ var ts;
|
|
|
163649
163687
|
};
|
|
163650
163688
|
var out_i_1;
|
|
163651
163689
|
for (var i = begin; i < nodes.length; i++) {
|
|
163652
|
-
|
|
163690
|
+
_loop_20(i);
|
|
163653
163691
|
i = out_i_1;
|
|
163654
163692
|
}
|
|
163655
163693
|
return ts.factory.createTemplateExpression(templateHead, templateSpans);
|
|
@@ -164485,7 +164523,7 @@ var ts;
|
|
|
164485
164523
|
var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
|
|
164486
164524
|
if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
164487
164525
|
var seenSymbols_1 = new ts.Set();
|
|
164488
|
-
var
|
|
164526
|
+
var _loop_21 = function (declaration) {
|
|
164489
164527
|
var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
164490
164528
|
var _a;
|
|
164491
164529
|
if (!seenSymbols_1.has(symbol)) {
|
|
@@ -164502,7 +164540,7 @@ var ts;
|
|
|
164502
164540
|
};
|
|
164503
164541
|
for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
|
|
164504
164542
|
var declaration = declarations_6[_i];
|
|
164505
|
-
|
|
164543
|
+
_loop_21(declaration);
|
|
164506
164544
|
}
|
|
164507
164545
|
}
|
|
164508
164546
|
return tags;
|
|
@@ -164513,7 +164551,7 @@ var ts;
|
|
|
164513
164551
|
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
|
|
164514
164552
|
if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
164515
164553
|
var seenSymbols_2 = new ts.Set();
|
|
164516
|
-
var
|
|
164554
|
+
var _loop_22 = function (declaration) {
|
|
164517
164555
|
var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
164518
164556
|
if (!seenSymbols_2.has(symbol)) {
|
|
164519
164557
|
seenSymbols_2.add(symbol);
|
|
@@ -164529,7 +164567,7 @@ var ts;
|
|
|
164529
164567
|
};
|
|
164530
164568
|
for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
|
|
164531
164569
|
var declaration = declarations_7[_i];
|
|
164532
|
-
|
|
164570
|
+
_loop_22(declaration);
|
|
164533
164571
|
}
|
|
164534
164572
|
}
|
|
164535
164573
|
return doc;
|