Skip to content

Commit dde8411

Browse files
committed
Update LKG
1 parent 5f720c2 commit dde8411

File tree

6 files changed

+84
-66
lines changed

6 files changed

+84
-66
lines changed

lib/tsc.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18964,13 +18964,7 @@ var ts;
1896418964
case 0:
1896518965
return tryReadFromField("typings") || tryReadFromField("types");
1896618966
case 1:
18967-
if (typeof jsonContent.main === "string") {
18968-
if (state.traceEnabled) {
18969-
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
18970-
}
18971-
return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
18972-
}
18973-
return undefined;
18967+
return tryReadFromField("main");
1897418968
}
1897518969
function tryReadFromField(fieldName) {
1897618970
if (ts.hasProperty(jsonContent, fieldName)) {
@@ -19488,12 +19482,20 @@ var ts;
1948819482
if (resolved_3) {
1948919483
return resolved_3;
1949019484
}
19491-
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
19485+
if (state.traceEnabled) {
19486+
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
19487+
}
1949219488
}
1949319489
var resolved = tryAddingExtensions(mainOrTypesFile, 0, failedLookupLocations, onlyRecordFailures_1, state);
1949419490
if (resolved) {
1949519491
return resolved;
1949619492
}
19493+
if (extensions === 1) {
19494+
var resolved_4 = tryAddingExtensions(mainOrTypesFile, 1, failedLookupLocations, onlyRecordFailures_1, state);
19495+
if (resolved_4) {
19496+
return resolved_4;
19497+
}
19498+
}
1949719499
}
1949819500
else {
1949919501
if (state.traceEnabled) {
@@ -19584,16 +19586,16 @@ var ts;
1958419586
}
1958519587
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
1958619588
if (moduleHasNonRelativeName(moduleName)) {
19587-
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
19589+
var resolved_5 = forEachAncestorDirectory(containingDirectory, function (directory) {
1958819590
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
1958919591
if (resolutionFromCache) {
1959019592
return resolutionFromCache;
1959119593
}
1959219594
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
1959319595
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state));
1959419596
});
19595-
if (resolved_4) {
19596-
return resolved_4;
19597+
if (resolved_5) {
19598+
return resolved_5;
1959719599
}
1959819600
if (extensions === 0) {
1959919601
return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);

lib/tsserver.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6323,13 +6323,7 @@ var ts;
63236323
case 0:
63246324
return tryReadFromField("typings") || tryReadFromField("types");
63256325
case 1:
6326-
if (typeof jsonContent.main === "string") {
6327-
if (state.traceEnabled) {
6328-
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
6329-
}
6330-
return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
6331-
}
6332-
return undefined;
6326+
return tryReadFromField("main");
63336327
}
63346328
function tryReadFromField(fieldName) {
63356329
if (ts.hasProperty(jsonContent, fieldName)) {
@@ -6847,12 +6841,20 @@ var ts;
68476841
if (resolved_3) {
68486842
return resolved_3;
68496843
}
6850-
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
6844+
if (state.traceEnabled) {
6845+
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
6846+
}
68516847
}
68526848
var resolved = tryAddingExtensions(mainOrTypesFile, 0, failedLookupLocations, onlyRecordFailures_1, state);
68536849
if (resolved) {
68546850
return resolved;
68556851
}
6852+
if (extensions === 1) {
6853+
var resolved_4 = tryAddingExtensions(mainOrTypesFile, 1, failedLookupLocations, onlyRecordFailures_1, state);
6854+
if (resolved_4) {
6855+
return resolved_4;
6856+
}
6857+
}
68566858
}
68576859
else {
68586860
if (state.traceEnabled) {
@@ -6943,16 +6945,16 @@ var ts;
69436945
}
69446946
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
69456947
if (moduleHasNonRelativeName(moduleName)) {
6946-
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
6948+
var resolved_5 = forEachAncestorDirectory(containingDirectory, function (directory) {
69476949
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
69486950
if (resolutionFromCache) {
69496951
return resolutionFromCache;
69506952
}
69516953
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
69526954
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state));
69536955
});
6954-
if (resolved_4) {
6955-
return resolved_4;
6956+
if (resolved_5) {
6957+
return resolved_5;
69566958
}
69576959
if (extensions === 0) {
69586960
return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);

lib/tsserverlibrary.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6323,13 +6323,7 @@ var ts;
63236323
case 0:
63246324
return tryReadFromField("typings") || tryReadFromField("types");
63256325
case 1:
6326-
if (typeof jsonContent.main === "string") {
6327-
if (state.traceEnabled) {
6328-
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
6329-
}
6330-
return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
6331-
}
6332-
return undefined;
6326+
return tryReadFromField("main");
63336327
}
63346328
function tryReadFromField(fieldName) {
63356329
if (ts.hasProperty(jsonContent, fieldName)) {
@@ -6847,12 +6841,20 @@ var ts;
68476841
if (resolved_3) {
68486842
return resolved_3;
68496843
}
6850-
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
6844+
if (state.traceEnabled) {
6845+
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
6846+
}
68516847
}
68526848
var resolved = tryAddingExtensions(mainOrTypesFile, 0, failedLookupLocations, onlyRecordFailures_1, state);
68536849
if (resolved) {
68546850
return resolved;
68556851
}
6852+
if (extensions === 1) {
6853+
var resolved_4 = tryAddingExtensions(mainOrTypesFile, 1, failedLookupLocations, onlyRecordFailures_1, state);
6854+
if (resolved_4) {
6855+
return resolved_4;
6856+
}
6857+
}
68566858
}
68576859
else {
68586860
if (state.traceEnabled) {
@@ -6943,16 +6945,16 @@ var ts;
69436945
}
69446946
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
69456947
if (moduleHasNonRelativeName(moduleName)) {
6946-
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
6948+
var resolved_5 = forEachAncestorDirectory(containingDirectory, function (directory) {
69476949
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
69486950
if (resolutionFromCache) {
69496951
return resolutionFromCache;
69506952
}
69516953
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
69526954
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state));
69536955
});
6954-
if (resolved_4) {
6955-
return resolved_4;
6956+
if (resolved_5) {
6957+
return resolved_5;
69566958
}
69576959
if (extensions === 0) {
69586960
return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);

lib/typescript.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23428,13 +23428,7 @@ var ts;
2342823428
case 0 /* TypeScript */:
2342923429
return tryReadFromField("typings") || tryReadFromField("types");
2343023430
case 1 /* JavaScript */:
23431-
if (typeof jsonContent.main === "string") {
23432-
if (state.traceEnabled) {
23433-
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
23434-
}
23435-
return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
23436-
}
23437-
return undefined;
23431+
return tryReadFromField("main");
2343823432
}
2343923433
function tryReadFromField(fieldName) {
2344023434
if (ts.hasProperty(jsonContent, fieldName)) {
@@ -24077,12 +24071,23 @@ var ts;
2407724071
if (resolved_3) {
2407824072
return resolved_3;
2407924073
}
24080-
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
24074+
if (state.traceEnabled) {
24075+
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
24076+
}
2408124077
}
2408224078
var resolved = tryAddingExtensions(mainOrTypesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state);
2408324079
if (resolved) {
2408424080
return resolved;
2408524081
}
24082+
if (extensions === 1 /* JavaScript */) {
24083+
// A package.json "main" may specify an exact filename, or may choose to omit an extension.
24084+
// We tried the ts extensions erlier, now try the js extensions.
24085+
// tryReadPackageJsonMainOrTypes returns main iff extensions is Extensions.JavaScript.
24086+
var resolved_4 = tryAddingExtensions(mainOrTypesFile, 1 /* JavaScript */, failedLookupLocations, onlyRecordFailures_1, state);
24087+
if (resolved_4) {
24088+
return resolved_4;
24089+
}
24090+
}
2408624091
}
2408724092
else {
2408824093
if (state.traceEnabled) {
@@ -24179,16 +24184,16 @@ var ts;
2417924184
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
2418024185
if (moduleHasNonRelativeName(moduleName)) {
2418124186
// Climb up parent directories looking for a module.
24182-
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
24187+
var resolved_5 = forEachAncestorDirectory(containingDirectory, function (directory) {
2418324188
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
2418424189
if (resolutionFromCache) {
2418524190
return resolutionFromCache;
2418624191
}
2418724192
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
2418824193
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state));
2418924194
});
24190-
if (resolved_4) {
24191-
return resolved_4;
24195+
if (resolved_5) {
24196+
return resolved_5;
2419224197
}
2419324198
if (extensions === 0 /* TypeScript */) {
2419424199
// If we didn't find the file normally, look it up in @types.

lib/typescriptServices.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23428,13 +23428,7 @@ var ts;
2342823428
case 0 /* TypeScript */:
2342923429
return tryReadFromField("typings") || tryReadFromField("types");
2343023430
case 1 /* JavaScript */:
23431-
if (typeof jsonContent.main === "string") {
23432-
if (state.traceEnabled) {
23433-
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
23434-
}
23435-
return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
23436-
}
23437-
return undefined;
23431+
return tryReadFromField("main");
2343823432
}
2343923433
function tryReadFromField(fieldName) {
2344023434
if (ts.hasProperty(jsonContent, fieldName)) {
@@ -24077,12 +24071,23 @@ var ts;
2407724071
if (resolved_3) {
2407824072
return resolved_3;
2407924073
}
24080-
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
24074+
if (state.traceEnabled) {
24075+
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
24076+
}
2408124077
}
2408224078
var resolved = tryAddingExtensions(mainOrTypesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state);
2408324079
if (resolved) {
2408424080
return resolved;
2408524081
}
24082+
if (extensions === 1 /* JavaScript */) {
24083+
// A package.json "main" may specify an exact filename, or may choose to omit an extension.
24084+
// We tried the ts extensions erlier, now try the js extensions.
24085+
// tryReadPackageJsonMainOrTypes returns main iff extensions is Extensions.JavaScript.
24086+
var resolved_4 = tryAddingExtensions(mainOrTypesFile, 1 /* JavaScript */, failedLookupLocations, onlyRecordFailures_1, state);
24087+
if (resolved_4) {
24088+
return resolved_4;
24089+
}
24090+
}
2408624091
}
2408724092
else {
2408824093
if (state.traceEnabled) {
@@ -24179,16 +24184,16 @@ var ts;
2417924184
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
2418024185
if (moduleHasNonRelativeName(moduleName)) {
2418124186
// Climb up parent directories looking for a module.
24182-
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
24187+
var resolved_5 = forEachAncestorDirectory(containingDirectory, function (directory) {
2418324188
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
2418424189
if (resolutionFromCache) {
2418524190
return resolutionFromCache;
2418624191
}
2418724192
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
2418824193
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state));
2418924194
});
24190-
if (resolved_4) {
24191-
return resolved_4;
24195+
if (resolved_5) {
24196+
return resolved_5;
2419224197
}
2419324198
if (extensions === 0 /* TypeScript */) {
2419424199
// If we didn't find the file normally, look it up in @types.

lib/typingsInstaller.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6130,13 +6130,7 @@ var ts;
61306130
case 0:
61316131
return tryReadFromField("typings") || tryReadFromField("types");
61326132
case 1:
6133-
if (typeof jsonContent.main === "string") {
6134-
if (state.traceEnabled) {
6135-
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
6136-
}
6137-
return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
6138-
}
6139-
return undefined;
6133+
return tryReadFromField("main");
61406134
}
61416135
function tryReadFromField(fieldName) {
61426136
if (ts.hasProperty(jsonContent, fieldName)) {
@@ -6654,12 +6648,20 @@ var ts;
66546648
if (resolved_3) {
66556649
return resolved_3;
66566650
}
6657-
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
6651+
if (state.traceEnabled) {
6652+
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
6653+
}
66586654
}
66596655
var resolved = tryAddingExtensions(mainOrTypesFile, 0, failedLookupLocations, onlyRecordFailures_1, state);
66606656
if (resolved) {
66616657
return resolved;
66626658
}
6659+
if (extensions === 1) {
6660+
var resolved_4 = tryAddingExtensions(mainOrTypesFile, 1, failedLookupLocations, onlyRecordFailures_1, state);
6661+
if (resolved_4) {
6662+
return resolved_4;
6663+
}
6664+
}
66636665
}
66646666
else {
66656667
if (state.traceEnabled) {
@@ -6750,16 +6752,16 @@ var ts;
67506752
}
67516753
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
67526754
if (moduleHasNonRelativeName(moduleName)) {
6753-
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
6755+
var resolved_5 = forEachAncestorDirectory(containingDirectory, function (directory) {
67546756
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
67556757
if (resolutionFromCache) {
67566758
return resolutionFromCache;
67576759
}
67586760
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
67596761
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state));
67606762
});
6761-
if (resolved_4) {
6762-
return resolved_4;
6763+
if (resolved_5) {
6764+
return resolved_5;
67636765
}
67646766
if (extensions === 0) {
67656767
return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);

0 commit comments

Comments
 (0)