typescript 5.0.0-dev.20230109 → 5.0.0-dev.20230110
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 +100 -74
- package/lib/tsserver.js +102 -77
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +102 -76
- package/lib/typescript.d.ts +2 -2
- package/lib/typescript.js +102 -75
- package/lib/typingsInstaller.js +38 -40
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20230110`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8394,6 +8394,9 @@ ${lanes.join("\n")}
|
|
|
8394
8394
|
Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
8395
8395
|
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
8396
8396
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
8397
|
+
File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
|
|
8398
|
+
Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
|
|
8399
|
+
Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
|
|
8397
8400
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
8398
8401
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
8399
8402
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -15859,13 +15862,13 @@ ${lanes.join("\n")}
|
|
|
15859
15862
|
return removeFileExtension(path) + declarationExtension;
|
|
15860
15863
|
}
|
|
15861
15864
|
function getDeclarationEmitExtensionForPath(path) {
|
|
15862
|
-
return fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ : fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ : fileExtensionIsOneOf(path, [".json" /* Json */]) ? `.json.
|
|
15865
|
+
return fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ : fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ : fileExtensionIsOneOf(path, [".json" /* Json */]) ? `.d.json.ts` : (
|
|
15863
15866
|
// Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well
|
|
15864
15867
|
".d.ts" /* Dts */
|
|
15865
15868
|
);
|
|
15866
15869
|
}
|
|
15867
15870
|
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
15868
|
-
return fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path, [`.json.
|
|
15871
|
+
return fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path, [`.d.json.ts`]) ? [".json" /* Json */] : [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
15869
15872
|
}
|
|
15870
15873
|
function outFile(options) {
|
|
15871
15874
|
return options.outFile || options.out;
|
|
@@ -17872,7 +17875,7 @@ ${lanes.join("\n")}
|
|
|
17872
17875
|
return !(pos >= 0);
|
|
17873
17876
|
}
|
|
17874
17877
|
function extensionIsTS(ext) {
|
|
17875
|
-
return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */ || ext === ".cts" /* Cts */ || ext === ".mts" /* Mts */ || ext === ".d.mts" /* Dmts */ || ext === ".d.cts" /* Dcts
|
|
17878
|
+
return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */ || ext === ".cts" /* Cts */ || ext === ".mts" /* Mts */ || ext === ".d.mts" /* Dmts */ || ext === ".d.cts" /* Dcts */ || startsWith(ext, ".d.") && endsWith(ext, ".ts");
|
|
17876
17879
|
}
|
|
17877
17880
|
function resolutionExtensionIsTSOrJson(ext) {
|
|
17878
17881
|
return extensionIsTS(ext) || ext === ".json" /* Json */;
|
|
@@ -26928,7 +26931,7 @@ ${lanes.join("\n")}
|
|
|
26928
26931
|
return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length2);
|
|
26929
26932
|
}
|
|
26930
26933
|
function isDeclarationFileName(fileName) {
|
|
26931
|
-
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions);
|
|
26934
|
+
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) && stringContains(getBaseFileName(fileName), ".d.");
|
|
26932
26935
|
}
|
|
26933
26936
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
26934
26937
|
if (!mode) {
|
|
@@ -37298,6 +37301,14 @@ ${lanes.join("\n")}
|
|
|
37298
37301
|
description: Diagnostics.Enable_importing_json_files,
|
|
37299
37302
|
defaultValueDescription: false
|
|
37300
37303
|
},
|
|
37304
|
+
{
|
|
37305
|
+
name: "allowArbitraryExtensions",
|
|
37306
|
+
type: "boolean",
|
|
37307
|
+
affectsModuleResolution: true,
|
|
37308
|
+
category: Diagnostics.Modules,
|
|
37309
|
+
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
|
|
37310
|
+
defaultValueDescription: false
|
|
37311
|
+
},
|
|
37301
37312
|
{
|
|
37302
37313
|
name: "out",
|
|
37303
37314
|
type: "string",
|
|
@@ -39045,14 +39056,19 @@ ${lanes.join("\n")}
|
|
|
39045
39056
|
}
|
|
39046
39057
|
}
|
|
39047
39058
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
39048
|
-
|
|
39049
|
-
|
|
39050
|
-
|
|
39051
|
-
if (state.traceEnabled) {
|
|
39052
|
-
trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
39053
|
-
}
|
|
39054
|
-
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
39059
|
+
const filename = getBaseFileName(candidate);
|
|
39060
|
+
if (filename.indexOf(".") === -1) {
|
|
39061
|
+
return void 0;
|
|
39055
39062
|
}
|
|
39063
|
+
let extensionless = removeFileExtension(candidate);
|
|
39064
|
+
if (extensionless === candidate) {
|
|
39065
|
+
extensionless = candidate.substring(0, candidate.lastIndexOf("."));
|
|
39066
|
+
}
|
|
39067
|
+
const extension = candidate.substring(extensionless.length);
|
|
39068
|
+
if (state.traceEnabled) {
|
|
39069
|
+
trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
39070
|
+
}
|
|
39071
|
+
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
39056
39072
|
}
|
|
39057
39073
|
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
39058
39074
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
@@ -39076,38 +39092,23 @@ ${lanes.join("\n")}
|
|
|
39076
39092
|
case ".mjs" /* Mjs */:
|
|
39077
39093
|
case ".mts" /* Mts */:
|
|
39078
39094
|
case ".d.mts" /* Dmts */:
|
|
39079
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
39095
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
39080
39096
|
case ".cjs" /* Cjs */:
|
|
39081
39097
|
case ".cts" /* Cts */:
|
|
39082
39098
|
case ".d.cts" /* Dcts */:
|
|
39083
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
39099
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
39084
39100
|
case ".json" /* Json */:
|
|
39085
|
-
|
|
39086
|
-
if (extensions & 4 /* Declaration */) {
|
|
39087
|
-
candidate += ".json" /* Json */;
|
|
39088
|
-
const result = tryExtension(".d.ts" /* Dts */);
|
|
39089
|
-
if (result)
|
|
39090
|
-
return result;
|
|
39091
|
-
}
|
|
39092
|
-
if (extensions & 8 /* Json */) {
|
|
39093
|
-
candidate = originalCandidate;
|
|
39094
|
-
const result = tryExtension(".json" /* Json */);
|
|
39095
|
-
if (result)
|
|
39096
|
-
return result;
|
|
39097
|
-
}
|
|
39098
|
-
return void 0;
|
|
39099
|
-
case ".ts" /* Ts */:
|
|
39101
|
+
return extensions & 4 /* Declaration */ && tryExtension(".d.json.ts") || extensions & 8 /* Json */ && tryExtension(".json" /* Json */) || void 0;
|
|
39100
39102
|
case ".tsx" /* Tsx */:
|
|
39103
|
+
case ".jsx" /* Jsx */:
|
|
39104
|
+
return extensions & 1 /* TypeScript */ && (tryExtension(".tsx" /* Tsx */, originalExtension === ".tsx" /* Tsx */) || tryExtension(".ts" /* Ts */, originalExtension === ".tsx" /* Tsx */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".tsx" /* Tsx */) || extensions & 2 /* JavaScript */ && (tryExtension(".jsx" /* Jsx */) || tryExtension(".js" /* Js */)) || void 0;
|
|
39105
|
+
case ".ts" /* Ts */:
|
|
39101
39106
|
case ".d.ts" /* Dts */:
|
|
39102
|
-
|
|
39103
|
-
|
|
39104
|
-
|
|
39105
|
-
/*resolvedUsingTsExtension*/
|
|
39106
|
-
true
|
|
39107
|
-
);
|
|
39108
|
-
}
|
|
39107
|
+
case ".js" /* Js */:
|
|
39108
|
+
case "":
|
|
39109
|
+
return extensions & 1 /* TypeScript */ && (tryExtension(".ts" /* Ts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || tryExtension(".tsx" /* Tsx */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || extensions & 2 /* JavaScript */ && (tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */)) || state.isConfigLookup && tryExtension(".json" /* Json */) || void 0;
|
|
39109
39110
|
default:
|
|
39110
|
-
return extensions &
|
|
39111
|
+
return extensions & 4 /* Declaration */ && !isDeclarationFileName(candidate + originalExtension) && tryExtension(`.d${originalExtension}.ts`) || void 0;
|
|
39111
39112
|
}
|
|
39112
39113
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
39113
39114
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
@@ -40146,11 +40147,8 @@ ${lanes.join("\n")}
|
|
|
40146
40147
|
}
|
|
40147
40148
|
}
|
|
40148
40149
|
}
|
|
40149
|
-
function moduleResolutionSupportsResolvingTsExtensions(compilerOptions) {
|
|
40150
|
-
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
|
|
40151
|
-
}
|
|
40152
40150
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
40153
|
-
return
|
|
40151
|
+
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && (!!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName));
|
|
40154
40152
|
}
|
|
40155
40153
|
function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
|
|
40156
40154
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -43916,6 +43914,8 @@ ${lanes.join("\n")}
|
|
|
43916
43914
|
}
|
|
43917
43915
|
if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
|
|
43918
43916
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
43917
|
+
} else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && stringContains(fileName, ".d.")) {
|
|
43918
|
+
return tryGetRealFileNameForNonJsDeclarationFileName(fileName);
|
|
43919
43919
|
}
|
|
43920
43920
|
switch (allowedEndings[0]) {
|
|
43921
43921
|
case 0 /* Minimal */:
|
|
@@ -43939,6 +43939,14 @@ ${lanes.join("\n")}
|
|
|
43939
43939
|
return Debug.assertNever(allowedEndings[0]);
|
|
43940
43940
|
}
|
|
43941
43941
|
}
|
|
43942
|
+
function tryGetRealFileNameForNonJsDeclarationFileName(fileName) {
|
|
43943
|
+
const baseName = getBaseFileName(fileName);
|
|
43944
|
+
if (!endsWith(fileName, ".ts" /* Ts */) || !stringContains(baseName, ".d.") || fileExtensionIsOneOf(baseName, [".d.ts" /* Dts */]))
|
|
43945
|
+
return void 0;
|
|
43946
|
+
const noExtension = removeExtension(fileName, ".ts" /* Ts */);
|
|
43947
|
+
const ext = noExtension.substring(noExtension.lastIndexOf("."));
|
|
43948
|
+
return noExtension.substring(0, noExtension.indexOf(".d.")) + ext;
|
|
43949
|
+
}
|
|
43942
43950
|
function getJSExtensionForFile(fileName, options) {
|
|
43943
43951
|
var _a2;
|
|
43944
43952
|
return (_a2 = tryGetJSExtensionForFile(fileName, options)) != null ? _a2 : Debug.fail(`Extension ${extensionFromPath(fileName)} is unsupported:: FileName:: ${fileName}`);
|
|
@@ -43999,6 +44007,7 @@ ${lanes.join("\n")}
|
|
|
43999
44007
|
getNodeModulesPackageName: () => getNodeModulesPackageName,
|
|
44000
44008
|
tryGetJSExtensionForFile: () => tryGetJSExtensionForFile,
|
|
44001
44009
|
tryGetModuleSpecifiersFromCache: () => tryGetModuleSpecifiersFromCache,
|
|
44010
|
+
tryGetRealFileNameForNonJsDeclarationFileName: () => tryGetRealFileNameForNonJsDeclarationFileName,
|
|
44002
44011
|
updateModuleSpecifier: () => updateModuleSpecifier
|
|
44003
44012
|
});
|
|
44004
44013
|
var init_ts_moduleSpecifiers = __esm({
|
|
@@ -46266,7 +46275,7 @@ ${lanes.join("\n")}
|
|
|
46266
46275
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
46267
46276
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
46268
46277
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
46269
|
-
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
46278
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
|
|
46270
46279
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
46271
46280
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
46272
46281
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -47061,7 +47070,7 @@ ${lanes.join("\n")}
|
|
|
47061
47070
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
47062
47071
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
47063
47072
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
47064
|
-
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
47073
|
+
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
47065
47074
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
47066
47075
|
if (sourceFile) {
|
|
47067
47076
|
if (resolutionDiagnostic) {
|
|
@@ -51015,7 +51024,9 @@ ${lanes.join("\n")}
|
|
|
51015
51024
|
case 267 /* NamespaceExportDeclaration */:
|
|
51016
51025
|
addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */);
|
|
51017
51026
|
break;
|
|
51018
|
-
case 270 /* ImportClause */:
|
|
51027
|
+
case 270 /* ImportClause */: {
|
|
51028
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51029
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51019
51030
|
addResult(factory.createImportDeclaration(
|
|
51020
51031
|
/*modifiers*/
|
|
51021
51032
|
void 0,
|
|
@@ -51026,15 +51037,14 @@ ${lanes.join("\n")}
|
|
|
51026
51037
|
/*namedBindings*/
|
|
51027
51038
|
void 0
|
|
51028
51039
|
),
|
|
51029
|
-
|
|
51030
|
-
|
|
51031
|
-
// In such cases, the `target` refers to the module itself already
|
|
51032
|
-
factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)),
|
|
51033
|
-
/*assertClause*/
|
|
51034
|
-
void 0
|
|
51040
|
+
specifier2,
|
|
51041
|
+
node.parent.assertClause
|
|
51035
51042
|
), 0 /* None */);
|
|
51036
51043
|
break;
|
|
51037
|
-
|
|
51044
|
+
}
|
|
51045
|
+
case 271 /* NamespaceImport */: {
|
|
51046
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51047
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51038
51048
|
addResult(factory.createImportDeclaration(
|
|
51039
51049
|
/*modifiers*/
|
|
51040
51050
|
void 0,
|
|
@@ -51045,11 +51055,11 @@ ${lanes.join("\n")}
|
|
|
51045
51055
|
void 0,
|
|
51046
51056
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
51047
51057
|
),
|
|
51048
|
-
|
|
51049
|
-
|
|
51050
|
-
void 0
|
|
51058
|
+
specifier2,
|
|
51059
|
+
node.parent.parent.assertClause
|
|
51051
51060
|
), 0 /* None */);
|
|
51052
51061
|
break;
|
|
51062
|
+
}
|
|
51053
51063
|
case 277 /* NamespaceExport */:
|
|
51054
51064
|
addResult(factory.createExportDeclaration(
|
|
51055
51065
|
/*modifiers*/
|
|
@@ -51060,7 +51070,9 @@ ${lanes.join("\n")}
|
|
|
51060
51070
|
factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
|
|
51061
51071
|
), 0 /* None */);
|
|
51062
51072
|
break;
|
|
51063
|
-
case 273 /* ImportSpecifier */:
|
|
51073
|
+
case 273 /* ImportSpecifier */: {
|
|
51074
|
+
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51075
|
+
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51064
51076
|
addResult(factory.createImportDeclaration(
|
|
51065
51077
|
/*modifiers*/
|
|
51066
51078
|
void 0,
|
|
@@ -51078,11 +51090,11 @@ ${lanes.join("\n")}
|
|
|
51078
51090
|
)
|
|
51079
51091
|
])
|
|
51080
51092
|
),
|
|
51081
|
-
|
|
51082
|
-
|
|
51083
|
-
void 0
|
|
51093
|
+
specifier2,
|
|
51094
|
+
node.parent.parent.parent.assertClause
|
|
51084
51095
|
), 0 /* None */);
|
|
51085
51096
|
break;
|
|
51097
|
+
}
|
|
51086
51098
|
case 278 /* ExportSpecifier */:
|
|
51087
51099
|
const specifier = node.parent.parent.moduleSpecifier;
|
|
51088
51100
|
serializeExportSpecifier(
|
|
@@ -73736,7 +73748,7 @@ ${lanes.join("\n")}
|
|
|
73736
73748
|
return getRegularTypeOfObjectLiteral(rightType);
|
|
73737
73749
|
}
|
|
73738
73750
|
case 27 /* CommaToken */:
|
|
73739
|
-
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !
|
|
73751
|
+
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
73740
73752
|
const sf = getSourceFileOfNode(left);
|
|
73741
73753
|
const sourceText = sf.text;
|
|
73742
73754
|
const start = skipTrivia(sourceText, left.pos);
|
|
@@ -73778,8 +73790,8 @@ ${lanes.join("\n")}
|
|
|
73778
73790
|
}
|
|
73779
73791
|
}
|
|
73780
73792
|
}
|
|
73781
|
-
function
|
|
73782
|
-
return node.kind ===
|
|
73793
|
+
function isIndirectCall(node) {
|
|
73794
|
+
return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) && (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
|
|
73783
73795
|
}
|
|
73784
73796
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
73785
73797
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
@@ -74343,15 +74355,16 @@ ${lanes.join("\n")}
|
|
|
74343
74355
|
}
|
|
74344
74356
|
}
|
|
74345
74357
|
expr = skipParentheses(node);
|
|
74358
|
+
if (isAwaitExpression(expr)) {
|
|
74359
|
+
const type = getQuickTypeOfExpression(expr.expression);
|
|
74360
|
+
return type ? getAwaitedType(type) : void 0;
|
|
74361
|
+
}
|
|
74346
74362
|
if (isCallExpression(expr) && expr.expression.kind !== 106 /* SuperKeyword */ && !isRequireCall(
|
|
74347
74363
|
expr,
|
|
74348
74364
|
/*checkArgumentIsStringLiteralLike*/
|
|
74349
74365
|
true
|
|
74350
74366
|
) && !isSymbolOrSymbolForCall(expr)) {
|
|
74351
|
-
|
|
74352
|
-
if (type) {
|
|
74353
|
-
return type;
|
|
74354
|
-
}
|
|
74367
|
+
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
74355
74368
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
74356
74369
|
return getTypeFromTypeNode(expr.type);
|
|
74357
74370
|
} else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
|
|
@@ -79518,12 +79531,12 @@ ${lanes.join("\n")}
|
|
|
79518
79531
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
79519
79532
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
79520
79533
|
}
|
|
79521
|
-
if (node.isExportEquals
|
|
79522
|
-
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */) {
|
|
79534
|
+
if (node.isExportEquals) {
|
|
79535
|
+
if (moduleKind >= 5 /* ES2015 */ && (node.flags & 16777216 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 16777216 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
79523
79536
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
79524
|
-
} else if (moduleKind === 4 /* System */) {
|
|
79537
|
+
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
79525
79538
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
79526
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
79539
|
+
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
79527
79540
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
|
|
79528
79541
|
}
|
|
79529
79542
|
}
|
|
@@ -113486,7 +113499,7 @@ ${lanes.join("\n")}
|
|
|
113486
113499
|
currentNodeModulesDepth++;
|
|
113487
113500
|
}
|
|
113488
113501
|
const elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
|
|
113489
|
-
const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
|
|
113502
|
+
const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution, file) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
|
|
113490
113503
|
if (elideImport) {
|
|
113491
113504
|
modulesWithElidedImports.set(file.path, true);
|
|
113492
113505
|
} else if (shouldAddFile) {
|
|
@@ -113829,7 +113842,7 @@ ${lanes.join("\n")}
|
|
|
113829
113842
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
113830
113843
|
createOptionValueDiagnostic("importsNotUsedAsValues", Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later);
|
|
113831
113844
|
}
|
|
113832
|
-
if (options.allowImportingTsExtensions && !(
|
|
113845
|
+
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
|
|
113833
113846
|
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_either_noEmit_or_emitDeclarationOnly_is_set);
|
|
113834
113847
|
}
|
|
113835
113848
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
@@ -114480,19 +114493,27 @@ ${lanes.join("\n")}
|
|
|
114480
114493
|
const passedInRef = ref ? ref : hostOrRef;
|
|
114481
114494
|
return resolveConfigFileProjectName(passedInRef.path);
|
|
114482
114495
|
}
|
|
114483
|
-
function getResolutionDiagnostic(options, { extension }) {
|
|
114496
|
+
function getResolutionDiagnostic(options, { extension }, { isDeclarationFile }) {
|
|
114484
114497
|
switch (extension) {
|
|
114485
114498
|
case ".ts" /* Ts */:
|
|
114486
114499
|
case ".d.ts" /* Dts */:
|
|
114500
|
+
case ".mts" /* Mts */:
|
|
114501
|
+
case ".d.mts" /* Dmts */:
|
|
114502
|
+
case ".cts" /* Cts */:
|
|
114503
|
+
case ".d.cts" /* Dcts */:
|
|
114487
114504
|
return void 0;
|
|
114488
114505
|
case ".tsx" /* Tsx */:
|
|
114489
114506
|
return needJsx();
|
|
114490
114507
|
case ".jsx" /* Jsx */:
|
|
114491
114508
|
return needJsx() || needAllowJs();
|
|
114492
114509
|
case ".js" /* Js */:
|
|
114510
|
+
case ".mjs" /* Mjs */:
|
|
114511
|
+
case ".cjs" /* Cjs */:
|
|
114493
114512
|
return needAllowJs();
|
|
114494
114513
|
case ".json" /* Json */:
|
|
114495
114514
|
return needResolveJsonModule();
|
|
114515
|
+
default:
|
|
114516
|
+
return needAllowArbitraryExtensions();
|
|
114496
114517
|
}
|
|
114497
114518
|
function needJsx() {
|
|
114498
114519
|
return options.jsx ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;
|
|
@@ -114503,6 +114524,9 @@ ${lanes.join("\n")}
|
|
|
114503
114524
|
function needResolveJsonModule() {
|
|
114504
114525
|
return getResolveJsonModule(options) ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used;
|
|
114505
114526
|
}
|
|
114527
|
+
function needAllowArbitraryExtensions() {
|
|
114528
|
+
return isDeclarationFile || options.allowArbitraryExtensions ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set;
|
|
114529
|
+
}
|
|
114506
114530
|
}
|
|
114507
114531
|
function getModuleNames({ imports, moduleAugmentations }) {
|
|
114508
114532
|
const res = imports.map((i) => i);
|
|
@@ -144542,7 +144566,7 @@ ${lanes.join("\n")}
|
|
|
144542
144566
|
break;
|
|
144543
144567
|
case 291 /* JsxExpression */:
|
|
144544
144568
|
case 290 /* JsxSpreadAttribute */:
|
|
144545
|
-
if (previousToken.kind === 19 /* CloseBraceToken */
|
|
144569
|
+
if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
|
|
144546
144570
|
isJsxIdentifierExpected = true;
|
|
144547
144571
|
}
|
|
144548
144572
|
break;
|
|
@@ -146688,6 +146712,10 @@ ${lanes.join("\n")}
|
|
|
146688
146712
|
return result;
|
|
146689
146713
|
}
|
|
146690
146714
|
function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions) {
|
|
146715
|
+
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
146716
|
+
if (nonJsResult) {
|
|
146717
|
+
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
146718
|
+
}
|
|
146691
146719
|
if (extensionOptions.referenceKind === 0 /* Filename */) {
|
|
146692
146720
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
146693
146721
|
}
|
|
@@ -147633,7 +147661,7 @@ ${lanes.join("\n")}
|
|
|
147633
147661
|
if (symbol.declarations) {
|
|
147634
147662
|
for (const declaration of symbol.declarations) {
|
|
147635
147663
|
if (isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) {
|
|
147636
|
-
return checker.getExportSpecifierLocalTargetSymbol(declaration);
|
|
147664
|
+
return checker.getExportSpecifierLocalTargetSymbol(declaration) || symbol;
|
|
147637
147665
|
} else if (isPropertyAccessExpression(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) {
|
|
147638
147666
|
return checker.getSymbolAtLocation(declaration);
|
|
147639
147667
|
} else if (isShorthandPropertyAssignment(declaration) && isBinaryExpression(declaration.parent.parent) && getAssignmentDeclarationKind(declaration.parent.parent) === 2 /* ModuleExports */) {
|
|
@@ -165998,7 +166026,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
165998
166026
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
165999
166027
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
166000
166028
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
166001
|
-
moduleResolutionSupportsResolvingTsExtensions: () => moduleResolutionSupportsResolvingTsExtensions,
|
|
166002
166029
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
166003
166030
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
|
166004
166031
|
moveEmitHelpers: () => moveEmitHelpers,
|
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.0";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230110`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -6578,6 +6578,9 @@ var Diagnostics = {
|
|
|
6578
6578
|
Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
6579
6579
|
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
6580
6580
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
6581
|
+
File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
|
|
6582
|
+
Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
|
|
6583
|
+
Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
|
|
6581
6584
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
6582
6585
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
6583
6586
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -11421,7 +11424,7 @@ function hostGetCanonicalFileName(host) {
|
|
|
11421
11424
|
return createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host));
|
|
11422
11425
|
}
|
|
11423
11426
|
function getPossibleOriginalInputExtensionForExtension(path2) {
|
|
11424
|
-
return fileExtensionIsOneOf(path2, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path2, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path2, [`.json.
|
|
11427
|
+
return fileExtensionIsOneOf(path2, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path2, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path2, [`.d.json.ts`]) ? [".json" /* Json */] : [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
11425
11428
|
}
|
|
11426
11429
|
function outFile(options) {
|
|
11427
11430
|
return options.outFile || options.out;
|
|
@@ -22097,7 +22100,7 @@ var Parser;
|
|
|
22097
22100
|
const pos = getNodePos();
|
|
22098
22101
|
return finishNode(factory2.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos);
|
|
22099
22102
|
}
|
|
22100
|
-
function
|
|
22103
|
+
function isAwaitExpression2() {
|
|
22101
22104
|
if (token() === 133 /* AwaitKeyword */) {
|
|
22102
22105
|
if (inAwaitContext()) {
|
|
22103
22106
|
return true;
|
|
@@ -22145,7 +22148,7 @@ var Parser;
|
|
|
22145
22148
|
case 29 /* LessThanToken */:
|
|
22146
22149
|
return parseTypeAssertion();
|
|
22147
22150
|
case 133 /* AwaitKeyword */:
|
|
22148
|
-
if (
|
|
22151
|
+
if (isAwaitExpression2()) {
|
|
22149
22152
|
return parseAwaitExpression();
|
|
22150
22153
|
}
|
|
22151
22154
|
default:
|
|
@@ -25808,7 +25811,7 @@ var IncrementalParser;
|
|
|
25808
25811
|
})(InvalidPosition || (InvalidPosition = {}));
|
|
25809
25812
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
25810
25813
|
function isDeclarationFileName(fileName) {
|
|
25811
|
-
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions);
|
|
25814
|
+
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) && stringContains(getBaseFileName(fileName), ".d.");
|
|
25812
25815
|
}
|
|
25813
25816
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
25814
25817
|
if (!mode) {
|
|
@@ -27066,6 +27069,14 @@ var commandOptionsWithoutBuild = [
|
|
|
27066
27069
|
description: Diagnostics.Enable_importing_json_files,
|
|
27067
27070
|
defaultValueDescription: false
|
|
27068
27071
|
},
|
|
27072
|
+
{
|
|
27073
|
+
name: "allowArbitraryExtensions",
|
|
27074
|
+
type: "boolean",
|
|
27075
|
+
affectsModuleResolution: true,
|
|
27076
|
+
category: Diagnostics.Modules,
|
|
27077
|
+
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
|
|
27078
|
+
defaultValueDescription: false
|
|
27079
|
+
},
|
|
27069
27080
|
{
|
|
27070
27081
|
name: "out",
|
|
27071
27082
|
type: "string",
|
|
@@ -28641,14 +28652,19 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
|
28641
28652
|
}
|
|
28642
28653
|
}
|
|
28643
28654
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
28644
|
-
|
|
28645
|
-
|
|
28646
|
-
|
|
28647
|
-
|
|
28648
|
-
|
|
28649
|
-
|
|
28650
|
-
|
|
28655
|
+
const filename = getBaseFileName(candidate);
|
|
28656
|
+
if (filename.indexOf(".") === -1) {
|
|
28657
|
+
return void 0;
|
|
28658
|
+
}
|
|
28659
|
+
let extensionless = removeFileExtension(candidate);
|
|
28660
|
+
if (extensionless === candidate) {
|
|
28661
|
+
extensionless = candidate.substring(0, candidate.lastIndexOf("."));
|
|
28662
|
+
}
|
|
28663
|
+
const extension = candidate.substring(extensionless.length);
|
|
28664
|
+
if (state.traceEnabled) {
|
|
28665
|
+
trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
28651
28666
|
}
|
|
28667
|
+
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
28652
28668
|
}
|
|
28653
28669
|
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
28654
28670
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
@@ -28672,38 +28688,23 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
28672
28688
|
case ".mjs" /* Mjs */:
|
|
28673
28689
|
case ".mts" /* Mts */:
|
|
28674
28690
|
case ".d.mts" /* Dmts */:
|
|
28675
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
28691
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
28676
28692
|
case ".cjs" /* Cjs */:
|
|
28677
28693
|
case ".cts" /* Cts */:
|
|
28678
28694
|
case ".d.cts" /* Dcts */:
|
|
28679
|
-
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
28695
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
28680
28696
|
case ".json" /* Json */:
|
|
28681
|
-
|
|
28682
|
-
if (extensions & 4 /* Declaration */) {
|
|
28683
|
-
candidate += ".json" /* Json */;
|
|
28684
|
-
const result = tryExtension(".d.ts" /* Dts */);
|
|
28685
|
-
if (result)
|
|
28686
|
-
return result;
|
|
28687
|
-
}
|
|
28688
|
-
if (extensions & 8 /* Json */) {
|
|
28689
|
-
candidate = originalCandidate;
|
|
28690
|
-
const result = tryExtension(".json" /* Json */);
|
|
28691
|
-
if (result)
|
|
28692
|
-
return result;
|
|
28693
|
-
}
|
|
28694
|
-
return void 0;
|
|
28695
|
-
case ".ts" /* Ts */:
|
|
28697
|
+
return extensions & 4 /* Declaration */ && tryExtension(".d.json.ts") || extensions & 8 /* Json */ && tryExtension(".json" /* Json */) || void 0;
|
|
28696
28698
|
case ".tsx" /* Tsx */:
|
|
28699
|
+
case ".jsx" /* Jsx */:
|
|
28700
|
+
return extensions & 1 /* TypeScript */ && (tryExtension(".tsx" /* Tsx */, originalExtension === ".tsx" /* Tsx */) || tryExtension(".ts" /* Ts */, originalExtension === ".tsx" /* Tsx */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".tsx" /* Tsx */) || extensions & 2 /* JavaScript */ && (tryExtension(".jsx" /* Jsx */) || tryExtension(".js" /* Js */)) || void 0;
|
|
28701
|
+
case ".ts" /* Ts */:
|
|
28697
28702
|
case ".d.ts" /* Dts */:
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28701
|
-
/*resolvedUsingTsExtension*/
|
|
28702
|
-
true
|
|
28703
|
-
);
|
|
28704
|
-
}
|
|
28703
|
+
case ".js" /* Js */:
|
|
28704
|
+
case "":
|
|
28705
|
+
return extensions & 1 /* TypeScript */ && (tryExtension(".ts" /* Ts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || tryExtension(".tsx" /* Tsx */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || extensions & 2 /* JavaScript */ && (tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */)) || state.isConfigLookup && tryExtension(".json" /* Json */) || void 0;
|
|
28705
28706
|
default:
|
|
28706
|
-
return extensions &
|
|
28707
|
+
return extensions & 4 /* Declaration */ && !isDeclarationFileName(candidate + originalExtension) && tryExtension(`.d${originalExtension}.ts`) || void 0;
|
|
28707
28708
|
}
|
|
28708
28709
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
28709
28710
|
const path2 = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
@@ -29614,9 +29615,6 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
29614
29615
|
}
|
|
29615
29616
|
}
|
|
29616
29617
|
}
|
|
29617
|
-
function moduleResolutionSupportsResolvingTsExtensions(compilerOptions) {
|
|
29618
|
-
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
|
|
29619
|
-
}
|
|
29620
29618
|
function toSearchResult(value) {
|
|
29621
29619
|
return value !== void 0 ? { value } : void 0;
|
|
29622
29620
|
}
|
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.0.0-dev.
|
|
5
|
+
"version": "5.0.0-dev.20230110",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|