typescript 4.7.0-dev.20220505 → 4.7.0-dev.20220506
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/lib.es2022.d.ts +1 -0
- package/lib/lib.es2022.intl.d.ts +111 -0
- package/lib/tsc.js +175 -23
- package/lib/tsserver.js +244 -41
- package/lib/tsserverlibrary.js +244 -41
- package/lib/typescript.js +240 -38
- package/lib/typescriptServices.js +240 -38
- package/lib/typingsInstaller.js +218 -23
- package/package.json +1 -1
package/lib/lib.es2022.d.ts
CHANGED
|
@@ -21,5 +21,6 @@ and limitations under the License.
|
|
|
21
21
|
/// <reference lib="es2021" />
|
|
22
22
|
/// <reference lib="es2022.array" />
|
|
23
23
|
/// <reference lib="es2022.error" />
|
|
24
|
+
/// <reference lib="es2022.intl" />
|
|
24
25
|
/// <reference lib="es2022.object" />
|
|
25
26
|
/// <reference lib="es2022.string" />
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/// <reference no-default-lib="true"/>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
declare namespace Intl {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An object with some or all properties of the `Intl.Segmenter` constructor `options` parameter.
|
|
25
|
+
*
|
|
26
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/Segmenter#parameters)
|
|
27
|
+
*/
|
|
28
|
+
interface SegmenterOptions {
|
|
29
|
+
/** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */
|
|
30
|
+
localeMatcher?: "best fit" | "lookup" | undefined;
|
|
31
|
+
/** The type of input to be split */
|
|
32
|
+
granularity?: "grapheme" | "word" | "sentence" | undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Segmenter {
|
|
36
|
+
/**
|
|
37
|
+
* Returns `Segments` object containing the segments of the input string, using the segmenter's locale and granularity.
|
|
38
|
+
*
|
|
39
|
+
* @param input - The text to be segmented as a `string`.
|
|
40
|
+
*
|
|
41
|
+
* @returns A new iterable Segments object containing the segments of the input string, using the segmenter's locale and granularity.
|
|
42
|
+
*/
|
|
43
|
+
segment(input: string): Segments;
|
|
44
|
+
resolvedOptions(): ResolvedSegmenterOptions;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface ResolvedSegmenterOptions {
|
|
48
|
+
locale: string;
|
|
49
|
+
granularity: "grapheme" | "word" | "sentence";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface Segments {
|
|
53
|
+
/**
|
|
54
|
+
* Returns an object describing the segment in the original string that includes the code unit at a specified index.
|
|
55
|
+
*
|
|
56
|
+
* @param codeUnitIndex - A number specifying the index of the code unit in the original input string. If the value is omitted, it defaults to `0`.
|
|
57
|
+
*/
|
|
58
|
+
containing(codeUnitIndex?: number): SegmentData;
|
|
59
|
+
|
|
60
|
+
/** Returns an iterator to iterate over the segments. */
|
|
61
|
+
[Symbol.iterator](): IterableIterator<SegmentData>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface SegmentData {
|
|
65
|
+
/** A string containing the segment extracted from the original input string. */
|
|
66
|
+
segment: string;
|
|
67
|
+
/** The code unit index in the original input string at which the segment begins. */
|
|
68
|
+
index: number;
|
|
69
|
+
/** The complete input string that was segmented. */
|
|
70
|
+
input: string;
|
|
71
|
+
/**
|
|
72
|
+
* A boolean value only if granularity is "word"; otherwise, undefined.
|
|
73
|
+
* If granularity is "word", then isWordLike is true when the segment is word-like (i.e., consists of letters/numbers/ideographs/etc.); otherwise, false.
|
|
74
|
+
*/
|
|
75
|
+
isWordLike?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const Segmenter: {
|
|
79
|
+
prototype: Segmenter;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new `Intl.Segmenter` object.
|
|
83
|
+
*
|
|
84
|
+
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
|
|
85
|
+
* For the general form and interpretation of the `locales` argument,
|
|
86
|
+
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
|
|
87
|
+
*
|
|
88
|
+
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/Segmenter#parameters)
|
|
89
|
+
* with some or all options of `SegmenterOptions`.
|
|
90
|
+
*
|
|
91
|
+
* @returns [Intl.Segmenter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segments) object.
|
|
92
|
+
*
|
|
93
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter).
|
|
94
|
+
*/
|
|
95
|
+
new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: SegmenterOptions): Segmenter;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale.
|
|
99
|
+
*
|
|
100
|
+
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
|
|
101
|
+
* For the general form and interpretation of the `locales` argument,
|
|
102
|
+
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
|
|
103
|
+
*
|
|
104
|
+
* @param options An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/supportedLocalesOf#parameters).
|
|
105
|
+
* with some or all possible options.
|
|
106
|
+
*
|
|
107
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/supportedLocalesOf)
|
|
108
|
+
*/
|
|
109
|
+
supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick<SegmenterOptions, "localeMatcher">): BCP47LanguageTag[];
|
|
110
|
+
};
|
|
111
|
+
}
|
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220506";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5593,6 +5593,8 @@ var ts;
|
|
|
5593
5593
|
Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
|
|
5594
5594
|
The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
|
|
5595
5595
|
The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
|
|
5596
|
+
The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5597
|
+
The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5596
5598
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
5597
5599
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
5598
5600
|
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -14276,6 +14278,13 @@ var ts;
|
|
|
14276
14278
|
".d.ts";
|
|
14277
14279
|
}
|
|
14278
14280
|
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
14281
|
+
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
14282
|
+
return ts.fileExtensionIsOneOf(path, [".d.mts", ".mjs", ".mts"]) ? [".mts", ".mjs"] :
|
|
14283
|
+
ts.fileExtensionIsOneOf(path, [".d.cts", ".cjs", ".cts"]) ? [".cts", ".cjs"] :
|
|
14284
|
+
ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json"] :
|
|
14285
|
+
[".tsx", ".ts", ".jsx", ".js"];
|
|
14286
|
+
}
|
|
14287
|
+
ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
|
|
14279
14288
|
function outFile(options) {
|
|
14280
14289
|
return options.outFile || options.out;
|
|
14281
14290
|
}
|
|
@@ -31465,6 +31474,7 @@ var ts;
|
|
|
31465
31474
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
31466
31475
|
["es2022.array", "lib.es2022.array.d.ts"],
|
|
31467
31476
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
31477
|
+
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
31468
31478
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
31469
31479
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
31470
31480
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
@@ -34356,7 +34366,7 @@ var ts;
|
|
|
34356
34366
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
34357
34367
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
34358
34368
|
}
|
|
34359
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
|
|
34369
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
|
|
34360
34370
|
var _a;
|
|
34361
34371
|
if (resultFromCache) {
|
|
34362
34372
|
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
@@ -34364,7 +34374,8 @@ var ts;
|
|
|
34364
34374
|
}
|
|
34365
34375
|
return {
|
|
34366
34376
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
34367
|
-
failedLookupLocations: failedLookupLocations
|
|
34377
|
+
failedLookupLocations: failedLookupLocations,
|
|
34378
|
+
resolutionDiagnostics: diagnostics
|
|
34368
34379
|
};
|
|
34369
34380
|
}
|
|
34370
34381
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
@@ -34545,7 +34556,18 @@ var ts;
|
|
|
34545
34556
|
features |= NodeResolutionFeatures.EsmMode;
|
|
34546
34557
|
}
|
|
34547
34558
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
34548
|
-
var
|
|
34559
|
+
var diagnostics = [];
|
|
34560
|
+
var moduleResolutionState = {
|
|
34561
|
+
compilerOptions: options,
|
|
34562
|
+
host: host,
|
|
34563
|
+
traceEnabled: traceEnabled,
|
|
34564
|
+
failedLookupLocations: failedLookupLocations,
|
|
34565
|
+
packageJsonInfoCache: cache,
|
|
34566
|
+
features: features,
|
|
34567
|
+
conditions: conditions,
|
|
34568
|
+
requestContainingDirectory: containingDirectory,
|
|
34569
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
34570
|
+
};
|
|
34549
34571
|
var resolved = primaryLookup();
|
|
34550
34572
|
var primary = true;
|
|
34551
34573
|
if (!resolved) {
|
|
@@ -34564,7 +34586,7 @@ var ts;
|
|
|
34564
34586
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
34565
34587
|
};
|
|
34566
34588
|
}
|
|
34567
|
-
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
34589
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
|
|
34568
34590
|
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
|
|
34569
34591
|
if (traceEnabled)
|
|
34570
34592
|
traceResult(result);
|
|
@@ -34641,6 +34663,8 @@ var ts;
|
|
|
34641
34663
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
34642
34664
|
conditions: ts.emptyArray,
|
|
34643
34665
|
features: NodeResolutionFeatures.None,
|
|
34666
|
+
requestContainingDirectory: containingDirectory,
|
|
34667
|
+
reportDiagnostic: ts.noop
|
|
34644
34668
|
};
|
|
34645
34669
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
34646
34670
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
@@ -35169,6 +35193,7 @@ var ts;
|
|
|
35169
35193
|
if (compilerOptions.noDtsResolution) {
|
|
35170
35194
|
conditions.pop();
|
|
35171
35195
|
}
|
|
35196
|
+
var diagnostics = [];
|
|
35172
35197
|
var state = {
|
|
35173
35198
|
compilerOptions: compilerOptions,
|
|
35174
35199
|
host: host,
|
|
@@ -35177,9 +35202,11 @@ var ts;
|
|
|
35177
35202
|
packageJsonInfoCache: cache,
|
|
35178
35203
|
features: features,
|
|
35179
35204
|
conditions: conditions,
|
|
35205
|
+
requestContainingDirectory: containingDirectory,
|
|
35206
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
35180
35207
|
};
|
|
35181
35208
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
35182
|
-
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
|
|
35209
|
+
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
35183
35210
|
function tryResolve(extensions) {
|
|
35184
35211
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
|
|
35185
35212
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -35321,9 +35348,9 @@ var ts;
|
|
|
35321
35348
|
}
|
|
35322
35349
|
}
|
|
35323
35350
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
35324
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
35351
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
|
|
35325
35352
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
35326
|
-
return result !== undefined ? { path: candidate, ext: ts.
|
|
35353
|
+
return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
|
|
35327
35354
|
}
|
|
35328
35355
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
35329
35356
|
}
|
|
@@ -35440,6 +35467,8 @@ var ts;
|
|
|
35440
35467
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
35441
35468
|
conditions: ["node", "require", "types"],
|
|
35442
35469
|
features: features,
|
|
35470
|
+
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
35471
|
+
reportDiagnostic: ts.noop
|
|
35443
35472
|
};
|
|
35444
35473
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
35445
35474
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -35519,6 +35548,8 @@ var ts;
|
|
|
35519
35548
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
35520
35549
|
features: 0,
|
|
35521
35550
|
conditions: [],
|
|
35551
|
+
requestContainingDirectory: undefined,
|
|
35552
|
+
reportDiagnostic: ts.noop
|
|
35522
35553
|
};
|
|
35523
35554
|
var parts = ts.getPathComponents(fileName);
|
|
35524
35555
|
parts.pop();
|
|
@@ -35793,7 +35824,6 @@ var ts;
|
|
|
35793
35824
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
35794
35825
|
return loadModuleFromTargetImportOrExport;
|
|
35795
35826
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
35796
|
-
var _a, _b;
|
|
35797
35827
|
if (typeof target === "string") {
|
|
35798
35828
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
35799
35829
|
if (state.traceEnabled) {
|
|
@@ -35828,13 +35858,16 @@ var ts;
|
|
|
35828
35858
|
}
|
|
35829
35859
|
return toSearchResult(undefined);
|
|
35830
35860
|
}
|
|
35831
|
-
var finalPath =
|
|
35861
|
+
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
35862
|
+
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
35863
|
+
if (inputLink)
|
|
35864
|
+
return inputLink;
|
|
35832
35865
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, false, state)));
|
|
35833
35866
|
}
|
|
35834
35867
|
else if (typeof target === "object" && target !== null) {
|
|
35835
35868
|
if (!Array.isArray(target)) {
|
|
35836
|
-
for (var _i = 0,
|
|
35837
|
-
var key =
|
|
35869
|
+
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
35870
|
+
var key = _a[_i];
|
|
35838
35871
|
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
35839
35872
|
var subTarget = target[key];
|
|
35840
35873
|
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
@@ -35852,8 +35885,8 @@ var ts;
|
|
|
35852
35885
|
}
|
|
35853
35886
|
return toSearchResult(undefined);
|
|
35854
35887
|
}
|
|
35855
|
-
for (var
|
|
35856
|
-
var elem = target_2[
|
|
35888
|
+
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
35889
|
+
var elem = target_2[_b];
|
|
35857
35890
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
35858
35891
|
if (result) {
|
|
35859
35892
|
return result;
|
|
@@ -35871,6 +35904,94 @@ var ts;
|
|
|
35871
35904
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
35872
35905
|
}
|
|
35873
35906
|
return toSearchResult(undefined);
|
|
35907
|
+
function toAbsolutePath(path) {
|
|
35908
|
+
var _a, _b;
|
|
35909
|
+
if (path === undefined)
|
|
35910
|
+
return path;
|
|
35911
|
+
return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
|
|
35912
|
+
}
|
|
35913
|
+
function combineDirectoryPath(root, dir) {
|
|
35914
|
+
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
35915
|
+
}
|
|
35916
|
+
function useCaseSensitiveFileNames() {
|
|
35917
|
+
return !state.host.useCaseSensitiveFileNames ? true :
|
|
35918
|
+
typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
|
|
35919
|
+
state.host.useCaseSensitiveFileNames();
|
|
35920
|
+
}
|
|
35921
|
+
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
|
|
35922
|
+
var _a, _b, _c, _d;
|
|
35923
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
35924
|
+
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
35925
|
+
&& finalPath.indexOf("/node_modules/") === -1
|
|
35926
|
+
&& (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
|
|
35927
|
+
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
35928
|
+
var commonSourceDirGuesses = [];
|
|
35929
|
+
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
35930
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
|
|
35931
|
+
commonSourceDirGuesses.push(commonDir);
|
|
35932
|
+
}
|
|
35933
|
+
else if (state.requestContainingDirectory) {
|
|
35934
|
+
var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
|
|
35935
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return [requestingFile_1, toAbsolutePath(packagePath)]; }, ((_d = (_c = state.host).getCurrentDirectory) === null || _d === void 0 ? void 0 : _d.call(_c)) || "", getCanonicalFileName));
|
|
35936
|
+
commonSourceDirGuesses.push(commonDir);
|
|
35937
|
+
var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
|
|
35938
|
+
while (fragment && fragment.length > 1) {
|
|
35939
|
+
var parts = ts.getPathComponents(fragment);
|
|
35940
|
+
parts.pop();
|
|
35941
|
+
var commonDir_1 = ts.getPathFromPathComponents(parts);
|
|
35942
|
+
commonSourceDirGuesses.unshift(commonDir_1);
|
|
35943
|
+
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
35944
|
+
}
|
|
35945
|
+
}
|
|
35946
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
35947
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
35948
|
+
? ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate
|
|
35949
|
+
: ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, entry === "" ? "." : entry, packagePath));
|
|
35950
|
+
}
|
|
35951
|
+
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
35952
|
+
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
35953
|
+
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
35954
|
+
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
35955
|
+
var candidateDir = candidateDirectories_1[_e];
|
|
35956
|
+
if (ts.startsWith(finalPath, candidateDir)) {
|
|
35957
|
+
var pathFragment = finalPath.slice(candidateDir.length + 1);
|
|
35958
|
+
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
35959
|
+
var jsAndDtsExtensions = [".mjs", ".cjs", ".js", ".json", ".d.mts", ".d.cts", ".d.ts"];
|
|
35960
|
+
for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
|
|
35961
|
+
var ext = jsAndDtsExtensions_1[_f];
|
|
35962
|
+
if (ts.fileExtensionIs(possibleInputBase, ext)) {
|
|
35963
|
+
var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
35964
|
+
for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
|
|
35965
|
+
var possibleExt = inputExts_1[_g];
|
|
35966
|
+
var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
35967
|
+
if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
|
|
35968
|
+
(extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
|
|
35969
|
+
continue;
|
|
35970
|
+
}
|
|
35971
|
+
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
35972
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, false, state)));
|
|
35973
|
+
}
|
|
35974
|
+
}
|
|
35975
|
+
}
|
|
35976
|
+
}
|
|
35977
|
+
}
|
|
35978
|
+
}
|
|
35979
|
+
}
|
|
35980
|
+
}
|
|
35981
|
+
return undefined;
|
|
35982
|
+
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
|
35983
|
+
var _a, _b;
|
|
35984
|
+
var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
|
|
35985
|
+
var candidateDirectories = [];
|
|
35986
|
+
if (state.compilerOptions.declarationDir) {
|
|
35987
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
|
35988
|
+
}
|
|
35989
|
+
if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
|
|
35990
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
|
|
35991
|
+
}
|
|
35992
|
+
return candidateDirectories;
|
|
35993
|
+
}
|
|
35994
|
+
}
|
|
35874
35995
|
}
|
|
35875
35996
|
}
|
|
35876
35997
|
function isApplicableVersionedTypesKey(conditions, key) {
|
|
@@ -36045,10 +36166,11 @@ var ts;
|
|
|
36045
36166
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
36046
36167
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
36047
36168
|
var failedLookupLocations = [];
|
|
36048
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
36049
36169
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
36170
|
+
var diagnostics = [];
|
|
36171
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
|
|
36050
36172
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
36051
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, state.resultFromCache);
|
|
36173
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
36052
36174
|
function tryResolve(extensions) {
|
|
36053
36175
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
36054
36176
|
if (resolvedUsingSettings) {
|
|
@@ -36084,9 +36206,10 @@ var ts;
|
|
|
36084
36206
|
trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
|
|
36085
36207
|
}
|
|
36086
36208
|
var failedLookupLocations = [];
|
|
36087
|
-
var
|
|
36209
|
+
var diagnostics = [];
|
|
36210
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: undefined, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
|
|
36088
36211
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
|
|
36089
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, state.resultFromCache);
|
|
36212
|
+
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
36090
36213
|
}
|
|
36091
36214
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
36092
36215
|
function toSearchResult(value) {
|
|
@@ -47928,7 +48051,8 @@ var ts;
|
|
|
47928
48051
|
if (symbol === globalThisSymbol) {
|
|
47929
48052
|
var varsOnly_1 = new ts.Map();
|
|
47930
48053
|
members.forEach(function (p) {
|
|
47931
|
-
|
|
48054
|
+
var _a;
|
|
48055
|
+
if (!(p.flags & 418) && !(p.flags & 512 && ((_a = p.declarations) === null || _a === void 0 ? void 0 : _a.length) && ts.every(p.declarations, ts.isAmbientModule))) {
|
|
47932
48056
|
varsOnly_1.set(p.escapedName, p);
|
|
47933
48057
|
}
|
|
47934
48058
|
});
|
|
@@ -72289,7 +72413,7 @@ var ts;
|
|
|
72289
72413
|
}
|
|
72290
72414
|
if (ts.isDeclaration(node)) {
|
|
72291
72415
|
var symbol = getSymbolOfNode(node);
|
|
72292
|
-
return getTypeOfSymbol(symbol);
|
|
72416
|
+
return symbol ? getTypeOfSymbol(symbol) : errorType;
|
|
72293
72417
|
}
|
|
72294
72418
|
if (isDeclarationNameOrImportPropertyName(node)) {
|
|
72295
72419
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -95781,7 +95905,6 @@ var ts;
|
|
|
95781
95905
|
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
95782
95906
|
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
95783
95907
|
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
95784
|
-
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
95785
95908
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
95786
95909
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
95787
95910
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
@@ -96120,6 +96243,34 @@ var ts;
|
|
|
96120
96243
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
96121
96244
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
96122
96245
|
return program;
|
|
96246
|
+
function addResolutionDiagnostics(list) {
|
|
96247
|
+
if (!list)
|
|
96248
|
+
return;
|
|
96249
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
96250
|
+
var elem = list_3[_i];
|
|
96251
|
+
programDiagnostics.add(elem);
|
|
96252
|
+
}
|
|
96253
|
+
}
|
|
96254
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
96255
|
+
var _a;
|
|
96256
|
+
if (!moduleResolutionCache)
|
|
96257
|
+
return;
|
|
96258
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
96259
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
96260
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
96261
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
96262
|
+
var i = 0;
|
|
96263
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
96264
|
+
var n = names_4[_i];
|
|
96265
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
96266
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
96267
|
+
i++;
|
|
96268
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
96269
|
+
continue;
|
|
96270
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
96271
|
+
addResolutionDiagnostics(diags);
|
|
96272
|
+
}
|
|
96273
|
+
}
|
|
96123
96274
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
96124
96275
|
if (!moduleNames.length)
|
|
96125
96276
|
return ts.emptyArray;
|
|
@@ -96131,6 +96282,7 @@ var ts;
|
|
|
96131
96282
|
ts.performance.mark("afterResolveModule");
|
|
96132
96283
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
96133
96284
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
96285
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
96134
96286
|
return result;
|
|
96135
96287
|
}
|
|
96136
96288
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
@@ -99933,8 +100085,8 @@ var ts;
|
|
|
99933
100085
|
!!redirectedReference;
|
|
99934
100086
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
99935
100087
|
var i = 0;
|
|
99936
|
-
for (var _i = 0,
|
|
99937
|
-
var entry =
|
|
100088
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
100089
|
+
var entry = names_5[_i];
|
|
99938
100090
|
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
99939
100091
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
99940
100092
|
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|