typescript 4.8.0-dev.20220519 → 4.8.0-dev.20220522
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.es2020.intl.d.ts +1 -0
- 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/lib.es2020.intl.d.ts
CHANGED
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220522";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -1862,6 +1862,7 @@ var ts;
|
|
|
1862
1862
|
startsWith(candidate, prefix) &&
|
|
1863
1863
|
endsWith(candidate, suffix);
|
|
1864
1864
|
}
|
|
1865
|
+
ts.isPatternMatch = isPatternMatch;
|
|
1865
1866
|
function and(f, g) {
|
|
1866
1867
|
return function (arg) { return f(arg) && g(arg); };
|
|
1867
1868
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220522";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -2238,6 +2238,7 @@ var ts;
|
|
|
2238
2238
|
startsWith(candidate, prefix) &&
|
|
2239
2239
|
endsWith(candidate, suffix);
|
|
2240
2240
|
}
|
|
2241
|
+
ts.isPatternMatch = isPatternMatch;
|
|
2241
2242
|
function and(f, g) {
|
|
2242
2243
|
return function (arg) { return f(arg) && g(arg); };
|
|
2243
2244
|
}
|
|
@@ -131046,6 +131047,7 @@ var ts;
|
|
|
131046
131047
|
* Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename.
|
|
131047
131048
|
*/
|
|
131048
131049
|
function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, _a, host, exclude, result) {
|
|
131050
|
+
var _b;
|
|
131049
131051
|
var extensions = _a.extensions, includeExtensionsOption = _a.includeExtensionsOption;
|
|
131050
131052
|
if (result === void 0) { result = []; }
|
|
131051
131053
|
if (fragment === undefined) {
|
|
@@ -131063,9 +131065,26 @@ var ts;
|
|
|
131063
131065
|
fragment = "." + ts.directorySeparator;
|
|
131064
131066
|
}
|
|
131065
131067
|
fragment = ts.ensureTrailingDirectorySeparator(fragment);
|
|
131066
|
-
// const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment)); // TODO(rbuckton): should use resolvePaths
|
|
131067
131068
|
var absolutePath = ts.resolvePath(scriptPath, fragment);
|
|
131068
131069
|
var baseDirectory = ts.hasTrailingDirectorySeparator(absolutePath) ? absolutePath : ts.getDirectoryPath(absolutePath);
|
|
131070
|
+
// check for a version redirect
|
|
131071
|
+
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131072
|
+
if (packageJsonPath) {
|
|
131073
|
+
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131074
|
+
var typesVersions = packageJson.typesVersions;
|
|
131075
|
+
if (typeof typesVersions === "object") {
|
|
131076
|
+
var versionPaths = (_b = ts.getPackageJsonTypesVersionsPaths(typesVersions)) === null || _b === void 0 ? void 0 : _b.paths;
|
|
131077
|
+
if (versionPaths) {
|
|
131078
|
+
var packageDirectory = ts.getDirectoryPath(packageJsonPath);
|
|
131079
|
+
var pathInPackage = absolutePath.slice(ts.ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
131080
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensions, versionPaths, host)) {
|
|
131081
|
+
// A true result means one of the `versionPaths` was matched, which will block relative resolution
|
|
131082
|
+
// to files and folders from here. All reachable paths given the pattern match are already added.
|
|
131083
|
+
return result;
|
|
131084
|
+
}
|
|
131085
|
+
}
|
|
131086
|
+
}
|
|
131087
|
+
}
|
|
131069
131088
|
var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
131070
131089
|
if (!ts.tryDirectoryExists(host, baseDirectory))
|
|
131071
131090
|
return result;
|
|
@@ -131107,48 +131126,62 @@ var ts;
|
|
|
131107
131126
|
// If possible, get folder completion as well
|
|
131108
131127
|
var directories = ts.tryGetDirectories(host, baseDirectory);
|
|
131109
131128
|
if (directories) {
|
|
131110
|
-
for (var
|
|
131111
|
-
var directory = directories_1[
|
|
131129
|
+
for (var _c = 0, directories_1 = directories; _c < directories_1.length; _c++) {
|
|
131130
|
+
var directory = directories_1[_c];
|
|
131112
131131
|
var directoryName = ts.getBaseFileName(ts.normalizePath(directory));
|
|
131113
131132
|
if (directoryName !== "@types") {
|
|
131114
131133
|
result.push(directoryResult(directoryName));
|
|
131115
131134
|
}
|
|
131116
131135
|
}
|
|
131117
131136
|
}
|
|
131118
|
-
// check for a version redirect
|
|
131119
|
-
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131120
|
-
if (packageJsonPath) {
|
|
131121
|
-
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131122
|
-
var typesVersions = packageJson.typesVersions;
|
|
131123
|
-
if (typeof typesVersions === "object") {
|
|
131124
|
-
var versionResult = ts.getPackageJsonTypesVersionsPaths(typesVersions);
|
|
131125
|
-
var versionPaths = versionResult && versionResult.paths;
|
|
131126
|
-
var rest = absolutePath.slice(ts.ensureTrailingDirectorySeparator(baseDirectory).length);
|
|
131127
|
-
if (versionPaths) {
|
|
131128
|
-
addCompletionEntriesFromPaths(result, rest, baseDirectory, extensions, versionPaths, host);
|
|
131129
|
-
}
|
|
131130
|
-
}
|
|
131131
|
-
}
|
|
131132
131137
|
return result;
|
|
131133
131138
|
}
|
|
131139
|
+
/** @returns whether `fragment` was a match for any `paths` (which should indicate whether any other path completions should be offered) */
|
|
131134
131140
|
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, fileExtensions, paths, host) {
|
|
131141
|
+
var _a;
|
|
131142
|
+
var pathResults = [];
|
|
131143
|
+
var matchedPathPrefixLength = -1;
|
|
131135
131144
|
for (var path in paths) {
|
|
131136
131145
|
if (!ts.hasProperty(paths, path))
|
|
131137
131146
|
continue;
|
|
131138
131147
|
var patterns = paths[path];
|
|
131139
131148
|
if (patterns) {
|
|
131140
|
-
var
|
|
131141
|
-
|
|
131142
|
-
|
|
131143
|
-
|
|
131144
|
-
|
|
131145
|
-
|
|
131146
|
-
|
|
131147
|
-
|
|
131148
|
-
|
|
131149
|
+
var pathPattern = ts.tryParsePattern(path);
|
|
131150
|
+
if (!pathPattern)
|
|
131151
|
+
continue;
|
|
131152
|
+
var isMatch = typeof pathPattern === "object" && ts.isPatternMatch(pathPattern, fragment);
|
|
131153
|
+
var isLongestMatch = isMatch && (matchedPathPrefixLength === undefined || pathPattern.prefix.length > matchedPathPrefixLength);
|
|
131154
|
+
if (isLongestMatch) {
|
|
131155
|
+
// If this is a higher priority match than anything we've seen so far, previous results from matches are invalid, e.g.
|
|
131156
|
+
// for `import {} from "some-package/|"` with a typesVersions:
|
|
131157
|
+
// {
|
|
131158
|
+
// "bar/*": ["bar/*"], // <-- 1. We add 'bar', but 'bar/*' doesn't match yet.
|
|
131159
|
+
// "*": ["dist/*"], // <-- 2. We match here and add files from dist. 'bar' is still ok because it didn't come from a match.
|
|
131160
|
+
// "foo/*": ["foo/*"] // <-- 3. We matched '*' earlier and added results from dist, but if 'foo/*' also matched,
|
|
131161
|
+
// } results in dist would not be visible. 'bar' still stands because it didn't come from a match.
|
|
131162
|
+
// This is especially important if `dist/foo` is a folder, because if we fail to clear results
|
|
131163
|
+
// added by the '*' match, after typing `"some-package/foo/|"` we would get file results from both
|
|
131164
|
+
// ./dist/foo and ./foo, when only the latter will actually be resolvable.
|
|
131165
|
+
// See pathCompletionsTypesVersionsWildcard6.ts.
|
|
131166
|
+
matchedPathPrefixLength = pathPattern.prefix.length;
|
|
131167
|
+
pathResults = pathResults.filter(function (r) { return !r.matchedPattern; });
|
|
131168
|
+
}
|
|
131169
|
+
if (typeof pathPattern === "string" || matchedPathPrefixLength === undefined || pathPattern.prefix.length >= matchedPathPrefixLength) {
|
|
131170
|
+
pathResults.push({
|
|
131171
|
+
matchedPattern: isMatch,
|
|
131172
|
+
results: getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host)
|
|
131173
|
+
.map(function (_a) {
|
|
131174
|
+
var name = _a.name, kind = _a.kind, extension = _a.extension;
|
|
131175
|
+
return nameAndKind(name, kind, extension);
|
|
131176
|
+
}),
|
|
131177
|
+
});
|
|
131149
131178
|
}
|
|
131150
131179
|
}
|
|
131151
131180
|
}
|
|
131181
|
+
var equatePaths = ((_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host)) ? ts.equateStringsCaseSensitive : ts.equateStringsCaseInsensitive;
|
|
131182
|
+
var equateResults = function (a, b) { return equatePaths(a.name, b.name); };
|
|
131183
|
+
pathResults.forEach(function (pathResult) { return pathResult.results.forEach(function (pathResult) { return ts.pushIfUnique(result, pathResult, equateResults); }); });
|
|
131184
|
+
return matchedPathPrefixLength > -1;
|
|
131152
131185
|
}
|
|
131153
131186
|
/**
|
|
131154
131187
|
* Check all of the declared modules and those in node modules. Possible sources of modules:
|
|
@@ -131180,7 +131213,7 @@ var ts;
|
|
|
131180
131213
|
// (But do if we didn't find anything, e.g. 'package.json' missing.)
|
|
131181
131214
|
var foundGlobal = false;
|
|
131182
131215
|
if (fragmentDirectory === undefined) {
|
|
131183
|
-
var
|
|
131216
|
+
var _loop_3 = function (moduleName) {
|
|
131184
131217
|
if (!result.some(function (entry) { return entry.name === moduleName; })) {
|
|
131185
131218
|
foundGlobal = true;
|
|
131186
131219
|
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
|
|
@@ -131188,7 +131221,7 @@ var ts;
|
|
|
131188
131221
|
};
|
|
131189
131222
|
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
|
|
131190
131223
|
var moduleName = _c[_b];
|
|
131191
|
-
|
|
131224
|
+
_loop_3(moduleName);
|
|
131192
131225
|
}
|
|
131193
131226
|
}
|
|
131194
131227
|
if (!foundGlobal) {
|
|
@@ -131268,11 +131301,16 @@ var ts;
|
|
|
131268
131301
|
}
|
|
131269
131302
|
var pathPrefix = path.slice(0, path.length - 1);
|
|
131270
131303
|
var remainingFragment = ts.tryRemovePrefix(fragment, pathPrefix);
|
|
131271
|
-
|
|
131272
|
-
|
|
131273
|
-
|
|
131304
|
+
if (remainingFragment === undefined) {
|
|
131305
|
+
var starIsFullPathComponent = path[path.length - 2] === "/";
|
|
131306
|
+
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) {
|
|
131307
|
+
var name = _a.name, rest = __rest(_a, ["name"]);
|
|
131308
|
+
return (__assign({ name: pathPrefix + name }, rest));
|
|
131309
|
+
}); });
|
|
131310
|
+
}
|
|
131311
|
+
return ts.flatMap(patterns, function (pattern) { return getModulesForPathsPattern(remainingFragment, baseUrl, pattern, fileExtensions, host); });
|
|
131274
131312
|
function justPathMappingName(name) {
|
|
131275
|
-
return ts.startsWith(name, fragment) ? [directoryResult(name)] : ts.emptyArray;
|
|
131313
|
+
return ts.startsWith(name, fragment) ? [directoryResult(ts.removeTrailingDirectorySeparator(name))] : ts.emptyArray;
|
|
131276
131314
|
}
|
|
131277
131315
|
}
|
|
131278
131316
|
function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) {
|
|
@@ -136978,7 +137016,7 @@ var ts;
|
|
|
136978
137016
|
result = references;
|
|
136979
137017
|
continue;
|
|
136980
137018
|
}
|
|
136981
|
-
var
|
|
137019
|
+
var _loop_4 = function (entry) {
|
|
136982
137020
|
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
|
|
136983
137021
|
result.push(entry);
|
|
136984
137022
|
return "continue";
|
|
@@ -137010,7 +137048,7 @@ var ts;
|
|
|
137010
137048
|
};
|
|
137011
137049
|
for (var _b = 0, references_2 = references; _b < references_2.length; _b++) {
|
|
137012
137050
|
var entry = references_2[_b];
|
|
137013
|
-
|
|
137051
|
+
_loop_4(entry);
|
|
137014
137052
|
}
|
|
137015
137053
|
}
|
|
137016
137054
|
return result;
|
|
@@ -139038,7 +139076,7 @@ var ts;
|
|
|
139038
139076
|
}
|
|
139039
139077
|
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
|
|
139040
139078
|
var allFiles = program.getSourceFiles();
|
|
139041
|
-
var
|
|
139079
|
+
var _loop_5 = function (sourceFile) {
|
|
139042
139080
|
var newFromOld = oldToNew(sourceFile.fileName);
|
|
139043
139081
|
var newImportFromPath = newFromOld !== null && newFromOld !== void 0 ? newFromOld : sourceFile.fileName;
|
|
139044
139082
|
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
|
|
@@ -139070,7 +139108,7 @@ var ts;
|
|
|
139070
139108
|
};
|
|
139071
139109
|
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
|
|
139072
139110
|
var sourceFile = allFiles_1[_i];
|
|
139073
|
-
|
|
139111
|
+
_loop_5(sourceFile);
|
|
139074
139112
|
}
|
|
139075
139113
|
}
|
|
139076
139114
|
function combineNormal(pathA, pathB) {
|
|
@@ -140094,7 +140132,7 @@ var ts;
|
|
|
140094
140132
|
if (!patternMatcher)
|
|
140095
140133
|
return ts.emptyArray;
|
|
140096
140134
|
var rawItems = [];
|
|
140097
|
-
var
|
|
140135
|
+
var _loop_6 = function (sourceFile) {
|
|
140098
140136
|
cancellationToken.throwIfCancellationRequested();
|
|
140099
140137
|
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
|
|
140100
140138
|
return "continue";
|
|
@@ -140106,7 +140144,7 @@ var ts;
|
|
|
140106
140144
|
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
|
140107
140145
|
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
|
|
140108
140146
|
var sourceFile = sourceFiles_4[_i];
|
|
140109
|
-
|
|
140147
|
+
_loop_6(sourceFile);
|
|
140110
140148
|
}
|
|
140111
140149
|
rawItems.sort(compareNavigateToItems);
|
|
140112
140150
|
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
|
|
@@ -142171,13 +142209,13 @@ var ts;
|
|
|
142171
142209
|
// Assumes 'value' is already lowercase.
|
|
142172
142210
|
function indexOfIgnoringCase(str, value) {
|
|
142173
142211
|
var n = str.length - value.length;
|
|
142174
|
-
var
|
|
142212
|
+
var _loop_7 = function (start) {
|
|
142175
142213
|
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
|
|
142176
142214
|
return { value: start };
|
|
142177
142215
|
}
|
|
142178
142216
|
};
|
|
142179
142217
|
for (var start = 0; start <= n; start++) {
|
|
142180
|
-
var state_3 =
|
|
142218
|
+
var state_3 = _loop_7(start);
|
|
142181
142219
|
if (typeof state_3 === "object")
|
|
142182
142220
|
return state_3.value;
|
|
142183
142221
|
}
|
|
@@ -143596,7 +143634,7 @@ var ts;
|
|
|
143596
143634
|
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
|
|
143597
143635
|
}
|
|
143598
143636
|
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
|
|
143599
|
-
var
|
|
143637
|
+
var _loop_8 = function (n) {
|
|
143600
143638
|
// If the node is not a subspan of its parent, this is a big problem.
|
|
143601
143639
|
// There have been crashes that might be caused by this violation.
|
|
143602
143640
|
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); });
|
|
@@ -143606,7 +143644,7 @@ var ts;
|
|
|
143606
143644
|
}
|
|
143607
143645
|
};
|
|
143608
143646
|
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
|
|
143609
|
-
var state_4 =
|
|
143647
|
+
var state_4 = _loop_8(n);
|
|
143610
143648
|
if (typeof state_4 === "object")
|
|
143611
143649
|
return state_4.value;
|
|
143612
143650
|
}
|
|
@@ -145205,7 +145243,7 @@ var ts;
|
|
|
145205
145243
|
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum ||
|
|
145206
145244
|
ts.filter(ts.optionDeclarations, function (o) { return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); });
|
|
145207
145245
|
options = ts.cloneCompilerOptions(options);
|
|
145208
|
-
var
|
|
145246
|
+
var _loop_9 = function (opt) {
|
|
145209
145247
|
if (!ts.hasProperty(options, opt.name)) {
|
|
145210
145248
|
return "continue";
|
|
145211
145249
|
}
|
|
@@ -145224,7 +145262,7 @@ var ts;
|
|
|
145224
145262
|
};
|
|
145225
145263
|
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
|
|
145226
145264
|
var opt = commandLineOptionsStringToEnum_1[_i];
|
|
145227
|
-
|
|
145265
|
+
_loop_9(opt);
|
|
145228
145266
|
}
|
|
145229
145267
|
return options;
|
|
145230
145268
|
}
|
|
@@ -148972,7 +149010,7 @@ var ts;
|
|
|
148972
149010
|
ChangeTracker.prototype.finishDeleteDeclarations = function () {
|
|
148973
149011
|
var _this = this;
|
|
148974
149012
|
var deletedNodesInLists = new ts.Set(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
|
|
148975
|
-
var
|
|
149013
|
+
var _loop_10 = function (sourceFile, node) {
|
|
148976
149014
|
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
|
|
148977
149015
|
if (ts.isArray(node)) {
|
|
148978
149016
|
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(sourceFile, node));
|
|
@@ -148985,7 +149023,7 @@ var ts;
|
|
|
148985
149023
|
var this_1 = this;
|
|
148986
149024
|
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
|
|
148987
149025
|
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
|
|
148988
|
-
|
|
149026
|
+
_loop_10(sourceFile, node);
|
|
148989
149027
|
}
|
|
148990
149028
|
deletedNodesInLists.forEach(function (node) {
|
|
148991
149029
|
var sourceFile = node.getSourceFile();
|
|
@@ -149073,14 +149111,14 @@ var ts;
|
|
|
149073
149111
|
// order changes by start position
|
|
149074
149112
|
// 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.
|
|
149075
149113
|
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
|
|
149076
|
-
var
|
|
149114
|
+
var _loop_11 = function (i) {
|
|
149077
149115
|
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
|
|
149078
149116
|
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
|
|
149079
149117
|
});
|
|
149080
149118
|
};
|
|
149081
149119
|
// verify that change intervals do not overlap, except possibly at end points.
|
|
149082
149120
|
for (var i = 0; i < normalized.length - 1; i++) {
|
|
149083
|
-
|
|
149121
|
+
_loop_11(i);
|
|
149084
149122
|
}
|
|
149085
149123
|
var textChanges = ts.mapDefined(normalized, function (c) {
|
|
149086
149124
|
var span = ts.createTextSpanFromRange(c.range);
|
|
@@ -149989,7 +150027,7 @@ var ts;
|
|
|
149989
150027
|
}
|
|
149990
150028
|
var isCompleteFix = identifiers.isCompleteFix;
|
|
149991
150029
|
var initializers;
|
|
149992
|
-
var
|
|
150030
|
+
var _loop_12 = function (identifier) {
|
|
149993
150031
|
var symbol = checker.getSymbolAtLocation(identifier);
|
|
149994
150032
|
if (!symbol) {
|
|
149995
150033
|
return "continue";
|
|
@@ -150022,7 +150060,7 @@ var ts;
|
|
|
150022
150060
|
};
|
|
150023
150061
|
for (var _i = 0, _a = identifiers.identifiers; _i < _a.length; _i++) {
|
|
150024
150062
|
var identifier = _a[_i];
|
|
150025
|
-
|
|
150063
|
+
_loop_12(identifier);
|
|
150026
150064
|
}
|
|
150027
150065
|
return initializers && {
|
|
150028
150066
|
initializers: initializers,
|
|
@@ -150912,7 +150950,7 @@ var ts;
|
|
|
150912
150950
|
functionToConvert.getStart(sourceFile);
|
|
150913
150951
|
var options = functionToConvert.modifiers ? { prefix: " " } : { suffix: " " };
|
|
150914
150952
|
changes.insertModifierAt(sourceFile, pos, 131 /* AsyncKeyword */, options);
|
|
150915
|
-
var
|
|
150953
|
+
var _loop_13 = function (returnStatement) {
|
|
150916
150954
|
ts.forEachChild(returnStatement, function visit(node) {
|
|
150917
150955
|
if (ts.isCallExpression(node)) {
|
|
150918
150956
|
var newNodes = transformExpression(node, node, transformer, /*hasContinuation*/ false);
|
|
@@ -150934,7 +150972,7 @@ var ts;
|
|
|
150934
150972
|
};
|
|
150935
150973
|
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
|
|
150936
150974
|
var returnStatement = returnStatements_1[_i];
|
|
150937
|
-
var state_5 =
|
|
150975
|
+
var state_5 = _loop_13(returnStatement);
|
|
150938
150976
|
if (typeof state_5 === "object")
|
|
150939
150977
|
return state_5.value;
|
|
150940
150978
|
}
|
|
@@ -154182,7 +154220,7 @@ var ts;
|
|
|
154182
154220
|
});
|
|
154183
154221
|
typeDeclToMembers.forEach(function (infos, declaration) {
|
|
154184
154222
|
var supers = ts.isTypeLiteralNode(declaration) ? undefined : codefix.getAllSupers(declaration, checker);
|
|
154185
|
-
var
|
|
154223
|
+
var _loop_14 = function (info) {
|
|
154186
154224
|
// If some superclass added this property, don't add it again.
|
|
154187
154225
|
if (supers === null || supers === void 0 ? void 0 : supers.some(function (superClassOrInterface) {
|
|
154188
154226
|
var superInfos = typeDeclToMembers.get(superClassOrInterface);
|
|
@@ -154209,7 +154247,7 @@ var ts;
|
|
|
154209
154247
|
};
|
|
154210
154248
|
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
|
|
154211
154249
|
var info = infos_1[_i];
|
|
154212
|
-
|
|
154250
|
+
_loop_14(info);
|
|
154213
154251
|
}
|
|
154214
154252
|
});
|
|
154215
154253
|
}));
|
|
@@ -156972,7 +157010,7 @@ var ts;
|
|
|
156972
157010
|
function getSignatureFromCalls(calls) {
|
|
156973
157011
|
var parameters = [];
|
|
156974
157012
|
var length = Math.max.apply(Math, calls.map(function (c) { return c.argumentTypes.length; }));
|
|
156975
|
-
var
|
|
157013
|
+
var _loop_15 = function (i) {
|
|
156976
157014
|
var symbol = checker.createSymbol(1 /* FunctionScopedVariable */, ts.escapeLeadingUnderscores("arg" + i));
|
|
156977
157015
|
symbol.type = combineTypes(calls.map(function (call) { return call.argumentTypes[i] || checker.getUndefinedType(); }));
|
|
156978
157016
|
if (calls.some(function (call) { return call.argumentTypes[i] === undefined; })) {
|
|
@@ -156981,7 +157019,7 @@ var ts;
|
|
|
156981
157019
|
parameters.push(symbol);
|
|
156982
157020
|
};
|
|
156983
157021
|
for (var i = 0; i < length; i++) {
|
|
156984
|
-
|
|
157022
|
+
_loop_15(i);
|
|
156985
157023
|
}
|
|
156986
157024
|
var returnType = combineFromUsage(combineUsages(calls.map(function (call) { return call.return_; })));
|
|
156987
157025
|
return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, 0 /* None */);
|
|
@@ -158954,7 +158992,7 @@ var ts;
|
|
|
158954
158992
|
// Imports that need to be kept as named imports in the refactored code, to avoid changing the semantics.
|
|
158955
158993
|
// 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 }`.
|
|
158956
158994
|
var neededNamedImports = new ts.Set();
|
|
158957
|
-
var
|
|
158995
|
+
var _loop_16 = function (element) {
|
|
158958
158996
|
var propertyName = (element.propertyName || element.name).text;
|
|
158959
158997
|
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
|
|
158960
158998
|
var access = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(namespaceImportName), propertyName);
|
|
@@ -158971,7 +159009,7 @@ var ts;
|
|
|
158971
159009
|
};
|
|
158972
159010
|
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
|
|
158973
159011
|
var element = _a[_i];
|
|
158974
|
-
|
|
159012
|
+
_loop_16(element);
|
|
158975
159013
|
}
|
|
158976
159014
|
changes.replaceNode(sourceFile, toConvert, shouldUseDefault
|
|
158977
159015
|
? ts.factory.createIdentifier(namespaceImportName)
|
|
@@ -160869,7 +160907,7 @@ var ts;
|
|
|
160869
160907
|
: ts.getEnclosingBlockScopeContainer(scopes[0]);
|
|
160870
160908
|
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
|
|
160871
160909
|
}
|
|
160872
|
-
var
|
|
160910
|
+
var _loop_17 = function (i) {
|
|
160873
160911
|
var scopeUsages = usagesPerScope[i];
|
|
160874
160912
|
// Special case: in the innermost scope, all usages are available.
|
|
160875
160913
|
// (The computed value reflects the value at the top-level of the scope, but the
|
|
@@ -160912,7 +160950,7 @@ var ts;
|
|
|
160912
160950
|
}
|
|
160913
160951
|
};
|
|
160914
160952
|
for (var i = 0; i < scopes.length; i++) {
|
|
160915
|
-
|
|
160953
|
+
_loop_17(i);
|
|
160916
160954
|
}
|
|
160917
160955
|
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
|
|
160918
160956
|
function isInGenericContext(node) {
|
|
@@ -161615,10 +161653,10 @@ var ts;
|
|
|
161615
161653
|
}
|
|
161616
161654
|
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
|
|
161617
161655
|
var checker = program.getTypeChecker();
|
|
161618
|
-
var
|
|
161656
|
+
var _loop_18 = function (sourceFile) {
|
|
161619
161657
|
if (sourceFile === oldFile)
|
|
161620
161658
|
return "continue";
|
|
161621
|
-
var
|
|
161659
|
+
var _loop_19 = function (statement) {
|
|
161622
161660
|
forEachImportInStatement(statement, function (importNode) {
|
|
161623
161661
|
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
|
|
161624
161662
|
return;
|
|
@@ -161640,12 +161678,12 @@ var ts;
|
|
|
161640
161678
|
};
|
|
161641
161679
|
for (var _b = 0, _c = sourceFile.statements; _b < _c.length; _b++) {
|
|
161642
161680
|
var statement = _c[_b];
|
|
161643
|
-
|
|
161681
|
+
_loop_19(statement);
|
|
161644
161682
|
}
|
|
161645
161683
|
};
|
|
161646
161684
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
161647
161685
|
var sourceFile = _a[_i];
|
|
161648
|
-
|
|
161686
|
+
_loop_18(sourceFile);
|
|
161649
161687
|
}
|
|
161650
161688
|
}
|
|
161651
161689
|
function getNamespaceLikeImport(node) {
|
|
@@ -163009,7 +163047,7 @@ var ts;
|
|
|
163009
163047
|
var templateSpans = [];
|
|
163010
163048
|
var templateHead = ts.factory.createTemplateHead(headText, rawHeadText);
|
|
163011
163049
|
copyCommentFromStringLiterals(headIndexes, templateHead);
|
|
163012
|
-
var
|
|
163050
|
+
var _loop_20 = function (i) {
|
|
163013
163051
|
var currentNode = getExpressionFromParenthesesOrExpression(nodes[i]);
|
|
163014
163052
|
copyOperatorComments(i, currentNode);
|
|
163015
163053
|
var _c = concatConsecutiveString(i + 1, nodes), newIndex = _c[0], subsequentText = _c[1], rawSubsequentText = _c[2], stringIndexes = _c[3];
|
|
@@ -163038,7 +163076,7 @@ var ts;
|
|
|
163038
163076
|
};
|
|
163039
163077
|
var out_i_1;
|
|
163040
163078
|
for (var i = begin; i < nodes.length; i++) {
|
|
163041
|
-
|
|
163079
|
+
_loop_20(i);
|
|
163042
163080
|
i = out_i_1;
|
|
163043
163081
|
}
|
|
163044
163082
|
return ts.factory.createTemplateExpression(templateHead, templateSpans);
|
|
@@ -163874,7 +163912,7 @@ var ts;
|
|
|
163874
163912
|
var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
|
|
163875
163913
|
if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
163876
163914
|
var seenSymbols_1 = new ts.Set();
|
|
163877
|
-
var
|
|
163915
|
+
var _loop_21 = function (declaration) {
|
|
163878
163916
|
var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
163879
163917
|
var _a;
|
|
163880
163918
|
if (!seenSymbols_1.has(symbol)) {
|
|
@@ -163891,7 +163929,7 @@ var ts;
|
|
|
163891
163929
|
};
|
|
163892
163930
|
for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
|
|
163893
163931
|
var declaration = declarations_6[_i];
|
|
163894
|
-
|
|
163932
|
+
_loop_21(declaration);
|
|
163895
163933
|
}
|
|
163896
163934
|
}
|
|
163897
163935
|
return tags;
|
|
@@ -163902,7 +163940,7 @@ var ts;
|
|
|
163902
163940
|
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
|
|
163903
163941
|
if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
163904
163942
|
var seenSymbols_2 = new ts.Set();
|
|
163905
|
-
var
|
|
163943
|
+
var _loop_22 = function (declaration) {
|
|
163906
163944
|
var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
163907
163945
|
if (!seenSymbols_2.has(symbol)) {
|
|
163908
163946
|
seenSymbols_2.add(symbol);
|
|
@@ -163918,7 +163956,7 @@ var ts;
|
|
|
163918
163956
|
};
|
|
163919
163957
|
for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
|
|
163920
163958
|
var declaration = declarations_7[_i];
|
|
163921
|
-
|
|
163959
|
+
_loop_22(declaration);
|
|
163922
163960
|
}
|
|
163923
163961
|
}
|
|
163924
163962
|
return doc;
|