typescript 4.5.0-dev.20211005 → 4.5.0-dev.20211009
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/cs/diagnosticMessages.generated.json +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +41 -16
- package/lib/tsserver.js +250 -132
- package/lib/tsserverlibrary.d.ts +15 -10
- package/lib/tsserverlibrary.js +250 -132
- package/lib/typescript.d.ts +15 -10
- package/lib/typescript.js +250 -132
- package/lib/typescriptServices.d.ts +15 -10
- package/lib/typescriptServices.js +250 -132
- package/lib/typingsInstaller.js +41 -17
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
|
@@ -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.20211009";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8868,6 +8868,7 @@ var ts;
|
|
|
8868
8868
|
Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
|
|
8869
8869
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
|
|
8870
8870
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8871
|
+
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8871
8872
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
8872
8873
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
8873
8874
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -20307,10 +20308,14 @@ var ts;
|
|
|
20307
20308
|
var ext = fileName.substr(fileName.lastIndexOf("."));
|
|
20308
20309
|
switch (ext.toLowerCase()) {
|
|
20309
20310
|
case ".js" /* Js */:
|
|
20311
|
+
case ".cjs" /* Cjs */:
|
|
20312
|
+
case ".mjs" /* Mjs */:
|
|
20310
20313
|
return 1 /* JS */;
|
|
20311
20314
|
case ".jsx" /* Jsx */:
|
|
20312
20315
|
return 2 /* JSX */;
|
|
20313
20316
|
case ".ts" /* Ts */:
|
|
20317
|
+
case ".cts" /* Cts */:
|
|
20318
|
+
case ".mts" /* Mts */:
|
|
20314
20319
|
return 3 /* TS */;
|
|
20315
20320
|
case ".tsx" /* Tsx */:
|
|
20316
20321
|
return 4 /* TSX */;
|
|
@@ -38885,6 +38890,8 @@ var ts;
|
|
|
38885
38890
|
type: new ts.Map(ts.getEntries({
|
|
38886
38891
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
38887
38892
|
classic: ts.ModuleResolutionKind.Classic,
|
|
38893
|
+
node12: ts.ModuleResolutionKind.Node12,
|
|
38894
|
+
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
38888
38895
|
})),
|
|
38889
38896
|
affectsModuleResolution: true,
|
|
38890
38897
|
paramType: ts.Diagnostics.STRATEGY,
|
|
@@ -42687,11 +42694,15 @@ var ts;
|
|
|
42687
42694
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
42688
42695
|
return undefined;
|
|
42689
42696
|
}
|
|
42697
|
+
if (typeof scope.packageJsonContent.name !== "string") {
|
|
42698
|
+
return undefined;
|
|
42699
|
+
}
|
|
42690
42700
|
var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
|
|
42691
|
-
|
|
42701
|
+
var nameParts = ts.getPathComponents(scope.packageJsonContent.name);
|
|
42702
|
+
if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) {
|
|
42692
42703
|
return undefined;
|
|
42693
42704
|
}
|
|
42694
|
-
var trailingParts = parts.slice(
|
|
42705
|
+
var trailingParts = parts.slice(nameParts.length);
|
|
42695
42706
|
return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : "." + ts.directorySeparator + trailingParts.join(ts.directorySeparator), state, cache, redirectedReference);
|
|
42696
42707
|
}
|
|
42697
42708
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
@@ -48169,11 +48180,11 @@ var ts;
|
|
|
48169
48180
|
*
|
|
48170
48181
|
* @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
|
|
48171
48182
|
*/
|
|
48172
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals
|
|
48183
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
|
|
48173
48184
|
if (excludeGlobals === void 0) { excludeGlobals = false; }
|
|
48174
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol
|
|
48185
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol);
|
|
48175
48186
|
}
|
|
48176
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup
|
|
48187
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
|
|
48177
48188
|
var _a, _b, _c;
|
|
48178
48189
|
var originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location
|
|
48179
48190
|
var result;
|
|
@@ -48500,7 +48511,7 @@ var ts;
|
|
|
48500
48511
|
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
48501
48512
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
48502
48513
|
var suggestion = void 0;
|
|
48503
|
-
if (
|
|
48514
|
+
if (suggestionCount < maximumSuggestionCount) {
|
|
48504
48515
|
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
48505
48516
|
var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
48506
48517
|
if (isGlobalScopeAugmentationDeclaration) {
|
|
@@ -48509,7 +48520,9 @@ var ts;
|
|
|
48509
48520
|
if (suggestion) {
|
|
48510
48521
|
var suggestionName = symbolToString(suggestion);
|
|
48511
48522
|
var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, /*excludeClasses*/ false);
|
|
48512
|
-
var message =
|
|
48523
|
+
var message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
|
|
48524
|
+
: isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
|
|
48525
|
+
: ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
48513
48526
|
var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
48514
48527
|
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
48515
48528
|
if (suggestion.valueDeclaration) {
|
|
@@ -49503,7 +49516,7 @@ var ts;
|
|
|
49503
49516
|
if (name.kind === 79 /* Identifier */) {
|
|
49504
49517
|
var message = meaning === namespaceMeaning || ts.nodeIsSynthesized(name) ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(ts.getFirstIdentifier(name));
|
|
49505
49518
|
var symbolFromJSPrototype = ts.isInJSFile(name) && !ts.nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
|
|
49506
|
-
symbol = getMergedSymbol(resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true));
|
|
49519
|
+
symbol = getMergedSymbol(resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true, false));
|
|
49507
49520
|
if (!symbol) {
|
|
49508
49521
|
return getMergedSymbol(symbolFromJSPrototype);
|
|
49509
49522
|
}
|
|
@@ -67281,8 +67294,7 @@ var ts;
|
|
|
67281
67294
|
if (!links.resolvedSymbol) {
|
|
67282
67295
|
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
|
|
67283
67296
|
resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
|
|
67284
|
-
/*excludeGlobals*/ false
|
|
67285
|
-
/*issueSuggestions*/ true) || unknownSymbol;
|
|
67297
|
+
/*excludeGlobals*/ false) || unknownSymbol;
|
|
67286
67298
|
}
|
|
67287
67299
|
return links.resolvedSymbol;
|
|
67288
67300
|
}
|
|
@@ -72773,7 +72785,7 @@ var ts;
|
|
|
72773
72785
|
if (relatedInfo) {
|
|
72774
72786
|
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
|
72775
72787
|
}
|
|
72776
|
-
addErrorOrSuggestion(!isUncheckedJS, resultDiagnostic);
|
|
72788
|
+
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
72777
72789
|
}
|
|
72778
72790
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
72779
72791
|
return (compilerOptions.lib && !compilerOptions.lib.includes("dom")) &&
|
|
@@ -72846,7 +72858,19 @@ var ts;
|
|
|
72846
72858
|
// Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function
|
|
72847
72859
|
// So the table *contains* `x` but `x` isn't actually in scope.
|
|
72848
72860
|
// However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion.
|
|
72849
|
-
|
|
72861
|
+
if (symbol)
|
|
72862
|
+
return symbol;
|
|
72863
|
+
var candidates;
|
|
72864
|
+
if (symbols === globals) {
|
|
72865
|
+
var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { return symbols.has((s.charAt(0).toUpperCase() + s.slice(1)))
|
|
72866
|
+
? createSymbol(524288 /* TypeAlias */, s)
|
|
72867
|
+
: undefined; });
|
|
72868
|
+
candidates = primitives.concat(ts.arrayFrom(symbols.values()));
|
|
72869
|
+
}
|
|
72870
|
+
else {
|
|
72871
|
+
candidates = ts.arrayFrom(symbols.values());
|
|
72872
|
+
}
|
|
72873
|
+
return getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), candidates, meaning);
|
|
72850
72874
|
});
|
|
72851
72875
|
return result;
|
|
72852
72876
|
}
|
|
@@ -121288,11 +121312,11 @@ var ts;
|
|
|
121288
121312
|
(_b = state.typeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.update(config.options);
|
|
121289
121313
|
// Create program
|
|
121290
121314
|
program = host.createProgram(config.fileNames, config.options, compilerHost, getOldProgram(state, projectPath, config), ts.getConfigFileParsingDiagnostics(config), config.projectReferences);
|
|
121291
|
-
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function (_a) {
|
|
121292
|
-
var path = _a[0], data = _a[1];
|
|
121293
|
-
return [state.host.realpath ? toPath(state, state.host.realpath(path)) : path, data];
|
|
121294
|
-
}));
|
|
121295
121315
|
if (state.watch) {
|
|
121316
|
+
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function (_a) {
|
|
121317
|
+
var path = _a[0], data = _a[1];
|
|
121318
|
+
return [state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data];
|
|
121319
|
+
}));
|
|
121296
121320
|
state.builderPrograms.set(projectPath, program);
|
|
121297
121321
|
}
|
|
121298
121322
|
step++;
|
|
@@ -124072,28 +124096,85 @@ var ts;
|
|
|
124072
124096
|
/** Get the token whose text contains the position */
|
|
124073
124097
|
function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includePrecedingTokenAtEndPosition, includeEndPosition) {
|
|
124074
124098
|
var current = sourceFile;
|
|
124075
|
-
|
|
124099
|
+
var foundToken;
|
|
124100
|
+
var _loop_1 = function () {
|
|
124076
124101
|
// find the child that contains 'position'
|
|
124077
|
-
|
|
124078
|
-
|
|
124079
|
-
|
|
124102
|
+
var children = current.getChildren(sourceFile);
|
|
124103
|
+
var i = ts.binarySearchKey(children, position, function (_, i) { return i; }, function (middle, _) {
|
|
124104
|
+
// This last callback is more of a selector than a comparator -
|
|
124105
|
+
// `EqualTo` causes the `middle` result to be returned
|
|
124106
|
+
// `GreaterThan` causes recursion on the left of the middle
|
|
124107
|
+
// `LessThan` causes recursion on the right of the middle
|
|
124108
|
+
// Let's say you have 3 nodes, spanning positons
|
|
124109
|
+
// pos: 1, end: 3
|
|
124110
|
+
// pos: 3, end: 3
|
|
124111
|
+
// pos: 3, end: 5
|
|
124112
|
+
// and you're looking for the token at positon 3 - all 3 of these nodes are overlapping with position 3.
|
|
124113
|
+
// In fact, there's a _good argument_ that node 2 shouldn't even be allowed to exist - depending on if
|
|
124114
|
+
// the start or end of the ranges are considered inclusive, it's either wholly subsumed by the first or the last node.
|
|
124115
|
+
// Unfortunately, such nodes do exist. :( - See fourslash/completionsImport_tsx.tsx - empty jsx attributes create
|
|
124116
|
+
// a zero-length node.
|
|
124117
|
+
// What also you may not expect is that which node we return depends on the includePrecedingTokenAtEndPosition flag.
|
|
124118
|
+
// Specifically, if includePrecedingTokenAtEndPosition is set, we return the 1-3 node, while if it's unset, we
|
|
124119
|
+
// return the 3-5 node. (The zero length node is never correct.) This is because the includePrecedingTokenAtEndPosition
|
|
124120
|
+
// flag causes us to return the first node whose end position matches the position and which produces and acceptable token
|
|
124121
|
+
// kind. Meanwhile, if includePrecedingTokenAtEndPosition is unset, we look for the first node whose start is <= the
|
|
124122
|
+
// position and whose end is greater than the position.
|
|
124123
|
+
var start = allowPositionInLeadingTrivia ? children[middle].getFullStart() : children[middle].getStart(sourceFile, /*includeJsDoc*/ true);
|
|
124080
124124
|
if (start > position) {
|
|
124081
|
-
|
|
124082
|
-
break;
|
|
124083
|
-
}
|
|
124084
|
-
var end = child.getEnd();
|
|
124085
|
-
if (position < end || (position === end && (child.kind === 1 /* EndOfFileToken */ || includeEndPosition))) {
|
|
124086
|
-
current = child;
|
|
124087
|
-
continue outer;
|
|
124125
|
+
return 1 /* GreaterThan */;
|
|
124088
124126
|
}
|
|
124089
|
-
|
|
124090
|
-
|
|
124091
|
-
if (
|
|
124092
|
-
|
|
124127
|
+
// first element whose start position is before the input and whose end position is after or equal to the input
|
|
124128
|
+
if (nodeContainsPosition(children[middle])) {
|
|
124129
|
+
if (children[middle - 1]) {
|
|
124130
|
+
// we want the _first_ element that contains the position, so left-recur if the prior node also contains the position
|
|
124131
|
+
if (nodeContainsPosition(children[middle - 1])) {
|
|
124132
|
+
return 1 /* GreaterThan */;
|
|
124133
|
+
}
|
|
124093
124134
|
}
|
|
124135
|
+
return 0 /* EqualTo */;
|
|
124136
|
+
}
|
|
124137
|
+
// this complex condition makes us left-recur around a zero-length node when includePrecedingTokenAtEndPosition is set, rather than right-recur on it
|
|
124138
|
+
if (includePrecedingTokenAtEndPosition && start === position && children[middle - 1] && children[middle - 1].getEnd() === position && nodeContainsPosition(children[middle - 1])) {
|
|
124139
|
+
return 1 /* GreaterThan */;
|
|
124094
124140
|
}
|
|
124141
|
+
return -1 /* LessThan */;
|
|
124142
|
+
});
|
|
124143
|
+
if (foundToken) {
|
|
124144
|
+
return { value: foundToken };
|
|
124145
|
+
}
|
|
124146
|
+
if (i >= 0 && children[i]) {
|
|
124147
|
+
current = children[i];
|
|
124148
|
+
return "continue-outer";
|
|
124149
|
+
}
|
|
124150
|
+
return { value: current };
|
|
124151
|
+
};
|
|
124152
|
+
outer: while (true) {
|
|
124153
|
+
var state_1 = _loop_1();
|
|
124154
|
+
if (typeof state_1 === "object")
|
|
124155
|
+
return state_1.value;
|
|
124156
|
+
switch (state_1) {
|
|
124157
|
+
case "continue-outer": continue outer;
|
|
124095
124158
|
}
|
|
124096
|
-
|
|
124159
|
+
}
|
|
124160
|
+
function nodeContainsPosition(node) {
|
|
124161
|
+
var start = allowPositionInLeadingTrivia ? node.getFullStart() : node.getStart(sourceFile, /*includeJsDoc*/ true);
|
|
124162
|
+
if (start > position) {
|
|
124163
|
+
// If this child begins after position, then all subsequent children will as well.
|
|
124164
|
+
return false;
|
|
124165
|
+
}
|
|
124166
|
+
var end = node.getEnd();
|
|
124167
|
+
if (position < end || (position === end && (node.kind === 1 /* EndOfFileToken */ || includeEndPosition))) {
|
|
124168
|
+
return true;
|
|
124169
|
+
}
|
|
124170
|
+
else if (includePrecedingTokenAtEndPosition && end === position) {
|
|
124171
|
+
var previousToken = findPrecedingToken(position, sourceFile, node);
|
|
124172
|
+
if (previousToken && includePrecedingTokenAtEndPosition(previousToken)) {
|
|
124173
|
+
foundToken = previousToken;
|
|
124174
|
+
return true;
|
|
124175
|
+
}
|
|
124176
|
+
}
|
|
124177
|
+
return false;
|
|
124097
124178
|
}
|
|
124098
124179
|
}
|
|
124099
124180
|
/**
|
|
@@ -126082,11 +126163,12 @@ var ts;
|
|
|
126082
126163
|
: ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
|
|
126083
126164
|
var moduleName = ts.stripQuotes(moduleSymbol.name);
|
|
126084
126165
|
var id = exportInfoId++;
|
|
126166
|
+
var target = ts.skipAlias(symbol, checker);
|
|
126085
126167
|
var storedSymbol = symbol.flags & 33554432 /* Transient */ ? undefined : symbol;
|
|
126086
126168
|
var storedModuleSymbol = moduleSymbol.flags & 33554432 /* Transient */ ? undefined : moduleSymbol;
|
|
126087
126169
|
if (!storedSymbol || !storedModuleSymbol)
|
|
126088
126170
|
symbols.set(id, [symbol, moduleSymbol]);
|
|
126089
|
-
exportInfo.add(key(importedName, symbol, moduleName, checker), {
|
|
126171
|
+
exportInfo.add(key(importedName, symbol, ts.isExternalModuleNameRelative(moduleName) ? undefined : moduleName, checker), {
|
|
126090
126172
|
id: id,
|
|
126091
126173
|
symbolTableKey: symbolTableKey,
|
|
126092
126174
|
symbolName: importedName,
|
|
@@ -126094,16 +126176,16 @@ var ts;
|
|
|
126094
126176
|
moduleFile: moduleFile,
|
|
126095
126177
|
moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName,
|
|
126096
126178
|
exportKind: exportKind,
|
|
126097
|
-
targetFlags:
|
|
126179
|
+
targetFlags: target.flags,
|
|
126098
126180
|
isFromPackageJson: isFromPackageJson,
|
|
126099
126181
|
symbol: storedSymbol,
|
|
126100
126182
|
moduleSymbol: storedModuleSymbol,
|
|
126101
126183
|
});
|
|
126102
126184
|
},
|
|
126103
|
-
get: function (importingFile,
|
|
126185
|
+
get: function (importingFile, key) {
|
|
126104
126186
|
if (importingFile !== usableByFileName)
|
|
126105
126187
|
return;
|
|
126106
|
-
var result = exportInfo.get(key
|
|
126188
|
+
var result = exportInfo.get(key);
|
|
126107
126189
|
return result === null || result === void 0 ? void 0 : result.map(rehydrateCachedInfo);
|
|
126108
126190
|
},
|
|
126109
126191
|
forEach: function (importingFile, action) {
|
|
@@ -126111,7 +126193,7 @@ var ts;
|
|
|
126111
126193
|
return;
|
|
126112
126194
|
exportInfo.forEach(function (info, key) {
|
|
126113
126195
|
var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
|
|
126114
|
-
action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName);
|
|
126196
|
+
action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName, key);
|
|
126115
126197
|
});
|
|
126116
126198
|
},
|
|
126117
126199
|
releaseSymbols: function () {
|
|
@@ -126176,26 +126258,16 @@ var ts;
|
|
|
126176
126258
|
isFromPackageJson: isFromPackageJson,
|
|
126177
126259
|
};
|
|
126178
126260
|
}
|
|
126179
|
-
function key(importedName, symbol,
|
|
126180
|
-
var
|
|
126181
|
-
|
|
126182
|
-
var target = ts.skipAlias(symbol, checker);
|
|
126183
|
-
return importedName + "|" + createSymbolKey(target) + "|" + moduleKey;
|
|
126261
|
+
function key(importedName, symbol, ambientModuleName, checker) {
|
|
126262
|
+
var moduleKey = ambientModuleName || "";
|
|
126263
|
+
return importedName + "|" + ts.getSymbolId(ts.skipAlias(symbol, checker)) + "|" + moduleKey;
|
|
126184
126264
|
}
|
|
126185
126265
|
function parseKey(key) {
|
|
126186
126266
|
var symbolName = key.substring(0, key.indexOf("|"));
|
|
126187
126267
|
var moduleKey = key.substring(key.lastIndexOf("|") + 1);
|
|
126188
|
-
var ambientModuleName = moduleKey === "
|
|
126268
|
+
var ambientModuleName = moduleKey === "" ? undefined : moduleKey;
|
|
126189
126269
|
return { symbolName: symbolName, ambientModuleName: ambientModuleName };
|
|
126190
126270
|
}
|
|
126191
|
-
function createSymbolKey(symbol) {
|
|
126192
|
-
var key = symbol.name;
|
|
126193
|
-
while (symbol.parent) {
|
|
126194
|
-
key += "," + symbol.parent.name;
|
|
126195
|
-
symbol = symbol.parent;
|
|
126196
|
-
}
|
|
126197
|
-
return key;
|
|
126198
|
-
}
|
|
126199
126271
|
function fileIsGlobalOnly(file) {
|
|
126200
126272
|
return !file.commonJsModuleIndicator && !file.externalModuleIndicator && !file.moduleAugmentations && !file.ambientModuleNames;
|
|
126201
126273
|
}
|
|
@@ -126205,7 +126277,7 @@ var ts;
|
|
|
126205
126277
|
}
|
|
126206
126278
|
var oldFileStatementIndex = -1;
|
|
126207
126279
|
var newFileStatementIndex = -1;
|
|
126208
|
-
var
|
|
126280
|
+
var _loop_2 = function (ambientModuleName) {
|
|
126209
126281
|
var isMatchingModuleDeclaration = function (node) { return ts.isNonGlobalAmbientModule(node) && node.name.text === ambientModuleName; };
|
|
126210
126282
|
oldFileStatementIndex = ts.findIndex(oldSourceFile.statements, isMatchingModuleDeclaration, oldFileStatementIndex + 1);
|
|
126211
126283
|
newFileStatementIndex = ts.findIndex(newSourceFile.statements, isMatchingModuleDeclaration, newFileStatementIndex + 1);
|
|
@@ -126215,9 +126287,9 @@ var ts;
|
|
|
126215
126287
|
};
|
|
126216
126288
|
for (var _i = 0, _a = newSourceFile.ambientModuleNames; _i < _a.length; _i++) {
|
|
126217
126289
|
var ambientModuleName = _a[_i];
|
|
126218
|
-
var
|
|
126219
|
-
if (typeof
|
|
126220
|
-
return
|
|
126290
|
+
var state_2 = _loop_2(ambientModuleName);
|
|
126291
|
+
if (typeof state_2 === "object")
|
|
126292
|
+
return state_2.value;
|
|
126221
126293
|
}
|
|
126222
126294
|
return true;
|
|
126223
126295
|
}
|
|
@@ -128059,7 +128131,7 @@ var ts;
|
|
|
128059
128131
|
continue;
|
|
128060
128132
|
var patterns = paths[path];
|
|
128061
128133
|
if (patterns) {
|
|
128062
|
-
var
|
|
128134
|
+
var _loop_3 = function (name, kind, extension) {
|
|
128063
128135
|
// Path mappings may provide a duplicate way to get to something we've already added, so don't add again.
|
|
128064
128136
|
if (!result.some(function (entry) { return entry.name === name; })) {
|
|
128065
128137
|
result.push(nameAndKind(name, kind, extension));
|
|
@@ -128067,7 +128139,7 @@ var ts;
|
|
|
128067
128139
|
};
|
|
128068
128140
|
for (var _i = 0, _a = getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host); _i < _a.length; _i++) {
|
|
128069
128141
|
var _b = _a[_i], name = _b.name, kind = _b.kind, extension = _b.extension;
|
|
128070
|
-
|
|
128142
|
+
_loop_3(name, kind, extension);
|
|
128071
128143
|
}
|
|
128072
128144
|
}
|
|
128073
128145
|
}
|
|
@@ -128102,7 +128174,7 @@ var ts;
|
|
|
128102
128174
|
// (But do if we didn't find anything, e.g. 'package.json' missing.)
|
|
128103
128175
|
var foundGlobal = false;
|
|
128104
128176
|
if (fragmentDirectory === undefined) {
|
|
128105
|
-
var
|
|
128177
|
+
var _loop_4 = function (moduleName) {
|
|
128106
128178
|
if (!result.some(function (entry) { return entry.name === moduleName; })) {
|
|
128107
128179
|
foundGlobal = true;
|
|
128108
128180
|
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
|
|
@@ -128110,7 +128182,7 @@ var ts;
|
|
|
128110
128182
|
};
|
|
128111
128183
|
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
|
|
128112
128184
|
var moduleName = _c[_b];
|
|
128113
|
-
|
|
128185
|
+
_loop_4(moduleName);
|
|
128114
128186
|
}
|
|
128115
128187
|
}
|
|
128116
128188
|
if (!foundGlobal) {
|
|
@@ -128540,20 +128612,19 @@ var ts;
|
|
|
128540
128612
|
}
|
|
128541
128613
|
}
|
|
128542
128614
|
Completions.getCompletionsAtPosition = getCompletionsAtPosition;
|
|
128615
|
+
function completionEntryDataIsResolved(data) {
|
|
128616
|
+
return !!(data === null || data === void 0 ? void 0 : data.moduleSpecifier);
|
|
128617
|
+
}
|
|
128543
128618
|
function continuePreviousIncompleteResponse(cache, file, location, program, host, preferences, cancellationToken) {
|
|
128544
|
-
var _a;
|
|
128545
128619
|
var previousResponse = cache.get();
|
|
128546
128620
|
if (!previousResponse)
|
|
128547
128621
|
return undefined;
|
|
128548
128622
|
var lowerCaseTokenText = location.text.toLowerCase();
|
|
128549
128623
|
var exportMap = ts.getExportInfoMap(file, host, program, cancellationToken);
|
|
128550
|
-
var checker = program.getTypeChecker();
|
|
128551
|
-
var autoImportProvider = (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
128552
|
-
var autoImportProviderChecker = autoImportProvider === null || autoImportProvider === void 0 ? void 0 : autoImportProvider.getTypeChecker();
|
|
128553
128624
|
var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, preferences,
|
|
128554
128625
|
/*isForImportStatementCompletion*/ false, function (context) {
|
|
128555
128626
|
var entries = ts.mapDefined(previousResponse.entries, function (entry) {
|
|
128556
|
-
if (!entry.hasAction || !entry.source || !entry.data || entry.data
|
|
128627
|
+
if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
|
|
128557
128628
|
// Not an auto import or already resolved; keep as is
|
|
128558
128629
|
return entry;
|
|
128559
128630
|
}
|
|
@@ -128561,8 +128632,8 @@ var ts;
|
|
|
128561
128632
|
// No longer matches typed characters; filter out
|
|
128562
128633
|
return undefined;
|
|
128563
128634
|
}
|
|
128564
|
-
var
|
|
128565
|
-
var info = exportMap.get(file.path, entry.
|
|
128635
|
+
var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
|
|
128636
|
+
var info = exportMap.get(file.path, entry.data.exportMapKey);
|
|
128566
128637
|
var result = info && context.tryResolve(info, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
|
|
128567
128638
|
if (!result)
|
|
128568
128639
|
return entry;
|
|
@@ -128863,13 +128934,54 @@ var ts;
|
|
|
128863
128934
|
return text.replace(/\$/gm, "\\$");
|
|
128864
128935
|
}
|
|
128865
128936
|
function originToCompletionEntryData(origin) {
|
|
128866
|
-
|
|
128937
|
+
var ambientModuleName = origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name);
|
|
128938
|
+
var isPackageJsonImport = origin.isFromPackageJson ? true : undefined;
|
|
128939
|
+
if (originIsResolvedExport(origin)) {
|
|
128940
|
+
var resolvedData = {
|
|
128941
|
+
exportName: origin.exportName,
|
|
128942
|
+
moduleSpecifier: origin.moduleSpecifier,
|
|
128943
|
+
ambientModuleName: ambientModuleName,
|
|
128944
|
+
fileName: origin.fileName,
|
|
128945
|
+
isPackageJsonImport: isPackageJsonImport,
|
|
128946
|
+
};
|
|
128947
|
+
return resolvedData;
|
|
128948
|
+
}
|
|
128949
|
+
var unresolvedData = {
|
|
128867
128950
|
exportName: origin.exportName,
|
|
128951
|
+
exportMapKey: origin.exportMapKey,
|
|
128868
128952
|
fileName: origin.fileName,
|
|
128869
128953
|
ambientModuleName: origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name),
|
|
128870
128954
|
isPackageJsonImport: origin.isFromPackageJson ? true : undefined,
|
|
128871
|
-
moduleSpecifier: originIsResolvedExport(origin) ? origin.moduleSpecifier : undefined,
|
|
128872
128955
|
};
|
|
128956
|
+
return unresolvedData;
|
|
128957
|
+
}
|
|
128958
|
+
function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbol) {
|
|
128959
|
+
var isDefaultExport = data.exportName === "default" /* Default */;
|
|
128960
|
+
var isFromPackageJson = !!data.isPackageJsonImport;
|
|
128961
|
+
if (completionEntryDataIsResolved(data)) {
|
|
128962
|
+
var resolvedOrigin = {
|
|
128963
|
+
kind: 32 /* ResolvedExport */,
|
|
128964
|
+
exportName: data.exportName,
|
|
128965
|
+
moduleSpecifier: data.moduleSpecifier,
|
|
128966
|
+
symbolName: completionName,
|
|
128967
|
+
fileName: data.fileName,
|
|
128968
|
+
moduleSymbol: moduleSymbol,
|
|
128969
|
+
isDefaultExport: isDefaultExport,
|
|
128970
|
+
isFromPackageJson: isFromPackageJson,
|
|
128971
|
+
};
|
|
128972
|
+
return resolvedOrigin;
|
|
128973
|
+
}
|
|
128974
|
+
var unresolvedOrigin = {
|
|
128975
|
+
kind: 4 /* Export */,
|
|
128976
|
+
exportName: data.exportName,
|
|
128977
|
+
exportMapKey: data.exportMapKey,
|
|
128978
|
+
symbolName: completionName,
|
|
128979
|
+
fileName: data.fileName,
|
|
128980
|
+
moduleSymbol: moduleSymbol,
|
|
128981
|
+
isDefaultExport: isDefaultExport,
|
|
128982
|
+
isFromPackageJson: isFromPackageJson,
|
|
128983
|
+
};
|
|
128984
|
+
return unresolvedOrigin;
|
|
128873
128985
|
}
|
|
128874
128986
|
function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) {
|
|
128875
128987
|
var _a, _b, _c;
|
|
@@ -129645,6 +129757,7 @@ var ts;
|
|
|
129645
129757
|
}
|
|
129646
129758
|
}
|
|
129647
129759
|
function addPropertySymbol(symbol, insertAwait, insertQuestionDot) {
|
|
129760
|
+
var _a;
|
|
129648
129761
|
// For a computed property with an accessible name like `Symbol.iterator`,
|
|
129649
129762
|
// we'll add a completion for the *name* `Symbol` instead of for the property.
|
|
129650
129763
|
// If this is e.g. [Symbol.iterator], add a completion for `Symbol`.
|
|
@@ -129658,19 +129771,33 @@ var ts;
|
|
|
129658
129771
|
var index = symbols.length;
|
|
129659
129772
|
symbols.push(firstAccessibleSymbol);
|
|
129660
129773
|
var moduleSymbol = firstAccessibleSymbol.parent;
|
|
129661
|
-
if (!moduleSymbol ||
|
|
129774
|
+
if (!moduleSymbol ||
|
|
129775
|
+
!ts.isExternalModuleSymbol(moduleSymbol) ||
|
|
129776
|
+
typeChecker.tryGetMemberInModuleExportsAndProperties(firstAccessibleSymbol.name, moduleSymbol) !== firstAccessibleSymbol) {
|
|
129662
129777
|
symbolToOriginInfoMap[index] = { kind: getNullableSymbolOriginInfoKind(2 /* SymbolMemberNoExport */) };
|
|
129663
129778
|
}
|
|
129664
129779
|
else {
|
|
129665
|
-
var
|
|
129666
|
-
|
|
129667
|
-
|
|
129668
|
-
|
|
129669
|
-
|
|
129670
|
-
|
|
129671
|
-
|
|
129672
|
-
|
|
129673
|
-
|
|
129780
|
+
var fileName = ts.isExternalModuleNameRelative(ts.stripQuotes(moduleSymbol.name)) ? (_a = ts.getSourceFileOfModule(moduleSymbol)) === null || _a === void 0 ? void 0 : _a.fileName : undefined;
|
|
129781
|
+
var moduleSpecifier = (ts.codefix.getModuleSpecifierForBestExportInfo([{
|
|
129782
|
+
exportKind: 0 /* Named */,
|
|
129783
|
+
moduleFileName: fileName,
|
|
129784
|
+
isFromPackageJson: false,
|
|
129785
|
+
moduleSymbol: moduleSymbol,
|
|
129786
|
+
symbol: firstAccessibleSymbol,
|
|
129787
|
+
targetFlags: ts.skipAlias(firstAccessibleSymbol, typeChecker).flags,
|
|
129788
|
+
}], sourceFile, program, host, preferences) || {}).moduleSpecifier;
|
|
129789
|
+
if (moduleSpecifier) {
|
|
129790
|
+
var origin = {
|
|
129791
|
+
kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
|
|
129792
|
+
moduleSymbol: moduleSymbol,
|
|
129793
|
+
isDefaultExport: false,
|
|
129794
|
+
symbolName: firstAccessibleSymbol.name,
|
|
129795
|
+
exportName: firstAccessibleSymbol.name,
|
|
129796
|
+
fileName: fileName,
|
|
129797
|
+
moduleSpecifier: moduleSpecifier,
|
|
129798
|
+
};
|
|
129799
|
+
symbolToOriginInfoMap[index] = origin;
|
|
129800
|
+
}
|
|
129674
129801
|
}
|
|
129675
129802
|
}
|
|
129676
129803
|
else if (preferences.includeCompletionsWithInsertText) {
|
|
@@ -129906,7 +130033,7 @@ var ts;
|
|
|
129906
130033
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
129907
130034
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
129908
130035
|
resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
|
|
129909
|
-
exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule) {
|
|
130036
|
+
exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule, exportMapKey) {
|
|
129910
130037
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
129911
130038
|
return;
|
|
129912
130039
|
if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
|
|
@@ -129931,6 +130058,7 @@ var ts;
|
|
|
129931
130058
|
kind: moduleSpecifier ? 32 /* ResolvedExport */ : 4 /* Export */,
|
|
129932
130059
|
moduleSpecifier: moduleSpecifier,
|
|
129933
130060
|
symbolName: symbolName,
|
|
130061
|
+
exportMapKey: exportMapKey,
|
|
129934
130062
|
exportName: exportInfo_1.exportKind === 2 /* ExportEquals */ ? "export=" /* ExportEquals */ : exportInfo_1.symbol.name,
|
|
129935
130063
|
fileName: exportInfo_1.moduleFileName,
|
|
129936
130064
|
isDefaultExport: isDefaultExport,
|
|
@@ -130754,18 +130882,7 @@ var ts;
|
|
|
130754
130882
|
return undefined;
|
|
130755
130883
|
var isDefaultExport = data.exportName === "default" /* Default */;
|
|
130756
130884
|
symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(symbol) || symbol;
|
|
130757
|
-
return {
|
|
130758
|
-
symbol: symbol,
|
|
130759
|
-
origin: {
|
|
130760
|
-
kind: data.moduleSpecifier ? 32 /* ResolvedExport */ : 4 /* Export */,
|
|
130761
|
-
moduleSymbol: moduleSymbol,
|
|
130762
|
-
symbolName: name,
|
|
130763
|
-
isDefaultExport: isDefaultExport,
|
|
130764
|
-
exportName: data.exportName,
|
|
130765
|
-
fileName: data.fileName,
|
|
130766
|
-
isFromPackageJson: !!data.isPackageJsonImport,
|
|
130767
|
-
}
|
|
130768
|
-
};
|
|
130885
|
+
return { symbol: symbol, origin: completionEntryDataToSymbolOriginInfo(data, name, moduleSymbol) };
|
|
130769
130886
|
}
|
|
130770
130887
|
function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, jsxIdentifierExpected) {
|
|
130771
130888
|
var name = originIncludesSymbolName(origin) ? origin.symbolName : symbol.name;
|
|
@@ -133146,7 +133263,7 @@ var ts;
|
|
|
133146
133263
|
result = references;
|
|
133147
133264
|
continue;
|
|
133148
133265
|
}
|
|
133149
|
-
var
|
|
133266
|
+
var _loop_5 = function (entry) {
|
|
133150
133267
|
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
|
|
133151
133268
|
result.push(entry);
|
|
133152
133269
|
return "continue";
|
|
@@ -133178,7 +133295,7 @@ var ts;
|
|
|
133178
133295
|
};
|
|
133179
133296
|
for (var _b = 0, references_2 = references; _b < references_2.length; _b++) {
|
|
133180
133297
|
var entry = references_2[_b];
|
|
133181
|
-
|
|
133298
|
+
_loop_5(entry);
|
|
133182
133299
|
}
|
|
133183
133300
|
}
|
|
133184
133301
|
return result;
|
|
@@ -135156,7 +135273,7 @@ var ts;
|
|
|
135156
135273
|
}
|
|
135157
135274
|
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
|
|
135158
135275
|
var allFiles = program.getSourceFiles();
|
|
135159
|
-
var
|
|
135276
|
+
var _loop_6 = function (sourceFile) {
|
|
135160
135277
|
var newFromOld = oldToNew(sourceFile.fileName);
|
|
135161
135278
|
var newImportFromPath = newFromOld !== null && newFromOld !== void 0 ? newFromOld : sourceFile.fileName;
|
|
135162
135279
|
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
|
|
@@ -135188,7 +135305,7 @@ var ts;
|
|
|
135188
135305
|
};
|
|
135189
135306
|
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
|
|
135190
135307
|
var sourceFile = allFiles_1[_i];
|
|
135191
|
-
|
|
135308
|
+
_loop_6(sourceFile);
|
|
135192
135309
|
}
|
|
135193
135310
|
}
|
|
135194
135311
|
function combineNormal(pathA, pathB) {
|
|
@@ -136125,7 +136242,7 @@ var ts;
|
|
|
136125
136242
|
if (!patternMatcher)
|
|
136126
136243
|
return ts.emptyArray;
|
|
136127
136244
|
var rawItems = [];
|
|
136128
|
-
var
|
|
136245
|
+
var _loop_7 = function (sourceFile) {
|
|
136129
136246
|
cancellationToken.throwIfCancellationRequested();
|
|
136130
136247
|
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
|
|
136131
136248
|
return "continue";
|
|
@@ -136137,7 +136254,7 @@ var ts;
|
|
|
136137
136254
|
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
|
136138
136255
|
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
|
|
136139
136256
|
var sourceFile = sourceFiles_4[_i];
|
|
136140
|
-
|
|
136257
|
+
_loop_7(sourceFile);
|
|
136141
136258
|
}
|
|
136142
136259
|
rawItems.sort(compareNavigateToItems);
|
|
136143
136260
|
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
|
|
@@ -138141,15 +138258,15 @@ var ts;
|
|
|
138141
138258
|
// Assumes 'value' is already lowercase.
|
|
138142
138259
|
function indexOfIgnoringCase(str, value) {
|
|
138143
138260
|
var n = str.length - value.length;
|
|
138144
|
-
var
|
|
138261
|
+
var _loop_8 = function (start) {
|
|
138145
138262
|
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
|
|
138146
138263
|
return { value: start };
|
|
138147
138264
|
}
|
|
138148
138265
|
};
|
|
138149
138266
|
for (var start = 0; start <= n; start++) {
|
|
138150
|
-
var
|
|
138151
|
-
if (typeof
|
|
138152
|
-
return
|
|
138267
|
+
var state_3 = _loop_8(start);
|
|
138268
|
+
if (typeof state_3 === "object")
|
|
138269
|
+
return state_3.value;
|
|
138153
138270
|
}
|
|
138154
138271
|
return -1;
|
|
138155
138272
|
}
|
|
@@ -139528,7 +139645,7 @@ var ts;
|
|
|
139528
139645
|
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
|
|
139529
139646
|
}
|
|
139530
139647
|
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
|
|
139531
|
-
var
|
|
139648
|
+
var _loop_9 = function (n) {
|
|
139532
139649
|
// If the node is not a subspan of its parent, this is a big problem.
|
|
139533
139650
|
// There have been crashes that might be caused by this violation.
|
|
139534
139651
|
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); });
|
|
@@ -139538,9 +139655,9 @@ var ts;
|
|
|
139538
139655
|
}
|
|
139539
139656
|
};
|
|
139540
139657
|
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
|
|
139541
|
-
var
|
|
139542
|
-
if (typeof
|
|
139543
|
-
return
|
|
139658
|
+
var state_4 = _loop_9(n);
|
|
139659
|
+
if (typeof state_4 === "object")
|
|
139660
|
+
return state_4.value;
|
|
139544
139661
|
}
|
|
139545
139662
|
return undefined;
|
|
139546
139663
|
}
|
|
@@ -141111,7 +141228,7 @@ var ts;
|
|
|
141111
141228
|
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum ||
|
|
141112
141229
|
ts.filter(ts.optionDeclarations, function (o) { return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); });
|
|
141113
141230
|
options = ts.cloneCompilerOptions(options);
|
|
141114
|
-
var
|
|
141231
|
+
var _loop_10 = function (opt) {
|
|
141115
141232
|
if (!ts.hasProperty(options, opt.name)) {
|
|
141116
141233
|
return "continue";
|
|
141117
141234
|
}
|
|
@@ -141130,7 +141247,7 @@ var ts;
|
|
|
141130
141247
|
};
|
|
141131
141248
|
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
|
|
141132
141249
|
var opt = commandLineOptionsStringToEnum_1[_i];
|
|
141133
|
-
|
|
141250
|
+
_loop_10(opt);
|
|
141134
141251
|
}
|
|
141135
141252
|
return options;
|
|
141136
141253
|
}
|
|
@@ -144798,7 +144915,7 @@ var ts;
|
|
|
144798
144915
|
ChangeTracker.prototype.finishDeleteDeclarations = function () {
|
|
144799
144916
|
var _this = this;
|
|
144800
144917
|
var deletedNodesInLists = new ts.Set(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
|
|
144801
|
-
var
|
|
144918
|
+
var _loop_11 = function (sourceFile, node) {
|
|
144802
144919
|
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
|
|
144803
144920
|
if (ts.isArray(node)) {
|
|
144804
144921
|
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(sourceFile, node));
|
|
@@ -144811,7 +144928,7 @@ var ts;
|
|
|
144811
144928
|
var this_1 = this;
|
|
144812
144929
|
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
|
|
144813
144930
|
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
|
|
144814
|
-
|
|
144931
|
+
_loop_11(sourceFile, node);
|
|
144815
144932
|
}
|
|
144816
144933
|
deletedNodesInLists.forEach(function (node) {
|
|
144817
144934
|
var sourceFile = node.getSourceFile();
|
|
@@ -144870,14 +144987,14 @@ var ts;
|
|
|
144870
144987
|
// order changes by start position
|
|
144871
144988
|
// 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.
|
|
144872
144989
|
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
|
|
144873
|
-
var
|
|
144990
|
+
var _loop_12 = function (i) {
|
|
144874
144991
|
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
|
|
144875
144992
|
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
|
|
144876
144993
|
});
|
|
144877
144994
|
};
|
|
144878
144995
|
// verify that change intervals do not overlap, except possibly at end points.
|
|
144879
144996
|
for (var i = 0; i < normalized.length - 1; i++) {
|
|
144880
|
-
|
|
144997
|
+
_loop_12(i);
|
|
144881
144998
|
}
|
|
144882
144999
|
var textChanges = ts.mapDefined(normalized, function (c) {
|
|
144883
145000
|
var span = ts.createTextSpanFromRange(c.range);
|
|
@@ -145781,7 +145898,7 @@ var ts;
|
|
|
145781
145898
|
}
|
|
145782
145899
|
var isCompleteFix = identifiers.isCompleteFix;
|
|
145783
145900
|
var initializers;
|
|
145784
|
-
var
|
|
145901
|
+
var _loop_13 = function (identifier) {
|
|
145785
145902
|
var symbol = checker.getSymbolAtLocation(identifier);
|
|
145786
145903
|
if (!symbol) {
|
|
145787
145904
|
return "continue";
|
|
@@ -145814,7 +145931,7 @@ var ts;
|
|
|
145814
145931
|
};
|
|
145815
145932
|
for (var _i = 0, _a = identifiers.identifiers; _i < _a.length; _i++) {
|
|
145816
145933
|
var identifier = _a[_i];
|
|
145817
|
-
|
|
145934
|
+
_loop_13(identifier);
|
|
145818
145935
|
}
|
|
145819
145936
|
return initializers && {
|
|
145820
145937
|
initializers: initializers,
|
|
@@ -146697,7 +146814,7 @@ var ts;
|
|
|
146697
146814
|
functionToConvert.getStart(sourceFile);
|
|
146698
146815
|
var options = functionToConvert.modifiers ? { prefix: " " } : { suffix: " " };
|
|
146699
146816
|
changes.insertModifierAt(sourceFile, pos, 131 /* AsyncKeyword */, options);
|
|
146700
|
-
var
|
|
146817
|
+
var _loop_14 = function (returnStatement) {
|
|
146701
146818
|
ts.forEachChild(returnStatement, function visit(node) {
|
|
146702
146819
|
if (ts.isCallExpression(node)) {
|
|
146703
146820
|
var newNodes = transformExpression(node, node, transformer, /*hasContinuation*/ false);
|
|
@@ -146719,9 +146836,9 @@ var ts;
|
|
|
146719
146836
|
};
|
|
146720
146837
|
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
|
|
146721
146838
|
var returnStatement = returnStatements_1[_i];
|
|
146722
|
-
var
|
|
146723
|
-
if (typeof
|
|
146724
|
-
return
|
|
146839
|
+
var state_5 = _loop_14(returnStatement);
|
|
146840
|
+
if (typeof state_5 === "object")
|
|
146841
|
+
return state_5.value;
|
|
146725
146842
|
}
|
|
146726
146843
|
}
|
|
146727
146844
|
function getReturnStatementsWithPromiseHandlers(body, checker) {
|
|
@@ -149345,6 +149462,7 @@ var ts;
|
|
|
149345
149462
|
ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
|
|
149346
149463
|
ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
149347
149464
|
ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1.code,
|
|
149465
|
+
ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
|
|
149348
149466
|
ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
149349
149467
|
ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
|
|
149350
149468
|
ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,
|
|
@@ -149763,7 +149881,7 @@ var ts;
|
|
|
149763
149881
|
});
|
|
149764
149882
|
typeDeclToMembers.forEach(function (infos, classDeclaration) {
|
|
149765
149883
|
var supers = codefix.getAllSupers(classDeclaration, checker);
|
|
149766
|
-
var
|
|
149884
|
+
var _loop_15 = function (info) {
|
|
149767
149885
|
// If some superclass added this property, don't add it again.
|
|
149768
149886
|
if (supers.some(function (superClassOrInterface) {
|
|
149769
149887
|
var superInfos = typeDeclToMembers.get(superClassOrInterface);
|
|
@@ -149790,7 +149908,7 @@ var ts;
|
|
|
149790
149908
|
};
|
|
149791
149909
|
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
|
|
149792
149910
|
var info = infos_1[_i];
|
|
149793
|
-
|
|
149911
|
+
_loop_15(info);
|
|
149794
149912
|
}
|
|
149795
149913
|
});
|
|
149796
149914
|
}));
|
|
@@ -152397,7 +152515,7 @@ var ts;
|
|
|
152397
152515
|
function getSignatureFromCalls(calls) {
|
|
152398
152516
|
var parameters = [];
|
|
152399
152517
|
var length = Math.max.apply(Math, calls.map(function (c) { return c.argumentTypes.length; }));
|
|
152400
|
-
var
|
|
152518
|
+
var _loop_16 = function (i) {
|
|
152401
152519
|
var symbol = checker.createSymbol(1 /* FunctionScopedVariable */, ts.escapeLeadingUnderscores("arg" + i));
|
|
152402
152520
|
symbol.type = combineTypes(calls.map(function (call) { return call.argumentTypes[i] || checker.getUndefinedType(); }));
|
|
152403
152521
|
if (calls.some(function (call) { return call.argumentTypes[i] === undefined; })) {
|
|
@@ -152406,7 +152524,7 @@ var ts;
|
|
|
152406
152524
|
parameters.push(symbol);
|
|
152407
152525
|
};
|
|
152408
152526
|
for (var i = 0; i < length; i++) {
|
|
152409
|
-
|
|
152527
|
+
_loop_16(i);
|
|
152410
152528
|
}
|
|
152411
152529
|
var returnType = combineFromUsage(combineUsages(calls.map(function (call) { return call.return_; })));
|
|
152412
152530
|
return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, 0 /* None */);
|
|
@@ -154323,7 +154441,7 @@ var ts;
|
|
|
154323
154441
|
// Imports that need to be kept as named imports in the refactored code, to avoid changing the semantics.
|
|
154324
154442
|
// 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 }`.
|
|
154325
154443
|
var neededNamedImports = new ts.Set();
|
|
154326
|
-
var
|
|
154444
|
+
var _loop_17 = function (element) {
|
|
154327
154445
|
var propertyName = (element.propertyName || element.name).text;
|
|
154328
154446
|
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
|
|
154329
154447
|
var access = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(namespaceImportName), propertyName);
|
|
@@ -154340,7 +154458,7 @@ var ts;
|
|
|
154340
154458
|
};
|
|
154341
154459
|
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
|
|
154342
154460
|
var element = _a[_i];
|
|
154343
|
-
|
|
154461
|
+
_loop_17(element);
|
|
154344
154462
|
}
|
|
154345
154463
|
changes.replaceNode(sourceFile, toConvert, ts.factory.createNamespaceImport(ts.factory.createIdentifier(namespaceImportName)));
|
|
154346
154464
|
if (neededNamedImports.size) {
|
|
@@ -156195,7 +156313,7 @@ var ts;
|
|
|
156195
156313
|
: ts.getEnclosingBlockScopeContainer(scopes[0]);
|
|
156196
156314
|
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
|
|
156197
156315
|
}
|
|
156198
|
-
var
|
|
156316
|
+
var _loop_18 = function (i) {
|
|
156199
156317
|
var scopeUsages = usagesPerScope[i];
|
|
156200
156318
|
// Special case: in the innermost scope, all usages are available.
|
|
156201
156319
|
// (The computed value reflects the value at the top-level of the scope, but the
|
|
@@ -156235,7 +156353,7 @@ var ts;
|
|
|
156235
156353
|
}
|
|
156236
156354
|
};
|
|
156237
156355
|
for (var i = 0; i < scopes.length; i++) {
|
|
156238
|
-
|
|
156356
|
+
_loop_18(i);
|
|
156239
156357
|
}
|
|
156240
156358
|
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
|
|
156241
156359
|
function isInGenericContext(node) {
|
|
@@ -156924,10 +157042,10 @@ var ts;
|
|
|
156924
157042
|
}
|
|
156925
157043
|
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
|
|
156926
157044
|
var checker = program.getTypeChecker();
|
|
156927
|
-
var
|
|
157045
|
+
var _loop_19 = function (sourceFile) {
|
|
156928
157046
|
if (sourceFile === oldFile)
|
|
156929
157047
|
return "continue";
|
|
156930
|
-
var
|
|
157048
|
+
var _loop_20 = function (statement) {
|
|
156931
157049
|
forEachImportInStatement(statement, function (importNode) {
|
|
156932
157050
|
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
|
|
156933
157051
|
return;
|
|
@@ -156949,12 +157067,12 @@ var ts;
|
|
|
156949
157067
|
};
|
|
156950
157068
|
for (var _b = 0, _c = sourceFile.statements; _b < _c.length; _b++) {
|
|
156951
157069
|
var statement = _c[_b];
|
|
156952
|
-
|
|
157070
|
+
_loop_20(statement);
|
|
156953
157071
|
}
|
|
156954
157072
|
};
|
|
156955
157073
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
156956
157074
|
var sourceFile = _a[_i];
|
|
156957
|
-
|
|
157075
|
+
_loop_19(sourceFile);
|
|
156958
157076
|
}
|
|
156959
157077
|
}
|
|
156960
157078
|
function getNamespaceLikeImport(node) {
|
|
@@ -158318,7 +158436,7 @@ var ts;
|
|
|
158318
158436
|
var templateSpans = [];
|
|
158319
158437
|
var templateHead = ts.factory.createTemplateHead(headText, rawHeadText);
|
|
158320
158438
|
copyCommentFromStringLiterals(headIndexes, templateHead);
|
|
158321
|
-
var
|
|
158439
|
+
var _loop_21 = function (i) {
|
|
158322
158440
|
var currentNode = getExpressionFromParenthesesOrExpression(nodes[i]);
|
|
158323
158441
|
copyOperatorComments(i, currentNode);
|
|
158324
158442
|
var _c = concatConsecutiveString(i + 1, nodes), newIndex = _c[0], subsequentText = _c[1], rawSubsequentText = _c[2], stringIndexes = _c[3];
|
|
@@ -158347,7 +158465,7 @@ var ts;
|
|
|
158347
158465
|
};
|
|
158348
158466
|
var out_i_1;
|
|
158349
158467
|
for (var i = begin; i < nodes.length; i++) {
|
|
158350
|
-
|
|
158468
|
+
_loop_21(i);
|
|
158351
158469
|
i = out_i_1;
|
|
158352
158470
|
}
|
|
158353
158471
|
return ts.factory.createTemplateExpression(templateHead, templateSpans);
|