typescript 4.9.0-dev.20221020 → 4.9.0-dev.20221022
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 +93 -21
- package/lib/tsserver.js +114 -37
- package/lib/tsserverlibrary.js +114 -37
- package/lib/typescript.js +114 -37
- package/lib/typescriptServices.js +114 -37
- package/lib/typingsInstaller.js +113 -36
- package/package.json +1 -1
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.9";
|
|
72
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
72
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221022");
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -1606,8 +1606,8 @@ var ts;
|
|
|
1606
1606
|
return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length);
|
|
1607
1607
|
}
|
|
1608
1608
|
ts.compareTextSpans = compareTextSpans;
|
|
1609
|
-
function min(
|
|
1610
|
-
return compare(
|
|
1609
|
+
function min(items, compare) {
|
|
1610
|
+
return reduceLeft(items, function (x, y) { return compare(x, y) === -1 ? x : y; });
|
|
1611
1611
|
}
|
|
1612
1612
|
ts.min = min;
|
|
1613
1613
|
function compareStringsCaseInsensitive(a, b) {
|
|
@@ -34525,12 +34525,22 @@ var ts;
|
|
|
34525
34525
|
return !isCommandLineOnly && category !== undefined && (!categoriesToSkip.includes(category) || compilerOptionsMap.has(name));
|
|
34526
34526
|
}
|
|
34527
34527
|
function writeConfigurations() {
|
|
34528
|
-
var categorizedOptions = ts.
|
|
34528
|
+
var categorizedOptions = new ts.Map();
|
|
34529
|
+
categorizedOptions.set(ts.Diagnostics.Projects, []);
|
|
34530
|
+
categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []);
|
|
34531
|
+
categorizedOptions.set(ts.Diagnostics.Modules, []);
|
|
34532
|
+
categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []);
|
|
34533
|
+
categorizedOptions.set(ts.Diagnostics.Emit, []);
|
|
34534
|
+
categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []);
|
|
34535
|
+
categorizedOptions.set(ts.Diagnostics.Type_Checking, []);
|
|
34536
|
+
categorizedOptions.set(ts.Diagnostics.Completeness, []);
|
|
34529
34537
|
for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) {
|
|
34530
34538
|
var option = optionDeclarations_1[_i];
|
|
34531
|
-
var category = option.category;
|
|
34532
34539
|
if (isAllowedOptionForOutput(option)) {
|
|
34533
|
-
categorizedOptions.
|
|
34540
|
+
var listForCategory = categorizedOptions.get(option.category);
|
|
34541
|
+
if (!listForCategory)
|
|
34542
|
+
categorizedOptions.set(option.category, listForCategory = []);
|
|
34543
|
+
listForCategory.push(option);
|
|
34534
34544
|
}
|
|
34535
34545
|
}
|
|
34536
34546
|
var marginLength = 0;
|
|
@@ -34540,7 +34550,7 @@ var ts;
|
|
|
34540
34550
|
if (entries.length !== 0) {
|
|
34541
34551
|
entries.push({ value: "" });
|
|
34542
34552
|
}
|
|
34543
|
-
entries.push({ value: "/* ".concat(category, " */") });
|
|
34553
|
+
entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") });
|
|
34544
34554
|
for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
|
|
34545
34555
|
var option = options_1[_i];
|
|
34546
34556
|
var optionName = void 0;
|
|
@@ -61327,7 +61337,7 @@ var ts;
|
|
|
61327
61337
|
(isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) {
|
|
61328
61338
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
61329
61339
|
}
|
|
61330
|
-
var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
|
|
61340
|
+
var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
|
|
61331
61341
|
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16384)) !== 0 ||
|
|
61332
61342
|
isInTypeQuery(node) || node.parent.kind === 278) ||
|
|
61333
61343
|
node.parent.kind === 232 ||
|
|
@@ -61352,6 +61362,12 @@ var ts;
|
|
|
61352
61362
|
}
|
|
61353
61363
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
61354
61364
|
}
|
|
61365
|
+
function isSameScopedBindingElement(node, declaration) {
|
|
61366
|
+
if (ts.isBindingElement(declaration)) {
|
|
61367
|
+
var bindingElement = ts.findAncestor(node, ts.isBindingElement);
|
|
61368
|
+
return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration);
|
|
61369
|
+
}
|
|
61370
|
+
}
|
|
61355
61371
|
function shouldMarkIdentifierAliasReferenced(node) {
|
|
61356
61372
|
var _a;
|
|
61357
61373
|
var parent = node.parent;
|
|
@@ -61650,11 +61666,16 @@ var ts;
|
|
|
61650
61666
|
var immediateContainer = ts.getSuperContainer(node, true);
|
|
61651
61667
|
var container = immediateContainer;
|
|
61652
61668
|
var needToCaptureLexicalThis = false;
|
|
61669
|
+
var inAsyncFunction = false;
|
|
61653
61670
|
if (!isCallExpression) {
|
|
61654
61671
|
while (container && container.kind === 216) {
|
|
61672
|
+
if (ts.hasSyntacticModifier(container, 512))
|
|
61673
|
+
inAsyncFunction = true;
|
|
61655
61674
|
container = ts.getSuperContainer(container, true);
|
|
61656
61675
|
needToCaptureLexicalThis = languageVersion < 2;
|
|
61657
61676
|
}
|
|
61677
|
+
if (container && ts.hasSyntacticModifier(container, 512))
|
|
61678
|
+
inAsyncFunction = true;
|
|
61658
61679
|
}
|
|
61659
61680
|
var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
|
|
61660
61681
|
var nodeCheckFlag = 0;
|
|
@@ -61693,7 +61714,7 @@ var ts;
|
|
|
61693
61714
|
nodeCheckFlag = 256;
|
|
61694
61715
|
}
|
|
61695
61716
|
getNodeLinks(node).flags |= nodeCheckFlag;
|
|
61696
|
-
if (container.kind === 171 &&
|
|
61717
|
+
if (container.kind === 171 && inAsyncFunction) {
|
|
61697
61718
|
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
|
|
61698
61719
|
getNodeLinks(container).flags |= 4096;
|
|
61699
61720
|
}
|
|
@@ -69702,7 +69723,7 @@ var ts;
|
|
|
69702
69723
|
if (isReferenceToType(type, getGlobalPromiseType(false))) {
|
|
69703
69724
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
69704
69725
|
}
|
|
69705
|
-
if (allTypesAssignableToKind(type, 131068 | 131072)) {
|
|
69726
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 | 131072)) {
|
|
69706
69727
|
return undefined;
|
|
69707
69728
|
}
|
|
69708
69729
|
var thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -69758,7 +69779,7 @@ var ts;
|
|
|
69758
69779
|
return awaitedType || errorType;
|
|
69759
69780
|
}
|
|
69760
69781
|
function isThenableType(type) {
|
|
69761
|
-
if (allTypesAssignableToKind(type, 131068 | 131072)) {
|
|
69782
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 | 131072)) {
|
|
69762
69783
|
return false;
|
|
69763
69784
|
}
|
|
69764
69785
|
var thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -82514,8 +82535,11 @@ var ts;
|
|
|
82514
82535
|
}
|
|
82515
82536
|
return ts.visitEachChild(node, visitor, context);
|
|
82516
82537
|
case 174:
|
|
82538
|
+
return doWithContext(1 | 2, visitGetAccessorDeclaration, node);
|
|
82517
82539
|
case 175:
|
|
82540
|
+
return doWithContext(1 | 2, visitSetAccessorDeclaration, node);
|
|
82518
82541
|
case 173:
|
|
82542
|
+
return doWithContext(1 | 2, visitConstructorDeclaration, node);
|
|
82519
82543
|
case 260:
|
|
82520
82544
|
case 228:
|
|
82521
82545
|
return doWithContext(1 | 2, visitDefault, node);
|
|
@@ -82606,10 +82630,19 @@ var ts;
|
|
|
82606
82630
|
}
|
|
82607
82631
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
|
|
82608
82632
|
}
|
|
82633
|
+
function visitConstructorDeclaration(node) {
|
|
82634
|
+
return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
82635
|
+
}
|
|
82609
82636
|
function visitMethodDeclaration(node) {
|
|
82610
82637
|
return factory.updateMethodDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.asteriskToken, node.name, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2
|
|
82611
82638
|
? transformAsyncFunctionBody(node)
|
|
82612
|
-
:
|
|
82639
|
+
: transformMethodBody(node));
|
|
82640
|
+
}
|
|
82641
|
+
function visitGetAccessorDeclaration(node) {
|
|
82642
|
+
return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), undefined, transformMethodBody(node));
|
|
82643
|
+
}
|
|
82644
|
+
function visitSetAccessorDeclaration(node) {
|
|
82645
|
+
return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
82613
82646
|
}
|
|
82614
82647
|
function visitFunctionDeclaration(node) {
|
|
82615
82648
|
return factory.updateFunctionDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2
|
|
@@ -82693,6 +82726,39 @@ var ts;
|
|
|
82693
82726
|
}
|
|
82694
82727
|
return false;
|
|
82695
82728
|
}
|
|
82729
|
+
function transformMethodBody(node) {
|
|
82730
|
+
ts.Debug.assertIsDefined(node.body);
|
|
82731
|
+
var savedCapturedSuperProperties = capturedSuperProperties;
|
|
82732
|
+
var savedHasSuperElementAccess = hasSuperElementAccess;
|
|
82733
|
+
capturedSuperProperties = new ts.Set();
|
|
82734
|
+
hasSuperElementAccess = false;
|
|
82735
|
+
var updated = ts.visitFunctionBody(node.body, visitor, context);
|
|
82736
|
+
var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
|
|
82737
|
+
var emitSuperHelpers = languageVersion >= 2 &&
|
|
82738
|
+
resolver.getNodeCheckFlags(node) & (4096 | 2048) &&
|
|
82739
|
+
(ts.getFunctionFlags(originalMethod) & 3) !== 3;
|
|
82740
|
+
if (emitSuperHelpers) {
|
|
82741
|
+
enableSubstitutionForAsyncMethodsWithSuper();
|
|
82742
|
+
if (capturedSuperProperties.size) {
|
|
82743
|
+
var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
82744
|
+
substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
|
|
82745
|
+
var statements = updated.statements.slice();
|
|
82746
|
+
ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
82747
|
+
updated = factory.updateBlock(updated, statements);
|
|
82748
|
+
}
|
|
82749
|
+
if (hasSuperElementAccess) {
|
|
82750
|
+
if (resolver.getNodeCheckFlags(node) & 4096) {
|
|
82751
|
+
ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
|
|
82752
|
+
}
|
|
82753
|
+
else if (resolver.getNodeCheckFlags(node) & 2048) {
|
|
82754
|
+
ts.addEmitHelper(updated, ts.asyncSuperHelper);
|
|
82755
|
+
}
|
|
82756
|
+
}
|
|
82757
|
+
}
|
|
82758
|
+
capturedSuperProperties = savedCapturedSuperProperties;
|
|
82759
|
+
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
82760
|
+
return updated;
|
|
82761
|
+
}
|
|
82696
82762
|
function transformAsyncFunctionBody(node) {
|
|
82697
82763
|
resumeLexicalEnvironment();
|
|
82698
82764
|
var original = ts.getOriginalNode(node, ts.isFunctionLike);
|
|
@@ -102703,7 +102769,7 @@ var ts;
|
|
|
102703
102769
|
var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47;
|
|
102704
102770
|
if (isNonDirectorySeparatorRoot &&
|
|
102705
102771
|
dirPath.search(/[a-zA-Z]:/) !== 0 &&
|
|
102706
|
-
pathPartForUserCheck.search(/[a-zA-
|
|
102772
|
+
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
|
|
102707
102773
|
nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
|
|
102708
102774
|
if (nextDirectorySeparator === -1) {
|
|
102709
102775
|
return false;
|
|
@@ -103980,15 +104046,21 @@ var ts;
|
|
|
103980
104046
|
return undefined;
|
|
103981
104047
|
}
|
|
103982
104048
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
|
|
103983
|
-
var
|
|
103984
|
-
if (
|
|
104049
|
+
var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
104050
|
+
if (normalizedTargetPaths === undefined) {
|
|
104051
|
+
return undefined;
|
|
104052
|
+
}
|
|
104053
|
+
var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
104054
|
+
var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
|
|
104055
|
+
return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
|
|
104056
|
+
});
|
|
104057
|
+
var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
|
|
104058
|
+
if (!shortest) {
|
|
103985
104059
|
return undefined;
|
|
103986
104060
|
}
|
|
103987
|
-
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
103988
|
-
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
|
|
103989
104061
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
|
|
103990
|
-
? removeExtensionAndIndexPostFix(
|
|
103991
|
-
: ts.removeFileExtension(
|
|
104062
|
+
? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
|
|
104063
|
+
: ts.removeFileExtension(shortest);
|
|
103992
104064
|
}
|
|
103993
104065
|
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
103994
104066
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
@@ -104108,8 +104180,8 @@ var ts;
|
|
|
104108
104180
|
}
|
|
104109
104181
|
}
|
|
104110
104182
|
}
|
|
104111
|
-
function
|
|
104112
|
-
return ts.
|
|
104183
|
+
function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
104184
|
+
return ts.mapDefined(rootDirs, function (rootDir) {
|
|
104113
104185
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
104114
104186
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
104115
104187
|
});
|
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
112
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221022");
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -1901,8 +1901,8 @@ var ts;
|
|
|
1901
1901
|
return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length);
|
|
1902
1902
|
}
|
|
1903
1903
|
ts.compareTextSpans = compareTextSpans;
|
|
1904
|
-
function min(
|
|
1905
|
-
return compare(
|
|
1904
|
+
function min(items, compare) {
|
|
1905
|
+
return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; });
|
|
1906
1906
|
}
|
|
1907
1907
|
ts.min = min;
|
|
1908
1908
|
/**
|
|
@@ -5119,8 +5119,8 @@ var ts;
|
|
|
5119
5119
|
NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
|
|
5120
5120
|
NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
|
|
5121
5121
|
NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
|
|
5122
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5123
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5122
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync";
|
|
5123
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync";
|
|
5124
5124
|
NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
|
|
5125
5125
|
NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
|
|
5126
5126
|
NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
|
|
@@ -42271,12 +42271,23 @@ var ts;
|
|
|
42271
42271
|
}
|
|
42272
42272
|
function writeConfigurations() {
|
|
42273
42273
|
// Filter applicable options to place in the file
|
|
42274
|
-
var categorizedOptions = ts.
|
|
42274
|
+
var categorizedOptions = new ts.Map();
|
|
42275
|
+
// Set allowed categories in order
|
|
42276
|
+
categorizedOptions.set(ts.Diagnostics.Projects, []);
|
|
42277
|
+
categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []);
|
|
42278
|
+
categorizedOptions.set(ts.Diagnostics.Modules, []);
|
|
42279
|
+
categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []);
|
|
42280
|
+
categorizedOptions.set(ts.Diagnostics.Emit, []);
|
|
42281
|
+
categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []);
|
|
42282
|
+
categorizedOptions.set(ts.Diagnostics.Type_Checking, []);
|
|
42283
|
+
categorizedOptions.set(ts.Diagnostics.Completeness, []);
|
|
42275
42284
|
for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) {
|
|
42276
42285
|
var option = optionDeclarations_1[_i];
|
|
42277
|
-
var category = option.category;
|
|
42278
42286
|
if (isAllowedOptionForOutput(option)) {
|
|
42279
|
-
categorizedOptions.
|
|
42287
|
+
var listForCategory = categorizedOptions.get(option.category);
|
|
42288
|
+
if (!listForCategory)
|
|
42289
|
+
categorizedOptions.set(option.category, listForCategory = []);
|
|
42290
|
+
listForCategory.push(option);
|
|
42280
42291
|
}
|
|
42281
42292
|
}
|
|
42282
42293
|
// Serialize all options and their descriptions
|
|
@@ -42287,7 +42298,7 @@ var ts;
|
|
|
42287
42298
|
if (entries.length !== 0) {
|
|
42288
42299
|
entries.push({ value: "" });
|
|
42289
42300
|
}
|
|
42290
|
-
entries.push({ value: "/* ".concat(category, " */") });
|
|
42301
|
+
entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") });
|
|
42291
42302
|
for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
|
|
42292
42303
|
var option = options_1[_i];
|
|
42293
42304
|
var optionName = void 0;
|
|
@@ -73298,7 +73309,7 @@ var ts;
|
|
|
73298
73309
|
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
|
|
73299
73310
|
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
|
|
73300
73311
|
// declaration container are the same).
|
|
73301
|
-
var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
|
|
73312
|
+
var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
|
|
73302
73313
|
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 ||
|
|
73303
73314
|
isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) ||
|
|
73304
73315
|
node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ ||
|
|
@@ -73327,6 +73338,12 @@ var ts;
|
|
|
73327
73338
|
}
|
|
73328
73339
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
73329
73340
|
}
|
|
73341
|
+
function isSameScopedBindingElement(node, declaration) {
|
|
73342
|
+
if (ts.isBindingElement(declaration)) {
|
|
73343
|
+
var bindingElement = ts.findAncestor(node, ts.isBindingElement);
|
|
73344
|
+
return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration);
|
|
73345
|
+
}
|
|
73346
|
+
}
|
|
73330
73347
|
function shouldMarkIdentifierAliasReferenced(node) {
|
|
73331
73348
|
var _a;
|
|
73332
73349
|
var parent = node.parent;
|
|
@@ -73668,12 +73685,17 @@ var ts;
|
|
|
73668
73685
|
var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
|
|
73669
73686
|
var container = immediateContainer;
|
|
73670
73687
|
var needToCaptureLexicalThis = false;
|
|
73688
|
+
var inAsyncFunction = false;
|
|
73671
73689
|
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
|
|
73672
73690
|
if (!isCallExpression) {
|
|
73673
73691
|
while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) {
|
|
73692
|
+
if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73693
|
+
inAsyncFunction = true;
|
|
73674
73694
|
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
|
|
73675
73695
|
needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */;
|
|
73676
73696
|
}
|
|
73697
|
+
if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73698
|
+
inAsyncFunction = true;
|
|
73677
73699
|
}
|
|
73678
73700
|
var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
|
|
73679
73701
|
var nodeCheckFlag = 0;
|
|
@@ -73779,12 +73801,12 @@ var ts;
|
|
|
73779
73801
|
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
|
|
73780
73802
|
//
|
|
73781
73803
|
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
|
|
73782
|
-
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ &&
|
|
73804
|
+
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) {
|
|
73783
73805
|
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
|
|
73784
|
-
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.
|
|
73806
|
+
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */;
|
|
73785
73807
|
}
|
|
73786
73808
|
else {
|
|
73787
|
-
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.
|
|
73809
|
+
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */;
|
|
73788
73810
|
}
|
|
73789
73811
|
}
|
|
73790
73812
|
if (needToCaptureLexicalThis) {
|
|
@@ -82940,7 +82962,7 @@ var ts;
|
|
|
82940
82962
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
82941
82963
|
}
|
|
82942
82964
|
// primitives with a `{ then() }` won't be unwrapped/adopted.
|
|
82943
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82965
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82944
82966
|
return undefined;
|
|
82945
82967
|
}
|
|
82946
82968
|
var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217
|
|
@@ -83007,7 +83029,7 @@ var ts;
|
|
|
83007
83029
|
* Determines whether a type is an object with a callable `then` member.
|
|
83008
83030
|
*/
|
|
83009
83031
|
function isThenableType(type) {
|
|
83010
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83032
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83011
83033
|
// primitive types cannot be considered "thenable" since they are not objects.
|
|
83012
83034
|
return false;
|
|
83013
83035
|
}
|
|
@@ -98506,8 +98528,11 @@ var ts;
|
|
|
98506
98528
|
}
|
|
98507
98529
|
return ts.visitEachChild(node, visitor, context);
|
|
98508
98530
|
case 174 /* SyntaxKind.GetAccessor */:
|
|
98531
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node);
|
|
98509
98532
|
case 175 /* SyntaxKind.SetAccessor */:
|
|
98533
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node);
|
|
98510
98534
|
case 173 /* SyntaxKind.Constructor */:
|
|
98535
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node);
|
|
98511
98536
|
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
98512
98537
|
case 228 /* SyntaxKind.ClassExpression */:
|
|
98513
98538
|
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node);
|
|
@@ -98608,6 +98633,9 @@ var ts;
|
|
|
98608
98633
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
|
|
98609
98634
|
/*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
|
|
98610
98635
|
}
|
|
98636
|
+
function visitConstructorDeclaration(node) {
|
|
98637
|
+
return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98638
|
+
}
|
|
98611
98639
|
/**
|
|
98612
98640
|
* Visits a MethodDeclaration node.
|
|
98613
98641
|
*
|
|
@@ -98622,7 +98650,14 @@ var ts;
|
|
|
98622
98650
|
/*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
|
|
98623
98651
|
/*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
|
|
98624
98652
|
? transformAsyncFunctionBody(node)
|
|
98625
|
-
:
|
|
98653
|
+
: transformMethodBody(node));
|
|
98654
|
+
}
|
|
98655
|
+
function visitGetAccessorDeclaration(node) {
|
|
98656
|
+
return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context),
|
|
98657
|
+
/*type*/ undefined, transformMethodBody(node));
|
|
98658
|
+
}
|
|
98659
|
+
function visitSetAccessorDeclaration(node) {
|
|
98660
|
+
return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98626
98661
|
}
|
|
98627
98662
|
/**
|
|
98628
98663
|
* Visits a FunctionDeclaration node.
|
|
@@ -98736,6 +98771,42 @@ var ts;
|
|
|
98736
98771
|
}
|
|
98737
98772
|
return false;
|
|
98738
98773
|
}
|
|
98774
|
+
function transformMethodBody(node) {
|
|
98775
|
+
ts.Debug.assertIsDefined(node.body);
|
|
98776
|
+
var savedCapturedSuperProperties = capturedSuperProperties;
|
|
98777
|
+
var savedHasSuperElementAccess = hasSuperElementAccess;
|
|
98778
|
+
capturedSuperProperties = new ts.Set();
|
|
98779
|
+
hasSuperElementAccess = false;
|
|
98780
|
+
var updated = ts.visitFunctionBody(node.body, visitor, context);
|
|
98781
|
+
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98782
|
+
// This step isn't needed if we eventually transform this to ES5.
|
|
98783
|
+
var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
|
|
98784
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ &&
|
|
98785
|
+
resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) &&
|
|
98786
|
+
(ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */;
|
|
98787
|
+
if (emitSuperHelpers) {
|
|
98788
|
+
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98789
|
+
if (capturedSuperProperties.size) {
|
|
98790
|
+
var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
98791
|
+
substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
|
|
98792
|
+
var statements = updated.statements.slice();
|
|
98793
|
+
ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
98794
|
+
updated = factory.updateBlock(updated, statements);
|
|
98795
|
+
}
|
|
98796
|
+
if (hasSuperElementAccess) {
|
|
98797
|
+
// Emit helpers for super element access expressions (`super[x]`).
|
|
98798
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98799
|
+
ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
|
|
98800
|
+
}
|
|
98801
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98802
|
+
ts.addEmitHelper(updated, ts.asyncSuperHelper);
|
|
98803
|
+
}
|
|
98804
|
+
}
|
|
98805
|
+
}
|
|
98806
|
+
capturedSuperProperties = savedCapturedSuperProperties;
|
|
98807
|
+
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
98808
|
+
return updated;
|
|
98809
|
+
}
|
|
98739
98810
|
function transformAsyncFunctionBody(node) {
|
|
98740
98811
|
resumeLexicalEnvironment();
|
|
98741
98812
|
var original = ts.getOriginalNode(node, ts.isFunctionLike);
|
|
@@ -98768,7 +98839,7 @@ var ts;
|
|
|
98768
98839
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
98769
98840
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98770
98841
|
// This step isn't needed if we eventually transform this to ES5.
|
|
98771
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
98842
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
98772
98843
|
if (emitSuperHelpers) {
|
|
98773
98844
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98774
98845
|
if (capturedSuperProperties.size) {
|
|
@@ -98781,10 +98852,10 @@ var ts;
|
|
|
98781
98852
|
ts.setTextRange(block, node.body);
|
|
98782
98853
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98783
98854
|
// Emit helpers for super element access expressions (`super[x]`).
|
|
98784
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
98855
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98785
98856
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
98786
98857
|
}
|
|
98787
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
98858
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98788
98859
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
98789
98860
|
}
|
|
98790
98861
|
}
|
|
@@ -98856,7 +98927,7 @@ var ts;
|
|
|
98856
98927
|
// If we need to support substitutions for `super` in an async method,
|
|
98857
98928
|
// we should track it here.
|
|
98858
98929
|
if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98859
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
98930
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
98860
98931
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98861
98932
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98862
98933
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -98933,7 +99004,7 @@ var ts;
|
|
|
98933
99004
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
98934
99005
|
}
|
|
98935
99006
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
98936
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
99007
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98937
99008
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */),
|
|
98938
99009
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
98939
99010
|
}
|
|
@@ -98948,7 +99019,7 @@ var ts;
|
|
|
98948
99019
|
function createSuperAccessVariableStatement(factory, resolver, node, names) {
|
|
98949
99020
|
// Create a variable declaration with a getter/setter (if binding) definition for each name:
|
|
98950
99021
|
// const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
|
|
98951
|
-
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99022
|
+
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0;
|
|
98952
99023
|
var accessors = [];
|
|
98953
99024
|
names.forEach(function (_, key) {
|
|
98954
99025
|
var name = ts.unescapeLeadingUnderscores(key);
|
|
@@ -99656,7 +99727,7 @@ var ts;
|
|
|
99656
99727
|
/*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */)));
|
|
99657
99728
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
99658
99729
|
// This step isn't needed if we eventually transform this to ES5.
|
|
99659
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
99730
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
99660
99731
|
if (emitSuperHelpers) {
|
|
99661
99732
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
99662
99733
|
var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
@@ -99667,10 +99738,10 @@ var ts;
|
|
|
99667
99738
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
99668
99739
|
var block = factory.updateBlock(node.body, statements);
|
|
99669
99740
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
99670
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99741
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99671
99742
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
99672
99743
|
}
|
|
99673
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
99744
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
99674
99745
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
99675
99746
|
}
|
|
99676
99747
|
}
|
|
@@ -99799,7 +99870,7 @@ var ts;
|
|
|
99799
99870
|
// If we need to support substitutions for `super` in an async method,
|
|
99800
99871
|
// we should track it here.
|
|
99801
99872
|
if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
99802
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
99873
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
99803
99874
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
99804
99875
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
99805
99876
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -99876,7 +99947,7 @@ var ts;
|
|
|
99876
99947
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
99877
99948
|
}
|
|
99878
99949
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
99879
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
99950
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99880
99951
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"),
|
|
99881
99952
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
99882
99953
|
}
|
|
@@ -123902,7 +123973,7 @@ var ts;
|
|
|
123902
123973
|
var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */;
|
|
123903
123974
|
if (isNonDirectorySeparatorRoot &&
|
|
123904
123975
|
dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
|
|
123905
|
-
pathPartForUserCheck.search(/[a-zA-
|
|
123976
|
+
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
|
|
123906
123977
|
nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
|
|
123907
123978
|
if (nextDirectorySeparator === -1) {
|
|
123908
123979
|
// ignore "//vda1cs4850/c$/folderAtRoot"
|
|
@@ -125408,15 +125479,21 @@ var ts;
|
|
|
125408
125479
|
return undefined;
|
|
125409
125480
|
}
|
|
125410
125481
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
|
|
125411
|
-
var
|
|
125412
|
-
if (
|
|
125482
|
+
var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
125483
|
+
if (normalizedTargetPaths === undefined) {
|
|
125484
|
+
return undefined;
|
|
125485
|
+
}
|
|
125486
|
+
var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125487
|
+
var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
|
|
125488
|
+
return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
|
|
125489
|
+
});
|
|
125490
|
+
var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
|
|
125491
|
+
if (!shortest) {
|
|
125413
125492
|
return undefined;
|
|
125414
125493
|
}
|
|
125415
|
-
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125416
|
-
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
|
|
125417
125494
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
|
|
125418
|
-
? removeExtensionAndIndexPostFix(
|
|
125419
|
-
: ts.removeFileExtension(
|
|
125495
|
+
? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
|
|
125496
|
+
: ts.removeFileExtension(shortest);
|
|
125420
125497
|
}
|
|
125421
125498
|
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
125422
125499
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
@@ -125553,8 +125630,8 @@ var ts;
|
|
|
125553
125630
|
}
|
|
125554
125631
|
}
|
|
125555
125632
|
}
|
|
125556
|
-
function
|
|
125557
|
-
return ts.
|
|
125633
|
+
function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
125634
|
+
return ts.mapDefined(rootDirs, function (rootDir) {
|
|
125558
125635
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
125559
125636
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
125560
125637
|
});
|
|
@@ -145644,7 +145721,7 @@ var ts;
|
|
|
145644
145721
|
return bestMatch;
|
|
145645
145722
|
}
|
|
145646
145723
|
function betterMatch(a, b) {
|
|
145647
|
-
return ts.min(a, b, compareMatches);
|
|
145724
|
+
return ts.min([a, b], compareMatches);
|
|
145648
145725
|
}
|
|
145649
145726
|
function compareMatches(a, b) {
|
|
145650
145727
|
return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */
|