typescript 5.1.0-dev.20230301 → 5.1.0-dev.20230303
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 +135 -102
- package/lib/tsserver.js +878 -641
- package/lib/tsserverlibrary.d.ts +2 -37
- package/lib/tsserverlibrary.js +937 -691
- package/lib/typescript.d.ts +0 -3
- package/lib/typescript.js +815 -581
- package/lib/typingsInstaller.js +52 -49
- package/package.json +1 -1
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.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230303`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -2212,41 +2212,8 @@ function tryGetWebPerformanceHooks() {
|
|
|
2212
2212
|
function tryGetNodePerformanceHooks() {
|
|
2213
2213
|
if (isNodeLikeSystem()) {
|
|
2214
2214
|
try {
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) {
|
|
2218
|
-
performance2 = nodePerformance;
|
|
2219
|
-
const version2 = new Version(process.versions.node);
|
|
2220
|
-
const range = new VersionRange("<12.16.3 || 13 <13.13");
|
|
2221
|
-
if (range.test(version2)) {
|
|
2222
|
-
performance2 = {
|
|
2223
|
-
get timeOrigin() {
|
|
2224
|
-
return nodePerformance.timeOrigin;
|
|
2225
|
-
},
|
|
2226
|
-
now() {
|
|
2227
|
-
return nodePerformance.now();
|
|
2228
|
-
},
|
|
2229
|
-
mark(name) {
|
|
2230
|
-
return nodePerformance.mark(name);
|
|
2231
|
-
},
|
|
2232
|
-
measure(name, start = "nodeStart", end) {
|
|
2233
|
-
if (end === void 0) {
|
|
2234
|
-
end = "__performance.measure-fix__";
|
|
2235
|
-
nodePerformance.mark(end);
|
|
2236
|
-
}
|
|
2237
|
-
nodePerformance.measure(name, start, end);
|
|
2238
|
-
if (end === "__performance.measure-fix__") {
|
|
2239
|
-
nodePerformance.clearMarks("__performance.measure-fix__");
|
|
2240
|
-
}
|
|
2241
|
-
},
|
|
2242
|
-
clearMarks(name) {
|
|
2243
|
-
return nodePerformance.clearMarks(name);
|
|
2244
|
-
},
|
|
2245
|
-
clearMeasures(name) {
|
|
2246
|
-
return nodePerformance.clearMeasures(name);
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
}
|
|
2215
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
2216
|
+
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
2250
2217
|
return {
|
|
2251
2218
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
2252
2219
|
shouldWriteNativeEvents: false,
|
|
@@ -6577,6 +6544,7 @@ var Diagnostics = {
|
|
|
6577
6544
|
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."),
|
|
6578
6545
|
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."),
|
|
6579
6546
|
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."),
|
|
6547
|
+
Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
|
|
6580
6548
|
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."),
|
|
6581
6549
|
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}'."),
|
|
6582
6550
|
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."),
|
|
@@ -6972,6 +6940,8 @@ var Diagnostics = {
|
|
|
6972
6940
|
This_may_be_converted_to_an_async_function: diag(80006, 2 /* Suggestion */, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."),
|
|
6973
6941
|
await_has_no_effect_on_the_type_of_this_expression: diag(80007, 2 /* Suggestion */, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."),
|
|
6974
6942
|
Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, 2 /* Suggestion */, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),
|
|
6943
|
+
JSDoc_typedef_may_be_converted_to_TypeScript_type: diag(80009, 2 /* Suggestion */, "JSDoc_typedef_may_be_converted_to_TypeScript_type_80009", "JSDoc typedef may be converted to TypeScript type."),
|
|
6944
|
+
JSDoc_typedefs_may_be_converted_to_TypeScript_types: diag(80010, 2 /* Suggestion */, "JSDoc_typedefs_may_be_converted_to_TypeScript_types_80010", "JSDoc typedefs may be converted to TypeScript types."),
|
|
6975
6945
|
Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
|
|
6976
6946
|
Make_super_call_the_first_statement_in_the_constructor: diag(90002, 3 /* Message */, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"),
|
|
6977
6947
|
Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
|
|
@@ -7186,6 +7156,8 @@ var Diagnostics = {
|
|
|
7186
7156
|
Rename_param_tag_name_0_to_1: diag(95173, 3 /* Message */, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
|
|
7187
7157
|
Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
|
|
7188
7158
|
Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
7159
|
+
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
7160
|
+
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
7189
7161
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7190
7162
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7191
7163
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -28534,6 +28506,9 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
28534
28506
|
}
|
|
28535
28507
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
28536
28508
|
}
|
|
28509
|
+
if (extensions2 & 4 /* Declaration */) {
|
|
28510
|
+
resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
|
|
28511
|
+
}
|
|
28537
28512
|
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
28538
28513
|
} else {
|
|
28539
28514
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
@@ -28714,6 +28689,7 @@ function tryFile(fileName, onlyRecordFailures, state) {
|
|
|
28714
28689
|
return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
|
|
28715
28690
|
}
|
|
28716
28691
|
function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
28692
|
+
var _a2;
|
|
28717
28693
|
if (!onlyRecordFailures) {
|
|
28718
28694
|
if (state.host.fileExists(fileName)) {
|
|
28719
28695
|
if (state.traceEnabled) {
|
|
@@ -28726,7 +28702,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
|
28726
28702
|
}
|
|
28727
28703
|
}
|
|
28728
28704
|
}
|
|
28729
|
-
state.failedLookupLocations.push(fileName);
|
|
28705
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
|
|
28730
28706
|
return void 0;
|
|
28731
28707
|
}
|
|
28732
28708
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
@@ -28759,24 +28735,24 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
|
28759
28735
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
28760
28736
|
}
|
|
28761
28737
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
28762
|
-
var _a2, _b, _c;
|
|
28738
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
28763
28739
|
const { host, traceEnabled } = state;
|
|
28764
28740
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
28765
28741
|
if (onlyRecordFailures) {
|
|
28766
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
28742
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
|
|
28767
28743
|
return void 0;
|
|
28768
28744
|
}
|
|
28769
|
-
const existing = (
|
|
28745
|
+
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
28770
28746
|
if (existing !== void 0) {
|
|
28771
28747
|
if (typeof existing !== "boolean") {
|
|
28772
28748
|
if (traceEnabled)
|
|
28773
28749
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
28774
|
-
state.affectingLocations.push(packageJsonPath);
|
|
28750
|
+
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
28775
28751
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
28776
28752
|
} else {
|
|
28777
28753
|
if (existing && traceEnabled)
|
|
28778
28754
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
28779
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
28755
|
+
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
28780
28756
|
return void 0;
|
|
28781
28757
|
}
|
|
28782
28758
|
}
|
|
@@ -28787,15 +28763,15 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
28787
28763
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
28788
28764
|
}
|
|
28789
28765
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
28790
|
-
(
|
|
28791
|
-
state.affectingLocations.push(packageJsonPath);
|
|
28766
|
+
(_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
|
|
28767
|
+
(_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
28792
28768
|
return result;
|
|
28793
28769
|
} else {
|
|
28794
28770
|
if (directoryExists && traceEnabled) {
|
|
28795
28771
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
28796
28772
|
}
|
|
28797
|
-
(
|
|
28798
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
28773
|
+
(_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
28774
|
+
(_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
|
|
28799
28775
|
}
|
|
28800
28776
|
}
|
|
28801
28777
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -29603,11 +29579,13 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
29603
29579
|
state
|
|
29604
29580
|
));
|
|
29605
29581
|
});
|
|
29606
|
-
if (resolved2)
|
|
29582
|
+
if (resolved2)
|
|
29607
29583
|
return resolved2;
|
|
29608
|
-
}
|
|
29609
29584
|
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
29610
|
-
|
|
29585
|
+
let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
29586
|
+
if (extensions & 4 /* Declaration */)
|
|
29587
|
+
resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
|
|
29588
|
+
return resolved3;
|
|
29611
29589
|
}
|
|
29612
29590
|
} else {
|
|
29613
29591
|
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
|
@@ -29621,6 +29599,31 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
29621
29599
|
}
|
|
29622
29600
|
}
|
|
29623
29601
|
}
|
|
29602
|
+
function resolveFromTypeRoot(moduleName, state) {
|
|
29603
|
+
if (!state.compilerOptions.typeRoots)
|
|
29604
|
+
return;
|
|
29605
|
+
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
29606
|
+
const candidate = combinePaths(typeRoot, moduleName);
|
|
29607
|
+
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
29608
|
+
if (!directoryExists && state.traceEnabled) {
|
|
29609
|
+
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
29610
|
+
}
|
|
29611
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state);
|
|
29612
|
+
if (resolvedFromFile) {
|
|
29613
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
29614
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
29615
|
+
packageDirectory,
|
|
29616
|
+
/*onlyRecordFailures*/
|
|
29617
|
+
false,
|
|
29618
|
+
state
|
|
29619
|
+
) : void 0;
|
|
29620
|
+
return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
|
|
29621
|
+
}
|
|
29622
|
+
const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
|
|
29623
|
+
if (resolved)
|
|
29624
|
+
return toSearchResult(resolved);
|
|
29625
|
+
}
|
|
29626
|
+
}
|
|
29624
29627
|
function toSearchResult(value) {
|
|
29625
29628
|
return value !== void 0 ? { value } : void 0;
|
|
29626
29629
|
}
|
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.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230303",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|