typescript 4.8.0-dev.20220728 → 4.8.0-dev.20220729
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 +41 -40
- package/lib/tsserver.js +70 -45
- package/lib/tsserverlibrary.js +70 -45
- package/lib/typescript.js +69 -44
- package/lib/typescriptServices.js +69 -44
- package/lib/typingsInstaller.js +45 -43
- 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.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220729";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -1484,6 +1484,10 @@ var ts;
|
|
|
1484
1484
|
ts.cast = cast;
|
|
1485
1485
|
function noop(_) { }
|
|
1486
1486
|
ts.noop = noop;
|
|
1487
|
+
ts.noopPush = {
|
|
1488
|
+
push: noop,
|
|
1489
|
+
length: 0
|
|
1490
|
+
};
|
|
1487
1491
|
function returnFalse() {
|
|
1488
1492
|
return false;
|
|
1489
1493
|
}
|
|
@@ -5945,6 +5949,7 @@ var ts;
|
|
|
5945
5949
|
Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."),
|
|
5946
5950
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
5947
5951
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
5952
|
+
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, ts.DiagnosticCategory.Error, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
5948
5953
|
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),
|
|
5949
5954
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
5950
5955
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
@@ -35246,18 +35251,7 @@ var ts;
|
|
|
35246
35251
|
NodeResolutionFeatures.None;
|
|
35247
35252
|
}
|
|
35248
35253
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
35249
|
-
var moduleResolutionState =
|
|
35250
|
-
compilerOptions: options,
|
|
35251
|
-
host: host,
|
|
35252
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
35253
|
-
failedLookupLocations: [],
|
|
35254
|
-
affectingLocations: [],
|
|
35255
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
35256
|
-
conditions: ts.emptyArray,
|
|
35257
|
-
features: NodeResolutionFeatures.None,
|
|
35258
|
-
requestContainingDirectory: containingDirectory,
|
|
35259
|
-
reportDiagnostic: ts.noop
|
|
35260
|
-
};
|
|
35254
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
35261
35255
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
35262
35256
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
35263
35257
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -36057,18 +36051,9 @@ var ts;
|
|
|
36057
36051
|
var entrypoints;
|
|
36058
36052
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
36059
36053
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
36060
|
-
var requireState =
|
|
36061
|
-
|
|
36062
|
-
|
|
36063
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
36064
|
-
failedLookupLocations: [],
|
|
36065
|
-
affectingLocations: [],
|
|
36066
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
36067
|
-
conditions: ["node", "require", "types"],
|
|
36068
|
-
features: features,
|
|
36069
|
-
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
36070
|
-
reportDiagnostic: ts.noop
|
|
36071
|
-
};
|
|
36054
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
36055
|
+
requireState.conditions = ["node", "require", "types"];
|
|
36056
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
36072
36057
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
36073
36058
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
36074
36059
|
if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
|
|
@@ -36138,19 +36123,22 @@ var ts;
|
|
|
36138
36123
|
}
|
|
36139
36124
|
}
|
|
36140
36125
|
}
|
|
36141
|
-
function
|
|
36142
|
-
|
|
36126
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
36127
|
+
return {
|
|
36143
36128
|
host: host,
|
|
36144
36129
|
compilerOptions: options,
|
|
36145
36130
|
traceEnabled: isTraceEnabled(options, host),
|
|
36146
|
-
failedLookupLocations:
|
|
36147
|
-
affectingLocations:
|
|
36131
|
+
failedLookupLocations: ts.noopPush,
|
|
36132
|
+
affectingLocations: ts.noopPush,
|
|
36148
36133
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
36149
|
-
features:
|
|
36150
|
-
conditions:
|
|
36134
|
+
features: NodeResolutionFeatures.None,
|
|
36135
|
+
conditions: ts.emptyArray,
|
|
36151
36136
|
requestContainingDirectory: undefined,
|
|
36152
36137
|
reportDiagnostic: ts.noop
|
|
36153
36138
|
};
|
|
36139
|
+
}
|
|
36140
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
36141
|
+
function getPackageScopeForPath(fileName, state) {
|
|
36154
36142
|
var parts = ts.getPathComponents(fileName);
|
|
36155
36143
|
parts.pop();
|
|
36156
36144
|
while (parts.length > 0) {
|
|
@@ -36307,7 +36295,7 @@ var ts;
|
|
|
36307
36295
|
var _a, _b;
|
|
36308
36296
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36309
36297
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
36310
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
36298
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36311
36299
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
36312
36300
|
return undefined;
|
|
36313
36301
|
}
|
|
@@ -36366,7 +36354,7 @@ var ts;
|
|
|
36366
36354
|
}
|
|
36367
36355
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36368
36356
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
36369
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
36357
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36370
36358
|
if (!scope) {
|
|
36371
36359
|
if (state.traceEnabled) {
|
|
36372
36360
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -43559,6 +43547,12 @@ var ts;
|
|
|
43559
43547
|
return context.truncating = context.approximateLength > ((context.flags & 1) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
43560
43548
|
}
|
|
43561
43549
|
function typeToTypeNodeHelper(type, context) {
|
|
43550
|
+
var savedFlags = context.flags;
|
|
43551
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
43552
|
+
context.flags = savedFlags;
|
|
43553
|
+
return typeNode;
|
|
43554
|
+
}
|
|
43555
|
+
function typeToTypeNodeWorker(type, context) {
|
|
43562
43556
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
43563
43557
|
cancellationToken.throwIfCancellationRequested();
|
|
43564
43558
|
}
|
|
@@ -52082,21 +52076,28 @@ var ts;
|
|
|
52082
52076
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
52083
52077
|
propType;
|
|
52084
52078
|
}
|
|
52085
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
52079
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
52080
|
+
var index = +propName;
|
|
52086
52081
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16)) {
|
|
52087
52082
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
52088
52083
|
if (isTupleType(objectType)) {
|
|
52084
|
+
if (index < 0) {
|
|
52085
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
52086
|
+
return undefinedType;
|
|
52087
|
+
}
|
|
52089
52088
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
52090
52089
|
}
|
|
52091
52090
|
else {
|
|
52092
52091
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
52093
52092
|
}
|
|
52094
52093
|
}
|
|
52095
|
-
|
|
52096
|
-
|
|
52097
|
-
|
|
52098
|
-
|
|
52099
|
-
|
|
52094
|
+
if (index >= 0) {
|
|
52095
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
52096
|
+
return mapType(objectType, function (t) {
|
|
52097
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
52098
|
+
return accessFlags & 1 ? getUnionType([restType, undefinedType]) : restType;
|
|
52099
|
+
});
|
|
52100
|
+
}
|
|
52100
52101
|
}
|
|
52101
52102
|
}
|
|
52102
52103
|
if (!(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 402653316 | 296 | 12288)) {
|
|
@@ -97290,7 +97291,7 @@ var ts;
|
|
|
97290
97291
|
return undefined;
|
|
97291
97292
|
}
|
|
97292
97293
|
function lookupFromPackageJson() {
|
|
97293
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
97294
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
97294
97295
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97295
97296
|
}
|
|
97296
97297
|
}
|
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 = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220729";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -1710,6 +1710,10 @@ var ts;
|
|
|
1710
1710
|
/** Does nothing. */
|
|
1711
1711
|
function noop(_) { }
|
|
1712
1712
|
ts.noop = noop;
|
|
1713
|
+
ts.noopPush = {
|
|
1714
|
+
push: noop,
|
|
1715
|
+
length: 0
|
|
1716
|
+
};
|
|
1713
1717
|
/** Do nothing and return false */
|
|
1714
1718
|
function returnFalse() {
|
|
1715
1719
|
return false;
|
|
@@ -8791,6 +8795,7 @@ var ts;
|
|
|
8791
8795
|
Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."),
|
|
8792
8796
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
8793
8797
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
8798
|
+
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, ts.DiagnosticCategory.Error, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
8794
8799
|
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),
|
|
8795
8800
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
8796
8801
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
@@ -43145,18 +43150,7 @@ var ts;
|
|
|
43145
43150
|
* Does not try `@types/${packageName}` - use a second pass if needed.
|
|
43146
43151
|
*/
|
|
43147
43152
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
43148
|
-
var moduleResolutionState =
|
|
43149
|
-
compilerOptions: options,
|
|
43150
|
-
host: host,
|
|
43151
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
43152
|
-
failedLookupLocations: [],
|
|
43153
|
-
affectingLocations: [],
|
|
43154
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43155
|
-
conditions: ts.emptyArray,
|
|
43156
|
-
features: NodeResolutionFeatures.None,
|
|
43157
|
-
requestContainingDirectory: containingDirectory,
|
|
43158
|
-
reportDiagnostic: ts.noop
|
|
43159
|
-
};
|
|
43153
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
43160
43154
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
43161
43155
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
43162
43156
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -44116,18 +44110,9 @@ var ts;
|
|
|
44116
44110
|
var entrypoints;
|
|
44117
44111
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
44118
44112
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
44119
|
-
var requireState =
|
|
44120
|
-
|
|
44121
|
-
|
|
44122
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
44123
|
-
failedLookupLocations: [],
|
|
44124
|
-
affectingLocations: [],
|
|
44125
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
44126
|
-
conditions: ["node", "require", "types"],
|
|
44127
|
-
features: features,
|
|
44128
|
-
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
44129
|
-
reportDiagnostic: ts.noop
|
|
44130
|
-
};
|
|
44113
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
44114
|
+
requireState.conditions = ["node", "require", "types"];
|
|
44115
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
44131
44116
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
44132
44117
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
44133
44118
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -44200,23 +44185,27 @@ var ts;
|
|
|
44200
44185
|
}
|
|
44201
44186
|
}
|
|
44202
44187
|
}
|
|
44203
|
-
/**
|
|
44204
|
-
* A function for locating the package.json scope for a given path
|
|
44205
|
-
*/
|
|
44206
44188
|
/*@internal*/
|
|
44207
|
-
function
|
|
44208
|
-
|
|
44189
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
44190
|
+
return {
|
|
44209
44191
|
host: host,
|
|
44210
44192
|
compilerOptions: options,
|
|
44211
44193
|
traceEnabled: isTraceEnabled(options, host),
|
|
44212
|
-
failedLookupLocations:
|
|
44213
|
-
affectingLocations:
|
|
44194
|
+
failedLookupLocations: ts.noopPush,
|
|
44195
|
+
affectingLocations: ts.noopPush,
|
|
44214
44196
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
44215
|
-
features:
|
|
44216
|
-
conditions:
|
|
44197
|
+
features: NodeResolutionFeatures.None,
|
|
44198
|
+
conditions: ts.emptyArray,
|
|
44217
44199
|
requestContainingDirectory: undefined,
|
|
44218
44200
|
reportDiagnostic: ts.noop
|
|
44219
44201
|
};
|
|
44202
|
+
}
|
|
44203
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
44204
|
+
/**
|
|
44205
|
+
* A function for locating the package.json scope for a given path
|
|
44206
|
+
*/
|
|
44207
|
+
/*@internal*/
|
|
44208
|
+
function getPackageScopeForPath(fileName, state) {
|
|
44220
44209
|
var parts = ts.getPathComponents(fileName);
|
|
44221
44210
|
parts.pop();
|
|
44222
44211
|
while (parts.length > 0) {
|
|
@@ -44387,7 +44376,7 @@ var ts;
|
|
|
44387
44376
|
var _a, _b;
|
|
44388
44377
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44389
44378
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44390
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44379
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44391
44380
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
44392
44381
|
return undefined;
|
|
44393
44382
|
}
|
|
@@ -44446,7 +44435,7 @@ var ts;
|
|
|
44446
44435
|
}
|
|
44447
44436
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44448
44437
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44449
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44438
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44450
44439
|
if (!scope) {
|
|
44451
44440
|
if (state.traceEnabled) {
|
|
44452
44441
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -52906,6 +52895,12 @@ var ts;
|
|
|
52906
52895
|
return context.truncating = context.approximateLength > ((context.flags & 1 /* NoTruncation */) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
52907
52896
|
}
|
|
52908
52897
|
function typeToTypeNodeHelper(type, context) {
|
|
52898
|
+
var savedFlags = context.flags;
|
|
52899
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
52900
|
+
context.flags = savedFlags;
|
|
52901
|
+
return typeNode;
|
|
52902
|
+
}
|
|
52903
|
+
function typeToTypeNodeWorker(type, context) {
|
|
52909
52904
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
52910
52905
|
cancellationToken.throwIfCancellationRequested();
|
|
52911
52906
|
}
|
|
@@ -62644,21 +62639,28 @@ var ts;
|
|
|
62644
62639
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
62645
62640
|
propType;
|
|
62646
62641
|
}
|
|
62647
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
62642
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
62643
|
+
var index = +propName;
|
|
62648
62644
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
62649
62645
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
62650
62646
|
if (isTupleType(objectType)) {
|
|
62647
|
+
if (index < 0) {
|
|
62648
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
62649
|
+
return undefinedType;
|
|
62650
|
+
}
|
|
62651
62651
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
62652
62652
|
}
|
|
62653
62653
|
else {
|
|
62654
62654
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
62655
62655
|
}
|
|
62656
62656
|
}
|
|
62657
|
-
|
|
62658
|
-
|
|
62659
|
-
|
|
62660
|
-
|
|
62661
|
-
|
|
62657
|
+
if (index >= 0) {
|
|
62658
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
62659
|
+
return mapType(objectType, function (t) {
|
|
62660
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
62661
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, undefinedType]) : restType;
|
|
62662
|
+
});
|
|
62663
|
+
}
|
|
62662
62664
|
}
|
|
62663
62665
|
}
|
|
62664
62666
|
if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
|
|
@@ -117669,7 +117671,7 @@ var ts;
|
|
|
117669
117671
|
return undefined;
|
|
117670
117672
|
}
|
|
117671
117673
|
function lookupFromPackageJson() {
|
|
117672
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
117674
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
117673
117675
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117674
117676
|
}
|
|
117675
117677
|
}
|
|
@@ -148632,6 +148634,7 @@ var ts;
|
|
|
148632
148634
|
var options = _a.options, getRules = _a.getRules, host = _a.host;
|
|
148633
148635
|
// formatting context is used by rules provider
|
|
148634
148636
|
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
|
|
148637
|
+
var previousRangeTriviaEnd;
|
|
148635
148638
|
var previousRange;
|
|
148636
148639
|
var previousParent;
|
|
148637
148640
|
var previousRangeStartLine;
|
|
@@ -148660,10 +148663,30 @@ var ts;
|
|
|
148660
148663
|
}
|
|
148661
148664
|
}
|
|
148662
148665
|
if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
|
|
148666
|
+
// Formatting edits happen by looking at pairs of contiguous tokens (see `processPair`),
|
|
148667
|
+
// typically inserting or deleting whitespace between them. The recursive `processNode`
|
|
148668
|
+
// logic above bails out as soon as it encounters a token that is beyond the end of the
|
|
148669
|
+
// range we're supposed to format (or if we reach the end of the file). But this potentially
|
|
148670
|
+
// leaves out an edit that would occur *inside* the requested range but cannot be discovered
|
|
148671
|
+
// without looking at one token *beyond* the end of the range: consider the line `x = { }`
|
|
148672
|
+
// with a selection from the beginning of the line to the space inside the curly braces,
|
|
148673
|
+
// inclusive. We would expect a format-selection would delete the space (if rules apply),
|
|
148674
|
+
// but in order to do that, we need to process the pair ["{", "}"], but we stopped processing
|
|
148675
|
+
// just before getting there. This block handles this trailing edit.
|
|
148663
148676
|
var tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
148664
148677
|
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
148665
148678
|
undefined;
|
|
148666
|
-
if (tokenInfo) {
|
|
148679
|
+
if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) {
|
|
148680
|
+
// We need to check that tokenInfo and previousRange are contiguous: the `originalRange`
|
|
148681
|
+
// may have ended in the middle of a token, which means we will have stopped formatting
|
|
148682
|
+
// on that token, leaving `previousRange` pointing to the token before it, but already
|
|
148683
|
+
// having moved the formatting scanner (where we just got `tokenInfo`) to the next token.
|
|
148684
|
+
// If this happens, our supposed pair [previousRange, tokenInfo] actually straddles the
|
|
148685
|
+
// token that intersects the end of the range we're supposed to format, so the pair will
|
|
148686
|
+
// produce bogus edits if we try to `processPair`. Recall that the point of this logic is
|
|
148687
|
+
// to perform a trailing edit at the end of the selection range: but there can be no valid
|
|
148688
|
+
// edit in the middle of a token where the range ended, so if we have a non-contiguous
|
|
148689
|
+
// pair here, we're already done and we can ignore it.
|
|
148667
148690
|
var parent = ((_b = ts.findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) === null || _b === void 0 ? void 0 : _b.parent) || previousParent;
|
|
148668
148691
|
processPair(tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, parent, previousRange, previousRangeStartLine, previousParent, parent,
|
|
148669
148692
|
/*dynamicIndentation*/ undefined);
|
|
@@ -149021,6 +149044,7 @@ var ts;
|
|
|
149021
149044
|
}
|
|
149022
149045
|
}
|
|
149023
149046
|
if (currentTokenInfo.trailingTrivia) {
|
|
149047
|
+
previousRangeTriviaEnd = ts.last(currentTokenInfo.trailingTrivia).end;
|
|
149024
149048
|
processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
|
|
149025
149049
|
}
|
|
149026
149050
|
if (indentToken) {
|
|
@@ -149091,6 +149115,7 @@ var ts;
|
|
|
149091
149115
|
}
|
|
149092
149116
|
}
|
|
149093
149117
|
previousRange = range;
|
|
149118
|
+
previousRangeTriviaEnd = range.end;
|
|
149094
149119
|
previousParent = parent;
|
|
149095
149120
|
previousRangeStartLine = rangeStart.line;
|
|
149096
149121
|
return lineAction;
|
|
@@ -178440,7 +178465,7 @@ var ts;
|
|
|
178440
178465
|
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
178441
178466
|
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
178442
178467
|
var compilerOptions = project.getCompilationSettings();
|
|
178443
|
-
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
178468
|
+
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
178444
178469
|
if (!packageJson)
|
|
178445
178470
|
return undefined;
|
|
178446
178471
|
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|