@typescript-deploys/pr-build 5.4.0-pr-56594-3 → 5.4.0-pr-57341-6
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 +24 -14
- package/lib/tsserver.js +72 -29
- package/lib/typescript.js +74 -29
- 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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240208`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -12929,6 +12929,9 @@ function isObjectLiteralOrClassExpressionMethodOrAccessor(node) {
|
|
|
12929
12929
|
function isIdentifierTypePredicate(predicate) {
|
|
12930
12930
|
return predicate && predicate.kind === 1 /* Identifier */;
|
|
12931
12931
|
}
|
|
12932
|
+
function isThisTypePredicate(predicate) {
|
|
12933
|
+
return predicate && predicate.kind === 0 /* This */;
|
|
12934
|
+
}
|
|
12932
12935
|
function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
12933
12936
|
return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
|
|
12934
12937
|
if (!isPropertyAssignment(property))
|
|
@@ -17041,7 +17044,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
|
|
|
17041
17044
|
}
|
|
17042
17045
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
17043
17046
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
17044
|
-
|
|
17047
|
+
const moduleResolutionIsNodeNext = 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */;
|
|
17048
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && moduleResolutionIsNodeNext) {
|
|
17045
17049
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
17046
17050
|
return 2 /* JsExtension */;
|
|
17047
17051
|
}
|
|
@@ -17059,16 +17063,19 @@ function getModuleSpecifierEndingPreference(preference, resolutionMode, compiler
|
|
|
17059
17063
|
return inferPreference();
|
|
17060
17064
|
function inferPreference() {
|
|
17061
17065
|
let usesJsExtensions = false;
|
|
17062
|
-
const specifiers = sourceFile.imports.length ? sourceFile.imports
|
|
17066
|
+
const specifiers = sourceFile.imports.length ? sourceFile.imports : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0]) : emptyArray;
|
|
17063
17067
|
for (const specifier of specifiers) {
|
|
17064
|
-
if (pathIsRelative(specifier)) {
|
|
17065
|
-
if (
|
|
17068
|
+
if (pathIsRelative(specifier.text)) {
|
|
17069
|
+
if (moduleResolutionIsNodeNext && resolutionMode === 1 /* CommonJS */ && getModeForUsageLocation(sourceFile, specifier, compilerOptions) === 99 /* ESNext */) {
|
|
17070
|
+
continue;
|
|
17071
|
+
}
|
|
17072
|
+
if (fileExtensionIsOneOf(specifier.text, extensionsNotSupportingExtensionlessResolution)) {
|
|
17066
17073
|
continue;
|
|
17067
17074
|
}
|
|
17068
|
-
if (hasTSFileExtension(specifier)) {
|
|
17075
|
+
if (hasTSFileExtension(specifier.text)) {
|
|
17069
17076
|
return 3 /* TsExtension */;
|
|
17070
17077
|
}
|
|
17071
|
-
if (hasJSFileExtension(specifier)) {
|
|
17078
|
+
if (hasJSFileExtension(specifier.text)) {
|
|
17072
17079
|
usesJsExtensions = true;
|
|
17073
17080
|
}
|
|
17074
17081
|
}
|
|
@@ -42625,11 +42632,12 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
42625
42632
|
}
|
|
42626
42633
|
|
|
42627
42634
|
// src/compiler/moduleSpecifiers.ts
|
|
42628
|
-
function
|
|
42629
|
-
const
|
|
42635
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
42636
|
+
const filePreferredEnding = getPreferredEnding();
|
|
42630
42637
|
return {
|
|
42631
42638
|
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
42639
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
42640
|
+
const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
42633
42641
|
if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
|
|
42634
42642
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
42635
42643
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
@@ -42654,7 +42662,7 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
42654
42662
|
}
|
|
42655
42663
|
}
|
|
42656
42664
|
};
|
|
42657
|
-
function getPreferredEnding() {
|
|
42665
|
+
function getPreferredEnding(resolutionMode) {
|
|
42658
42666
|
if (oldImportSpecifier !== void 0) {
|
|
42659
42667
|
if (hasJSFileExtension(oldImportSpecifier))
|
|
42660
42668
|
return 2 /* JsExtension */;
|
|
@@ -42663,14 +42671,14 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
|
|
|
42663
42671
|
}
|
|
42664
42672
|
return getModuleSpecifierEndingPreference(
|
|
42665
42673
|
importModuleSpecifierEnding,
|
|
42666
|
-
importingSourceFile.impliedNodeFormat,
|
|
42674
|
+
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
42667
42675
|
compilerOptions,
|
|
42668
42676
|
importingSourceFile
|
|
42669
42677
|
);
|
|
42670
42678
|
}
|
|
42671
42679
|
}
|
|
42672
42680
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
42673
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host,
|
|
42681
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
42674
42682
|
}
|
|
42675
42683
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
42676
42684
|
const info = getInfo(importingSourceFileName, host);
|
|
@@ -42742,7 +42750,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
42742
42750
|
}
|
|
42743
42751
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
42744
42752
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
42745
|
-
const preferences =
|
|
42753
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
42746
42754
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
42747
42755
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
42748
42756
|
(reason) => {
|
|
@@ -43252,7 +43260,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43252
43260
|
if (!parts) {
|
|
43253
43261
|
return void 0;
|
|
43254
43262
|
}
|
|
43255
|
-
const preferences =
|
|
43263
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
43256
43264
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
43257
43265
|
let moduleSpecifier = path;
|
|
43258
43266
|
let isPackageRootPath = false;
|
|
@@ -60704,6 +60712,8 @@ function createTypeChecker(host) {
|
|
|
60704
60712
|
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
|
|
60705
60713
|
}
|
|
60706
60714
|
return 0 /* False */;
|
|
60715
|
+
} else if (isThisTypePredicate(targetTypePredicate)) {
|
|
60716
|
+
result &= compareTypes(sourceReturnType, targetReturnType, reportErrors2);
|
|
60707
60717
|
}
|
|
60708
60718
|
} else {
|
|
60709
60719
|
result &= checkMode & 1 /* BivariantCallback */ && compareTypes(
|
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-insiders.
|
|
2343
|
+
var version = `${versionMajorMinor}.0-insiders.20240208`;
|
|
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;
|
|
@@ -65439,6 +65453,8 @@ function createTypeChecker(host) {
|
|
|
65439
65453
|
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
|
|
65440
65454
|
}
|
|
65441
65455
|
return 0 /* False */;
|
|
65456
|
+
} else if (isThisTypePredicate(targetTypePredicate)) {
|
|
65457
|
+
result &= compareTypes(sourceReturnType, targetReturnType, reportErrors2);
|
|
65442
65458
|
}
|
|
65443
65459
|
} else {
|
|
65444
65460
|
result &= checkMode & 1 /* BivariantCallback */ && compareTypes(
|
|
@@ -151016,7 +151032,8 @@ function getTypeExportSpecifiers(originExportSpecifier, context) {
|
|
|
151016
151032
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
151017
151033
|
var errorCodes14 = [
|
|
151018
151034
|
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
|
|
151035
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code,
|
|
151036
|
+
Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
151020
151037
|
];
|
|
151021
151038
|
var fixId13 = "convertToTypeOnlyImport";
|
|
151022
151039
|
registerCodeFix({
|
|
@@ -163097,7 +163114,13 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
163097
163114
|
if (exclude && comparePaths(filePath, exclude, scriptDirectory, ignoreCase) === 0 /* EqualTo */) {
|
|
163098
163115
|
continue;
|
|
163099
163116
|
}
|
|
163100
|
-
const { name, extension } = getFilenameWithExtensionOption(
|
|
163117
|
+
const { name, extension } = getFilenameWithExtensionOption(
|
|
163118
|
+
getBaseFileName(filePath),
|
|
163119
|
+
host.getCompilationSettings(),
|
|
163120
|
+
extensionOptions,
|
|
163121
|
+
/*isExportsWildcard*/
|
|
163122
|
+
false
|
|
163123
|
+
);
|
|
163101
163124
|
result.add(nameAndKind(name, "script" /* scriptElement */, extension));
|
|
163102
163125
|
}
|
|
163103
163126
|
}
|
|
@@ -163112,7 +163135,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
163112
163135
|
}
|
|
163113
163136
|
return result;
|
|
163114
163137
|
}
|
|
163115
|
-
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions) {
|
|
163138
|
+
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
|
|
163116
163139
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
163117
163140
|
if (nonJsResult) {
|
|
163118
163141
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -163120,15 +163143,22 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions)
|
|
|
163120
163143
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
163121
163144
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
163122
163145
|
}
|
|
163123
|
-
|
|
163124
|
-
|
|
163146
|
+
let allowedEndings = getModuleSpecifierPreferences(
|
|
163147
|
+
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
163148
|
+
compilerOptions,
|
|
163149
|
+
extensionOptions.importingSourceFile
|
|
163150
|
+
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
163151
|
+
if (isExportsWildcard) {
|
|
163152
|
+
allowedEndings = allowedEndings.filter((e) => e !== 0 /* Minimal */ && e !== 1 /* Index */);
|
|
163153
|
+
}
|
|
163154
|
+
if (allowedEndings[0] === 3 /* TsExtension */) {
|
|
163125
163155
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
163126
163156
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
163127
163157
|
}
|
|
163128
163158
|
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
163129
163159
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
163130
163160
|
}
|
|
163131
|
-
if ((
|
|
163161
|
+
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
163132
163162
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
163133
163163
|
}
|
|
163134
163164
|
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
@@ -163143,9 +163173,20 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
|
|
|
163143
163173
|
const lengthB = typeof patternB === "object" ? patternB.prefix.length : b.length;
|
|
163144
163174
|
return compareValues(lengthB, lengthA);
|
|
163145
163175
|
};
|
|
163146
|
-
return addCompletionEntriesFromPathsOrExports(
|
|
163176
|
+
return addCompletionEntriesFromPathsOrExports(
|
|
163177
|
+
result,
|
|
163178
|
+
/*isExports*/
|
|
163179
|
+
false,
|
|
163180
|
+
fragment,
|
|
163181
|
+
baseDirectory,
|
|
163182
|
+
extensionOptions,
|
|
163183
|
+
host,
|
|
163184
|
+
getOwnKeys(paths),
|
|
163185
|
+
getPatternsForKey,
|
|
163186
|
+
comparePaths2
|
|
163187
|
+
);
|
|
163147
163188
|
}
|
|
163148
|
-
function addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
163189
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
163149
163190
|
let pathResults = [];
|
|
163150
163191
|
let matchedPath;
|
|
163151
163192
|
for (const key of keys) {
|
|
@@ -163166,7 +163207,7 @@ function addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory,
|
|
|
163166
163207
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
163167
163208
|
pathResults.push({
|
|
163168
163209
|
matchedPattern: isMatch,
|
|
163169
|
-
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
163210
|
+
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
163170
163211
|
});
|
|
163171
163212
|
}
|
|
163172
163213
|
}
|
|
@@ -163269,6 +163310,8 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
163269
163310
|
const conditions = getConditions(compilerOptions, mode);
|
|
163270
163311
|
addCompletionEntriesFromPathsOrExports(
|
|
163271
163312
|
result,
|
|
163313
|
+
/*isExports*/
|
|
163314
|
+
true,
|
|
163272
163315
|
fragmentSubpath,
|
|
163273
163316
|
packageDirectory,
|
|
163274
163317
|
extensionOptions,
|
|
@@ -163304,7 +163347,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
|
|
|
163304
163347
|
function getFragmentDirectory(fragment) {
|
|
163305
163348
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
163306
163349
|
}
|
|
163307
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, host) {
|
|
163350
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
163308
163351
|
if (!endsWith(path, "*")) {
|
|
163309
163352
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
163310
163353
|
}
|
|
@@ -163314,15 +163357,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
|
|
|
163314
163357
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
163315
163358
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
163316
163359
|
var _a;
|
|
163317
|
-
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
163360
|
+
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
163318
163361
|
});
|
|
163319
163362
|
}
|
|
163320
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, host));
|
|
163363
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
163321
163364
|
function justPathMappingName(name, kind) {
|
|
163322
163365
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
163323
163366
|
}
|
|
163324
163367
|
}
|
|
163325
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, host) {
|
|
163368
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
163326
163369
|
if (!host.readDirectory) {
|
|
163327
163370
|
return void 0;
|
|
163328
163371
|
}
|
|
@@ -163355,7 +163398,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
|
|
|
163355
163398
|
if (containsSlash(trimmedWithPattern)) {
|
|
163356
163399
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
163357
163400
|
}
|
|
163358
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions);
|
|
163401
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
|
|
163359
163402
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
163360
163403
|
}
|
|
163361
163404
|
});
|
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-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20240208`;
|
|
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,
|
|
@@ -63193,6 +63208,8 @@ ${lanes.join("\n")}
|
|
|
63193
63208
|
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
|
|
63194
63209
|
}
|
|
63195
63210
|
return 0 /* False */;
|
|
63211
|
+
} else if (isThisTypePredicate(targetTypePredicate)) {
|
|
63212
|
+
result &= compareTypes(sourceReturnType, targetReturnType, reportErrors2);
|
|
63196
63213
|
}
|
|
63197
63214
|
} else {
|
|
63198
63215
|
result &= checkMode & 1 /* BivariantCallback */ && compareTypes(
|
|
@@ -149870,7 +149887,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149870
149887
|
init_ts_codefix();
|
|
149871
149888
|
errorCodes14 = [
|
|
149872
149889
|
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
|
|
149890
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code,
|
|
149891
|
+
Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
149874
149892
|
];
|
|
149875
149893
|
fixId13 = "convertToTypeOnlyImport";
|
|
149876
149894
|
registerCodeFix({
|
|
@@ -162363,7 +162381,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162363
162381
|
if (exclude && comparePaths(filePath, exclude, scriptDirectory, ignoreCase) === 0 /* EqualTo */) {
|
|
162364
162382
|
continue;
|
|
162365
162383
|
}
|
|
162366
|
-
const { name, extension } = getFilenameWithExtensionOption(
|
|
162384
|
+
const { name, extension } = getFilenameWithExtensionOption(
|
|
162385
|
+
getBaseFileName(filePath),
|
|
162386
|
+
host.getCompilationSettings(),
|
|
162387
|
+
extensionOptions,
|
|
162388
|
+
/*isExportsWildcard*/
|
|
162389
|
+
false
|
|
162390
|
+
);
|
|
162367
162391
|
result.add(nameAndKind(name, "script" /* scriptElement */, extension));
|
|
162368
162392
|
}
|
|
162369
162393
|
}
|
|
@@ -162378,7 +162402,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162378
162402
|
}
|
|
162379
162403
|
return result;
|
|
162380
162404
|
}
|
|
162381
|
-
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions) {
|
|
162405
|
+
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
|
|
162382
162406
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
162383
162407
|
if (nonJsResult) {
|
|
162384
162408
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -162386,15 +162410,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162386
162410
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
162387
162411
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
162388
162412
|
}
|
|
162389
|
-
|
|
162390
|
-
|
|
162413
|
+
let allowedEndings = getModuleSpecifierPreferences(
|
|
162414
|
+
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
162415
|
+
compilerOptions,
|
|
162416
|
+
extensionOptions.importingSourceFile
|
|
162417
|
+
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
162418
|
+
if (isExportsWildcard) {
|
|
162419
|
+
allowedEndings = allowedEndings.filter((e) => e !== 0 /* Minimal */ && e !== 1 /* Index */);
|
|
162420
|
+
}
|
|
162421
|
+
if (allowedEndings[0] === 3 /* TsExtension */) {
|
|
162391
162422
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
162392
162423
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
162393
162424
|
}
|
|
162394
162425
|
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
162395
162426
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
162396
162427
|
}
|
|
162397
|
-
if ((
|
|
162428
|
+
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
162398
162429
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
162399
162430
|
}
|
|
162400
162431
|
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
|
|
@@ -162409,9 +162440,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162409
162440
|
const lengthB = typeof patternB === "object" ? patternB.prefix.length : b.length;
|
|
162410
162441
|
return compareValues(lengthB, lengthA);
|
|
162411
162442
|
};
|
|
162412
|
-
return addCompletionEntriesFromPathsOrExports(
|
|
162443
|
+
return addCompletionEntriesFromPathsOrExports(
|
|
162444
|
+
result,
|
|
162445
|
+
/*isExports*/
|
|
162446
|
+
false,
|
|
162447
|
+
fragment,
|
|
162448
|
+
baseDirectory,
|
|
162449
|
+
extensionOptions,
|
|
162450
|
+
host,
|
|
162451
|
+
getOwnKeys(paths),
|
|
162452
|
+
getPatternsForKey,
|
|
162453
|
+
comparePaths2
|
|
162454
|
+
);
|
|
162413
162455
|
}
|
|
162414
|
-
function addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
162456
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
162415
162457
|
let pathResults = [];
|
|
162416
162458
|
let matchedPath;
|
|
162417
162459
|
for (const key of keys) {
|
|
@@ -162432,7 +162474,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162432
162474
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
162433
162475
|
pathResults.push({
|
|
162434
162476
|
matchedPattern: isMatch,
|
|
162435
|
-
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
162477
|
+
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
162436
162478
|
});
|
|
162437
162479
|
}
|
|
162438
162480
|
}
|
|
@@ -162535,6 +162577,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162535
162577
|
const conditions = getConditions(compilerOptions, mode);
|
|
162536
162578
|
addCompletionEntriesFromPathsOrExports(
|
|
162537
162579
|
result,
|
|
162580
|
+
/*isExports*/
|
|
162581
|
+
true,
|
|
162538
162582
|
fragmentSubpath,
|
|
162539
162583
|
packageDirectory,
|
|
162540
162584
|
extensionOptions,
|
|
@@ -162570,7 +162614,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162570
162614
|
function getFragmentDirectory(fragment) {
|
|
162571
162615
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
162572
162616
|
}
|
|
162573
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, host) {
|
|
162617
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
162574
162618
|
if (!endsWith(path, "*")) {
|
|
162575
162619
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
162576
162620
|
}
|
|
@@ -162580,15 +162624,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162580
162624
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
162581
162625
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
162582
162626
|
var _a;
|
|
162583
|
-
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
162627
|
+
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
162584
162628
|
});
|
|
162585
162629
|
}
|
|
162586
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, host));
|
|
162630
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
162587
162631
|
function justPathMappingName(name, kind) {
|
|
162588
162632
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
162589
162633
|
}
|
|
162590
162634
|
}
|
|
162591
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, host) {
|
|
162635
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
162592
162636
|
if (!host.readDirectory) {
|
|
162593
162637
|
return void 0;
|
|
162594
162638
|
}
|
|
@@ -162621,7 +162665,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162621
162665
|
if (containsSlash(trimmedWithPattern)) {
|
|
162622
162666
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
162623
162667
|
}
|
|
162624
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions);
|
|
162668
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
|
|
162625
162669
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
162626
162670
|
}
|
|
162627
162671
|
});
|
|
@@ -162765,6 +162809,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162765
162809
|
var init_stringCompletions = __esm({
|
|
162766
162810
|
"src/services/stringCompletions.ts"() {
|
|
162767
162811
|
"use strict";
|
|
162812
|
+
init_moduleSpecifiers();
|
|
162768
162813
|
init_ts4();
|
|
162769
162814
|
init_ts_Completions();
|
|
162770
162815
|
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-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20240208`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-57341-6",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "86385b777836bffd86799b927b2b3504ad486788"
|
|
118
118
|
}
|