typescript 5.4.0-dev.20240207 → 5.4.0-dev.20240209
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 +19 -14
- package/lib/tsserver.js +71 -30
- package/lib/typescript.js +73 -30
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240209`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -17041,7 +17041,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
|
|
|
17041
17041
|
}
|
|
17042
17042
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
17043
17043
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
17044
|
-
|
|
17044
|
+
const moduleResolutionIsNodeNext = 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */;
|
|
17045
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && moduleResolutionIsNodeNext) {
|
|
17045
17046
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
17046
17047
|
return 2 /* JsExtension */;
|
|
17047
17048
|
}
|
|
@@ -17059,16 +17060,19 @@ function getModuleSpecifierEndingPreference(preference, resolutionMode, compiler
|
|
|
17059
17060
|
return inferPreference();
|
|
17060
17061
|
function inferPreference() {
|
|
17061
17062
|
let usesJsExtensions = false;
|
|
17062
|
-
const specifiers = sourceFile.imports.length ? sourceFile.imports
|
|
17063
|
+
const specifiers = sourceFile.imports.length ? sourceFile.imports : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0]) : emptyArray;
|
|
17063
17064
|
for (const specifier of specifiers) {
|
|
17064
|
-
if (pathIsRelative(specifier)) {
|
|
17065
|
-
if (
|
|
17065
|
+
if (pathIsRelative(specifier.text)) {
|
|
17066
|
+
if (moduleResolutionIsNodeNext && resolutionMode === 1 /* CommonJS */ && getModeForUsageLocation(sourceFile, specifier, compilerOptions) === 99 /* ESNext */) {
|
|
17066
17067
|
continue;
|
|
17067
17068
|
}
|
|
17068
|
-
if (
|
|
17069
|
+
if (fileExtensionIsOneOf(specifier.text, extensionsNotSupportingExtensionlessResolution)) {
|
|
17070
|
+
continue;
|
|
17071
|
+
}
|
|
17072
|
+
if (hasTSFileExtension(specifier.text)) {
|
|
17069
17073
|
return 3 /* TsExtension */;
|
|
17070
17074
|
}
|
|
17071
|
-
if (hasJSFileExtension(specifier)) {
|
|
17075
|
+
if (hasJSFileExtension(specifier.text)) {
|
|
17072
17076
|
usesJsExtensions = true;
|
|
17073
17077
|
}
|
|
17074
17078
|
}
|
|
@@ -42625,11 +42629,12 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
42625
42629
|
}
|
|
42626
42630
|
|
|
42627
42631
|
// src/compiler/moduleSpecifiers.ts
|
|
42628
|
-
function
|
|
42629
|
-
const
|
|
42632
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
42633
|
+
const filePreferredEnding = getPreferredEnding();
|
|
42630
42634
|
return {
|
|
42631
42635
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
42632
42636
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
42637
|
+
const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
42633
42638
|
if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
|
|
42634
42639
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
42635
42640
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
@@ -42654,7 +42659,7 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
42654
42659
|
}
|
|
42655
42660
|
}
|
|
42656
42661
|
};
|
|
42657
|
-
function getPreferredEnding() {
|
|
42662
|
+
function getPreferredEnding(resolutionMode) {
|
|
42658
42663
|
if (oldImportSpecifier !== void 0) {
|
|
42659
42664
|
if (hasJSFileExtension(oldImportSpecifier))
|
|
42660
42665
|
return 2 /* JsExtension */;
|
|
@@ -42663,14 +42668,14 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
42663
42668
|
}
|
|
42664
42669
|
return getModuleSpecifierEndingPreference(
|
|
42665
42670
|
importModuleSpecifierEnding,
|
|
42666
|
-
importingSourceFile.impliedNodeFormat,
|
|
42671
|
+
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
42667
42672
|
compilerOptions,
|
|
42668
42673
|
importingSourceFile
|
|
42669
42674
|
);
|
|
42670
42675
|
}
|
|
42671
42676
|
}
|
|
42672
42677
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
42673
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host,
|
|
42678
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
42674
42679
|
}
|
|
42675
42680
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
42676
42681
|
const info = getInfo(importingSourceFileName, host);
|
|
@@ -42742,7 +42747,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
42742
42747
|
}
|
|
42743
42748
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
42744
42749
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
42745
|
-
const preferences =
|
|
42750
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
42746
42751
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
42747
42752
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
42748
42753
|
(reason) => {
|
|
@@ -43252,7 +43257,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43252
43257
|
if (!parts) {
|
|
43253
43258
|
return void 0;
|
|
43254
43259
|
}
|
|
43255
|
-
const preferences =
|
|
43260
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
43256
43261
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
43257
43262
|
let moduleSpecifier = path;
|
|
43258
43263
|
let isPackageRootPath = false;
|
package/lib/tsserver.js
CHANGED
|
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2340
2340
|
|
|
2341
2341
|
// src/compiler/corePublic.ts
|
|
2342
2342
|
var versionMajorMinor = "5.4";
|
|
2343
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2343
|
+
var version = `${versionMajorMinor}.0-dev.20240209`;
|
|
2344
2344
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2345
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2346
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -21248,7 +21248,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
|
|
|
21248
21248
|
}
|
|
21249
21249
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
21250
21250
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
21251
|
-
|
|
21251
|
+
const moduleResolutionIsNodeNext = 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */;
|
|
21252
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && moduleResolutionIsNodeNext) {
|
|
21252
21253
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
21253
21254
|
return 2 /* JsExtension */;
|
|
21254
21255
|
}
|
|
@@ -21266,16 +21267,19 @@ function getModuleSpecifierEndingPreference(preference, resolutionMode, compiler
|
|
|
21266
21267
|
return inferPreference();
|
|
21267
21268
|
function inferPreference() {
|
|
21268
21269
|
let usesJsExtensions = false;
|
|
21269
|
-
const specifiers = sourceFile.imports.length ? sourceFile.imports
|
|
21270
|
+
const specifiers = sourceFile.imports.length ? sourceFile.imports : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0]) : emptyArray;
|
|
21270
21271
|
for (const specifier of specifiers) {
|
|
21271
|
-
if (pathIsRelative(specifier)) {
|
|
21272
|
-
if (
|
|
21272
|
+
if (pathIsRelative(specifier.text)) {
|
|
21273
|
+
if (moduleResolutionIsNodeNext && resolutionMode === 1 /* CommonJS */ && getModeForUsageLocation(sourceFile, specifier, compilerOptions) === 99 /* ESNext */) {
|
|
21273
21274
|
continue;
|
|
21274
21275
|
}
|
|
21275
|
-
if (
|
|
21276
|
+
if (fileExtensionIsOneOf(specifier.text, extensionsNotSupportingExtensionlessResolution)) {
|
|
21277
|
+
continue;
|
|
21278
|
+
}
|
|
21279
|
+
if (hasTSFileExtension(specifier.text)) {
|
|
21276
21280
|
return 3 /* TsExtension */;
|
|
21277
21281
|
}
|
|
21278
|
-
if (hasJSFileExtension(specifier)) {
|
|
21282
|
+
if (hasJSFileExtension(specifier.text)) {
|
|
21279
21283
|
usesJsExtensions = true;
|
|
21280
21284
|
}
|
|
21281
21285
|
}
|
|
@@ -47317,9 +47321,11 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
47317
47321
|
// src/compiler/_namespaces/ts.moduleSpecifiers.ts
|
|
47318
47322
|
var ts_moduleSpecifiers_exports = {};
|
|
47319
47323
|
__export(ts_moduleSpecifiers_exports, {
|
|
47324
|
+
RelativePreference: () => RelativePreference,
|
|
47320
47325
|
countPathComponents: () => countPathComponents,
|
|
47321
47326
|
forEachFileNameOfModule: () => forEachFileNameOfModule,
|
|
47322
47327
|
getModuleSpecifier: () => getModuleSpecifier,
|
|
47328
|
+
getModuleSpecifierPreferences: () => getModuleSpecifierPreferences,
|
|
47323
47329
|
getModuleSpecifiers: () => getModuleSpecifiers,
|
|
47324
47330
|
getModuleSpecifiersWithCacheInfo: () => getModuleSpecifiersWithCacheInfo,
|
|
47325
47331
|
getNodeModulesPackageName: () => getNodeModulesPackageName,
|
|
@@ -47330,11 +47336,19 @@ __export(ts_moduleSpecifiers_exports, {
|
|
|
47330
47336
|
});
|
|
47331
47337
|
|
|
47332
47338
|
// src/compiler/moduleSpecifiers.ts
|
|
47333
|
-
|
|
47334
|
-
|
|
47339
|
+
var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
|
|
47340
|
+
RelativePreference2[RelativePreference2["Relative"] = 0] = "Relative";
|
|
47341
|
+
RelativePreference2[RelativePreference2["NonRelative"] = 1] = "NonRelative";
|
|
47342
|
+
RelativePreference2[RelativePreference2["Shortest"] = 2] = "Shortest";
|
|
47343
|
+
RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
|
|
47344
|
+
return RelativePreference2;
|
|
47345
|
+
})(RelativePreference || {});
|
|
47346
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
47347
|
+
const filePreferredEnding = getPreferredEnding();
|
|
47335
47348
|
return {
|
|
47336
47349
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
47337
47350
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
47351
|
+
const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
47338
47352
|
if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
|
|
47339
47353
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
47340
47354
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
@@ -47359,7 +47373,7 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
47359
47373
|
}
|
|
47360
47374
|
}
|
|
47361
47375
|
};
|
|
47362
|
-
function getPreferredEnding() {
|
|
47376
|
+
function getPreferredEnding(resolutionMode) {
|
|
47363
47377
|
if (oldImportSpecifier !== void 0) {
|
|
47364
47378
|
if (hasJSFileExtension(oldImportSpecifier))
|
|
47365
47379
|
return 2 /* JsExtension */;
|
|
@@ -47368,20 +47382,20 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
47368
47382
|
}
|
|
47369
47383
|
return getModuleSpecifierEndingPreference(
|
|
47370
47384
|
importModuleSpecifierEnding,
|
|
47371
|
-
importingSourceFile.impliedNodeFormat,
|
|
47385
|
+
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
47372
47386
|
compilerOptions,
|
|
47373
47387
|
importingSourceFile
|
|
47374
47388
|
);
|
|
47375
47389
|
}
|
|
47376
47390
|
}
|
|
47377
47391
|
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
|
|
47378
|
-
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host,
|
|
47392
|
+
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
|
|
47379
47393
|
if (res === oldImportSpecifier)
|
|
47380
47394
|
return void 0;
|
|
47381
47395
|
return res;
|
|
47382
47396
|
}
|
|
47383
47397
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
47384
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host,
|
|
47398
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
47385
47399
|
}
|
|
47386
47400
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
47387
47401
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
@@ -47477,7 +47491,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
47477
47491
|
}
|
|
47478
47492
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
47479
47493
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
47480
|
-
const preferences =
|
|
47494
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
47481
47495
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
47482
47496
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
47483
47497
|
(reason) => {
|
|
@@ -47987,7 +48001,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
47987
48001
|
if (!parts) {
|
|
47988
48002
|
return void 0;
|
|
47989
48003
|
}
|
|
47990
|
-
const preferences =
|
|
48004
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
47991
48005
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
47992
48006
|
let moduleSpecifier = path;
|
|
47993
48007
|
let isPackageRootPath = false;
|
|
@@ -151016,7 +151030,8 @@ function getTypeExportSpecifiers(originExportSpecifier, context) {
|
|
|
151016
151030
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
151017
151031
|
var errorCodes14 = [
|
|
151018
151032
|
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
151019
|
-
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
151033
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code,
|
|
151034
|
+
Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
151020
151035
|
];
|
|
151021
151036
|
var fixId13 = "convertToTypeOnlyImport";
|
|
151022
151037
|
registerCodeFix({
|
|
@@ -152196,7 +152211,7 @@ function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSp
|
|
|
152196
152211
|
}
|
|
152197
152212
|
function isFixPossiblyReExportingImportingFile(fix, importingFile, compilerOptions, toPath3) {
|
|
152198
152213
|
var _a;
|
|
152199
|
-
if (fix.isReExport && ((_a = fix.exportInfo) == null ? void 0 : _a.moduleFileName) &&
|
|
152214
|
+
if (fix.isReExport && ((_a = fix.exportInfo) == null ? void 0 : _a.moduleFileName) && isIndexFileName(fix.exportInfo.moduleFileName)) {
|
|
152200
152215
|
const reExportDir = toPath3(getDirectoryPath(fix.exportInfo.moduleFileName));
|
|
152201
152216
|
return startsWith(importingFile.path, reExportDir);
|
|
152202
152217
|
}
|
|
@@ -163097,7 +163112,13 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
163097
163112
|
if (exclude && comparePaths(filePath, exclude, scriptDirectory, ignoreCase) === 0 /* EqualTo */) {
|
|
163098
163113
|
continue;
|
|
163099
163114
|
}
|
|
163100
|
-
const { name, extension } = getFilenameWithExtensionOption(
|
|
163115
|
+
const { name, extension } = getFilenameWithExtensionOption(
|
|
163116
|
+
getBaseFileName(filePath),
|
|
163117
|
+
host.getCompilationSettings(),
|
|
163118
|
+
extensionOptions,
|
|
163119
|
+
/*isExportsWildcard*/
|
|
163120
|
+
false
|
|
163121
|
+
);
|
|
163101
163122
|
result.add(nameAndKind(name, "script" /* scriptElement */, extension));
|
|
163102
163123
|
}
|
|
163103
163124
|
}
|
|
@@ -163112,7 +163133,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
163112
163133
|
}
|
|
163113
163134
|
return result;
|
|
163114
163135
|
}
|
|
163115
|
-
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions) {
|
|
163136
|
+
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
|
|
163116
163137
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
163117
163138
|
if (nonJsResult) {
|
|
163118
163139
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -163120,15 +163141,22 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions)
|
|
|
163120
163141
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
163121
163142
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
163122
163143
|
}
|
|
163123
|
-
|
|
163124
|
-
|
|
163144
|
+
let allowedEndings = getModuleSpecifierPreferences(
|
|
163145
|
+
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
163146
|
+
compilerOptions,
|
|
163147
|
+
extensionOptions.importingSourceFile
|
|
163148
|
+
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
163149
|
+
if (isExportsWildcard) {
|
|
163150
|
+
allowedEndings = allowedEndings.filter((e) => e !== 0 /* Minimal */ && e !== 1 /* Index */);
|
|
163151
|
+
}
|
|
163152
|
+
if (allowedEndings[0] === 3 /* TsExtension */) {
|
|
163125
163153
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
163126
163154
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
163127
163155
|
}
|
|
163128
163156
|
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
163129
163157
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
163130
163158
|
}
|
|
163131
|
-
if ((
|
|
163159
|
+
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
163132
163160
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
163133
163161
|
}
|
|
163134
163162
|
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
@@ -163143,9 +163171,20 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
|
|
|
163143
163171
|
const lengthB = typeof patternB === "object" ? patternB.prefix.length : b.length;
|
|
163144
163172
|
return compareValues(lengthB, lengthA);
|
|
163145
163173
|
};
|
|
163146
|
-
return addCompletionEntriesFromPathsOrExports(
|
|
163174
|
+
return addCompletionEntriesFromPathsOrExports(
|
|
163175
|
+
result,
|
|
163176
|
+
/*isExports*/
|
|
163177
|
+
false,
|
|
163178
|
+
fragment,
|
|
163179
|
+
baseDirectory,
|
|
163180
|
+
extensionOptions,
|
|
163181
|
+
host,
|
|
163182
|
+
getOwnKeys(paths),
|
|
163183
|
+
getPatternsForKey,
|
|
163184
|
+
comparePaths2
|
|
163185
|
+
);
|
|
163147
163186
|
}
|
|
163148
|
-
function addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
163187
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
163149
163188
|
let pathResults = [];
|
|
163150
163189
|
let matchedPath;
|
|
163151
163190
|
for (const key of keys) {
|
|
@@ -163166,7 +163205,7 @@ function addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory,
|
|
|
163166
163205
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
163167
163206
|
pathResults.push({
|
|
163168
163207
|
matchedPattern: isMatch,
|
|
163169
|
-
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
163208
|
+
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
163170
163209
|
});
|
|
163171
163210
|
}
|
|
163172
163211
|
}
|
|
@@ -163269,6 +163308,8 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
163269
163308
|
const conditions = getConditions(compilerOptions, mode);
|
|
163270
163309
|
addCompletionEntriesFromPathsOrExports(
|
|
163271
163310
|
result,
|
|
163311
|
+
/*isExports*/
|
|
163312
|
+
true,
|
|
163272
163313
|
fragmentSubpath,
|
|
163273
163314
|
packageDirectory,
|
|
163274
163315
|
extensionOptions,
|
|
@@ -163304,7 +163345,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
|
|
|
163304
163345
|
function getFragmentDirectory(fragment) {
|
|
163305
163346
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
163306
163347
|
}
|
|
163307
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, host) {
|
|
163348
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
163308
163349
|
if (!endsWith(path, "*")) {
|
|
163309
163350
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
163310
163351
|
}
|
|
@@ -163314,15 +163355,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
|
|
|
163314
163355
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
163315
163356
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
163316
163357
|
var _a;
|
|
163317
|
-
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
163358
|
+
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
163318
163359
|
});
|
|
163319
163360
|
}
|
|
163320
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, host));
|
|
163361
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
163321
163362
|
function justPathMappingName(name, kind) {
|
|
163322
163363
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
163323
163364
|
}
|
|
163324
163365
|
}
|
|
163325
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, host) {
|
|
163366
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
163326
163367
|
if (!host.readDirectory) {
|
|
163327
163368
|
return void 0;
|
|
163328
163369
|
}
|
|
@@ -163355,7 +163396,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
|
|
|
163355
163396
|
if (containsSlash(trimmedWithPattern)) {
|
|
163356
163397
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
163357
163398
|
}
|
|
163358
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions);
|
|
163399
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
|
|
163359
163400
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
163360
163401
|
}
|
|
163361
163402
|
});
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20240209`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -18245,7 +18245,8 @@ ${lanes.join("\n")}
|
|
|
18245
18245
|
}
|
|
18246
18246
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
18247
18247
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
18248
|
-
|
|
18248
|
+
const moduleResolutionIsNodeNext = 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */;
|
|
18249
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && moduleResolutionIsNodeNext) {
|
|
18249
18250
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
18250
18251
|
return 2 /* JsExtension */;
|
|
18251
18252
|
}
|
|
@@ -18263,16 +18264,19 @@ ${lanes.join("\n")}
|
|
|
18263
18264
|
return inferPreference();
|
|
18264
18265
|
function inferPreference() {
|
|
18265
18266
|
let usesJsExtensions = false;
|
|
18266
|
-
const specifiers = sourceFile.imports.length ? sourceFile.imports
|
|
18267
|
+
const specifiers = sourceFile.imports.length ? sourceFile.imports : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0]) : emptyArray;
|
|
18267
18268
|
for (const specifier of specifiers) {
|
|
18268
|
-
if (pathIsRelative(specifier)) {
|
|
18269
|
-
if (
|
|
18269
|
+
if (pathIsRelative(specifier.text)) {
|
|
18270
|
+
if (moduleResolutionIsNodeNext && resolutionMode === 1 /* CommonJS */ && getModeForUsageLocation(sourceFile, specifier, compilerOptions) === 99 /* ESNext */) {
|
|
18270
18271
|
continue;
|
|
18271
18272
|
}
|
|
18272
|
-
if (
|
|
18273
|
+
if (fileExtensionIsOneOf(specifier.text, extensionsNotSupportingExtensionlessResolution)) {
|
|
18274
|
+
continue;
|
|
18275
|
+
}
|
|
18276
|
+
if (hasTSFileExtension(specifier.text)) {
|
|
18273
18277
|
return 3 /* TsExtension */;
|
|
18274
18278
|
}
|
|
18275
|
-
if (hasJSFileExtension(specifier)) {
|
|
18279
|
+
if (hasJSFileExtension(specifier.text)) {
|
|
18276
18280
|
usesJsExtensions = true;
|
|
18277
18281
|
}
|
|
18278
18282
|
}
|
|
@@ -45183,11 +45187,12 @@ ${lanes.join("\n")}
|
|
|
45183
45187
|
});
|
|
45184
45188
|
|
|
45185
45189
|
// src/compiler/moduleSpecifiers.ts
|
|
45186
|
-
function
|
|
45187
|
-
const
|
|
45190
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
45191
|
+
const filePreferredEnding = getPreferredEnding();
|
|
45188
45192
|
return {
|
|
45189
45193
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
45190
45194
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
45195
|
+
const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
45191
45196
|
if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
|
|
45192
45197
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
45193
45198
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
@@ -45212,7 +45217,7 @@ ${lanes.join("\n")}
|
|
|
45212
45217
|
}
|
|
45213
45218
|
}
|
|
45214
45219
|
};
|
|
45215
|
-
function getPreferredEnding() {
|
|
45220
|
+
function getPreferredEnding(resolutionMode) {
|
|
45216
45221
|
if (oldImportSpecifier !== void 0) {
|
|
45217
45222
|
if (hasJSFileExtension(oldImportSpecifier))
|
|
45218
45223
|
return 2 /* JsExtension */;
|
|
@@ -45221,20 +45226,20 @@ ${lanes.join("\n")}
|
|
|
45221
45226
|
}
|
|
45222
45227
|
return getModuleSpecifierEndingPreference(
|
|
45223
45228
|
importModuleSpecifierEnding,
|
|
45224
|
-
importingSourceFile.impliedNodeFormat,
|
|
45229
|
+
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
45225
45230
|
compilerOptions,
|
|
45226
45231
|
importingSourceFile
|
|
45227
45232
|
);
|
|
45228
45233
|
}
|
|
45229
45234
|
}
|
|
45230
45235
|
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
|
|
45231
|
-
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host,
|
|
45236
|
+
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
|
|
45232
45237
|
if (res === oldImportSpecifier)
|
|
45233
45238
|
return void 0;
|
|
45234
45239
|
return res;
|
|
45235
45240
|
}
|
|
45236
45241
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
45237
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host,
|
|
45242
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
45238
45243
|
}
|
|
45239
45244
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
45240
45245
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
@@ -45330,7 +45335,7 @@ ${lanes.join("\n")}
|
|
|
45330
45335
|
}
|
|
45331
45336
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
45332
45337
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
45333
|
-
const preferences =
|
|
45338
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
45334
45339
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
45335
45340
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
45336
45341
|
(reason) => {
|
|
@@ -45840,7 +45845,7 @@ ${lanes.join("\n")}
|
|
|
45840
45845
|
if (!parts) {
|
|
45841
45846
|
return void 0;
|
|
45842
45847
|
}
|
|
45843
|
-
const preferences =
|
|
45848
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
45844
45849
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
45845
45850
|
let moduleSpecifier = path;
|
|
45846
45851
|
let isPackageRootPath = false;
|
|
@@ -46043,19 +46048,29 @@ ${lanes.join("\n")}
|
|
|
46043
46048
|
function isPathRelativeToParent(path) {
|
|
46044
46049
|
return startsWith(path, "..");
|
|
46045
46050
|
}
|
|
46051
|
+
var RelativePreference;
|
|
46046
46052
|
var init_moduleSpecifiers = __esm({
|
|
46047
46053
|
"src/compiler/moduleSpecifiers.ts"() {
|
|
46048
46054
|
"use strict";
|
|
46049
46055
|
init_ts2();
|
|
46056
|
+
RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
|
|
46057
|
+
RelativePreference2[RelativePreference2["Relative"] = 0] = "Relative";
|
|
46058
|
+
RelativePreference2[RelativePreference2["NonRelative"] = 1] = "NonRelative";
|
|
46059
|
+
RelativePreference2[RelativePreference2["Shortest"] = 2] = "Shortest";
|
|
46060
|
+
RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
|
|
46061
|
+
return RelativePreference2;
|
|
46062
|
+
})(RelativePreference || {});
|
|
46050
46063
|
}
|
|
46051
46064
|
});
|
|
46052
46065
|
|
|
46053
46066
|
// src/compiler/_namespaces/ts.moduleSpecifiers.ts
|
|
46054
46067
|
var ts_moduleSpecifiers_exports = {};
|
|
46055
46068
|
__export(ts_moduleSpecifiers_exports, {
|
|
46069
|
+
RelativePreference: () => RelativePreference,
|
|
46056
46070
|
countPathComponents: () => countPathComponents,
|
|
46057
46071
|
forEachFileNameOfModule: () => forEachFileNameOfModule,
|
|
46058
46072
|
getModuleSpecifier: () => getModuleSpecifier,
|
|
46073
|
+
getModuleSpecifierPreferences: () => getModuleSpecifierPreferences,
|
|
46059
46074
|
getModuleSpecifiers: () => getModuleSpecifiers,
|
|
46060
46075
|
getModuleSpecifiersWithCacheInfo: () => getModuleSpecifiersWithCacheInfo,
|
|
46061
46076
|
getNodeModulesPackageName: () => getNodeModulesPackageName,
|
|
@@ -149870,7 +149885,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149870
149885
|
init_ts_codefix();
|
|
149871
149886
|
errorCodes14 = [
|
|
149872
149887
|
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
149873
|
-
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
149888
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code,
|
|
149889
|
+
Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
149874
149890
|
];
|
|
149875
149891
|
fixId13 = "convertToTypeOnlyImport";
|
|
149876
149892
|
registerCodeFix({
|
|
@@ -150895,7 +150911,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150895
150911
|
}
|
|
150896
150912
|
function isFixPossiblyReExportingImportingFile(fix, importingFile, compilerOptions, toPath3) {
|
|
150897
150913
|
var _a;
|
|
150898
|
-
if (fix.isReExport && ((_a = fix.exportInfo) == null ? void 0 : _a.moduleFileName) &&
|
|
150914
|
+
if (fix.isReExport && ((_a = fix.exportInfo) == null ? void 0 : _a.moduleFileName) && isIndexFileName(fix.exportInfo.moduleFileName)) {
|
|
150899
150915
|
const reExportDir = toPath3(getDirectoryPath(fix.exportInfo.moduleFileName));
|
|
150900
150916
|
return startsWith(importingFile.path, reExportDir);
|
|
150901
150917
|
}
|
|
@@ -162363,7 +162379,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162363
162379
|
if (exclude && comparePaths(filePath, exclude, scriptDirectory, ignoreCase) === 0 /* EqualTo */) {
|
|
162364
162380
|
continue;
|
|
162365
162381
|
}
|
|
162366
|
-
const { name, extension } = getFilenameWithExtensionOption(
|
|
162382
|
+
const { name, extension } = getFilenameWithExtensionOption(
|
|
162383
|
+
getBaseFileName(filePath),
|
|
162384
|
+
host.getCompilationSettings(),
|
|
162385
|
+
extensionOptions,
|
|
162386
|
+
/*isExportsWildcard*/
|
|
162387
|
+
false
|
|
162388
|
+
);
|
|
162367
162389
|
result.add(nameAndKind(name, "script" /* scriptElement */, extension));
|
|
162368
162390
|
}
|
|
162369
162391
|
}
|
|
@@ -162378,7 +162400,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162378
162400
|
}
|
|
162379
162401
|
return result;
|
|
162380
162402
|
}
|
|
162381
|
-
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions) {
|
|
162403
|
+
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
|
|
162382
162404
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
162383
162405
|
if (nonJsResult) {
|
|
162384
162406
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -162386,15 +162408,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162386
162408
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
162387
162409
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
162388
162410
|
}
|
|
162389
|
-
|
|
162390
|
-
|
|
162411
|
+
let allowedEndings = getModuleSpecifierPreferences(
|
|
162412
|
+
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
162413
|
+
compilerOptions,
|
|
162414
|
+
extensionOptions.importingSourceFile
|
|
162415
|
+
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
162416
|
+
if (isExportsWildcard) {
|
|
162417
|
+
allowedEndings = allowedEndings.filter((e) => e !== 0 /* Minimal */ && e !== 1 /* Index */);
|
|
162418
|
+
}
|
|
162419
|
+
if (allowedEndings[0] === 3 /* TsExtension */) {
|
|
162391
162420
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
162392
162421
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
162393
162422
|
}
|
|
162394
162423
|
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
162395
162424
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
162396
162425
|
}
|
|
162397
|
-
if ((
|
|
162426
|
+
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
162398
162427
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
162399
162428
|
}
|
|
162400
162429
|
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
@@ -162409,9 +162438,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162409
162438
|
const lengthB = typeof patternB === "object" ? patternB.prefix.length : b.length;
|
|
162410
162439
|
return compareValues(lengthB, lengthA);
|
|
162411
162440
|
};
|
|
162412
|
-
return addCompletionEntriesFromPathsOrExports(
|
|
162441
|
+
return addCompletionEntriesFromPathsOrExports(
|
|
162442
|
+
result,
|
|
162443
|
+
/*isExports*/
|
|
162444
|
+
false,
|
|
162445
|
+
fragment,
|
|
162446
|
+
baseDirectory,
|
|
162447
|
+
extensionOptions,
|
|
162448
|
+
host,
|
|
162449
|
+
getOwnKeys(paths),
|
|
162450
|
+
getPatternsForKey,
|
|
162451
|
+
comparePaths2
|
|
162452
|
+
);
|
|
162413
162453
|
}
|
|
162414
|
-
function addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
162454
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
162415
162455
|
let pathResults = [];
|
|
162416
162456
|
let matchedPath;
|
|
162417
162457
|
for (const key of keys) {
|
|
@@ -162432,7 +162472,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162432
162472
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
162433
162473
|
pathResults.push({
|
|
162434
162474
|
matchedPattern: isMatch,
|
|
162435
|
-
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
162475
|
+
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
162436
162476
|
});
|
|
162437
162477
|
}
|
|
162438
162478
|
}
|
|
@@ -162535,6 +162575,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162535
162575
|
const conditions = getConditions(compilerOptions, mode);
|
|
162536
162576
|
addCompletionEntriesFromPathsOrExports(
|
|
162537
162577
|
result,
|
|
162578
|
+
/*isExports*/
|
|
162579
|
+
true,
|
|
162538
162580
|
fragmentSubpath,
|
|
162539
162581
|
packageDirectory,
|
|
162540
162582
|
extensionOptions,
|
|
@@ -162570,7 +162612,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162570
162612
|
function getFragmentDirectory(fragment) {
|
|
162571
162613
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
162572
162614
|
}
|
|
162573
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, host) {
|
|
162615
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
162574
162616
|
if (!endsWith(path, "*")) {
|
|
162575
162617
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
162576
162618
|
}
|
|
@@ -162580,15 +162622,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162580
162622
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
162581
162623
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
162582
162624
|
var _a;
|
|
162583
|
-
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
162625
|
+
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
162584
162626
|
});
|
|
162585
162627
|
}
|
|
162586
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, host));
|
|
162628
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
162587
162629
|
function justPathMappingName(name, kind) {
|
|
162588
162630
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
162589
162631
|
}
|
|
162590
162632
|
}
|
|
162591
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, host) {
|
|
162633
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
162592
162634
|
if (!host.readDirectory) {
|
|
162593
162635
|
return void 0;
|
|
162594
162636
|
}
|
|
@@ -162621,7 +162663,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162621
162663
|
if (containsSlash(trimmedWithPattern)) {
|
|
162622
162664
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
162623
162665
|
}
|
|
162624
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions);
|
|
162666
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
|
|
162625
162667
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
162626
162668
|
}
|
|
162627
162669
|
});
|
|
@@ -162765,6 +162807,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162765
162807
|
var init_stringCompletions = __esm({
|
|
162766
162808
|
"src/services/stringCompletions.ts"() {
|
|
162767
162809
|
"use strict";
|
|
162810
|
+
init_moduleSpecifiers();
|
|
162768
162811
|
init_ts4();
|
|
162769
162812
|
init_ts_Completions();
|
|
162770
162813
|
kindPrecedence = {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.4";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20240209`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-dev.
|
|
5
|
+
"version": "5.4.0-dev.20240209",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "c5db0ac0ef57d75ef277a4af6b473e5637d95ca0"
|
|
117
117
|
}
|