@typescript-deploys/pr-build 4.5.0-pr-45884-2 → 4.5.0-pr-45903-8
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/cs/diagnosticMessages.generated.json +6 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +6 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +6 -0
- package/lib/lib.es2018.intl.d.ts +2 -2
- package/lib/lib.es5.d.ts +5 -7
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/protocol.d.ts +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +6 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +6 -0
- package/lib/tsc.js +336 -973
- package/lib/tsserver.js +430 -1125
- package/lib/tsserverlibrary.d.ts +18 -67
- package/lib/tsserverlibrary.js +430 -1125
- package/lib/typescript.d.ts +15 -65
- package/lib/typescript.js +424 -1120
- package/lib/typescriptServices.d.ts +15 -65
- package/lib/typescriptServices.js +424 -1120
- package/lib/typingsInstaller.js +368 -1075
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +6 -0
- package/package.json +2 -2
package/lib/typescript.d.ts
CHANGED
|
@@ -2011,18 +2011,6 @@ declare namespace ts {
|
|
|
2011
2011
|
*/
|
|
2012
2012
|
hasNoDefaultLib: boolean;
|
|
2013
2013
|
languageVersion: ScriptTarget;
|
|
2014
|
-
/**
|
|
2015
|
-
* When `module` is `Node12` or `NodeNext`, this field controls whether the
|
|
2016
|
-
* source file in question is an ESNext-output-format file, or a CommonJS-output-format
|
|
2017
|
-
* module. This is derived by the module resolver as it looks up the file, since
|
|
2018
|
-
* it is derived from either the file extension of the module, or the containing
|
|
2019
|
-
* `package.json` context, and affects both checking and emit.
|
|
2020
|
-
*
|
|
2021
|
-
* It is _public_ so that (pre)transformers can set this field,
|
|
2022
|
-
* since it switches the builtin `node` module transform. Generally speaking, if unset,
|
|
2023
|
-
* the field is treated as though it is `ModuleKind.CommonJS`.
|
|
2024
|
-
*/
|
|
2025
|
-
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
|
|
2026
2014
|
}
|
|
2027
2015
|
export interface Bundle extends Node {
|
|
2028
2016
|
readonly kind: SyntaxKind.Bundle;
|
|
@@ -2734,8 +2722,8 @@ declare namespace ts {
|
|
|
2734
2722
|
root: ConditionalRoot;
|
|
2735
2723
|
checkType: Type;
|
|
2736
2724
|
extendsType: Type;
|
|
2737
|
-
resolvedTrueType
|
|
2738
|
-
resolvedFalseType
|
|
2725
|
+
resolvedTrueType?: Type;
|
|
2726
|
+
resolvedFalseType?: Type;
|
|
2739
2727
|
}
|
|
2740
2728
|
export interface TemplateLiteralType extends InstantiableType {
|
|
2741
2729
|
texts: readonly string[];
|
|
@@ -2840,9 +2828,7 @@ declare namespace ts {
|
|
|
2840
2828
|
}
|
|
2841
2829
|
export enum ModuleResolutionKind {
|
|
2842
2830
|
Classic = 1,
|
|
2843
|
-
NodeJs = 2
|
|
2844
|
-
Node12 = 3,
|
|
2845
|
-
NodeNext = 99
|
|
2831
|
+
NodeJs = 2
|
|
2846
2832
|
}
|
|
2847
2833
|
export interface PluginImport {
|
|
2848
2834
|
name: string;
|
|
@@ -3004,9 +2990,7 @@ declare namespace ts {
|
|
|
3004
2990
|
System = 4,
|
|
3005
2991
|
ES2015 = 5,
|
|
3006
2992
|
ES2020 = 6,
|
|
3007
|
-
ESNext = 99
|
|
3008
|
-
Node12 = 100,
|
|
3009
|
-
NodeNext = 199
|
|
2993
|
+
ESNext = 99
|
|
3010
2994
|
}
|
|
3011
2995
|
export enum JsxEmit {
|
|
3012
2996
|
None = 0,
|
|
@@ -3152,13 +3136,7 @@ declare namespace ts {
|
|
|
3152
3136
|
Js = ".js",
|
|
3153
3137
|
Jsx = ".jsx",
|
|
3154
3138
|
Json = ".json",
|
|
3155
|
-
TsBuildInfo = ".tsbuildinfo"
|
|
3156
|
-
Mjs = ".mjs",
|
|
3157
|
-
Mts = ".mts",
|
|
3158
|
-
Dmts = ".d.mts",
|
|
3159
|
-
Cjs = ".cjs",
|
|
3160
|
-
Cts = ".cts",
|
|
3161
|
-
Dcts = ".d.cts"
|
|
3139
|
+
TsBuildInfo = ".tsbuildinfo"
|
|
3162
3140
|
}
|
|
3163
3141
|
export interface ResolvedModuleWithFailedLookupLocations {
|
|
3164
3142
|
readonly resolvedModule: ResolvedModuleFull | undefined;
|
|
@@ -3186,11 +3164,7 @@ declare namespace ts {
|
|
|
3186
3164
|
useCaseSensitiveFileNames(): boolean;
|
|
3187
3165
|
getNewLine(): string;
|
|
3188
3166
|
readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[];
|
|
3189
|
-
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions
|
|
3190
|
-
/**
|
|
3191
|
-
* Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
|
|
3192
|
-
*/
|
|
3193
|
-
getModuleResolutionCache?(): ModuleResolutionCache | undefined;
|
|
3167
|
+
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
|
|
3194
3168
|
/**
|
|
3195
3169
|
* This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
|
|
3196
3170
|
*/
|
|
@@ -4021,6 +3995,7 @@ declare namespace ts {
|
|
|
4021
3995
|
readonly providePrefixAndSuffixTextForRename?: boolean;
|
|
4022
3996
|
readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
|
|
4023
3997
|
readonly provideRefactorNotApplicableReason?: boolean;
|
|
3998
|
+
readonly jsxSnippetCompletion?: "auto" | "braces" | "none";
|
|
4024
3999
|
}
|
|
4025
4000
|
/** Represents a bigint literal value without requiring bigint support */
|
|
4026
4001
|
export interface PseudoBigInt {
|
|
@@ -4828,20 +4803,12 @@ declare namespace ts {
|
|
|
4828
4803
|
export function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
|
|
4829
4804
|
export interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
|
|
4830
4805
|
}
|
|
4831
|
-
export interface ModeAwareCache<T> {
|
|
4832
|
-
get(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined): T | undefined;
|
|
4833
|
-
set(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined, value: T): this;
|
|
4834
|
-
delete(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined): this;
|
|
4835
|
-
has(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined): boolean;
|
|
4836
|
-
forEach(cb: (elem: T, key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined) => void): void;
|
|
4837
|
-
size(): number;
|
|
4838
|
-
}
|
|
4839
4806
|
/**
|
|
4840
4807
|
* Cached resolutions per containing directory.
|
|
4841
4808
|
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
|
|
4842
4809
|
*/
|
|
4843
4810
|
export interface PerDirectoryResolutionCache<T> {
|
|
4844
|
-
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference):
|
|
4811
|
+
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<T>;
|
|
4845
4812
|
clear(): void;
|
|
4846
4813
|
/**
|
|
4847
4814
|
* Updates with the current compilerOptions the cache will operate with.
|
|
@@ -4857,7 +4824,7 @@ declare namespace ts {
|
|
|
4857
4824
|
* We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
|
|
4858
4825
|
*/
|
|
4859
4826
|
export interface NonRelativeModuleNameResolutionCache extends PackageJsonInfoCache {
|
|
4860
|
-
getOrCreateCacheForModuleName(nonRelativeModuleName: string,
|
|
4827
|
+
getOrCreateCacheForModuleName(nonRelativeModuleName: string, redirectedReference?: ResolvedProjectReference): PerModuleNameCache;
|
|
4861
4828
|
}
|
|
4862
4829
|
export interface PackageJsonInfoCache {
|
|
4863
4830
|
clear(): void;
|
|
@@ -4868,8 +4835,8 @@ declare namespace ts {
|
|
|
4868
4835
|
}
|
|
4869
4836
|
export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
|
|
4870
4837
|
export function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache;
|
|
4871
|
-
export function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache
|
|
4872
|
-
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference
|
|
4838
|
+
export function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
|
|
4839
|
+
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
|
|
4873
4840
|
export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
|
|
4874
4841
|
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
|
|
4875
4842
|
export {};
|
|
@@ -4980,17 +4947,6 @@ declare namespace ts {
|
|
|
4980
4947
|
export function formatDiagnosticsWithColorAndContext(diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string;
|
|
4981
4948
|
export function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string;
|
|
4982
4949
|
export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
|
|
4983
|
-
/**
|
|
4984
|
-
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|
|
4985
|
-
* `options` parameter.
|
|
4986
|
-
*
|
|
4987
|
-
* @param fileName The normalized absolute path to check the format of (it need not exist on disk)
|
|
4988
|
-
* @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
|
|
4989
|
-
* @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
|
|
4990
|
-
* @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
|
|
4991
|
-
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
|
4992
|
-
*/
|
|
4993
|
-
export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ModuleKind.ESNext | ModuleKind.CommonJS | undefined;
|
|
4994
4950
|
/**
|
|
4995
4951
|
* Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
|
|
4996
4952
|
* that represent a compilation unit.
|
|
@@ -5235,7 +5191,7 @@ declare namespace ts {
|
|
|
5235
5191
|
/** If provided is used to get the environment variable */
|
|
5236
5192
|
getEnvironmentVariable?(name: string): string | undefined;
|
|
5237
5193
|
/** If provided, used to resolve the module names, otherwise typescript's default module resolution */
|
|
5238
|
-
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions
|
|
5194
|
+
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
|
|
5239
5195
|
/** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
|
|
5240
5196
|
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
|
|
5241
5197
|
}
|
|
@@ -5625,8 +5581,8 @@ declare namespace ts {
|
|
|
5625
5581
|
realpath?(path: string): string;
|
|
5626
5582
|
fileExists?(path: string): boolean;
|
|
5627
5583
|
getTypeRootsVersion?(): number;
|
|
5628
|
-
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions
|
|
5629
|
-
getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string
|
|
5584
|
+
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedModule | undefined)[];
|
|
5585
|
+
getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
|
|
5630
5586
|
resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions): (ResolvedTypeReferenceDirective | undefined)[];
|
|
5631
5587
|
getDirectories?(directoryName: string): string[];
|
|
5632
5588
|
/**
|
|
@@ -6574,13 +6530,7 @@ declare namespace ts {
|
|
|
6574
6530
|
tsxModifier = ".tsx",
|
|
6575
6531
|
jsModifier = ".js",
|
|
6576
6532
|
jsxModifier = ".jsx",
|
|
6577
|
-
jsonModifier = ".json"
|
|
6578
|
-
dmtsModifier = ".d.mts",
|
|
6579
|
-
mtsModifier = ".mts",
|
|
6580
|
-
mjsModifier = ".mjs",
|
|
6581
|
-
dctsModifier = ".d.cts",
|
|
6582
|
-
ctsModifier = ".cts",
|
|
6583
|
-
cjsModifier = ".cjs"
|
|
6533
|
+
jsonModifier = ".json"
|
|
6584
6534
|
}
|
|
6585
6535
|
enum ClassificationTypeNames {
|
|
6586
6536
|
comment = "comment",
|
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20210916";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5302,12 +5302,6 @@ var ts;
|
|
|
5302
5302
|
(function (ModuleResolutionKind) {
|
|
5303
5303
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5304
5304
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5305
|
-
// Starting with node12, node's module resolver has significant departures from tranditional cjs resolution
|
|
5306
|
-
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5307
|
-
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5308
|
-
// version-anchored resolution target
|
|
5309
|
-
ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
|
|
5310
|
-
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5311
5305
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5312
5306
|
var WatchFileKind;
|
|
5313
5307
|
(function (WatchFileKind) {
|
|
@@ -5345,9 +5339,6 @@ var ts;
|
|
|
5345
5339
|
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
|
|
5346
5340
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5347
5341
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5348
|
-
// Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext
|
|
5349
|
-
ModuleKind[ModuleKind["Node12"] = 100] = "Node12";
|
|
5350
|
-
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5351
5342
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5352
5343
|
var JsxEmit;
|
|
5353
5344
|
(function (JsxEmit) {
|
|
@@ -5547,12 +5538,6 @@ var ts;
|
|
|
5547
5538
|
Extension["Jsx"] = ".jsx";
|
|
5548
5539
|
Extension["Json"] = ".json";
|
|
5549
5540
|
Extension["TsBuildInfo"] = ".tsbuildinfo";
|
|
5550
|
-
Extension["Mjs"] = ".mjs";
|
|
5551
|
-
Extension["Mts"] = ".mts";
|
|
5552
|
-
Extension["Dmts"] = ".d.mts";
|
|
5553
|
-
Extension["Cjs"] = ".cjs";
|
|
5554
|
-
Extension["Cts"] = ".cts";
|
|
5555
|
-
Extension["Dcts"] = ".d.cts";
|
|
5556
5541
|
})(Extension = ts.Extension || (ts.Extension = {}));
|
|
5557
5542
|
/* @internal */
|
|
5558
5543
|
var TransformFlags;
|
|
@@ -8259,7 +8244,7 @@ var ts;
|
|
|
8259
8244
|
Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8260
8245
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
8261
8246
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8262
|
-
|
|
8247
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'."),
|
|
8263
8248
|
Dynamic_import_must_have_one_specifier_as_an_argument: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_import_must_have_one_specifier_as_an_argument_1324", "Dynamic import must have one specifier as an argument."),
|
|
8264
8249
|
Specifier_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Specifier_of_dynamic_import_cannot_be_spread_element_1325", "Specifier of dynamic import cannot be spread element."),
|
|
8265
8250
|
Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
|
|
@@ -8277,7 +8262,7 @@ var ts;
|
|
|
8277
8262
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
8278
8263
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
8279
8264
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8280
|
-
|
|
8265
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'."),
|
|
8281
8266
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8282
8267
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
8283
8268
|
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
|
|
@@ -8308,7 +8293,7 @@ var ts;
|
|
|
8308
8293
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8309
8294
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8310
8295
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8311
|
-
|
|
8296
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_t_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher."),
|
|
8312
8297
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
|
|
8313
8298
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
8314
8299
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
@@ -8360,7 +8345,7 @@ var ts;
|
|
|
8360
8345
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8361
8346
|
The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
|
8362
8347
|
for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8363
|
-
|
|
8348
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher."),
|
|
8364
8349
|
Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
|
|
8365
8350
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8366
8351
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
|
@@ -8376,8 +8361,6 @@ var ts;
|
|
|
8376
8361
|
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled: diag(1446, ts.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),
|
|
8377
8362
|
_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled: diag(1448, ts.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isol_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled."),
|
|
8378
8363
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
8379
|
-
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
8380
|
-
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_es_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_es_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
8381
8364
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8382
8365
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8383
8366
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -8956,6 +8939,11 @@ var ts;
|
|
|
8956
8939
|
This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0: diag(4116, ts.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116", "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."),
|
|
8957
8940
|
This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4117, ts.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
8958
8941
|
The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized: diag(4118, ts.DiagnosticCategory.Error, "The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118", "The type of this node cannot be serialized because its property '{0}' cannot be serialized."),
|
|
8942
|
+
This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4119, ts.DiagnosticCategory.Error, "This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119", "This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
|
|
8943
|
+
This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4120, ts.DiagnosticCategory.Error, "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120", "This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
|
|
8944
|
+
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
|
|
8945
|
+
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
8946
|
+
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
8959
8947
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
8960
8948
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
8961
8949
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -9240,13 +9228,6 @@ var ts;
|
|
|
9240
9228
|
Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
|
|
9241
9229
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9242
9230
|
_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
|
|
9243
|
-
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.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."),
|
|
9244
|
-
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.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}'."),
|
|
9245
|
-
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
9246
|
-
package_json_scope_0_has_no_imports_defined: diag(6273, ts.DiagnosticCategory.Message, "package_json_scope_0_has_no_imports_defined_6273", "package.json scope '{0}' has no imports defined."),
|
|
9247
|
-
package_json_scope_0_explicitly_maps_specifier_1_to_null: diag(6274, ts.DiagnosticCategory.Message, "package_json_scope_0_explicitly_maps_specifier_1_to_null_6274", "package.json scope '{0}' explicitly maps specifier '{1}' to null."),
|
|
9248
|
-
package_json_scope_0_has_invalid_type_for_target_of_specifier_1: diag(6275, ts.DiagnosticCategory.Message, "package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275", "package.json scope '{0}' has invalid type for target of specifier '{1}'"),
|
|
9249
|
-
Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6276, ts.DiagnosticCategory.Message, "Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276", "Export specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
9250
9231
|
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
|
|
9251
9232
|
Composite_projects_may_not_disable_declaration_emit: diag(6304, ts.DiagnosticCategory.Error, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."),
|
|
9252
9233
|
Output_file_0_has_not_been_built_from_source_file_1: diag(6305, ts.DiagnosticCategory.Error, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."),
|
|
@@ -9506,8 +9487,6 @@ var ts;
|
|
|
9506
9487
|
The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed: diag(7056, ts.DiagnosticCategory.Error, "The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056", "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."),
|
|
9507
9488
|
yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation: diag(7057, ts.DiagnosticCategory.Error, "yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057", "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."),
|
|
9508
9489
|
If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1: diag(7058, ts.DiagnosticCategory.Error, "If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058", "If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"),
|
|
9509
|
-
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9510
|
-
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9511
9490
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9512
9491
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9513
9492
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -12113,7 +12092,7 @@ var ts;
|
|
|
12113
12092
|
}
|
|
12114
12093
|
ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;
|
|
12115
12094
|
function getDefaultLibFileName(options) {
|
|
12116
|
-
switch (
|
|
12095
|
+
switch (options.target) {
|
|
12117
12096
|
case 99 /* ESNext */:
|
|
12118
12097
|
return "lib.esnext.full.d.ts";
|
|
12119
12098
|
case 8 /* ES2021 */:
|
|
@@ -14172,22 +14151,22 @@ var ts;
|
|
|
14172
14151
|
return node.end - node.pos;
|
|
14173
14152
|
}
|
|
14174
14153
|
ts.getFullWidth = getFullWidth;
|
|
14175
|
-
function getResolvedModule(sourceFile, moduleNameText
|
|
14176
|
-
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText
|
|
14154
|
+
function getResolvedModule(sourceFile, moduleNameText) {
|
|
14155
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText);
|
|
14177
14156
|
}
|
|
14178
14157
|
ts.getResolvedModule = getResolvedModule;
|
|
14179
|
-
function setResolvedModule(sourceFile, moduleNameText, resolvedModule
|
|
14158
|
+
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
|
14180
14159
|
if (!sourceFile.resolvedModules) {
|
|
14181
|
-
sourceFile.resolvedModules = ts.
|
|
14160
|
+
sourceFile.resolvedModules = new ts.Map();
|
|
14182
14161
|
}
|
|
14183
|
-
sourceFile.resolvedModules.set(moduleNameText,
|
|
14162
|
+
sourceFile.resolvedModules.set(moduleNameText, resolvedModule);
|
|
14184
14163
|
}
|
|
14185
14164
|
ts.setResolvedModule = setResolvedModule;
|
|
14186
14165
|
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
14187
14166
|
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
14188
|
-
sourceFile.resolvedTypeReferenceDirectiveNames = ts.
|
|
14167
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = new ts.Map();
|
|
14189
14168
|
}
|
|
14190
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName,
|
|
14169
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective);
|
|
14191
14170
|
}
|
|
14192
14171
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
14193
14172
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -14219,11 +14198,11 @@ var ts;
|
|
|
14219
14198
|
&& oldResolution.originalPath === newResolution.originalPath;
|
|
14220
14199
|
}
|
|
14221
14200
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
14222
|
-
function hasChangesInResolutions(names, newResolutions, oldResolutions,
|
|
14201
|
+
function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {
|
|
14223
14202
|
ts.Debug.assert(names.length === newResolutions.length);
|
|
14224
14203
|
for (var i = 0; i < names.length; i++) {
|
|
14225
14204
|
var newResolution = newResolutions[i];
|
|
14226
|
-
var oldResolution = oldResolutions && oldResolutions.get(names[i]
|
|
14205
|
+
var oldResolution = oldResolutions && oldResolutions.get(names[i]);
|
|
14227
14206
|
var changed = oldResolution
|
|
14228
14207
|
? !newResolution || !comparer(oldResolution, newResolution)
|
|
14229
14208
|
: newResolution;
|
|
@@ -14758,11 +14737,8 @@ var ts;
|
|
|
14758
14737
|
return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return !isExternalModuleAugmentation(d) && !(ts.isModuleDeclaration(d) && isGlobalScopeAugmentation(d)); });
|
|
14759
14738
|
}
|
|
14760
14739
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14761
|
-
function isCommonJSContainingModuleKind(kind) {
|
|
14762
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node12 || kind === ts.ModuleKind.NodeNext;
|
|
14763
|
-
}
|
|
14764
14740
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14765
|
-
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (
|
|
14741
|
+
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
|
|
14766
14742
|
}
|
|
14767
14743
|
ts.isEffectiveExternalModule = isEffectiveExternalModule;
|
|
14768
14744
|
/**
|
|
@@ -18052,17 +18028,9 @@ var ts;
|
|
|
18052
18028
|
var path = outputDir
|
|
18053
18029
|
? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName)
|
|
18054
18030
|
: fileName;
|
|
18055
|
-
|
|
18056
|
-
return removeFileExtension(path) + declarationExtension;
|
|
18031
|
+
return removeFileExtension(path) + ".d.ts" /* Dts */;
|
|
18057
18032
|
}
|
|
18058
18033
|
ts.getDeclarationEmitOutputFilePathWorker = getDeclarationEmitOutputFilePathWorker;
|
|
18059
|
-
function getDeclarationEmitExtensionForPath(path) {
|
|
18060
|
-
return ts.fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ :
|
|
18061
|
-
ts.fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ :
|
|
18062
|
-
ts.fileExtensionIsOneOf(path, [".json" /* Json */]) ? ".json.d.ts" : // Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well
|
|
18063
|
-
".d.ts" /* Dts */;
|
|
18064
|
-
}
|
|
18065
|
-
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
18066
18034
|
function outFile(options) {
|
|
18067
18035
|
return options.outFile || options.out;
|
|
18068
18036
|
}
|
|
@@ -18802,7 +18770,7 @@ var ts;
|
|
|
18802
18770
|
}
|
|
18803
18771
|
/** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */
|
|
18804
18772
|
function tryExtractTSExtension(fileName) {
|
|
18805
|
-
return ts.find(supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
18773
|
+
return ts.find(ts.supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
18806
18774
|
}
|
|
18807
18775
|
ts.tryExtractTSExtension = tryExtractTSExtension;
|
|
18808
18776
|
/**
|
|
@@ -19754,10 +19722,7 @@ var ts;
|
|
|
19754
19722
|
}
|
|
19755
19723
|
ts.getLanguageVariant = getLanguageVariant;
|
|
19756
19724
|
function getEmitScriptTarget(compilerOptions) {
|
|
19757
|
-
return compilerOptions.target ||
|
|
19758
|
-
(compilerOptions.module === ts.ModuleKind.Node12 && 7 /* ES2020 */) ||
|
|
19759
|
-
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
19760
|
-
0 /* ES3 */;
|
|
19725
|
+
return compilerOptions.target || 0 /* ES3 */;
|
|
19761
19726
|
}
|
|
19762
19727
|
ts.getEmitScriptTarget = getEmitScriptTarget;
|
|
19763
19728
|
function getEmitModuleKind(compilerOptions) {
|
|
@@ -19769,20 +19734,7 @@ var ts;
|
|
|
19769
19734
|
function getEmitModuleResolutionKind(compilerOptions) {
|
|
19770
19735
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
19771
19736
|
if (moduleResolution === undefined) {
|
|
19772
|
-
|
|
19773
|
-
case ts.ModuleKind.CommonJS:
|
|
19774
|
-
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
19775
|
-
break;
|
|
19776
|
-
case ts.ModuleKind.Node12:
|
|
19777
|
-
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
19778
|
-
break;
|
|
19779
|
-
case ts.ModuleKind.NodeNext:
|
|
19780
|
-
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
19781
|
-
break;
|
|
19782
|
-
default:
|
|
19783
|
-
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
19784
|
-
break;
|
|
19785
|
-
}
|
|
19737
|
+
moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
|
|
19786
19738
|
}
|
|
19787
19739
|
return moduleResolution;
|
|
19788
19740
|
}
|
|
@@ -19812,23 +19764,11 @@ var ts;
|
|
|
19812
19764
|
return !!(getEmitDeclarations(options) && options.declarationMap);
|
|
19813
19765
|
}
|
|
19814
19766
|
ts.getAreDeclarationMapsEnabled = getAreDeclarationMapsEnabled;
|
|
19815
|
-
function getESModuleInterop(compilerOptions) {
|
|
19816
|
-
if (compilerOptions.esModuleInterop !== undefined) {
|
|
19817
|
-
return compilerOptions.esModuleInterop;
|
|
19818
|
-
}
|
|
19819
|
-
switch (getEmitModuleKind(compilerOptions)) {
|
|
19820
|
-
case ts.ModuleKind.Node12:
|
|
19821
|
-
case ts.ModuleKind.NodeNext:
|
|
19822
|
-
return true;
|
|
19823
|
-
}
|
|
19824
|
-
return undefined;
|
|
19825
|
-
}
|
|
19826
|
-
ts.getESModuleInterop = getESModuleInterop;
|
|
19827
19767
|
function getAllowSyntheticDefaultImports(compilerOptions) {
|
|
19828
19768
|
var moduleKind = getEmitModuleKind(compilerOptions);
|
|
19829
19769
|
return compilerOptions.allowSyntheticDefaultImports !== undefined
|
|
19830
19770
|
? compilerOptions.allowSyntheticDefaultImports
|
|
19831
|
-
:
|
|
19771
|
+
: compilerOptions.esModuleInterop ||
|
|
19832
19772
|
moduleKind === ts.ModuleKind.System;
|
|
19833
19773
|
}
|
|
19834
19774
|
ts.getAllowSyntheticDefaultImports = getAllowSyntheticDefaultImports;
|
|
@@ -19853,7 +19793,7 @@ var ts;
|
|
|
19853
19793
|
}
|
|
19854
19794
|
ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
|
|
19855
19795
|
function getUseDefineForClassFields(compilerOptions) {
|
|
19856
|
-
return compilerOptions.useDefineForClassFields === undefined ?
|
|
19796
|
+
return compilerOptions.useDefineForClassFields === undefined ? compilerOptions.target === 99 /* ESNext */ : compilerOptions.useDefineForClassFields;
|
|
19857
19797
|
}
|
|
19858
19798
|
ts.getUseDefineForClassFields = getUseDefineForClassFields;
|
|
19859
19799
|
function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
|
|
@@ -20293,54 +20233,51 @@ var ts;
|
|
|
20293
20233
|
}
|
|
20294
20234
|
ts.getScriptKindFromFileName = getScriptKindFromFileName;
|
|
20295
20235
|
/**
|
|
20296
|
-
*
|
|
20236
|
+
* List of supported extensions in order of file resolution precedence.
|
|
20297
20237
|
*/
|
|
20298
|
-
ts.supportedTSExtensions = [
|
|
20299
|
-
ts.
|
|
20300
|
-
var supportedTSExtensionsWithJson = __spreadArray(__spreadArray([], ts.supportedTSExtensions, true), [[".json" /* Json */]], false);
|
|
20238
|
+
ts.supportedTSExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */];
|
|
20239
|
+
ts.supportedTSExtensionsWithJson = [".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".json" /* Json */];
|
|
20301
20240
|
/** Must have ".d.ts" first because if ".ts" goes first, that will be detected as the extension instead of ".d.ts". */
|
|
20302
|
-
|
|
20303
|
-
ts.supportedJSExtensions = [
|
|
20304
|
-
ts.
|
|
20305
|
-
var allSupportedExtensions = [
|
|
20306
|
-
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([],
|
|
20241
|
+
ts.supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
20242
|
+
ts.supportedJSExtensions = [".js" /* Js */, ".jsx" /* Jsx */];
|
|
20243
|
+
ts.supportedJSAndJsonExtensions = [".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
20244
|
+
var allSupportedExtensions = __spreadArray(__spreadArray([], ts.supportedTSExtensions, true), ts.supportedJSExtensions, true);
|
|
20245
|
+
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray(__spreadArray([], ts.supportedTSExtensions, true), ts.supportedJSExtensions, true), [".json" /* Json */], false);
|
|
20307
20246
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20308
20247
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20309
20248
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
20310
20249
|
return needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
|
|
20311
20250
|
}
|
|
20312
|
-
var
|
|
20313
|
-
|
|
20314
|
-
var extensions = __spreadArray(__spreadArray([], builtins, true), ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension) === -1 ? [x.extension] : undefined; }), true);
|
|
20315
|
-
return extensions;
|
|
20251
|
+
var extensions = __spreadArray(__spreadArray([], needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions, true), ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) ? x.extension : undefined; }), true);
|
|
20252
|
+
return ts.deduplicate(extensions, ts.equateStringsCaseSensitive, ts.compareStringsCaseSensitive);
|
|
20316
20253
|
}
|
|
20317
20254
|
ts.getSupportedExtensions = getSupportedExtensions;
|
|
20318
|
-
function
|
|
20255
|
+
function getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions) {
|
|
20319
20256
|
if (!options || !options.resolveJsonModule)
|
|
20320
20257
|
return supportedExtensions;
|
|
20321
20258
|
if (supportedExtensions === allSupportedExtensions)
|
|
20322
20259
|
return allSupportedExtensionsWithJson;
|
|
20323
20260
|
if (supportedExtensions === ts.supportedTSExtensions)
|
|
20324
|
-
return supportedTSExtensionsWithJson;
|
|
20325
|
-
return __spreadArray(__spreadArray([], supportedExtensions, true), [
|
|
20261
|
+
return ts.supportedTSExtensionsWithJson;
|
|
20262
|
+
return __spreadArray(__spreadArray([], supportedExtensions, true), [".json" /* Json */], false);
|
|
20326
20263
|
}
|
|
20327
|
-
ts.
|
|
20264
|
+
ts.getSuppoertedExtensionsWithJsonIfResolveJsonModule = getSuppoertedExtensionsWithJsonIfResolveJsonModule;
|
|
20328
20265
|
function isJSLike(scriptKind) {
|
|
20329
20266
|
return scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */;
|
|
20330
20267
|
}
|
|
20331
20268
|
function hasJSFileExtension(fileName) {
|
|
20332
|
-
return ts.some(ts.
|
|
20269
|
+
return ts.some(ts.supportedJSExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
20333
20270
|
}
|
|
20334
20271
|
ts.hasJSFileExtension = hasJSFileExtension;
|
|
20335
20272
|
function hasTSFileExtension(fileName) {
|
|
20336
|
-
return ts.some(ts.
|
|
20273
|
+
return ts.some(ts.supportedTSExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
20337
20274
|
}
|
|
20338
20275
|
ts.hasTSFileExtension = hasTSFileExtension;
|
|
20339
20276
|
function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
|
|
20340
20277
|
if (!fileName)
|
|
20341
20278
|
return false;
|
|
20342
20279
|
var supportedExtensions = getSupportedExtensions(compilerOptions, extraFileExtensions);
|
|
20343
|
-
for (var _i = 0, _a =
|
|
20280
|
+
for (var _i = 0, _a = getSuppoertedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions); _i < _a.length; _i++) {
|
|
20344
20281
|
var extension = _a[_i];
|
|
20345
20282
|
if (ts.fileExtensionIs(fileName, extension)) {
|
|
20346
20283
|
return true;
|
|
@@ -20357,7 +20294,57 @@ var ts;
|
|
|
20357
20294
|
return ts.compareValues(numberOfDirectorySeparators(path1), numberOfDirectorySeparators(path2));
|
|
20358
20295
|
}
|
|
20359
20296
|
ts.compareNumberOfDirectorySeparators = compareNumberOfDirectorySeparators;
|
|
20360
|
-
|
|
20297
|
+
/**
|
|
20298
|
+
* Extension boundaries by priority. Lower numbers indicate higher priorities, and are
|
|
20299
|
+
* aligned to the offset of the highest priority extension in the
|
|
20300
|
+
* allSupportedExtensions array.
|
|
20301
|
+
*/
|
|
20302
|
+
var ExtensionPriority;
|
|
20303
|
+
(function (ExtensionPriority) {
|
|
20304
|
+
ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles";
|
|
20305
|
+
ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles";
|
|
20306
|
+
ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest";
|
|
20307
|
+
ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest";
|
|
20308
|
+
})(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {}));
|
|
20309
|
+
function getExtensionPriority(path, supportedExtensions) {
|
|
20310
|
+
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
|
|
20311
|
+
if (ts.fileExtensionIs(path, supportedExtensions[i])) {
|
|
20312
|
+
return adjustExtensionPriority(i, supportedExtensions);
|
|
20313
|
+
}
|
|
20314
|
+
}
|
|
20315
|
+
// If its not in the list of supported extensions, this is likely a
|
|
20316
|
+
// TypeScript file with a non-ts extension
|
|
20317
|
+
return 0 /* Highest */;
|
|
20318
|
+
}
|
|
20319
|
+
ts.getExtensionPriority = getExtensionPriority;
|
|
20320
|
+
/**
|
|
20321
|
+
* Adjusts an extension priority to be the highest priority within the same range.
|
|
20322
|
+
*/
|
|
20323
|
+
function adjustExtensionPriority(extensionPriority, supportedExtensions) {
|
|
20324
|
+
if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
|
|
20325
|
+
return 0 /* TypeScriptFiles */;
|
|
20326
|
+
}
|
|
20327
|
+
else if (extensionPriority < supportedExtensions.length) {
|
|
20328
|
+
return 2 /* DeclarationAndJavaScriptFiles */;
|
|
20329
|
+
}
|
|
20330
|
+
else {
|
|
20331
|
+
return supportedExtensions.length;
|
|
20332
|
+
}
|
|
20333
|
+
}
|
|
20334
|
+
ts.adjustExtensionPriority = adjustExtensionPriority;
|
|
20335
|
+
/**
|
|
20336
|
+
* Gets the next lowest extension priority for a given priority.
|
|
20337
|
+
*/
|
|
20338
|
+
function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) {
|
|
20339
|
+
if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
|
|
20340
|
+
return 2 /* DeclarationAndJavaScriptFiles */;
|
|
20341
|
+
}
|
|
20342
|
+
else {
|
|
20343
|
+
return supportedExtensions.length;
|
|
20344
|
+
}
|
|
20345
|
+
}
|
|
20346
|
+
ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;
|
|
20347
|
+
var extensionsToRemove = [".d.ts" /* Dts */, ".ts" /* Ts */, ".js" /* Js */, ".tsx" /* Tsx */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
20361
20348
|
function removeFileExtension(path) {
|
|
20362
20349
|
for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {
|
|
20363
20350
|
var ext = extensionsToRemove_1[_i];
|
|
@@ -25533,7 +25520,6 @@ var ts;
|
|
|
25533
25520
|
node.transformFlags =
|
|
25534
25521
|
propagateChildrenFlags(node.statements) |
|
|
25535
25522
|
propagateChildFlags(node.endOfFileToken);
|
|
25536
|
-
node.impliedNodeFormat = source.impliedNodeFormat;
|
|
25537
25523
|
return node;
|
|
25538
25524
|
}
|
|
25539
25525
|
// @api
|
|
@@ -27147,7 +27133,7 @@ var ts;
|
|
|
27147
27133
|
}
|
|
27148
27134
|
// ES2018 Helpers
|
|
27149
27135
|
function createAssignHelper(attributesSegments) {
|
|
27150
|
-
if (
|
|
27136
|
+
if (context.getCompilerOptions().target >= 2 /* ES2015 */) {
|
|
27151
27137
|
return factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "assign"),
|
|
27152
27138
|
/*typeArguments*/ undefined, attributesSegments);
|
|
27153
27139
|
}
|
|
@@ -29009,7 +28995,7 @@ var ts;
|
|
|
29009
28995
|
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
29010
28996
|
var namedBindings = void 0;
|
|
29011
28997
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
29012
|
-
if (
|
|
28998
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
|
|
29013
28999
|
// use named imports
|
|
29014
29000
|
var helpers = ts.getEmitHelpers(sourceFile);
|
|
29015
29001
|
if (helpers) {
|
|
@@ -29060,9 +29046,9 @@ var ts;
|
|
|
29060
29046
|
return externalHelpersModuleName;
|
|
29061
29047
|
}
|
|
29062
29048
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
29063
|
-
var create = (hasExportStarsToExportValues || (
|
|
29049
|
+
var create = (hasExportStarsToExportValues || (compilerOptions.esModuleInterop && hasImportStarOrImportDefault))
|
|
29064
29050
|
&& moduleKind !== ts.ModuleKind.System
|
|
29065
|
-
&&
|
|
29051
|
+
&& moduleKind < ts.ModuleKind.ES2015;
|
|
29066
29052
|
if (!create) {
|
|
29067
29053
|
var helpers = ts.getEmitHelpers(node);
|
|
29068
29054
|
if (helpers) {
|
|
@@ -38332,9 +38318,7 @@ var ts;
|
|
|
38332
38318
|
es6: ts.ModuleKind.ES2015,
|
|
38333
38319
|
es2015: ts.ModuleKind.ES2015,
|
|
38334
38320
|
es2020: ts.ModuleKind.ES2020,
|
|
38335
|
-
esnext: ts.ModuleKind.ESNext
|
|
38336
|
-
node12: ts.ModuleKind.Node12,
|
|
38337
|
-
nodenext: ts.ModuleKind.NodeNext,
|
|
38321
|
+
esnext: ts.ModuleKind.ESNext
|
|
38338
38322
|
})),
|
|
38339
38323
|
affectsModuleResolution: true,
|
|
38340
38324
|
affectsEmit: true,
|
|
@@ -40760,7 +40744,7 @@ var ts;
|
|
|
40760
40744
|
// Rather than re-query this for each file and filespec, we query the supported extensions
|
|
40761
40745
|
// once and store it on the expansion context.
|
|
40762
40746
|
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
|
|
40763
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
40747
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
40764
40748
|
// Literal files are always included verbatim. An "include" or "exclude" specification cannot
|
|
40765
40749
|
// remove a literal file.
|
|
40766
40750
|
if (validatedFilesSpec) {
|
|
@@ -40808,7 +40792,7 @@ var ts;
|
|
|
40808
40792
|
wildcardFileMap.set(key, file);
|
|
40809
40793
|
}
|
|
40810
40794
|
};
|
|
40811
|
-
for (var _a = 0, _b = host.readDirectory(basePath,
|
|
40795
|
+
for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensionsWithJsonIfResolveJsonModule, validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
|
|
40812
40796
|
var file = _b[_a];
|
|
40813
40797
|
_loop_6(file);
|
|
40814
40798
|
}
|
|
@@ -40971,25 +40955,16 @@ var ts;
|
|
|
40971
40955
|
* extension priority.
|
|
40972
40956
|
*
|
|
40973
40957
|
* @param file The path to the file.
|
|
40958
|
+
* @param extensionPriority The priority of the extension.
|
|
40959
|
+
* @param context The expansion context.
|
|
40974
40960
|
*/
|
|
40975
40961
|
function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
|
|
40976
|
-
var
|
|
40977
|
-
|
|
40978
|
-
|
|
40979
|
-
|
|
40980
|
-
|
|
40981
|
-
var ext = extensionGroup_1[_i];
|
|
40982
|
-
if (ts.fileExtensionIs(file, ext)) {
|
|
40983
|
-
return false;
|
|
40984
|
-
}
|
|
40985
|
-
var higherPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
40962
|
+
var extensionPriority = ts.getExtensionPriority(file, extensions);
|
|
40963
|
+
var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions);
|
|
40964
|
+
for (var i = 0 /* Highest */; i < adjustedExtensionPriority; i++) {
|
|
40965
|
+
var higherPriorityExtension = extensions[i];
|
|
40966
|
+
var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));
|
|
40986
40967
|
if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) {
|
|
40987
|
-
if (ext === ".d.ts" /* Dts */ && (ts.fileExtensionIs(file, ".js" /* Js */) || ts.fileExtensionIs(file, ".jsx" /* Jsx */))) {
|
|
40988
|
-
// LEGACY BEHAVIOR: An off-by-one bug somewhere in the extension priority system for wildcard module loading allowed declaration
|
|
40989
|
-
// files to be loaded alongside their js(x) counterparts. We regard this as generally undesirable, but retain the behavior to
|
|
40990
|
-
// prevent breakage.
|
|
40991
|
-
continue;
|
|
40992
|
-
}
|
|
40993
40968
|
return true;
|
|
40994
40969
|
}
|
|
40995
40970
|
}
|
|
@@ -41000,18 +40975,15 @@ var ts;
|
|
|
41000
40975
|
* already been included.
|
|
41001
40976
|
*
|
|
41002
40977
|
* @param file The path to the file.
|
|
40978
|
+
* @param extensionPriority The priority of the extension.
|
|
40979
|
+
* @param context The expansion context.
|
|
41003
40980
|
*/
|
|
41004
40981
|
function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
|
|
41005
|
-
var
|
|
41006
|
-
|
|
41007
|
-
|
|
41008
|
-
|
|
41009
|
-
|
|
41010
|
-
var ext = extensionGroup[i];
|
|
41011
|
-
if (ts.fileExtensionIs(file, ext)) {
|
|
41012
|
-
return;
|
|
41013
|
-
}
|
|
41014
|
-
var lowerPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
40982
|
+
var extensionPriority = ts.getExtensionPriority(file, extensions);
|
|
40983
|
+
var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions);
|
|
40984
|
+
for (var i = nextExtensionPriority; i < extensions.length; i++) {
|
|
40985
|
+
var lowerPriorityExtension = extensions[i];
|
|
40986
|
+
var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));
|
|
41015
40987
|
wildcardFiles.delete(lowerPriorityPath);
|
|
41016
40988
|
}
|
|
41017
40989
|
}
|
|
@@ -41271,7 +41243,7 @@ var ts;
|
|
|
41271
41243
|
}
|
|
41272
41244
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
41273
41245
|
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
41274
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName
|
|
41246
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName);
|
|
41275
41247
|
if (result) {
|
|
41276
41248
|
if (traceEnabled) {
|
|
41277
41249
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -41305,7 +41277,7 @@ var ts;
|
|
|
41305
41277
|
}
|
|
41306
41278
|
}
|
|
41307
41279
|
var failedLookupLocations = [];
|
|
41308
|
-
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache
|
|
41280
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
41309
41281
|
var resolved = primaryLookup();
|
|
41310
41282
|
var primary = true;
|
|
41311
41283
|
if (!resolved) {
|
|
@@ -41325,7 +41297,7 @@ var ts;
|
|
|
41325
41297
|
};
|
|
41326
41298
|
}
|
|
41327
41299
|
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
41328
|
-
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName,
|
|
41300
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, result);
|
|
41329
41301
|
if (traceEnabled)
|
|
41330
41302
|
traceResult(result);
|
|
41331
41303
|
return result;
|
|
@@ -41538,56 +41510,9 @@ var ts;
|
|
|
41538
41510
|
}
|
|
41539
41511
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
41540
41512
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
41541
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return
|
|
41513
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return new ts.Map(); });
|
|
41542
41514
|
}
|
|
41543
41515
|
}
|
|
41544
|
-
/* @internal */
|
|
41545
|
-
function createModeAwareCache() {
|
|
41546
|
-
var underlying = new ts.Map();
|
|
41547
|
-
var memoizedReverseKeys = new ts.Map();
|
|
41548
|
-
var cache = {
|
|
41549
|
-
get: function (specifier, mode) {
|
|
41550
|
-
return underlying.get(getUnderlyingCacheKey(specifier, mode));
|
|
41551
|
-
},
|
|
41552
|
-
set: function (specifier, mode, value) {
|
|
41553
|
-
underlying.set(getUnderlyingCacheKey(specifier, mode), value);
|
|
41554
|
-
return cache;
|
|
41555
|
-
},
|
|
41556
|
-
delete: function (specifier, mode) {
|
|
41557
|
-
underlying.delete(getUnderlyingCacheKey(specifier, mode));
|
|
41558
|
-
return cache;
|
|
41559
|
-
},
|
|
41560
|
-
has: function (specifier, mode) {
|
|
41561
|
-
return underlying.has(getUnderlyingCacheKey(specifier, mode));
|
|
41562
|
-
},
|
|
41563
|
-
forEach: function (cb) {
|
|
41564
|
-
return underlying.forEach(function (elem, key) {
|
|
41565
|
-
var _a = memoizedReverseKeys.get(key), specifier = _a[0], mode = _a[1];
|
|
41566
|
-
return cb(elem, specifier, mode);
|
|
41567
|
-
});
|
|
41568
|
-
},
|
|
41569
|
-
size: function () {
|
|
41570
|
-
return underlying.size;
|
|
41571
|
-
}
|
|
41572
|
-
};
|
|
41573
|
-
return cache;
|
|
41574
|
-
function getUnderlyingCacheKey(specifier, mode) {
|
|
41575
|
-
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
41576
|
-
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
41577
|
-
return result;
|
|
41578
|
-
}
|
|
41579
|
-
}
|
|
41580
|
-
ts.createModeAwareCache = createModeAwareCache;
|
|
41581
|
-
/* @internal */
|
|
41582
|
-
function zipToModeAwareCache(file, keys, values) {
|
|
41583
|
-
ts.Debug.assert(keys.length === values.length);
|
|
41584
|
-
var map = createModeAwareCache();
|
|
41585
|
-
for (var i = 0; i < keys.length; ++i) {
|
|
41586
|
-
map.set(keys[i], ts.getModeForResolutionAtIndex(file, i), values[i]);
|
|
41587
|
-
}
|
|
41588
|
-
return map;
|
|
41589
|
-
}
|
|
41590
|
-
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
41591
41516
|
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
41592
41517
|
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
41593
41518
|
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
@@ -41601,9 +41526,9 @@ var ts;
|
|
|
41601
41526
|
function update(options) {
|
|
41602
41527
|
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
41603
41528
|
}
|
|
41604
|
-
function getOrCreateCacheForModuleName(nonRelativeModuleName,
|
|
41529
|
+
function getOrCreateCacheForModuleName(nonRelativeModuleName, redirectedReference) {
|
|
41605
41530
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
41606
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
41531
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, nonRelativeModuleName, createPerModuleNameCache);
|
|
41607
41532
|
}
|
|
41608
41533
|
function createPerModuleNameCache() {
|
|
41609
41534
|
var directoryPathMap = new ts.Map();
|
|
@@ -41682,15 +41607,13 @@ var ts;
|
|
|
41682
41607
|
}
|
|
41683
41608
|
}
|
|
41684
41609
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
41685
|
-
function resolveModuleNameFromCache(moduleName, containingFile, cache
|
|
41610
|
+
function resolveModuleNameFromCache(moduleName, containingFile, cache) {
|
|
41686
41611
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41687
41612
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
41688
|
-
|
|
41689
|
-
return undefined;
|
|
41690
|
-
return perFolderCache.get(moduleName, mode);
|
|
41613
|
+
return perFolderCache && perFolderCache.get(moduleName);
|
|
41691
41614
|
}
|
|
41692
41615
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
41693
|
-
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference
|
|
41616
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
41694
41617
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
41695
41618
|
if (redirectedReference) {
|
|
41696
41619
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -41703,7 +41626,7 @@ var ts;
|
|
|
41703
41626
|
}
|
|
41704
41627
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41705
41628
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
41706
|
-
var result = perFolderCache && perFolderCache.get(moduleName
|
|
41629
|
+
var result = perFolderCache && perFolderCache.get(moduleName);
|
|
41707
41630
|
if (result) {
|
|
41708
41631
|
if (traceEnabled) {
|
|
41709
41632
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -41712,20 +41635,7 @@ var ts;
|
|
|
41712
41635
|
else {
|
|
41713
41636
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
41714
41637
|
if (moduleResolution === undefined) {
|
|
41715
|
-
|
|
41716
|
-
case ts.ModuleKind.CommonJS:
|
|
41717
|
-
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
41718
|
-
break;
|
|
41719
|
-
case ts.ModuleKind.Node12:
|
|
41720
|
-
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
41721
|
-
break;
|
|
41722
|
-
case ts.ModuleKind.NodeNext:
|
|
41723
|
-
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
41724
|
-
break;
|
|
41725
|
-
default:
|
|
41726
|
-
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
41727
|
-
break;
|
|
41728
|
-
}
|
|
41638
|
+
moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
|
|
41729
41639
|
if (traceEnabled) {
|
|
41730
41640
|
trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
|
|
41731
41641
|
}
|
|
@@ -41737,12 +41647,6 @@ var ts;
|
|
|
41737
41647
|
}
|
|
41738
41648
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
41739
41649
|
switch (moduleResolution) {
|
|
41740
|
-
case ts.ModuleResolutionKind.Node12:
|
|
41741
|
-
result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41742
|
-
break;
|
|
41743
|
-
case ts.ModuleResolutionKind.NodeNext:
|
|
41744
|
-
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41745
|
-
break;
|
|
41746
41650
|
case ts.ModuleResolutionKind.NodeJs:
|
|
41747
41651
|
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
41748
41652
|
break;
|
|
@@ -41756,10 +41660,10 @@ var ts;
|
|
|
41756
41660
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
41757
41661
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
41758
41662
|
if (perFolderCache) {
|
|
41759
|
-
perFolderCache.set(moduleName,
|
|
41663
|
+
perFolderCache.set(moduleName, result);
|
|
41760
41664
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
41761
41665
|
// put result in per-module name cache
|
|
41762
|
-
cache.getOrCreateCacheForModuleName(moduleName,
|
|
41666
|
+
cache.getOrCreateCacheForModuleName(moduleName, redirectedReference).set(containingDirectory, result);
|
|
41763
41667
|
}
|
|
41764
41668
|
}
|
|
41765
41669
|
}
|
|
@@ -41966,51 +41870,22 @@ var ts;
|
|
|
41966
41870
|
return tryResolveJSModuleWorker(moduleName, initialDir, host).resolvedModule;
|
|
41967
41871
|
}
|
|
41968
41872
|
ts.tryResolveJSModule = tryResolveJSModule;
|
|
41969
|
-
/* @internal */
|
|
41970
|
-
var NodeResolutionFeatures;
|
|
41971
|
-
(function (NodeResolutionFeatures) {
|
|
41972
|
-
NodeResolutionFeatures[NodeResolutionFeatures["None"] = 0] = "None";
|
|
41973
|
-
// resolving `#local` names in your own package.json
|
|
41974
|
-
NodeResolutionFeatures[NodeResolutionFeatures["Imports"] = 2] = "Imports";
|
|
41975
|
-
// resolving `your-own-name` from your own package.json
|
|
41976
|
-
NodeResolutionFeatures[NodeResolutionFeatures["SelfName"] = 4] = "SelfName";
|
|
41977
|
-
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
41978
|
-
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
41979
|
-
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
41980
|
-
// not currently backported to node 12 - https://github.com/nodejs/Release/issues/690
|
|
41981
|
-
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
41982
|
-
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
41983
|
-
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
41984
|
-
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
41985
|
-
function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41986
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Imports | NodeResolutionFeatures.SelfName | NodeResolutionFeatures.Exports, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41987
|
-
}
|
|
41988
|
-
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41989
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.AllFeatures, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41990
|
-
}
|
|
41991
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41992
|
-
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41993
|
-
// es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
|
|
41994
|
-
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
41995
|
-
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
|
|
41996
|
-
}
|
|
41997
41873
|
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
41998
41874
|
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
41999
41875
|
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
42000
41876
|
var tsconfigExtensions = [Extensions.TSConfig];
|
|
42001
41877
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
42002
|
-
return nodeModuleNameResolverWorker(
|
|
41878
|
+
return nodeModuleNameResolverWorker(moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
42003
41879
|
}
|
|
42004
41880
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
42005
|
-
return nodeModuleNameResolverWorker(
|
|
41881
|
+
return nodeModuleNameResolverWorker(moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
42006
41882
|
}
|
|
42007
41883
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
42008
|
-
function nodeModuleNameResolverWorker(
|
|
41884
|
+
function nodeModuleNameResolverWorker(moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
42009
41885
|
var _a, _b;
|
|
42010
41886
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
42011
41887
|
var failedLookupLocations = [];
|
|
42012
|
-
|
|
42013
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] };
|
|
41888
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
42014
41889
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
42015
41890
|
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);
|
|
42016
41891
|
function tryResolve(extensions) {
|
|
@@ -42020,19 +41895,10 @@ var ts;
|
|
|
42020
41895
|
return toSearchResult({ resolved: resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) });
|
|
42021
41896
|
}
|
|
42022
41897
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
42023
|
-
|
|
42024
|
-
|
|
42025
|
-
resolved_1 = loadModuleFromImports(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
42026
|
-
}
|
|
42027
|
-
if (!resolved_1 && features & NodeResolutionFeatures.SelfName) {
|
|
42028
|
-
resolved_1 = loadModuleFromSelfNameReference(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
42029
|
-
}
|
|
42030
|
-
if (!resolved_1) {
|
|
42031
|
-
if (traceEnabled) {
|
|
42032
|
-
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
|
|
42033
|
-
}
|
|
42034
|
-
resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41898
|
+
if (traceEnabled) {
|
|
41899
|
+
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
|
|
42035
41900
|
}
|
|
41901
|
+
var resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
42036
41902
|
if (!resolved_1)
|
|
42037
41903
|
return undefined;
|
|
42038
41904
|
var resolvedValue = resolved_1.value;
|
|
@@ -42141,33 +42007,26 @@ var ts;
|
|
|
42141
42007
|
function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
42142
42008
|
if (extensions === Extensions.Json || extensions === Extensions.TSConfig) {
|
|
42143
42009
|
var extensionLess = ts.tryRemoveExtension(candidate, ".json" /* Json */);
|
|
42144
|
-
|
|
42145
|
-
return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
|
|
42010
|
+
return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, onlyRecordFailures, state);
|
|
42146
42011
|
}
|
|
42147
|
-
//
|
|
42148
|
-
|
|
42149
|
-
|
|
42150
|
-
|
|
42151
|
-
if (resolvedByAddingExtension) {
|
|
42152
|
-
return resolvedByAddingExtension;
|
|
42153
|
-
}
|
|
42012
|
+
// First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts"
|
|
42013
|
+
var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, onlyRecordFailures, state);
|
|
42014
|
+
if (resolvedByAddingExtension) {
|
|
42015
|
+
return resolvedByAddingExtension;
|
|
42154
42016
|
}
|
|
42155
|
-
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
42156
|
-
}
|
|
42157
|
-
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
42158
42017
|
// If that didn't work, try stripping a ".js" or ".jsx" extension and replacing it with a TypeScript one;
|
|
42159
42018
|
// e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts"
|
|
42160
|
-
if (ts.hasJSFileExtension(candidate)
|
|
42019
|
+
if (ts.hasJSFileExtension(candidate)) {
|
|
42161
42020
|
var extensionless = ts.removeFileExtension(candidate);
|
|
42162
|
-
var extension = candidate.substring(extensionless.length);
|
|
42163
42021
|
if (state.traceEnabled) {
|
|
42022
|
+
var extension = candidate.substring(extensionless.length);
|
|
42164
42023
|
trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
42165
42024
|
}
|
|
42166
|
-
return tryAddingExtensions(extensionless, extensions,
|
|
42025
|
+
return tryAddingExtensions(extensionless, extensions, onlyRecordFailures, state);
|
|
42167
42026
|
}
|
|
42168
42027
|
}
|
|
42169
42028
|
/** Try to return an existing file that adds one of the `extensions` to `candidate`. */
|
|
42170
|
-
function tryAddingExtensions(candidate, extensions,
|
|
42029
|
+
function tryAddingExtensions(candidate, extensions, onlyRecordFailures, state) {
|
|
42171
42030
|
if (!onlyRecordFailures) {
|
|
42172
42031
|
// check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing
|
|
42173
42032
|
var directory = ts.getDirectoryPath(candidate);
|
|
@@ -42177,51 +42036,11 @@ var ts;
|
|
|
42177
42036
|
}
|
|
42178
42037
|
switch (extensions) {
|
|
42179
42038
|
case Extensions.DtsOnly:
|
|
42180
|
-
|
|
42181
|
-
case ".mjs" /* Mjs */:
|
|
42182
|
-
case ".mts" /* Mts */:
|
|
42183
|
-
case ".d.mts" /* Dmts */:
|
|
42184
|
-
return tryExtension(".d.mts" /* Dmts */);
|
|
42185
|
-
case ".cjs" /* Cjs */:
|
|
42186
|
-
case ".cts" /* Cts */:
|
|
42187
|
-
case ".d.cts" /* Dcts */:
|
|
42188
|
-
return tryExtension(".d.cts" /* Dcts */);
|
|
42189
|
-
case ".json" /* Json */:
|
|
42190
|
-
candidate += ".json" /* Json */;
|
|
42191
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
42192
|
-
default: return tryExtension(".d.ts" /* Dts */);
|
|
42193
|
-
}
|
|
42039
|
+
return tryExtension(".d.ts" /* Dts */);
|
|
42194
42040
|
case Extensions.TypeScript:
|
|
42195
|
-
|
|
42196
|
-
case ".mjs" /* Mjs */:
|
|
42197
|
-
case ".mts" /* Mts */:
|
|
42198
|
-
case ".d.mts" /* Dmts */:
|
|
42199
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
42200
|
-
case ".cjs" /* Cjs */:
|
|
42201
|
-
case ".cts" /* Cts */:
|
|
42202
|
-
case ".d.cts" /* Dcts */:
|
|
42203
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
42204
|
-
case ".json" /* Json */:
|
|
42205
|
-
candidate += ".json" /* Json */;
|
|
42206
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
42207
|
-
default:
|
|
42208
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
42209
|
-
}
|
|
42041
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
42210
42042
|
case Extensions.JavaScript:
|
|
42211
|
-
|
|
42212
|
-
case ".mjs" /* Mjs */:
|
|
42213
|
-
case ".mts" /* Mts */:
|
|
42214
|
-
case ".d.mts" /* Dmts */:
|
|
42215
|
-
return tryExtension(".mjs" /* Mjs */);
|
|
42216
|
-
case ".cjs" /* Cjs */:
|
|
42217
|
-
case ".cts" /* Cts */:
|
|
42218
|
-
case ".d.cts" /* Dcts */:
|
|
42219
|
-
return tryExtension(".cjs" /* Cjs */);
|
|
42220
|
-
case ".json" /* Json */:
|
|
42221
|
-
return tryExtension(".json" /* Json */);
|
|
42222
|
-
default:
|
|
42223
|
-
return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
|
|
42224
|
-
}
|
|
42043
|
+
return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
|
|
42225
42044
|
case Extensions.TSConfig:
|
|
42226
42045
|
case Extensions.Json:
|
|
42227
42046
|
return tryExtension(".json" /* Json */);
|
|
@@ -42256,33 +42075,6 @@ var ts;
|
|
|
42256
42075
|
var versionPaths = packageInfo && packageInfo.versionPaths;
|
|
42257
42076
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
42258
42077
|
}
|
|
42259
|
-
/**
|
|
42260
|
-
* A function for locating the package.json scope for a given path
|
|
42261
|
-
*/
|
|
42262
|
-
/*@internal*/
|
|
42263
|
-
function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
|
|
42264
|
-
var state = {
|
|
42265
|
-
host: host,
|
|
42266
|
-
compilerOptions: options,
|
|
42267
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
42268
|
-
failedLookupLocations: [],
|
|
42269
|
-
packageJsonInfoCache: packageJsonInfoCache,
|
|
42270
|
-
features: 0,
|
|
42271
|
-
conditions: [],
|
|
42272
|
-
};
|
|
42273
|
-
var parts = ts.getPathComponents(fileName);
|
|
42274
|
-
parts.pop();
|
|
42275
|
-
while (parts.length > 0) {
|
|
42276
|
-
var pkg = getPackageJsonInfo(ts.getPathFromPathComponents(parts), /*onlyRecordFailures*/ false, state);
|
|
42277
|
-
if (pkg) {
|
|
42278
|
-
return pkg;
|
|
42279
|
-
}
|
|
42280
|
-
parts.pop();
|
|
42281
|
-
}
|
|
42282
|
-
return undefined;
|
|
42283
|
-
}
|
|
42284
|
-
ts.getPackageScopeForPath = getPackageScopeForPath;
|
|
42285
|
-
/*@internal*/
|
|
42286
42078
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
42287
42079
|
var _a, _b, _c;
|
|
42288
42080
|
var host = state.host, traceEnabled = state.traceEnabled;
|
|
@@ -42325,7 +42117,6 @@ var ts;
|
|
|
42325
42117
|
state.failedLookupLocations.push(packageJsonPath);
|
|
42326
42118
|
}
|
|
42327
42119
|
}
|
|
42328
|
-
ts.getPackageJsonInfo = getPackageJsonInfo;
|
|
42329
42120
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
42330
42121
|
var packageFile;
|
|
42331
42122
|
if (jsonContent) {
|
|
@@ -42381,10 +42172,7 @@ var ts;
|
|
|
42381
42172
|
var packageFileResult = packageFile && removeIgnoredPackageId(loader(extensions, packageFile, onlyRecordFailuresForPackageFile, state));
|
|
42382
42173
|
if (packageFileResult)
|
|
42383
42174
|
return packageFileResult;
|
|
42384
|
-
|
|
42385
|
-
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
|
|
42386
|
-
return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state);
|
|
42387
|
-
}
|
|
42175
|
+
return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state);
|
|
42388
42176
|
}
|
|
42389
42177
|
/** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */
|
|
42390
42178
|
function resolvedIfExtensionMatches(extensions, path) {
|
|
@@ -42414,216 +42202,6 @@ var ts;
|
|
|
42414
42202
|
return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
|
|
42415
42203
|
}
|
|
42416
42204
|
ts.parsePackageName = parsePackageName;
|
|
42417
|
-
function allKeysStartWithDot(obj) {
|
|
42418
|
-
return ts.every(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
42419
|
-
}
|
|
42420
|
-
function noKeyStartsWithDot(obj) {
|
|
42421
|
-
return !ts.some(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
42422
|
-
}
|
|
42423
|
-
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42424
|
-
var _a, _b;
|
|
42425
|
-
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
42426
|
-
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
42427
|
-
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
42428
|
-
if (!scope || !scope.packageJsonContent.exports) {
|
|
42429
|
-
return undefined;
|
|
42430
|
-
}
|
|
42431
|
-
var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
|
|
42432
|
-
if (scope.packageJsonContent.name !== parts[1]) {
|
|
42433
|
-
return undefined;
|
|
42434
|
-
}
|
|
42435
|
-
var trailingParts = parts.slice(2);
|
|
42436
|
-
return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : "." + ts.directorySeparator + trailingParts.join(ts.directorySeparator), state, cache, redirectedReference);
|
|
42437
|
-
}
|
|
42438
|
-
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
42439
|
-
if (!scope.packageJsonContent.exports) {
|
|
42440
|
-
return undefined;
|
|
42441
|
-
}
|
|
42442
|
-
if (subpath === ".") {
|
|
42443
|
-
var mainExport = void 0;
|
|
42444
|
-
if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) {
|
|
42445
|
-
mainExport = scope.packageJsonContent.exports;
|
|
42446
|
-
}
|
|
42447
|
-
else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) {
|
|
42448
|
-
mainExport = scope.packageJsonContent.exports["."];
|
|
42449
|
-
}
|
|
42450
|
-
if (mainExport) {
|
|
42451
|
-
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
|
|
42452
|
-
return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
|
|
42453
|
-
}
|
|
42454
|
-
}
|
|
42455
|
-
else if (allKeysStartWithDot(scope.packageJsonContent.exports)) {
|
|
42456
|
-
if (typeof scope.packageJsonContent.exports !== "object") {
|
|
42457
|
-
if (state.traceEnabled) {
|
|
42458
|
-
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
42459
|
-
}
|
|
42460
|
-
return toSearchResult(/*value*/ undefined);
|
|
42461
|
-
}
|
|
42462
|
-
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false);
|
|
42463
|
-
if (result) {
|
|
42464
|
-
return result;
|
|
42465
|
-
}
|
|
42466
|
-
}
|
|
42467
|
-
if (state.traceEnabled) {
|
|
42468
|
-
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
42469
|
-
}
|
|
42470
|
-
return toSearchResult(/*value*/ undefined);
|
|
42471
|
-
}
|
|
42472
|
-
function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42473
|
-
var _a, _b;
|
|
42474
|
-
if (moduleName === "#" || ts.startsWith(moduleName, "#/")) {
|
|
42475
|
-
if (state.traceEnabled) {
|
|
42476
|
-
trace(state.host, ts.Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName);
|
|
42477
|
-
}
|
|
42478
|
-
return toSearchResult(/*value*/ undefined);
|
|
42479
|
-
}
|
|
42480
|
-
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
42481
|
-
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
42482
|
-
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
42483
|
-
if (!scope) {
|
|
42484
|
-
if (state.traceEnabled) {
|
|
42485
|
-
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
42486
|
-
}
|
|
42487
|
-
return toSearchResult(/*value*/ undefined);
|
|
42488
|
-
}
|
|
42489
|
-
if (!scope.packageJsonContent.imports) {
|
|
42490
|
-
if (state.traceEnabled) {
|
|
42491
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory);
|
|
42492
|
-
}
|
|
42493
|
-
return toSearchResult(/*value*/ undefined);
|
|
42494
|
-
}
|
|
42495
|
-
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true);
|
|
42496
|
-
if (result) {
|
|
42497
|
-
return result;
|
|
42498
|
-
}
|
|
42499
|
-
if (state.traceEnabled) {
|
|
42500
|
-
trace(state.host, ts.Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1, moduleName, scope.packageDirectory);
|
|
42501
|
-
}
|
|
42502
|
-
return toSearchResult(/*value*/ undefined);
|
|
42503
|
-
}
|
|
42504
|
-
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
42505
|
-
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
42506
|
-
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
42507
|
-
var target = lookupTable[moduleName];
|
|
42508
|
-
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
42509
|
-
}
|
|
42510
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), function (a, b) { return a.length - b.length; });
|
|
42511
|
-
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
42512
|
-
var potentialTarget = expandingKeys_1[_i];
|
|
42513
|
-
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
42514
|
-
var target = lookupTable[potentialTarget];
|
|
42515
|
-
var starPos = potentialTarget.indexOf("*");
|
|
42516
|
-
var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
|
|
42517
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
42518
|
-
}
|
|
42519
|
-
else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
|
|
42520
|
-
var target = lookupTable[potentialTarget];
|
|
42521
|
-
var subpath = moduleName.substring(potentialTarget.length - 1);
|
|
42522
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
42523
|
-
}
|
|
42524
|
-
else if (ts.startsWith(moduleName, potentialTarget)) {
|
|
42525
|
-
var target = lookupTable[potentialTarget];
|
|
42526
|
-
var subpath = moduleName.substring(potentialTarget.length);
|
|
42527
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false);
|
|
42528
|
-
}
|
|
42529
|
-
}
|
|
42530
|
-
function matchesPatternWithTrailer(target, name) {
|
|
42531
|
-
if (ts.endsWith(target, "*"))
|
|
42532
|
-
return false; // handled by next case in loop
|
|
42533
|
-
var starPos = target.indexOf("*");
|
|
42534
|
-
if (starPos === -1)
|
|
42535
|
-
return false; // handled by last case in loop
|
|
42536
|
-
return ts.startsWith(name, target.substring(0, starPos)) && ts.endsWith(name, target.substring(starPos + 1));
|
|
42537
|
-
}
|
|
42538
|
-
}
|
|
42539
|
-
/**
|
|
42540
|
-
* Gets the self-recursive function specialized to retrieving the targeted import/export element for the given resolution configuration
|
|
42541
|
-
*/
|
|
42542
|
-
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
42543
|
-
return loadModuleFromTargetImportOrExport;
|
|
42544
|
-
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
42545
|
-
var _a, _b;
|
|
42546
|
-
if (typeof target === "string") {
|
|
42547
|
-
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
42548
|
-
if (state.traceEnabled) {
|
|
42549
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42550
|
-
}
|
|
42551
|
-
return toSearchResult(/*value*/ undefined);
|
|
42552
|
-
}
|
|
42553
|
-
if (!ts.startsWith(target, "./")) {
|
|
42554
|
-
if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
|
|
42555
|
-
var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
|
|
42556
|
-
var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
|
|
42557
|
-
return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
|
|
42558
|
-
}
|
|
42559
|
-
if (state.traceEnabled) {
|
|
42560
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42561
|
-
}
|
|
42562
|
-
return toSearchResult(/*value*/ undefined);
|
|
42563
|
-
}
|
|
42564
|
-
var parts = ts.pathIsRelative(target) ? ts.getPathComponents(target).slice(1) : ts.getPathComponents(target);
|
|
42565
|
-
var partsAfterFirst = parts.slice(1);
|
|
42566
|
-
if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
|
|
42567
|
-
if (state.traceEnabled) {
|
|
42568
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42569
|
-
}
|
|
42570
|
-
return toSearchResult(/*value*/ undefined);
|
|
42571
|
-
}
|
|
42572
|
-
var resolvedTarget = ts.combinePaths(scope.packageDirectory, target);
|
|
42573
|
-
// TODO: Assert that `resolvedTarget` is actually within the package directory? That's what the spec says.... but I'm not sure we need
|
|
42574
|
-
// to be in the business of validating everyone's import and export map correctness.
|
|
42575
|
-
var subpathParts = ts.getPathComponents(subpath);
|
|
42576
|
-
if (subpathParts.indexOf("..") >= 0 || subpathParts.indexOf(".") >= 0 || subpathParts.indexOf("node_modules") >= 0) {
|
|
42577
|
-
if (state.traceEnabled) {
|
|
42578
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42579
|
-
}
|
|
42580
|
-
return toSearchResult(/*value*/ undefined);
|
|
42581
|
-
}
|
|
42582
|
-
var finalPath = ts.getNormalizedAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
42583
|
-
return toSearchResult(withPackageId(scope, loadModuleFromFileNoImplicitExtensions(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
42584
|
-
}
|
|
42585
|
-
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
42586
|
-
if (!Array.isArray(target)) {
|
|
42587
|
-
for (var _i = 0, _c = ts.getOwnKeys(target); _i < _c.length; _i++) {
|
|
42588
|
-
var key = _c[_i];
|
|
42589
|
-
if (key === "default" || state.conditions.indexOf(key) >= 0) {
|
|
42590
|
-
var subTarget = target[key];
|
|
42591
|
-
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
42592
|
-
if (result) {
|
|
42593
|
-
return result;
|
|
42594
|
-
}
|
|
42595
|
-
}
|
|
42596
|
-
}
|
|
42597
|
-
return undefined;
|
|
42598
|
-
}
|
|
42599
|
-
else {
|
|
42600
|
-
if (!ts.length(target)) {
|
|
42601
|
-
if (state.traceEnabled) {
|
|
42602
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42603
|
-
}
|
|
42604
|
-
return toSearchResult(/*value*/ undefined);
|
|
42605
|
-
}
|
|
42606
|
-
for (var _d = 0, target_1 = target; _d < target_1.length; _d++) {
|
|
42607
|
-
var elem = target_1[_d];
|
|
42608
|
-
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
42609
|
-
if (result) {
|
|
42610
|
-
return result;
|
|
42611
|
-
}
|
|
42612
|
-
}
|
|
42613
|
-
}
|
|
42614
|
-
}
|
|
42615
|
-
else if (target === null) { // eslint-disable-line no-null/no-null
|
|
42616
|
-
if (state.traceEnabled) {
|
|
42617
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName);
|
|
42618
|
-
}
|
|
42619
|
-
return toSearchResult(/*value*/ undefined);
|
|
42620
|
-
}
|
|
42621
|
-
if (state.traceEnabled) {
|
|
42622
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42623
|
-
}
|
|
42624
|
-
return toSearchResult(/*value*/ undefined);
|
|
42625
|
-
}
|
|
42626
|
-
}
|
|
42627
42205
|
function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42628
42206
|
return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, /*typesScopeOnly*/ false, cache, redirectedReference);
|
|
42629
42207
|
}
|
|
@@ -42632,24 +42210,24 @@ var ts;
|
|
|
42632
42210
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, /*typesScopeOnly*/ true, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
42633
42211
|
}
|
|
42634
42212
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
42635
|
-
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName,
|
|
42213
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
42636
42214
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
42637
42215
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
42638
42216
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
42639
42217
|
if (resolutionFromCache) {
|
|
42640
42218
|
return resolutionFromCache;
|
|
42641
42219
|
}
|
|
42642
|
-
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly
|
|
42220
|
+
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly));
|
|
42643
42221
|
}
|
|
42644
42222
|
});
|
|
42645
42223
|
}
|
|
42646
|
-
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly
|
|
42224
|
+
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly) {
|
|
42647
42225
|
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
|
|
42648
42226
|
var nodeModulesFolderExists = ts.directoryProbablyExists(nodeModulesFolder, state.host);
|
|
42649
42227
|
if (!nodeModulesFolderExists && state.traceEnabled) {
|
|
42650
42228
|
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
|
|
42651
42229
|
}
|
|
42652
|
-
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state
|
|
42230
|
+
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state);
|
|
42653
42231
|
if (packageResult) {
|
|
42654
42232
|
return packageResult;
|
|
42655
42233
|
}
|
|
@@ -42662,35 +42240,27 @@ var ts;
|
|
|
42662
42240
|
}
|
|
42663
42241
|
nodeModulesAtTypesExists = false;
|
|
42664
42242
|
}
|
|
42665
|
-
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state
|
|
42243
|
+
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state);
|
|
42666
42244
|
}
|
|
42667
42245
|
}
|
|
42668
|
-
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state
|
|
42246
|
+
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
|
|
42669
42247
|
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
|
|
42670
42248
|
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
|
|
42671
42249
|
var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
42672
|
-
|
|
42673
|
-
|
|
42674
|
-
if (
|
|
42675
|
-
|
|
42676
|
-
if (fromFile) {
|
|
42677
|
-
return noPackageId(fromFile);
|
|
42678
|
-
}
|
|
42679
|
-
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
42680
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
42250
|
+
if (packageInfo) {
|
|
42251
|
+
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
42252
|
+
if (fromFile) {
|
|
42253
|
+
return noPackageId(fromFile);
|
|
42681
42254
|
}
|
|
42255
|
+
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
42256
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
42682
42257
|
}
|
|
42683
|
-
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
42684
42258
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
42685
|
-
var _a;
|
|
42686
|
-
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
|
|
42687
|
-
if (packageInfo && packageInfo.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
42688
|
-
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
42689
|
-
}
|
|
42690
42259
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
42691
42260
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
42692
42261
|
return withPackageId(packageInfo, pathAndExtension);
|
|
42693
42262
|
};
|
|
42263
|
+
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
42694
42264
|
if (rest !== "") { // If "rest" is empty, we just did this search above.
|
|
42695
42265
|
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
|
|
42696
42266
|
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
|
|
@@ -42792,7 +42362,7 @@ var ts;
|
|
|
42792
42362
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
42793
42363
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
42794
42364
|
var failedLookupLocations = [];
|
|
42795
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache
|
|
42365
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
42796
42366
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
42797
42367
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
42798
42368
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
@@ -42803,7 +42373,7 @@ var ts;
|
|
|
42803
42373
|
return { value: resolvedUsingSettings };
|
|
42804
42374
|
}
|
|
42805
42375
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
42806
|
-
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName,
|
|
42376
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
42807
42377
|
// Climb up parent directories looking for a module.
|
|
42808
42378
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
42809
42379
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
@@ -42839,8 +42409,8 @@ var ts;
|
|
|
42839
42409
|
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);
|
|
42840
42410
|
}
|
|
42841
42411
|
var failedLookupLocations = [];
|
|
42842
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache
|
|
42843
|
-
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false
|
|
42412
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache };
|
|
42413
|
+
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false);
|
|
42844
42414
|
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
42845
42415
|
}
|
|
42846
42416
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -45021,7 +44591,7 @@ var ts;
|
|
|
45021
44591
|
}
|
|
45022
44592
|
function checkStrictModeLabeledStatement(node) {
|
|
45023
44593
|
// Grammar checking for labeledStatement
|
|
45024
|
-
if (inStrictMode &&
|
|
44594
|
+
if (inStrictMode && options.target >= 2 /* ES2015 */) {
|
|
45025
44595
|
if (ts.isDeclarationStatement(node.statement) || ts.isVariableStatement(node.statement)) {
|
|
45026
44596
|
errorOnFirstToken(node.label, ts.Diagnostics.A_label_is_not_allowed_here);
|
|
45027
44597
|
}
|
|
@@ -46537,7 +46107,7 @@ var ts;
|
|
|
46537
46107
|
host.getSourceFiles().forEach(function (sf) {
|
|
46538
46108
|
if (!sf.resolvedModules)
|
|
46539
46109
|
return;
|
|
46540
|
-
sf.resolvedModules
|
|
46110
|
+
ts.forEachEntry(sf.resolvedModules, function (r) {
|
|
46541
46111
|
if (r && r.packageId)
|
|
46542
46112
|
map.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map.get(r.packageId.name));
|
|
46543
46113
|
});
|
|
@@ -47679,7 +47249,7 @@ var ts;
|
|
|
47679
47249
|
}
|
|
47680
47250
|
else if (ts.isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
47681
47251
|
// foo = this.bar is illegal in esnext+useDefineForClassFields when bar is a parameter property
|
|
47682
|
-
return !(
|
|
47252
|
+
return !(compilerOptions.target === 99 /* ESNext */ && useDefineForClassFields
|
|
47683
47253
|
&& ts.getContainingClass(declaration) === ts.getContainingClass(usage)
|
|
47684
47254
|
&& isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
47685
47255
|
}
|
|
@@ -47707,7 +47277,7 @@ var ts;
|
|
|
47707
47277
|
return true;
|
|
47708
47278
|
}
|
|
47709
47279
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
47710
|
-
if (
|
|
47280
|
+
if (compilerOptions.target === 99 /* ESNext */ && useDefineForClassFields
|
|
47711
47281
|
&& ts.getContainingClass(declaration)
|
|
47712
47282
|
&& (ts.isPropertyDeclaration(declaration) || ts.isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
47713
47283
|
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, /*stopAtAnyPropertyDeclaration*/ true);
|
|
@@ -48078,7 +47648,7 @@ var ts;
|
|
|
48078
47648
|
case 212 /* ArrowFunction */:
|
|
48079
47649
|
// when targeting ES6 or higher there is no 'arguments' in an arrow function
|
|
48080
47650
|
// for lower compile targets the resolved symbol is used to emit an error
|
|
48081
|
-
if (
|
|
47651
|
+
if (compilerOptions.target >= 2 /* ES2015 */) {
|
|
48082
47652
|
break;
|
|
48083
47653
|
}
|
|
48084
47654
|
// falls through
|
|
@@ -48246,7 +47816,7 @@ var ts;
|
|
|
48246
47816
|
}
|
|
48247
47817
|
// Perform extra checks only if error reporting was requested
|
|
48248
47818
|
if (nameNotFoundMessage) {
|
|
48249
|
-
if (propertyWithInvalidInitializer && !(
|
|
47819
|
+
if (propertyWithInvalidInitializer && !(compilerOptions.target === 99 /* ESNext */ && useDefineForClassFields)) {
|
|
48250
47820
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
48251
47821
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
48252
47822
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -48824,7 +48394,7 @@ var ts;
|
|
|
48824
48394
|
if (!ts.isIdentifier(name)) {
|
|
48825
48395
|
return undefined;
|
|
48826
48396
|
}
|
|
48827
|
-
var suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports ||
|
|
48397
|
+
var suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || compilerOptions.esModuleInterop);
|
|
48828
48398
|
var targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, /*dontResolveAlias*/ false, suppressInteropError);
|
|
48829
48399
|
if (targetSymbol) {
|
|
48830
48400
|
if (name.escapedText) {
|
|
@@ -48902,18 +48472,18 @@ var ts;
|
|
|
48902
48472
|
}
|
|
48903
48473
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
48904
48474
|
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
48905
|
-
var message =
|
|
48475
|
+
var message = compilerOptions.esModuleInterop ? ts.Diagnostics._0_can_only_be_imported_by_using_a_default_import :
|
|
48906
48476
|
ts.Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48907
48477
|
error(name, message, declarationName);
|
|
48908
48478
|
}
|
|
48909
48479
|
else {
|
|
48910
48480
|
if (ts.isInJSFile(node)) {
|
|
48911
|
-
var message =
|
|
48481
|
+
var message = compilerOptions.esModuleInterop ? ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import :
|
|
48912
48482
|
ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48913
48483
|
error(name, message, declarationName);
|
|
48914
48484
|
}
|
|
48915
48485
|
else {
|
|
48916
|
-
var message =
|
|
48486
|
+
var message = compilerOptions.esModuleInterop ? ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import :
|
|
48917
48487
|
ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48918
48488
|
error(name, message, declarationName, declarationName, moduleName);
|
|
48919
48489
|
}
|
|
@@ -49354,7 +48924,6 @@ var ts;
|
|
|
49354
48924
|
: undefined;
|
|
49355
48925
|
}
|
|
49356
48926
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49357
|
-
var _a, _b, _c, _d;
|
|
49358
48927
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49359
48928
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49360
48929
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49366,13 +48935,7 @@ var ts;
|
|
|
49366
48935
|
return ambientModule;
|
|
49367
48936
|
}
|
|
49368
48937
|
var currentSourceFile = ts.getSourceFileOfNode(location);
|
|
49369
|
-
var
|
|
49370
|
-
? location
|
|
49371
|
-
: ((_a = (ts.isImportCall(location) ? location : ts.findAncestor(location, ts.isImportCall))) === null || _a === void 0 ? void 0 : _a.arguments[0]) ||
|
|
49372
|
-
((_b = (ts.isImportDeclaration(location) ? location : ts.findAncestor(location, ts.isImportDeclaration))) === null || _b === void 0 ? void 0 : _b.moduleSpecifier) ||
|
|
49373
|
-
((_c = (ts.isExternalModuleImportEqualsDeclaration(location) ? location : ts.findAncestor(location, ts.isExternalModuleImportEqualsDeclaration))) === null || _c === void 0 ? void 0 : _c.moduleReference.expression) ||
|
|
49374
|
-
((_d = (ts.isExportDeclaration(location) ? location : ts.findAncestor(location, ts.isExportDeclaration))) === null || _d === void 0 ? void 0 : _d.moduleSpecifier);
|
|
49375
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : undefined); // TODO: GH#18217
|
|
48938
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference); // TODO: GH#18217
|
|
49376
48939
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49377
48940
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49378
48941
|
if (sourceFile) {
|
|
@@ -49380,12 +48943,6 @@ var ts;
|
|
|
49380
48943
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
49381
48944
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
49382
48945
|
}
|
|
49383
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
49384
|
-
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
49385
|
-
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49386
|
-
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_es_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
49387
|
-
}
|
|
49388
|
-
}
|
|
49389
48946
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
49390
48947
|
return getMergedSymbol(sourceFile.symbol);
|
|
49391
48948
|
}
|
|
@@ -49443,14 +49000,15 @@ var ts;
|
|
|
49443
49000
|
* Direct users to import source with .js extension if outputting an ES module.
|
|
49444
49001
|
* @see https://github.com/microsoft/TypeScript/issues/42151
|
|
49445
49002
|
*/
|
|
49446
|
-
|
|
49003
|
+
var moduleKind_1 = ts.getEmitModuleKind(compilerOptions);
|
|
49004
|
+
if (moduleKind_1 >= ts.ModuleKind.ES2015) {
|
|
49447
49005
|
replacedImportSource += ".js";
|
|
49448
49006
|
}
|
|
49449
49007
|
error(errorNode, diag, tsExtension, replacedImportSource);
|
|
49450
49008
|
}
|
|
49451
49009
|
else if (!compilerOptions.resolveJsonModule &&
|
|
49452
49010
|
ts.fileExtensionIs(moduleReference, ".json" /* Json */) &&
|
|
49453
|
-
ts.getEmitModuleResolutionKind(compilerOptions)
|
|
49011
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs &&
|
|
49454
49012
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49455
49013
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49456
49014
|
}
|
|
@@ -49523,7 +49081,7 @@ var ts;
|
|
|
49523
49081
|
error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
|
|
49524
49082
|
return symbol;
|
|
49525
49083
|
}
|
|
49526
|
-
if (
|
|
49084
|
+
if (compilerOptions.esModuleInterop) {
|
|
49527
49085
|
var referenceParent = referencingLocation.parent;
|
|
49528
49086
|
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
49529
49087
|
ts.isImportCall(referenceParent)) {
|
|
@@ -51649,7 +51207,7 @@ var ts;
|
|
|
51649
51207
|
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
|
|
51650
51208
|
var typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context);
|
|
51651
51209
|
var specifier = getSpecifierForModuleSymbol(chain[0], context);
|
|
51652
|
-
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions)
|
|
51210
|
+
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs && specifier.indexOf("/node_modules/") >= 0) {
|
|
51653
51211
|
// If ultimately we can only name the symbol with a reference that dives into a `node_modules` folder, we should error
|
|
51654
51212
|
// since declaration files with these kinds of references are liable to fail when published :(
|
|
51655
51213
|
context.encounteredError = true;
|
|
@@ -51872,7 +51430,7 @@ var ts;
|
|
|
51872
51430
|
if (nameType) {
|
|
51873
51431
|
if (nameType.flags & 384 /* StringOrNumberLiteral */) {
|
|
51874
51432
|
var name = "" + nameType.value;
|
|
51875
|
-
if (!ts.isIdentifierText(name,
|
|
51433
|
+
if (!ts.isIdentifierText(name, compilerOptions.target) && !isNumericLiteralName(name)) {
|
|
51876
51434
|
return ts.factory.createStringLiteral(name, !!singleQuote);
|
|
51877
51435
|
}
|
|
51878
51436
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -51886,7 +51444,7 @@ var ts;
|
|
|
51886
51444
|
}
|
|
51887
51445
|
}
|
|
51888
51446
|
function createPropertyNameNodeForIdentifierOrLiteral(name, stringNamed, singleQuote) {
|
|
51889
|
-
return ts.isIdentifierText(name,
|
|
51447
|
+
return ts.isIdentifierText(name, compilerOptions.target) ? ts.factory.createIdentifier(name) :
|
|
51890
51448
|
!stringNamed && isNumericLiteralName(name) && +name >= 0 ? ts.factory.createNumericLiteral(+name) :
|
|
51891
51449
|
ts.factory.createStringLiteral(name, !!singleQuote);
|
|
51892
51450
|
}
|
|
@@ -52820,27 +52378,6 @@ var ts;
|
|
|
52820
52378
|
/*decorators*/ undefined,
|
|
52821
52379
|
/*modifiers*/ undefined, localName, typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), staticMembers, true), constructors, true), publicProperties, true), privateProperties, true)), symbol.declarations && ts.filter(symbol.declarations, function (d) { return ts.isClassDeclaration(d) || ts.isClassExpression(d); })[0]), modifierFlags);
|
|
52822
52380
|
}
|
|
52823
|
-
function getSomeTargetNameFromDeclarations(declarations) {
|
|
52824
|
-
return ts.firstDefined(declarations, function (d) {
|
|
52825
|
-
if (ts.isImportSpecifier(d) || ts.isExportSpecifier(d)) {
|
|
52826
|
-
return ts.idText(d.propertyName || d.name);
|
|
52827
|
-
}
|
|
52828
|
-
if (ts.isBinaryExpression(d) || ts.isExportAssignment(d)) {
|
|
52829
|
-
var expression = ts.isExportAssignment(d) ? d.expression : d.right;
|
|
52830
|
-
if (ts.isPropertyAccessExpression(expression)) {
|
|
52831
|
-
return ts.idText(expression.name);
|
|
52832
|
-
}
|
|
52833
|
-
}
|
|
52834
|
-
if (isAliasSymbolDeclaration(d)) {
|
|
52835
|
-
// This is... heuristic, at best. But it's probably better than always printing the name of the shorthand ambient module.
|
|
52836
|
-
var name = ts.getNameOfDeclaration(d);
|
|
52837
|
-
if (name && ts.isIdentifier(name)) {
|
|
52838
|
-
return ts.idText(name);
|
|
52839
|
-
}
|
|
52840
|
-
}
|
|
52841
|
-
return undefined;
|
|
52842
|
-
});
|
|
52843
|
-
}
|
|
52844
52381
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
52845
52382
|
var _a, _b, _c, _d, _e;
|
|
52846
52383
|
// synthesize an alias, eg `export { symbolName as Name }`
|
|
@@ -52853,10 +52390,8 @@ var ts;
|
|
|
52853
52390
|
if (!target) {
|
|
52854
52391
|
return;
|
|
52855
52392
|
}
|
|
52856
|
-
|
|
52857
|
-
|
|
52858
|
-
var verbatimTargetName = ts.isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || ts.unescapeLeadingUnderscores(target.escapedName);
|
|
52859
|
-
if (verbatimTargetName === "export=" /* ExportEquals */ && (ts.getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
|
|
52393
|
+
var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
|
|
52394
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
|
|
52860
52395
|
// target refers to an `export=` symbol that was hoisted into a synthetic default - rename here to match
|
|
52861
52396
|
verbatimTargetName = "default" /* Default */;
|
|
52862
52397
|
}
|
|
@@ -53399,7 +52934,7 @@ var ts;
|
|
|
53399
52934
|
if (nameType) {
|
|
53400
52935
|
if (nameType.flags & 384 /* StringOrNumberLiteral */) {
|
|
53401
52936
|
var name = "" + nameType.value;
|
|
53402
|
-
if (!ts.isIdentifierText(name,
|
|
52937
|
+
if (!ts.isIdentifierText(name, compilerOptions.target) && !isNumericLiteralName(name)) {
|
|
53403
52938
|
return "\"" + ts.escapeString(name, 34 /* doubleQuote */) + "\"";
|
|
53404
52939
|
}
|
|
53405
52940
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -62487,7 +62022,7 @@ var ts;
|
|
|
62487
62022
|
path = "" + str;
|
|
62488
62023
|
}
|
|
62489
62024
|
// Otherwise write a dotted name if possible
|
|
62490
|
-
else if (ts.isIdentifierText(str,
|
|
62025
|
+
else if (ts.isIdentifierText(str, compilerOptions.target)) {
|
|
62491
62026
|
path = path + "." + str;
|
|
62492
62027
|
}
|
|
62493
62028
|
// Failing that, check if the name is already a computed name
|
|
@@ -68954,7 +68489,19 @@ var ts;
|
|
|
68954
68489
|
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
68955
68490
|
}
|
|
68956
68491
|
function isExportOrExportExpression(location) {
|
|
68957
|
-
return !!ts.findAncestor(location, function (
|
|
68492
|
+
return !!ts.findAncestor(location, function (n) {
|
|
68493
|
+
var parent = n.parent;
|
|
68494
|
+
if (parent === undefined) {
|
|
68495
|
+
return "quit";
|
|
68496
|
+
}
|
|
68497
|
+
if (ts.isExportAssignment(parent)) {
|
|
68498
|
+
return parent.expression === n && ts.isEntityNameExpression(n);
|
|
68499
|
+
}
|
|
68500
|
+
if (ts.isExportSpecifier(parent)) {
|
|
68501
|
+
return parent.name === n || parent.propertyName === n;
|
|
68502
|
+
}
|
|
68503
|
+
return false;
|
|
68504
|
+
});
|
|
68958
68505
|
}
|
|
68959
68506
|
function markAliasReferenced(symbol, location) {
|
|
68960
68507
|
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
@@ -71922,7 +71469,7 @@ var ts;
|
|
|
71922
71469
|
if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) {
|
|
71923
71470
|
grammarErrorOnNode(right, ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts.idText(right));
|
|
71924
71471
|
}
|
|
71925
|
-
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (
|
|
71472
|
+
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (compilerOptions.target === 99 /* ESNext */ && !useDefineForClassFields)) {
|
|
71926
71473
|
var lexicalClass_1 = ts.getContainingClass(lexicallyScopedSymbol.valueDeclaration);
|
|
71927
71474
|
var parentStaticFieldInitializer = ts.findAncestor(node, function (n) {
|
|
71928
71475
|
if (n === lexicalClass_1)
|
|
@@ -74523,12 +74070,6 @@ var ts;
|
|
|
74523
74070
|
return getReturnTypeOfSignature(signature);
|
|
74524
74071
|
}
|
|
74525
74072
|
function checkAssertion(node) {
|
|
74526
|
-
if (node.kind === 209 /* TypeAssertionExpression */) {
|
|
74527
|
-
var file = ts.getSourceFileOfNode(node);
|
|
74528
|
-
if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Cts */, ".mts" /* Mts */])) {
|
|
74529
|
-
grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
|
|
74530
|
-
}
|
|
74531
|
-
}
|
|
74532
74073
|
return checkAssertionWorker(node, node.type, node.expression);
|
|
74533
74074
|
}
|
|
74534
74075
|
function isValidConstAssertionArgument(node) {
|
|
@@ -74629,14 +74170,7 @@ var ts;
|
|
|
74629
74170
|
}
|
|
74630
74171
|
function checkImportMetaProperty(node) {
|
|
74631
74172
|
if (moduleKind !== ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
|
|
74632
|
-
|
|
74633
|
-
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
74634
|
-
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
74635
|
-
}
|
|
74636
|
-
}
|
|
74637
|
-
else {
|
|
74638
|
-
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext);
|
|
74639
|
-
}
|
|
74173
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system);
|
|
74640
74174
|
}
|
|
74641
74175
|
var file = ts.getSourceFileOfNode(node);
|
|
74642
74176
|
ts.Debug.assert(!!(file.flags & 2097152 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -75578,9 +75112,9 @@ var ts;
|
|
|
75578
75112
|
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
|
|
75579
75113
|
diagnostics.add(diagnostic);
|
|
75580
75114
|
}
|
|
75581
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System
|
|
75115
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4 /* ES2017 */) {
|
|
75582
75116
|
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
75583
|
-
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.
|
|
75117
|
+
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher);
|
|
75584
75118
|
diagnostics.add(diagnostic);
|
|
75585
75119
|
}
|
|
75586
75120
|
}
|
|
@@ -77618,7 +77152,7 @@ var ts;
|
|
|
77618
77152
|
// - The containing class is a derived class.
|
|
77619
77153
|
// - The constructor declares parameter properties
|
|
77620
77154
|
// or the containing class declares instance member variables with initializers.
|
|
77621
|
-
var superCallShouldBeFirst = (
|
|
77155
|
+
var superCallShouldBeFirst = (compilerOptions.target !== 99 /* ESNext */ || !useDefineForClassFields) &&
|
|
77622
77156
|
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
77623
77157
|
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */); }));
|
|
77624
77158
|
// Skip past any prologue directives to find the first statement
|
|
@@ -79350,7 +78884,7 @@ var ts;
|
|
|
79350
78884
|
}
|
|
79351
78885
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
79352
78886
|
// No need to check for require or exports for ES6 modules and later
|
|
79353
|
-
if (moduleKind >= ts.ModuleKind.ES2015
|
|
78887
|
+
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
79354
78888
|
return;
|
|
79355
78889
|
}
|
|
79356
78890
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -80911,8 +80445,8 @@ var ts;
|
|
|
80911
80445
|
* The name cannot be used as 'Object' of user defined types with special target.
|
|
80912
80446
|
*/
|
|
80913
80447
|
function checkClassNameCollisionWithObject(name) {
|
|
80914
|
-
if (languageVersion
|
|
80915
|
-
&&
|
|
80448
|
+
if (languageVersion === 1 /* ES5 */ && name.escapedText === "Object"
|
|
80449
|
+
&& moduleKind < ts.ModuleKind.ES2015) {
|
|
80916
80450
|
error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
|
|
80917
80451
|
}
|
|
80918
80452
|
}
|
|
@@ -81178,6 +80712,7 @@ var ts;
|
|
|
81178
80712
|
function checkClassMember(member, memberIsParameterProperty) {
|
|
81179
80713
|
var hasOverride = ts.hasOverrideModifier(member);
|
|
81180
80714
|
var hasStatic = ts.isStatic(member);
|
|
80715
|
+
var isJs = ts.isInJSFile(member);
|
|
81181
80716
|
if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) {
|
|
81182
80717
|
var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member);
|
|
81183
80718
|
if (!declaredProp) {
|
|
@@ -81191,8 +80726,12 @@ var ts;
|
|
|
81191
80726
|
if (prop && !baseProp && hasOverride) {
|
|
81192
80727
|
var suggestion = getSuggestedSymbolForNonexistentClassMember(ts.symbolName(declaredProp), baseType);
|
|
81193
80728
|
suggestion ?
|
|
81194
|
-
error(member,
|
|
81195
|
-
|
|
80729
|
+
error(member, isJs ?
|
|
80730
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 :
|
|
80731
|
+
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
|
|
80732
|
+
error(member, isJs ?
|
|
80733
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
|
|
80734
|
+
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
|
|
81196
80735
|
}
|
|
81197
80736
|
else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
|
|
81198
80737
|
var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
|
|
@@ -81201,8 +80740,12 @@ var ts;
|
|
|
81201
80740
|
}
|
|
81202
80741
|
if (!baseHasAbstract) {
|
|
81203
80742
|
var diag = memberIsParameterProperty ?
|
|
81204
|
-
|
|
81205
|
-
|
|
80743
|
+
isJs ?
|
|
80744
|
+
ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
80745
|
+
ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 :
|
|
80746
|
+
isJs ?
|
|
80747
|
+
ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
80748
|
+
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
|
|
81206
80749
|
error(member, diag, baseClassName);
|
|
81207
80750
|
}
|
|
81208
80751
|
else if (ts.hasAbstractModifier(member) && baseHasAbstract) {
|
|
@@ -81212,7 +80755,9 @@ var ts;
|
|
|
81212
80755
|
}
|
|
81213
80756
|
else if (hasOverride) {
|
|
81214
80757
|
var className = typeToString(type);
|
|
81215
|
-
error(member,
|
|
80758
|
+
error(member, isJs ?
|
|
80759
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
|
|
80760
|
+
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
|
|
81216
80761
|
}
|
|
81217
80762
|
}
|
|
81218
80763
|
}
|
|
@@ -82071,8 +81616,8 @@ var ts;
|
|
|
82071
81616
|
checkAliasSymbol(node);
|
|
82072
81617
|
if (node.kind === 268 /* ImportSpecifier */ &&
|
|
82073
81618
|
ts.idText(node.propertyName || node.name) === "default" &&
|
|
82074
|
-
|
|
82075
|
-
moduleKind !== ts.ModuleKind.System &&
|
|
81619
|
+
compilerOptions.esModuleInterop &&
|
|
81620
|
+
moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
82076
81621
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
82077
81622
|
}
|
|
82078
81623
|
}
|
|
@@ -82093,7 +81638,7 @@ var ts;
|
|
|
82093
81638
|
if (importClause.namedBindings) {
|
|
82094
81639
|
if (importClause.namedBindings.kind === 266 /* NamespaceImport */) {
|
|
82095
81640
|
checkImportBinding(importClause.namedBindings);
|
|
82096
|
-
if (moduleKind !== ts.ModuleKind.System &&
|
|
81641
|
+
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015 && compilerOptions.esModuleInterop) {
|
|
82097
81642
|
// import * as ns from "foo";
|
|
82098
81643
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
82099
81644
|
}
|
|
@@ -82138,7 +81683,7 @@ var ts;
|
|
|
82138
81683
|
}
|
|
82139
81684
|
}
|
|
82140
81685
|
else {
|
|
82141
|
-
if (moduleKind >= ts.ModuleKind.ES2015 &&
|
|
81686
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !node.isTypeOnly && !(node.flags & 8388608 /* Ambient */)) {
|
|
82142
81687
|
// Import equals declaration is deprecated in es6 or above
|
|
82143
81688
|
grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
82144
81689
|
}
|
|
@@ -82179,12 +81724,12 @@ var ts;
|
|
|
82179
81724
|
else if (node.exportClause) {
|
|
82180
81725
|
checkAliasSymbol(node.exportClause);
|
|
82181
81726
|
}
|
|
82182
|
-
if (moduleKind !== ts.ModuleKind.System &&
|
|
81727
|
+
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
82183
81728
|
if (node.exportClause) {
|
|
82184
81729
|
// export * as ns from "foo";
|
|
82185
81730
|
// For ES2015 modules, we emit it as a pair of `import * as a_1 ...; export { a_1 as ns }` and don't need the helper.
|
|
82186
81731
|
// We only use the helper here when in esModuleInterop
|
|
82187
|
-
if (
|
|
81732
|
+
if (compilerOptions.esModuleInterop) {
|
|
82188
81733
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
82189
81734
|
}
|
|
82190
81735
|
}
|
|
@@ -82267,9 +81812,9 @@ var ts;
|
|
|
82267
81812
|
}
|
|
82268
81813
|
}
|
|
82269
81814
|
else {
|
|
82270
|
-
if (
|
|
81815
|
+
if (compilerOptions.esModuleInterop &&
|
|
82271
81816
|
moduleKind !== ts.ModuleKind.System &&
|
|
82272
|
-
|
|
81817
|
+
moduleKind < ts.ModuleKind.ES2015 &&
|
|
82273
81818
|
ts.idText(node.propertyName || node.name) === "default") {
|
|
82274
81819
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
82275
81820
|
}
|
|
@@ -82328,7 +81873,7 @@ var ts;
|
|
|
82328
81873
|
grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
82329
81874
|
}
|
|
82330
81875
|
if (node.isExportEquals && !(node.flags & 8388608 /* Ambient */)) {
|
|
82331
|
-
if (moduleKind >= ts.ModuleKind.ES2015
|
|
81876
|
+
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
82332
81877
|
// export assignment is not supported in es6 modules
|
|
82333
81878
|
grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
82334
81879
|
}
|
|
@@ -84865,11 +84410,6 @@ var ts;
|
|
|
84865
84410
|
if (!ts.isArrowFunction(node)) {
|
|
84866
84411
|
return false;
|
|
84867
84412
|
}
|
|
84868
|
-
if (node.typeParameters && !(ts.length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) {
|
|
84869
|
-
if (file && ts.fileExtensionIsOneOf(file.fileName, [".mts" /* Mts */, ".cts" /* Cts */])) {
|
|
84870
|
-
grammarErrorOnNode(node.typeParameters[0], ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint);
|
|
84871
|
-
}
|
|
84872
|
-
}
|
|
84873
84413
|
var equalsGreaterThanToken = node.equalsGreaterThanToken;
|
|
84874
84414
|
var startLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line;
|
|
84875
84415
|
var endLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line;
|
|
@@ -85202,8 +84742,8 @@ var ts;
|
|
|
85202
84742
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
85203
84743
|
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
|
|
85204
84744
|
}
|
|
85205
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System
|
|
85206
|
-
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.
|
|
84745
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4 /* ES2017 */) {
|
|
84746
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher));
|
|
85207
84747
|
}
|
|
85208
84748
|
}
|
|
85209
84749
|
}
|
|
@@ -85544,7 +85084,8 @@ var ts;
|
|
|
85544
85084
|
: ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
85545
85085
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
85546
85086
|
}
|
|
85547
|
-
|
|
85087
|
+
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
85088
|
+
if (moduleKind < ts.ModuleKind.ES2015 && moduleKind !== ts.ModuleKind.System &&
|
|
85548
85089
|
!(node.parent.parent.flags & 8388608 /* Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* Export */)) {
|
|
85549
85090
|
checkESModuleMarker(node.name);
|
|
85550
85091
|
}
|
|
@@ -85879,7 +85420,7 @@ var ts;
|
|
|
85879
85420
|
}
|
|
85880
85421
|
function checkGrammarImportCallExpression(node) {
|
|
85881
85422
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
85882
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
85423
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd);
|
|
85883
85424
|
}
|
|
85884
85425
|
if (node.typeArguments) {
|
|
85885
85426
|
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
|
|
@@ -91024,7 +90565,7 @@ var ts;
|
|
|
91024
90565
|
function transformSourceFile(node) {
|
|
91025
90566
|
var options = context.getCompilerOptions();
|
|
91026
90567
|
if (node.isDeclarationFile
|
|
91027
|
-
|| useDefineForClassFields &&
|
|
90568
|
+
|| useDefineForClassFields && options.target === 99 /* ESNext */) {
|
|
91028
90569
|
return node;
|
|
91029
90570
|
}
|
|
91030
90571
|
var visited = ts.visitEachChild(node, visitor, context);
|
|
@@ -94400,7 +93941,7 @@ var ts;
|
|
|
94400
93941
|
// When there are no attributes, React wants "null"
|
|
94401
93942
|
}
|
|
94402
93943
|
else {
|
|
94403
|
-
var target =
|
|
93944
|
+
var target = compilerOptions.target;
|
|
94404
93945
|
if (target && target >= 5 /* ES2018 */) {
|
|
94405
93946
|
objectProperties = factory.createObjectLiteralExpression(ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) {
|
|
94406
93947
|
return isSpread ? ts.map(attrs, transformJsxSpreadAttributeToSpreadAssignment) : ts.map(attrs, transformJsxAttributeToObjectLiteralElement);
|
|
@@ -101235,7 +100776,7 @@ var ts;
|
|
|
101235
100776
|
case 345 /* PartiallyEmittedExpression */:
|
|
101236
100777
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
101237
100778
|
case 206 /* CallExpression */:
|
|
101238
|
-
if (ts.isImportCall(node)
|
|
100779
|
+
if (ts.isImportCall(node)) {
|
|
101239
100780
|
return visitImportCallExpression(node);
|
|
101240
100781
|
}
|
|
101241
100782
|
break;
|
|
@@ -101458,7 +100999,7 @@ var ts;
|
|
|
101458
100999
|
}
|
|
101459
101000
|
}
|
|
101460
101001
|
var promise = factory.createNewExpression(factory.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
|
|
101461
|
-
if (
|
|
101002
|
+
if (compilerOptions.esModuleInterop) {
|
|
101462
101003
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), /*typeArguments*/ undefined, [emitHelpers().createImportStarCallbackHelper()]);
|
|
101463
101004
|
}
|
|
101464
101005
|
return promise;
|
|
@@ -101471,7 +101012,7 @@ var ts;
|
|
|
101471
101012
|
// if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
|
|
101472
101013
|
var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
|
|
101473
101014
|
var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
|
|
101474
|
-
if (
|
|
101015
|
+
if (compilerOptions.esModuleInterop) {
|
|
101475
101016
|
requireCall = emitHelpers().createImportStarHelper(requireCall);
|
|
101476
101017
|
}
|
|
101477
101018
|
var func;
|
|
@@ -101501,7 +101042,7 @@ var ts;
|
|
|
101501
101042
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
|
|
101502
101043
|
}
|
|
101503
101044
|
function getHelperExpressionForExport(node, innerExpr) {
|
|
101504
|
-
if (!
|
|
101045
|
+
if (!compilerOptions.esModuleInterop || ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) {
|
|
101505
101046
|
return innerExpr;
|
|
101506
101047
|
}
|
|
101507
101048
|
if (ts.getExportNeedsImportStarHelper(node)) {
|
|
@@ -101510,7 +101051,7 @@ var ts;
|
|
|
101510
101051
|
return innerExpr;
|
|
101511
101052
|
}
|
|
101512
101053
|
function getHelperExpressionForImport(node, innerExpr) {
|
|
101513
|
-
if (!
|
|
101054
|
+
if (!compilerOptions.esModuleInterop || ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) {
|
|
101514
101055
|
return innerExpr;
|
|
101515
101056
|
}
|
|
101516
101057
|
if (ts.getImportNeedsImportStarHelper(node)) {
|
|
@@ -101664,7 +101205,7 @@ var ts;
|
|
|
101664
101205
|
statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createCreateBindingHelper(generatedName, factory.createStringLiteralFromNode(specifier.propertyName || specifier.name), specifier.propertyName ? factory.createStringLiteralFromNode(specifier.name) : undefined)), specifier), specifier));
|
|
101665
101206
|
}
|
|
101666
101207
|
else {
|
|
101667
|
-
var exportNeedsImportDefault = !!
|
|
101208
|
+
var exportNeedsImportDefault = !!compilerOptions.esModuleInterop &&
|
|
101668
101209
|
!(ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) &&
|
|
101669
101210
|
ts.idText(specifier.propertyName || specifier.name) === "default";
|
|
101670
101211
|
var exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name);
|
|
@@ -103833,10 +103374,7 @@ var ts;
|
|
|
103833
103374
|
(function (ts) {
|
|
103834
103375
|
function transformECMAScriptModule(context) {
|
|
103835
103376
|
var factory = context.factory, emitHelpers = context.getEmitHelperFactory;
|
|
103836
|
-
var host = context.getEmitHost();
|
|
103837
|
-
var resolver = context.getEmitResolver();
|
|
103838
103377
|
var compilerOptions = context.getCompilerOptions();
|
|
103839
|
-
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
103840
103378
|
var previousOnEmitNode = context.onEmitNode;
|
|
103841
103379
|
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
103842
103380
|
context.onEmitNode = onEmitNode;
|
|
@@ -103844,21 +103382,13 @@ var ts;
|
|
|
103844
103382
|
context.enableEmitNotification(300 /* SourceFile */);
|
|
103845
103383
|
context.enableSubstitution(79 /* Identifier */);
|
|
103846
103384
|
var helperNameSubstitutions;
|
|
103847
|
-
var currentSourceFile;
|
|
103848
|
-
var importRequireStatements;
|
|
103849
103385
|
return ts.chainBundle(context, transformSourceFile);
|
|
103850
103386
|
function transformSourceFile(node) {
|
|
103851
103387
|
if (node.isDeclarationFile) {
|
|
103852
103388
|
return node;
|
|
103853
103389
|
}
|
|
103854
103390
|
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
|
|
103855
|
-
currentSourceFile = node;
|
|
103856
|
-
importRequireStatements = undefined;
|
|
103857
103391
|
var result = updateExternalModule(node);
|
|
103858
|
-
currentSourceFile = undefined;
|
|
103859
|
-
if (importRequireStatements) {
|
|
103860
|
-
result = factory.updateSourceFile(result, ts.setTextRange(factory.createNodeArray(ts.insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements));
|
|
103861
|
-
}
|
|
103862
103392
|
if (!ts.isExternalModule(node) || ts.some(result.statements, ts.isExternalModuleIndicator)) {
|
|
103863
103393
|
return result;
|
|
103864
103394
|
}
|
|
@@ -103882,10 +103412,8 @@ var ts;
|
|
|
103882
103412
|
function visitor(node) {
|
|
103883
103413
|
switch (node.kind) {
|
|
103884
103414
|
case 263 /* ImportEqualsDeclaration */:
|
|
103885
|
-
//
|
|
103886
|
-
|
|
103887
|
-
// is available, just because the output is reasonable for a node-like runtime.
|
|
103888
|
-
return ts.getEmitScriptTarget(compilerOptions) >= ts.ModuleKind.ES2020 ? visitImportEqualsDeclaration(node) : undefined;
|
|
103415
|
+
// Elide `import=` as it is not legal with --module ES6
|
|
103416
|
+
return undefined;
|
|
103889
103417
|
case 269 /* ExportAssignment */:
|
|
103890
103418
|
return visitExportAssignment(node);
|
|
103891
103419
|
case 270 /* ExportDeclaration */:
|
|
@@ -103894,68 +103422,6 @@ var ts;
|
|
|
103894
103422
|
}
|
|
103895
103423
|
return node;
|
|
103896
103424
|
}
|
|
103897
|
-
/**
|
|
103898
|
-
* Creates a `require()` call to import an external module.
|
|
103899
|
-
*
|
|
103900
|
-
* @param importNode The declaration to import.
|
|
103901
|
-
*/
|
|
103902
|
-
function createRequireCall(importNode) {
|
|
103903
|
-
var moduleName = ts.getExternalModuleNameLiteral(factory, importNode, ts.Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
|
|
103904
|
-
var args = [];
|
|
103905
|
-
if (moduleName) {
|
|
103906
|
-
args.push(moduleName);
|
|
103907
|
-
}
|
|
103908
|
-
if (!importRequireStatements) {
|
|
103909
|
-
var createRequireName = factory.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
103910
|
-
var importStatement = factory.createImportDeclaration(
|
|
103911
|
-
/*decorators*/ undefined,
|
|
103912
|
-
/*modifiers*/ undefined, factory.createImportClause(
|
|
103913
|
-
/*isTypeOnly*/ false,
|
|
103914
|
-
/*name*/ undefined, factory.createNamedImports([
|
|
103915
|
-
factory.createImportSpecifier(factory.createIdentifier("createRequire"), createRequireName)
|
|
103916
|
-
])), factory.createStringLiteral("module"));
|
|
103917
|
-
var requireHelperName = factory.createUniqueName("__require", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
103918
|
-
var requireStatement = factory.createVariableStatement(
|
|
103919
|
-
/*modifiers*/ undefined, factory.createVariableDeclarationList([
|
|
103920
|
-
factory.createVariableDeclaration(requireHelperName,
|
|
103921
|
-
/*exclamationToken*/ undefined,
|
|
103922
|
-
/*type*/ undefined, factory.createCallExpression(factory.cloneNode(createRequireName), /*typeArguments*/ undefined, [
|
|
103923
|
-
factory.createPropertyAccessExpression(factory.createMetaProperty(100 /* ImportKeyword */, factory.createIdentifier("meta")), factory.createIdentifier("url"))
|
|
103924
|
-
]))
|
|
103925
|
-
],
|
|
103926
|
-
/*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */));
|
|
103927
|
-
importRequireStatements = [importStatement, requireStatement];
|
|
103928
|
-
}
|
|
103929
|
-
var name = importRequireStatements[1].declarationList.declarations[0].name;
|
|
103930
|
-
ts.Debug.assertNode(name, ts.isIdentifier);
|
|
103931
|
-
return factory.createCallExpression(factory.cloneNode(name), /*typeArguments*/ undefined, args);
|
|
103932
|
-
}
|
|
103933
|
-
/**
|
|
103934
|
-
* Visits an ImportEqualsDeclaration node.
|
|
103935
|
-
*
|
|
103936
|
-
* @param node The node to visit.
|
|
103937
|
-
*/
|
|
103938
|
-
function visitImportEqualsDeclaration(node) {
|
|
103939
|
-
ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
|
|
103940
|
-
var statements;
|
|
103941
|
-
statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(
|
|
103942
|
-
/*modifiers*/ undefined, factory.createVariableDeclarationList([
|
|
103943
|
-
factory.createVariableDeclaration(factory.cloneNode(node.name),
|
|
103944
|
-
/*exclamationToken*/ undefined,
|
|
103945
|
-
/*type*/ undefined, createRequireCall(node))
|
|
103946
|
-
],
|
|
103947
|
-
/*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)), node), node));
|
|
103948
|
-
statements = appendExportsOfImportEqualsDeclaration(statements, node);
|
|
103949
|
-
return ts.singleOrMany(statements);
|
|
103950
|
-
}
|
|
103951
|
-
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
103952
|
-
if (ts.hasSyntacticModifier(node, 1 /* Export */)) {
|
|
103953
|
-
statements = ts.append(statements, factory.createExportDeclaration(
|
|
103954
|
-
/*decorators*/ undefined,
|
|
103955
|
-
/*modifiers*/ undefined, node.isTypeOnly, factory.createNamedExports([factory.createExportSpecifier(/*propertyName*/ undefined, ts.idText(node.name))])));
|
|
103956
|
-
}
|
|
103957
|
-
return statements;
|
|
103958
|
-
}
|
|
103959
103425
|
function visitExportAssignment(node) {
|
|
103960
103426
|
// Elide `export=` as it is not legal with --module ES6
|
|
103961
103427
|
return node.isExportEquals ? undefined : node;
|
|
@@ -104033,78 +103499,6 @@ var ts;
|
|
|
104033
103499
|
}
|
|
104034
103500
|
ts.transformECMAScriptModule = transformECMAScriptModule;
|
|
104035
103501
|
})(ts || (ts = {}));
|
|
104036
|
-
/*@internal*/
|
|
104037
|
-
var ts;
|
|
104038
|
-
(function (ts) {
|
|
104039
|
-
function transformNodeModule(context) {
|
|
104040
|
-
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
104041
|
-
var previousOnEmitNode = context.onEmitNode;
|
|
104042
|
-
var esmTransform = ts.transformECMAScriptModule(context);
|
|
104043
|
-
var esmOnSubstituteNode = context.onSubstituteNode;
|
|
104044
|
-
var esmOnEmitNode = context.onEmitNode;
|
|
104045
|
-
context.onSubstituteNode = previousOnSubstituteNode;
|
|
104046
|
-
context.onEmitNode = previousOnEmitNode;
|
|
104047
|
-
var cjsTransform = ts.transformModule(context);
|
|
104048
|
-
var cjsOnSubstituteNode = context.onSubstituteNode;
|
|
104049
|
-
var cjsOnEmitNode = context.onEmitNode;
|
|
104050
|
-
context.onSubstituteNode = onSubstituteNode;
|
|
104051
|
-
context.onEmitNode = onEmitNode;
|
|
104052
|
-
context.enableSubstitution(300 /* SourceFile */);
|
|
104053
|
-
context.enableEmitNotification(300 /* SourceFile */);
|
|
104054
|
-
var currentSourceFile;
|
|
104055
|
-
return transformSourceFileOrBundle;
|
|
104056
|
-
function onSubstituteNode(hint, node) {
|
|
104057
|
-
if (ts.isSourceFile(node)) {
|
|
104058
|
-
currentSourceFile = node;
|
|
104059
|
-
// Neither component transform wants substitution notifications for `SourceFile`s, and, in fact, relies on
|
|
104060
|
-
// the source file emit notification to setup scope variables for substitutions (so we _cannot_ call their substitute
|
|
104061
|
-
// functions on source files safely, as that context only gets setup in a later pipeline phase!)
|
|
104062
|
-
return previousOnSubstituteNode(hint, node);
|
|
104063
|
-
}
|
|
104064
|
-
else {
|
|
104065
|
-
if (!currentSourceFile) {
|
|
104066
|
-
return previousOnSubstituteNode(hint, node);
|
|
104067
|
-
}
|
|
104068
|
-
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
104069
|
-
return esmOnSubstituteNode(hint, node);
|
|
104070
|
-
}
|
|
104071
|
-
return cjsOnSubstituteNode(hint, node);
|
|
104072
|
-
}
|
|
104073
|
-
}
|
|
104074
|
-
function onEmitNode(hint, node, emitCallback) {
|
|
104075
|
-
if (ts.isSourceFile(node)) {
|
|
104076
|
-
currentSourceFile = node;
|
|
104077
|
-
}
|
|
104078
|
-
if (!currentSourceFile) {
|
|
104079
|
-
return previousOnEmitNode(hint, node, emitCallback);
|
|
104080
|
-
}
|
|
104081
|
-
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
104082
|
-
return esmOnEmitNode(hint, node, emitCallback);
|
|
104083
|
-
}
|
|
104084
|
-
return cjsOnEmitNode(hint, node, emitCallback);
|
|
104085
|
-
}
|
|
104086
|
-
function getModuleTransformForFile(file) {
|
|
104087
|
-
return file.impliedNodeFormat === ts.ModuleKind.ESNext ? esmTransform : cjsTransform;
|
|
104088
|
-
}
|
|
104089
|
-
function transformSourceFile(node) {
|
|
104090
|
-
if (node.isDeclarationFile) {
|
|
104091
|
-
return node;
|
|
104092
|
-
}
|
|
104093
|
-
currentSourceFile = node;
|
|
104094
|
-
var result = getModuleTransformForFile(node)(node);
|
|
104095
|
-
currentSourceFile = undefined;
|
|
104096
|
-
ts.Debug.assert(ts.isSourceFile(result));
|
|
104097
|
-
return result;
|
|
104098
|
-
}
|
|
104099
|
-
function transformSourceFileOrBundle(node) {
|
|
104100
|
-
return node.kind === 300 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
|
|
104101
|
-
}
|
|
104102
|
-
function transformBundle(node) {
|
|
104103
|
-
return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
|
|
104104
|
-
}
|
|
104105
|
-
}
|
|
104106
|
-
ts.transformNodeModule = transformNodeModule;
|
|
104107
|
-
})(ts || (ts = {}));
|
|
104108
103502
|
/* @internal */
|
|
104109
103503
|
var ts;
|
|
104110
103504
|
(function (ts) {
|
|
@@ -105922,9 +105316,6 @@ var ts;
|
|
|
105922
105316
|
return ts.transformECMAScriptModule;
|
|
105923
105317
|
case ts.ModuleKind.System:
|
|
105924
105318
|
return ts.transformSystemModule;
|
|
105925
|
-
case ts.ModuleKind.Node12:
|
|
105926
|
-
case ts.ModuleKind.NodeNext:
|
|
105927
|
-
return ts.transformNodeModule;
|
|
105928
105319
|
default:
|
|
105929
105320
|
return ts.transformModule;
|
|
105930
105321
|
}
|
|
@@ -106535,7 +105926,7 @@ var ts;
|
|
|
106535
105926
|
return getOutputPathsForBundle(options, forceDtsPaths);
|
|
106536
105927
|
}
|
|
106537
105928
|
else {
|
|
106538
|
-
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile
|
|
105929
|
+
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
|
|
106539
105930
|
var isJsonFile = ts.isJsonSourceFile(sourceFile);
|
|
106540
105931
|
// If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it
|
|
106541
105932
|
var isJsonEmittedToSameLocation = isJsonFile &&
|
|
@@ -106551,13 +105942,26 @@ var ts;
|
|
|
106551
105942
|
function getSourceMapFilePath(jsFilePath, options) {
|
|
106552
105943
|
return (options.sourceMap && !options.inlineSourceMap) ? jsFilePath + ".map" : undefined;
|
|
106553
105944
|
}
|
|
105945
|
+
// JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
|
|
105946
|
+
// So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.
|
|
105947
|
+
// For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve
|
|
106554
105948
|
/* @internal */
|
|
106555
|
-
function getOutputExtension(
|
|
106556
|
-
|
|
106557
|
-
|
|
106558
|
-
|
|
106559
|
-
|
|
106560
|
-
|
|
105949
|
+
function getOutputExtension(sourceFile, options) {
|
|
105950
|
+
if (ts.isJsonSourceFile(sourceFile)) {
|
|
105951
|
+
return ".json" /* Json */;
|
|
105952
|
+
}
|
|
105953
|
+
if (options.jsx === 1 /* Preserve */) {
|
|
105954
|
+
if (ts.isSourceFileJS(sourceFile)) {
|
|
105955
|
+
if (ts.fileExtensionIs(sourceFile.fileName, ".jsx" /* Jsx */)) {
|
|
105956
|
+
return ".jsx" /* Jsx */;
|
|
105957
|
+
}
|
|
105958
|
+
}
|
|
105959
|
+
else if (sourceFile.languageVariant === 1 /* JSX */) {
|
|
105960
|
+
// TypeScript source file preserving JSX syntax
|
|
105961
|
+
return ".jsx" /* Jsx */;
|
|
105962
|
+
}
|
|
105963
|
+
}
|
|
105964
|
+
return ".js" /* Js */;
|
|
106561
105965
|
}
|
|
106562
105966
|
ts.getOutputExtension = getOutputExtension;
|
|
106563
105967
|
function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory) {
|
|
@@ -106567,14 +105971,19 @@ var ts;
|
|
|
106567
105971
|
}
|
|
106568
105972
|
/* @internal */
|
|
106569
105973
|
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
106570
|
-
|
|
105974
|
+
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */));
|
|
105975
|
+
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), ".d.ts" /* Dts */);
|
|
106571
105976
|
}
|
|
106572
105977
|
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
|
106573
105978
|
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
106574
105979
|
if (configFile.options.emitDeclarationOnly)
|
|
106575
105980
|
return undefined;
|
|
106576
105981
|
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
106577
|
-
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory),
|
|
105982
|
+
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ?
|
|
105983
|
+
".json" /* Json */ :
|
|
105984
|
+
configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ?
|
|
105985
|
+
".jsx" /* Jsx */ :
|
|
105986
|
+
".js" /* Js */);
|
|
106578
105987
|
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
|
106579
105988
|
outputFileName :
|
|
106580
105989
|
undefined;
|
|
@@ -106645,7 +106054,7 @@ var ts;
|
|
|
106645
106054
|
/*@internal*/
|
|
106646
106055
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
106647
106056
|
var options = _a.options, fileNames = _a.fileNames;
|
|
106648
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.
|
|
106057
|
+
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensions)) && !ts.fileExtensionIs(file, ".d.ts" /* Dts */); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
|
|
106649
106058
|
}
|
|
106650
106059
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
106651
106060
|
/*@internal*/
|
|
@@ -111880,7 +111289,7 @@ var ts;
|
|
|
111880
111289
|
if (options.declarationDir)
|
|
111881
111290
|
return false;
|
|
111882
111291
|
}
|
|
111883
|
-
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.
|
|
111292
|
+
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.supportedJSExtensions)) {
|
|
111884
111293
|
return false;
|
|
111885
111294
|
}
|
|
111886
111295
|
// just check if sourceFile with the name exists
|
|
@@ -112493,82 +111902,6 @@ var ts;
|
|
|
112493
111902
|
}
|
|
112494
111903
|
ts.loadWithLocalCache = loadWithLocalCache;
|
|
112495
111904
|
/* @internal */
|
|
112496
|
-
/**
|
|
112497
|
-
* Are you sure you want to use this? If you have a bound and parent pointer'd sourcefile, as in the checker, getModeForUsageLocation is much more ergonomic
|
|
112498
|
-
*/
|
|
112499
|
-
function getModeForResolutionAtIndex(file, index) {
|
|
112500
|
-
if (file.impliedNodeFormat === undefined)
|
|
112501
|
-
return undefined;
|
|
112502
|
-
if (file.impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
112503
|
-
var usage_1 = getModuleNameStringLiteralAt(file, index);
|
|
112504
|
-
if (usage_1.parent) {
|
|
112505
|
-
// parent pointers are set - do the fast thing and just check if the parent is an import call expression
|
|
112506
|
-
return ts.isImportCall(ts.walkUpParenthesizedExpressions(usage_1.parent)) ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112507
|
-
}
|
|
112508
|
-
// We can't rely on parent pointers being set - so instead we search for the usage in the top-level statements in the file,
|
|
112509
|
-
// since that's the only place (module) import declarations and module augmentations (or definitions) are allowed.
|
|
112510
|
-
// If the usage is anywhere else, by process of elimination, it must be an import call usage.
|
|
112511
|
-
if (ts.some(file.statements, function (s) {
|
|
112512
|
-
return (ts.isImportDeclaration(s) && s.moduleSpecifier === usage_1) ||
|
|
112513
|
-
(ts.isImportEqualsDeclaration(s) && ts.isExternalModuleReference(s.moduleReference) && ts.skipParentheses(s.moduleReference.expression) === usage_1) ||
|
|
112514
|
-
(ts.isModuleDeclaration(s) && s.name === usage_1) ||
|
|
112515
|
-
(ts.isExportDeclaration(s) && s.moduleSpecifier === usage_1);
|
|
112516
|
-
})) {
|
|
112517
|
-
return ts.ModuleKind.CommonJS;
|
|
112518
|
-
}
|
|
112519
|
-
return ts.ModuleKind.ESNext;
|
|
112520
|
-
}
|
|
112521
|
-
// in an esnext format file, import require statements desugar to `require` calls, so should follow cjs resolution rules
|
|
112522
|
-
var usage = getModuleNameStringLiteralAt(file, index);
|
|
112523
|
-
if (usage.parent) {
|
|
112524
|
-
// parent pointers are set - do the fast thing and just check if the parent is an import require statement
|
|
112525
|
-
return ts.isImportEqualsDeclaration(ts.walkUpParenthesizedExpressions(usage.parent).parent) ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
112526
|
-
}
|
|
112527
|
-
// parent pointers are unset - check to see if the usage is refered to in any of the top-level import require statements, as that's the only place they should be valid
|
|
112528
|
-
if (ts.some(file.statements, function (s) { return ts.isImportEqualsDeclaration(s) && ts.isExternalModuleReference(s.moduleReference) && ts.skipParentheses(s.moduleReference.expression) === usage; })) {
|
|
112529
|
-
return ts.ModuleKind.CommonJS;
|
|
112530
|
-
}
|
|
112531
|
-
return ts.ModuleKind.ESNext;
|
|
112532
|
-
}
|
|
112533
|
-
ts.getModeForResolutionAtIndex = getModeForResolutionAtIndex;
|
|
112534
|
-
/* @internal */
|
|
112535
|
-
function getModeForUsageLocation(file, usage) {
|
|
112536
|
-
if (file.impliedNodeFormat === undefined)
|
|
112537
|
-
return undefined;
|
|
112538
|
-
if (file.impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
112539
|
-
// in cjs files, import call expressions are esm format, otherwise everything is cjs
|
|
112540
|
-
return ts.isImportCall(ts.walkUpParenthesizedExpressions(usage.parent)) ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112541
|
-
}
|
|
112542
|
-
// in esm files, import=require statements are cjs format, otherwise everything is esm
|
|
112543
|
-
return ts.isImportEqualsDeclaration(ts.walkUpParenthesizedExpressions(usage.parent).parent) ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
112544
|
-
}
|
|
112545
|
-
ts.getModeForUsageLocation = getModeForUsageLocation;
|
|
112546
|
-
/* @internal */
|
|
112547
|
-
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
112548
|
-
if (names.length === 0) {
|
|
112549
|
-
return [];
|
|
112550
|
-
}
|
|
112551
|
-
var resolutions = [];
|
|
112552
|
-
var cache = new ts.Map();
|
|
112553
|
-
var i = 0;
|
|
112554
|
-
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
112555
|
-
var name = names_3[_i];
|
|
112556
|
-
var result = void 0;
|
|
112557
|
-
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
112558
|
-
i++;
|
|
112559
|
-
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
112560
|
-
if (cache.has(cacheKey)) {
|
|
112561
|
-
result = cache.get(cacheKey);
|
|
112562
|
-
}
|
|
112563
|
-
else {
|
|
112564
|
-
cache.set(cacheKey, result = loader(name, mode, containingFileName, redirectedReference));
|
|
112565
|
-
}
|
|
112566
|
-
resolutions.push(result);
|
|
112567
|
-
}
|
|
112568
|
-
return resolutions;
|
|
112569
|
-
}
|
|
112570
|
-
ts.loadWithModeAwareCache = loadWithModeAwareCache;
|
|
112571
|
-
/* @internal */
|
|
112572
111905
|
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
|
112573
111906
|
return forEachProjectReference(/*projectReferences*/ undefined, resolvedProjectReferences, function (resolvedRef, parent) { return resolvedRef && cb(resolvedRef, parent); });
|
|
112574
111907
|
}
|
|
@@ -112626,7 +111959,7 @@ var ts;
|
|
|
112626
111959
|
switch (kind) {
|
|
112627
111960
|
case ts.FileIncludeKind.Import:
|
|
112628
111961
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
112629
|
-
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text
|
|
111962
|
+
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text)) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
112630
111963
|
if (importLiteral.pos === -1)
|
|
112631
111964
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
112632
111965
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -112637,7 +111970,7 @@ var ts;
|
|
|
112637
111970
|
break;
|
|
112638
111971
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
112639
111972
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end);
|
|
112640
|
-
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName)
|
|
111973
|
+
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName))) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
112641
111974
|
break;
|
|
112642
111975
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
112643
111976
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -112724,33 +112057,6 @@ var ts;
|
|
|
112724
112057
|
configFileParseResult.errors;
|
|
112725
112058
|
}
|
|
112726
112059
|
ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
|
|
112727
|
-
/**
|
|
112728
|
-
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|
|
112729
|
-
* `options` parameter.
|
|
112730
|
-
*
|
|
112731
|
-
* @param fileName The normalized absolute path to check the format of (it need not exist on disk)
|
|
112732
|
-
* @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
|
|
112733
|
-
* @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
|
|
112734
|
-
* @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
|
|
112735
|
-
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
|
112736
|
-
*/
|
|
112737
|
-
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
112738
|
-
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
112739
|
-
case ts.ModuleResolutionKind.Node12:
|
|
112740
|
-
case ts.ModuleResolutionKind.NodeNext:
|
|
112741
|
-
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
112742
|
-
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
112743
|
-
ts.fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() :
|
|
112744
|
-
undefined; // other extensions, like `json` or `tsbuildinfo`, are set as `undefined` here but they should never be fed through the transformer pipeline
|
|
112745
|
-
default:
|
|
112746
|
-
return undefined;
|
|
112747
|
-
}
|
|
112748
|
-
function lookupFromPackageJson() {
|
|
112749
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
112750
|
-
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112751
|
-
}
|
|
112752
|
-
}
|
|
112753
|
-
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
112754
112060
|
/**
|
|
112755
112061
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
112756
112062
|
*/
|
|
@@ -112771,7 +112077,7 @@ var ts;
|
|
|
112771
112077
|
};
|
|
112772
112078
|
}
|
|
112773
112079
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
112774
|
-
var _a, _b, _c
|
|
112080
|
+
var _a, _b, _c;
|
|
112775
112081
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217
|
|
112776
112082
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
112777
112083
|
var oldProgram = createProgramOptions.oldProgram;
|
|
@@ -112813,7 +112119,7 @@ var ts;
|
|
|
112813
112119
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
112814
112120
|
var currentDirectory = host.getCurrentDirectory();
|
|
112815
112121
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
112816
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
112122
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
112817
112123
|
// Map storing if there is emit blocking diagnostics for given input
|
|
112818
112124
|
var hasEmitBlockingDiagnostics = new ts.Map();
|
|
112819
112125
|
var _compilerOptionsObjectLiteralSyntax;
|
|
@@ -112822,7 +112128,7 @@ var ts;
|
|
|
112822
112128
|
var actualResolveModuleNamesWorker;
|
|
112823
112129
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
112824
112130
|
if (host.resolveModuleNames) {
|
|
112825
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile,
|
|
112131
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
|
|
112826
112132
|
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
112827
112133
|
if (!resolved || resolved.extension !== undefined) {
|
|
112828
112134
|
return resolved;
|
|
@@ -112831,12 +112137,11 @@ var ts;
|
|
|
112831
112137
|
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
112832
112138
|
return withExtension;
|
|
112833
112139
|
}); };
|
|
112834
|
-
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
112835
112140
|
}
|
|
112836
112141
|
else {
|
|
112837
112142
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
112838
|
-
var loader_1 = function (moduleName,
|
|
112839
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile,
|
|
112143
|
+
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217
|
|
112144
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.checkEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
|
|
112840
112145
|
}
|
|
112841
112146
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
112842
112147
|
if (host.resolveTypeReferenceDirectives) {
|
|
@@ -112872,9 +112177,9 @@ var ts;
|
|
|
112872
112177
|
var projectReferenceRedirects;
|
|
112873
112178
|
var mapFromFileToProjectReferenceRedirects;
|
|
112874
112179
|
var mapFromToProjectReferenceRedirectSource;
|
|
112875
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
112180
|
+
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
|
|
112876
112181
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
112877
|
-
var
|
|
112182
|
+
var _d = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
112878
112183
|
compilerHost: host,
|
|
112879
112184
|
getSymlinkCache: getSymlinkCache,
|
|
112880
112185
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -112882,7 +112187,7 @@ var ts;
|
|
|
112882
112187
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
112883
112188
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
112884
112189
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
112885
|
-
}), onProgramCreateComplete =
|
|
112190
|
+
}), onProgramCreateComplete = _d.onProgramCreateComplete, fileExists = _d.fileExists, directoryExists = _d.directoryExists;
|
|
112886
112191
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
112887
112192
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
112888
112193
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -112941,7 +112246,7 @@ var ts;
|
|
|
112941
112246
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
112942
112247
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
112943
112248
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
112944
|
-
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (
|
|
112249
|
+
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_b = resolutions[i]) === null || _b === void 0 ? void 0 : _b.packageId });
|
|
112945
112250
|
}
|
|
112946
112251
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
112947
112252
|
}
|
|
@@ -112958,7 +112263,7 @@ var ts;
|
|
|
112958
112263
|
}
|
|
112959
112264
|
else {
|
|
112960
112265
|
ts.forEach(options.lib, function (libFileName, index) {
|
|
112961
|
-
processRootFile(
|
|
112266
|
+
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.LibFile, index: index });
|
|
112962
112267
|
});
|
|
112963
112268
|
}
|
|
112964
112269
|
}
|
|
@@ -113059,7 +112364,7 @@ var ts;
|
|
|
113059
112364
|
fileExists: fileExists,
|
|
113060
112365
|
directoryExists: directoryExists,
|
|
113061
112366
|
getSymlinkCache: getSymlinkCache,
|
|
113062
|
-
realpath: (
|
|
112367
|
+
realpath: (_c = host.realpath) === null || _c === void 0 ? void 0 : _c.bind(host),
|
|
113063
112368
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
113064
112369
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
113065
112370
|
structureIsReused: structureIsReused,
|
|
@@ -113089,7 +112394,7 @@ var ts;
|
|
|
113089
112394
|
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
113090
112395
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
113091
112396
|
ts.performance.mark("beforeResolveModule");
|
|
113092
|
-
var result = actualResolveModuleNamesWorker(moduleNames,
|
|
112397
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference);
|
|
113093
112398
|
ts.performance.mark("afterResolveModule");
|
|
113094
112399
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
113095
112400
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -113155,8 +112460,8 @@ var ts;
|
|
|
113155
112460
|
}
|
|
113156
112461
|
return ts.libs.length + 2;
|
|
113157
112462
|
}
|
|
113158
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile
|
|
113159
|
-
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache
|
|
112463
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
112464
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache);
|
|
113160
112465
|
}
|
|
113161
112466
|
function toPath(fileName) {
|
|
113162
112467
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
@@ -113198,11 +112503,9 @@ var ts;
|
|
|
113198
112503
|
// Since we assume the filesystem does not change during program creation,
|
|
113199
112504
|
// it is safe to reuse resolutions from the earlier call.
|
|
113200
112505
|
var result_14 = [];
|
|
113201
|
-
var i = 0;
|
|
113202
112506
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
113203
112507
|
var moduleName = moduleNames_1[_i];
|
|
113204
|
-
var resolvedModule = file.resolvedModules.get(moduleName
|
|
113205
|
-
i++;
|
|
112508
|
+
var resolvedModule = file.resolvedModules.get(moduleName);
|
|
113206
112509
|
result_14.push(resolvedModule);
|
|
113207
112510
|
}
|
|
113208
112511
|
return result_14;
|
|
@@ -113230,7 +112533,7 @@ var ts;
|
|
|
113230
112533
|
var moduleName = moduleNames[i];
|
|
113231
112534
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
113232
112535
|
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
113233
|
-
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName
|
|
112536
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName);
|
|
113234
112537
|
if (oldResolvedModule) {
|
|
113235
112538
|
if (ts.isTraceEnabled(options, host)) {
|
|
113236
112539
|
ts.trace(host, oldResolvedModule.packageId ?
|
|
@@ -113254,7 +112557,7 @@ var ts;
|
|
|
113254
112557
|
}
|
|
113255
112558
|
}
|
|
113256
112559
|
else {
|
|
113257
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName
|
|
112560
|
+
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
113258
112561
|
}
|
|
113259
112562
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
113260
112563
|
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
@@ -113291,8 +112594,8 @@ var ts;
|
|
|
113291
112594
|
return result;
|
|
113292
112595
|
// If we change our policy of rechecking failed lookups on each program create,
|
|
113293
112596
|
// we should adjust the value returned here.
|
|
113294
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName
|
|
113295
|
-
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName
|
|
112597
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
112598
|
+
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
|
|
113296
112599
|
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
113297
112600
|
if (resolutionToFile && resolvedFile) {
|
|
113298
112601
|
// In the old program, we resolved to an ambient module that was in the same
|
|
@@ -113375,8 +112678,8 @@ var ts;
|
|
|
113375
112678
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
113376
112679
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
113377
112680
|
var newSourceFile = host.getSourceFileByPath
|
|
113378
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath,
|
|
113379
|
-
: host.getSourceFile(oldSourceFile.fileName,
|
|
112681
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, options.target, /*onError*/ undefined, shouldCreateNewSourceFile)
|
|
112682
|
+
: host.getSourceFile(oldSourceFile.fileName, options.target, /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217
|
|
113380
112683
|
if (!newSourceFile) {
|
|
113381
112684
|
return 0 /* Not */;
|
|
113382
112685
|
}
|
|
@@ -113483,10 +112786,10 @@ var ts;
|
|
|
113483
112786
|
var moduleNames = getModuleNames(newSourceFile);
|
|
113484
112787
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
113485
112788
|
// ensure that module resolution results are still correct
|
|
113486
|
-
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules,
|
|
112789
|
+
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);
|
|
113487
112790
|
if (resolutionsChanged) {
|
|
113488
112791
|
structureIsReused = 1 /* SafeModules */;
|
|
113489
|
-
newSourceFile.resolvedModules = ts.
|
|
112792
|
+
newSourceFile.resolvedModules = ts.zipToMap(moduleNames, resolutions);
|
|
113490
112793
|
}
|
|
113491
112794
|
else {
|
|
113492
112795
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
@@ -113495,10 +112798,10 @@ var ts;
|
|
|
113495
112798
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
113496
112799
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
113497
112800
|
// ensure that types resolutions are still correct
|
|
113498
|
-
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames,
|
|
112801
|
+
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);
|
|
113499
112802
|
if (typeReferenceEesolutionsChanged) {
|
|
113500
112803
|
structureIsReused = 1 /* SafeModules */;
|
|
113501
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.
|
|
112804
|
+
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToMap(typesReferenceDirectives, typeReferenceResolutions);
|
|
113502
112805
|
}
|
|
113503
112806
|
else {
|
|
113504
112807
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
@@ -113622,7 +112925,7 @@ var ts;
|
|
|
113622
112925
|
return equalityComparer(file.fileName, getDefaultLibraryFileName());
|
|
113623
112926
|
}
|
|
113624
112927
|
else {
|
|
113625
|
-
return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName,
|
|
112928
|
+
return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, pathForLibFile(libFileName)); });
|
|
113626
112929
|
}
|
|
113627
112930
|
}
|
|
113628
112931
|
function getDiagnosticsProducingTypeChecker() {
|
|
@@ -114204,7 +113507,7 @@ var ts;
|
|
|
114204
113507
|
var libName = ts.toFileNameLowerCase(ref.fileName);
|
|
114205
113508
|
var libFileName = ts.libMap.get(libName);
|
|
114206
113509
|
if (libFileName) {
|
|
114207
|
-
return getSourceFile(
|
|
113510
|
+
return getSourceFile(pathForLibFile(libFileName));
|
|
114208
113511
|
}
|
|
114209
113512
|
}
|
|
114210
113513
|
/** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */
|
|
@@ -114214,13 +113517,13 @@ var ts;
|
|
|
114214
113517
|
function getSourceFileFromReferenceWorker(fileName, getSourceFile, fail, reason) {
|
|
114215
113518
|
if (ts.hasExtension(fileName)) {
|
|
114216
113519
|
var canonicalFileName_1 = host.getCanonicalFileName(fileName);
|
|
114217
|
-
if (!options.allowNonTsExtensions && !ts.forEach(
|
|
113520
|
+
if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensionsWithJsonIfResolveJsonModule, function (extension) { return ts.fileExtensionIs(canonicalFileName_1, extension); })) {
|
|
114218
113521
|
if (fail) {
|
|
114219
113522
|
if (ts.hasJSFileExtension(canonicalFileName_1)) {
|
|
114220
113523
|
fail(ts.Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option, fileName);
|
|
114221
113524
|
}
|
|
114222
113525
|
else {
|
|
114223
|
-
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" +
|
|
113526
|
+
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
114224
113527
|
}
|
|
114225
113528
|
}
|
|
114226
113529
|
return undefined;
|
|
@@ -114250,10 +113553,9 @@ var ts;
|
|
|
114250
113553
|
fail(ts.Diagnostics.File_0_not_found, fileName);
|
|
114251
113554
|
return undefined;
|
|
114252
113555
|
}
|
|
114253
|
-
|
|
114254
|
-
var sourceFileWithAddedExtension = ts.forEach(supportedExtensions[0], function (extension) { return getSourceFile(fileName + extension); });
|
|
113556
|
+
var sourceFileWithAddedExtension = ts.forEach(supportedExtensions, function (extension) { return getSourceFile(fileName + extension); });
|
|
114255
113557
|
if (fail && !sourceFileWithAddedExtension)
|
|
114256
|
-
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" +
|
|
113558
|
+
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
114257
113559
|
return sourceFileWithAddedExtension;
|
|
114258
113560
|
}
|
|
114259
113561
|
}
|
|
@@ -114398,7 +113700,7 @@ var ts;
|
|
|
114398
113700
|
}
|
|
114399
113701
|
}
|
|
114400
113702
|
// We haven't looked for this file, do so now and cache result
|
|
114401
|
-
var file = host.getSourceFile(fileName,
|
|
113703
|
+
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
|
|
114402
113704
|
if (packageId) {
|
|
114403
113705
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
114404
113706
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
@@ -114426,10 +113728,6 @@ var ts;
|
|
|
114426
113728
|
file.path = path;
|
|
114427
113729
|
file.resolvedPath = toPath(fileName);
|
|
114428
113730
|
file.originalFileName = originalFileName;
|
|
114429
|
-
// It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
|
|
114430
|
-
// and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
|
|
114431
|
-
// to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
|
|
114432
|
-
file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
114433
113731
|
addFileIncludeReason(file, reason);
|
|
114434
113732
|
if (host.useCaseSensitiveFileNames()) {
|
|
114435
113733
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -114620,13 +113918,31 @@ var ts;
|
|
|
114620
113918
|
resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective);
|
|
114621
113919
|
}
|
|
114622
113920
|
}
|
|
113921
|
+
function pathForLibFile(libFileName) {
|
|
113922
|
+
// Support resolving to lib.dom.d.ts -> @typescript/dom, and
|
|
113923
|
+
// lib.dom.iterable.d.ts -> @typescript/dom/iterable
|
|
113924
|
+
// lib.es2015.symbol.wellknown.d.ts -> @typescript/es2015/symbol-wellknown
|
|
113925
|
+
var components = libFileName.split(".");
|
|
113926
|
+
var path = components[1];
|
|
113927
|
+
var i = 2;
|
|
113928
|
+
while (components[i] && components[i] !== "d") {
|
|
113929
|
+
path += (i === 2 ? "/" : "-") + components[i];
|
|
113930
|
+
i++;
|
|
113931
|
+
}
|
|
113932
|
+
var resolveFrom = ts.combinePaths(currentDirectory, "__lib_node_modules_lookup_" + libFileName + "__.ts");
|
|
113933
|
+
var localOverrideModuleResult = ts.resolveModuleName("@typescript/" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
|
|
113934
|
+
if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
113935
|
+
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
113936
|
+
}
|
|
113937
|
+
return ts.combinePaths(defaultLibraryPath, libFileName);
|
|
113938
|
+
}
|
|
114623
113939
|
function processLibReferenceDirectives(file) {
|
|
114624
113940
|
ts.forEach(file.libReferenceDirectives, function (libReference, index) {
|
|
114625
113941
|
var libName = ts.toFileNameLowerCase(libReference.fileName);
|
|
114626
113942
|
var libFileName = ts.libMap.get(libName);
|
|
114627
113943
|
if (libFileName) {
|
|
114628
113944
|
// we ignore any 'no-default-lib' reference set on this file.
|
|
114629
|
-
processRootFile(
|
|
113945
|
+
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, });
|
|
114630
113946
|
}
|
|
114631
113947
|
else {
|
|
114632
113948
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
@@ -114655,7 +113971,7 @@ var ts;
|
|
|
114655
113971
|
var optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a = getRedirectReferenceForResolution(file)) === null || _a === void 0 ? void 0 : _a.commandLine.options : undefined) || options;
|
|
114656
113972
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
114657
113973
|
var resolution = resolutions[index];
|
|
114658
|
-
ts.setResolvedModule(file, moduleNames[index], resolution
|
|
113974
|
+
ts.setResolvedModule(file, moduleNames[index], resolution);
|
|
114659
113975
|
if (!resolution) {
|
|
114660
113976
|
continue;
|
|
114661
113977
|
}
|
|
@@ -114878,7 +114194,7 @@ var ts;
|
|
|
114878
114194
|
if (options.noImplicitUseStrict && ts.getStrictOptionValue(options, "alwaysStrict")) {
|
|
114879
114195
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict");
|
|
114880
114196
|
}
|
|
114881
|
-
var languageVersion =
|
|
114197
|
+
var languageVersion = options.target || 0 /* ES3 */;
|
|
114882
114198
|
var firstNonAmbientExternalModuleSourceFile = ts.find(files, function (f) { return ts.isExternalModule(f) && !f.isDeclarationFile; });
|
|
114883
114199
|
if (options.isolatedModules) {
|
|
114884
114200
|
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
|
|
@@ -115139,7 +114455,7 @@ var ts;
|
|
|
115139
114455
|
message = ts.Diagnostics.File_is_library_specified_here;
|
|
115140
114456
|
break;
|
|
115141
114457
|
}
|
|
115142
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value ===
|
|
114458
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options.target ? key : undefined; });
|
|
115143
114459
|
configFileNode = target ? getOptionsSyntaxByValue("target", target) : undefined;
|
|
115144
114460
|
message = ts.Diagnostics.File_is_default_library_for_target_specified_here;
|
|
115145
114461
|
break;
|
|
@@ -115307,7 +114623,7 @@ var ts;
|
|
|
115307
114623
|
if (options.outDir) {
|
|
115308
114624
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
115309
114625
|
}
|
|
115310
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.
|
|
114626
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensions) || ts.fileExtensionIs(filePath, ".d.ts" /* Dts */)) {
|
|
115311
114627
|
// Otherwise just check if sourceFile with the name exists
|
|
115312
114628
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
115313
114629
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -115839,7 +115155,7 @@ var ts;
|
|
|
115839
115155
|
}
|
|
115840
115156
|
}
|
|
115841
115157
|
}
|
|
115842
|
-
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined
|
|
115158
|
+
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined });
|
|
115843
115159
|
}
|
|
115844
115160
|
return {
|
|
115845
115161
|
fileInfos: fileInfos,
|
|
@@ -115933,7 +115249,7 @@ var ts;
|
|
|
115933
115249
|
/*forceDtsEmit*/ true);
|
|
115934
115250
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
115935
115251
|
if (firstDts_1) {
|
|
115936
|
-
ts.Debug.assert(ts.
|
|
115252
|
+
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts" /* Dts */), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
|
115937
115253
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
115938
115254
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
115939
115255
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -116257,14 +115573,6 @@ var ts;
|
|
|
116257
115573
|
ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
116258
115574
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
116259
115575
|
}
|
|
116260
|
-
if (useOldState) {
|
|
116261
|
-
// Any time the interpretation of a source file changes, mark it as changed
|
|
116262
|
-
ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
|
|
116263
|
-
if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
|
|
116264
|
-
state.changedFilesSet.add(sourceFilePath);
|
|
116265
|
-
}
|
|
116266
|
-
});
|
|
116267
|
-
}
|
|
116268
115576
|
state.buildInfoEmitPending = !!state.changedFilesSet.size;
|
|
116269
115577
|
return state;
|
|
116270
115578
|
}
|
|
@@ -116661,13 +115969,13 @@ var ts;
|
|
|
116661
115969
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
116662
115970
|
return value.version === actualSignature ?
|
|
116663
115971
|
value.affectsGlobalScope ?
|
|
116664
|
-
{ version: value.version, signature: undefined, affectsGlobalScope: true
|
|
115972
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: true } :
|
|
116665
115973
|
value.version :
|
|
116666
115974
|
actualSignature !== undefined ?
|
|
116667
115975
|
signature === undefined ?
|
|
116668
115976
|
value :
|
|
116669
|
-
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope
|
|
116670
|
-
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope
|
|
115977
|
+
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope } :
|
|
115978
|
+
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope };
|
|
116671
115979
|
});
|
|
116672
115980
|
var referencedMap;
|
|
116673
115981
|
if (state.referencedMap) {
|
|
@@ -117087,10 +116395,10 @@ var ts;
|
|
|
117087
116395
|
}
|
|
117088
116396
|
function toBuilderStateFileInfo(fileInfo) {
|
|
117089
116397
|
return ts.isString(fileInfo) ?
|
|
117090
|
-
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined
|
|
116398
|
+
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined } :
|
|
117091
116399
|
ts.isString(fileInfo.signature) ?
|
|
117092
116400
|
fileInfo :
|
|
117093
|
-
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope
|
|
116401
|
+
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope };
|
|
117094
116402
|
}
|
|
117095
116403
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
117096
116404
|
function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
@@ -117428,14 +116736,14 @@ var ts;
|
|
|
117428
116736
|
}
|
|
117429
116737
|
function resolveNamesWithLocalCache(_a) {
|
|
117430
116738
|
var _b, _c, _d;
|
|
117431
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges
|
|
116739
|
+
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
|
|
117432
116740
|
var path = resolutionHost.toPath(containingFile);
|
|
117433
|
-
var resolutionsInFile = cache.get(path) || cache.set(path, ts.
|
|
116741
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
|
|
117434
116742
|
var dirPath = ts.getDirectoryPath(path);
|
|
117435
116743
|
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
117436
116744
|
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
117437
116745
|
if (!perDirectoryResolution) {
|
|
117438
|
-
perDirectoryResolution = ts.
|
|
116746
|
+
perDirectoryResolution = new ts.Map();
|
|
117439
116747
|
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
117440
116748
|
}
|
|
117441
116749
|
var resolvedModules = [];
|
|
@@ -117447,20 +116755,17 @@ var ts;
|
|
|
117447
116755
|
var unmatchedRedirects = oldRedirect ?
|
|
117448
116756
|
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
117449
116757
|
!!redirectedReference;
|
|
117450
|
-
var seenNamesInFile = ts.
|
|
117451
|
-
var
|
|
117452
|
-
|
|
117453
|
-
var
|
|
117454
|
-
var mode = containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
117455
|
-
i++;
|
|
117456
|
-
var resolution = resolutionsInFile.get(name, mode);
|
|
116758
|
+
var seenNamesInFile = new ts.Map();
|
|
116759
|
+
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
116760
|
+
var name = names_3[_i];
|
|
116761
|
+
var resolution = resolutionsInFile.get(name);
|
|
117457
116762
|
// Resolution is valid if it is present and not invalidated
|
|
117458
|
-
if (!seenNamesInFile.has(name
|
|
116763
|
+
if (!seenNamesInFile.has(name) &&
|
|
117459
116764
|
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
117460
116765
|
// If the name is unresolved import that was invalidated, recalculate
|
|
117461
116766
|
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
117462
116767
|
var existingResolution = resolution;
|
|
117463
|
-
var resolutionInDirectory = perDirectoryResolution.get(name
|
|
116768
|
+
var resolutionInDirectory = perDirectoryResolution.get(name);
|
|
117464
116769
|
if (resolutionInDirectory) {
|
|
117465
116770
|
resolution = resolutionInDirectory;
|
|
117466
116771
|
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
@@ -117480,10 +116785,10 @@ var ts;
|
|
|
117480
116785
|
}
|
|
117481
116786
|
}
|
|
117482
116787
|
else {
|
|
117483
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference
|
|
117484
|
-
perDirectoryResolution.set(name,
|
|
116788
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference);
|
|
116789
|
+
perDirectoryResolution.set(name, resolution);
|
|
117485
116790
|
}
|
|
117486
|
-
resolutionsInFile.set(name,
|
|
116791
|
+
resolutionsInFile.set(name, resolution);
|
|
117487
116792
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
117488
116793
|
if (existingResolution) {
|
|
117489
116794
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
@@ -117496,7 +116801,7 @@ var ts;
|
|
|
117496
116801
|
}
|
|
117497
116802
|
else {
|
|
117498
116803
|
var host = ((_d = resolutionHost.getCompilerHost) === null || _d === void 0 ? void 0 : _d.call(resolutionHost)) || resolutionHost;
|
|
117499
|
-
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name
|
|
116804
|
+
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name)) {
|
|
117500
116805
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
117501
116806
|
ts.trace(host, loader === resolveModuleName ?
|
|
117502
116807
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
@@ -117512,14 +116817,14 @@ var ts;
|
|
|
117512
116817
|
}
|
|
117513
116818
|
}
|
|
117514
116819
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
117515
|
-
seenNamesInFile.set(name,
|
|
116820
|
+
seenNamesInFile.set(name, true);
|
|
117516
116821
|
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
117517
116822
|
}
|
|
117518
116823
|
// Stop watching and remove the unused name
|
|
117519
|
-
resolutionsInFile.forEach(function (resolution, name
|
|
117520
|
-
if (!seenNamesInFile.has(name
|
|
116824
|
+
resolutionsInFile.forEach(function (resolution, name) {
|
|
116825
|
+
if (!seenNamesInFile.has(name) && !ts.contains(reusedNames, name)) {
|
|
117521
116826
|
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
117522
|
-
resolutionsInFile.delete(name
|
|
116827
|
+
resolutionsInFile.delete(name);
|
|
117523
116828
|
}
|
|
117524
116829
|
});
|
|
117525
116830
|
return resolvedModules;
|
|
@@ -117553,7 +116858,7 @@ var ts;
|
|
|
117553
116858
|
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
117554
116859
|
});
|
|
117555
116860
|
}
|
|
117556
|
-
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference
|
|
116861
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
117557
116862
|
return resolveNamesWithLocalCache({
|
|
117558
116863
|
names: moduleNames,
|
|
117559
116864
|
containingFile: containingFile,
|
|
@@ -117565,14 +116870,11 @@ var ts;
|
|
|
117565
116870
|
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
117566
116871
|
reusedNames: reusedNames,
|
|
117567
116872
|
logChanges: logChangesWhenResolvingModule,
|
|
117568
|
-
containingSourceFile: containingSourceFile,
|
|
117569
116873
|
});
|
|
117570
116874
|
}
|
|
117571
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile
|
|
116875
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
117572
116876
|
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
117573
|
-
|
|
117574
|
-
return undefined;
|
|
117575
|
-
return cache.get(moduleName, resolutionMode);
|
|
116877
|
+
return cache && cache.get(moduleName);
|
|
117576
116878
|
}
|
|
117577
116879
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
117578
116880
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
@@ -118497,7 +117799,7 @@ var ts;
|
|
|
118497
117799
|
if (!host.fileExists)
|
|
118498
117800
|
return;
|
|
118499
117801
|
// We check all js, `node` and `json` extensions in addition to TS, since node module resolution would also choose those over the directory
|
|
118500
|
-
var extensions = ts.
|
|
117802
|
+
var extensions = ts.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 /* JSON */ }]);
|
|
118501
117803
|
for (var _i = 0, extensions_3 = extensions; _i < extensions_3.length; _i++) {
|
|
118502
117804
|
var e = extensions_3[_i];
|
|
118503
117805
|
var fullPath = path + e;
|
|
@@ -118595,14 +117897,6 @@ var ts;
|
|
|
118595
117897
|
case ".jsx" /* Jsx */:
|
|
118596
117898
|
case ".json" /* Json */:
|
|
118597
117899
|
return ext;
|
|
118598
|
-
case ".d.mts" /* Dmts */:
|
|
118599
|
-
case ".mts" /* Mts */:
|
|
118600
|
-
case ".mjs" /* Mjs */:
|
|
118601
|
-
return ".mjs" /* Mjs */;
|
|
118602
|
-
case ".d.cts" /* Dcts */:
|
|
118603
|
-
case ".cts" /* Cts */:
|
|
118604
|
-
case ".cjs" /* Cjs */:
|
|
118605
|
-
return ".cjs" /* Cjs */;
|
|
118606
117900
|
default:
|
|
118607
117901
|
return undefined;
|
|
118608
117902
|
}
|
|
@@ -118877,7 +118171,7 @@ var ts;
|
|
|
118877
118171
|
case ts.FileIncludeKind.LibFile:
|
|
118878
118172
|
if (reason.index !== undefined)
|
|
118879
118173
|
return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Library_0_specified_in_compilerOptions, options.lib[reason.index]);
|
|
118880
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value ===
|
|
118174
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options.target ? key : undefined; });
|
|
118881
118175
|
return ts.chainDiagnosticMessages(
|
|
118882
118176
|
/*details*/ undefined, target ?
|
|
118883
118177
|
ts.Diagnostics.Default_library_for_target_0 :
|
|
@@ -119300,7 +118594,7 @@ var ts;
|
|
|
119300
118594
|
}
|
|
119301
118595
|
return host.resolveModuleNames.apply(host, args);
|
|
119302
118596
|
}) :
|
|
119303
|
-
(function (moduleNames, containingFile, reusedNames, redirectedReference
|
|
118597
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
|
|
119304
118598
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
119305
118599
|
(function () {
|
|
119306
118600
|
var args = [];
|
|
@@ -120028,11 +119322,10 @@ var ts;
|
|
|
120028
119322
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
120029
119323
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
120030
119324
|
if (!compilerHost.resolveModuleNames) {
|
|
120031
|
-
var loader_3 = function (moduleName,
|
|
120032
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference
|
|
120033
|
-
return ts.
|
|
119325
|
+
var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
|
|
119326
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
|
|
119327
|
+
return ts.loadWithLocalCache(ts.Debug.checkEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
|
|
120034
119328
|
};
|
|
120035
|
-
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
120036
119329
|
}
|
|
120037
119330
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
120038
119331
|
var loader_4 = function (moduleName, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
@@ -122109,12 +121402,6 @@ var ts;
|
|
|
122109
121402
|
ScriptElementKindModifier["jsModifier"] = ".js";
|
|
122110
121403
|
ScriptElementKindModifier["jsxModifier"] = ".jsx";
|
|
122111
121404
|
ScriptElementKindModifier["jsonModifier"] = ".json";
|
|
122112
|
-
ScriptElementKindModifier["dmtsModifier"] = ".d.mts";
|
|
122113
|
-
ScriptElementKindModifier["mtsModifier"] = ".mts";
|
|
122114
|
-
ScriptElementKindModifier["mjsModifier"] = ".mjs";
|
|
122115
|
-
ScriptElementKindModifier["dctsModifier"] = ".d.cts";
|
|
122116
|
-
ScriptElementKindModifier["ctsModifier"] = ".cts";
|
|
122117
|
-
ScriptElementKindModifier["cjsModifier"] = ".cjs";
|
|
122118
121405
|
})(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {}));
|
|
122119
121406
|
var ClassificationTypeNames;
|
|
122120
121407
|
(function (ClassificationTypeNames) {
|
|
@@ -123904,7 +123191,7 @@ var ts;
|
|
|
123904
123191
|
}
|
|
123905
123192
|
ts.programContainsEs6Modules = programContainsEs6Modules;
|
|
123906
123193
|
function compilerOptionsIndicateEs6Modules(compilerOptions) {
|
|
123907
|
-
return !!compilerOptions.module ||
|
|
123194
|
+
return !!compilerOptions.module || compilerOptions.target >= 2 /* ES2015 */ || !!compilerOptions.noEmit;
|
|
123908
123195
|
}
|
|
123909
123196
|
ts.compilerOptionsIndicateEs6Modules = compilerOptionsIndicateEs6Modules;
|
|
123910
123197
|
function createModuleSpecifierResolutionHost(program, host) {
|
|
@@ -126879,12 +126166,6 @@ var ts;
|
|
|
126879
126166
|
case ".jsx" /* Jsx */: return ".jsx" /* jsxModifier */;
|
|
126880
126167
|
case ".ts" /* Ts */: return ".ts" /* tsModifier */;
|
|
126881
126168
|
case ".tsx" /* Tsx */: return ".tsx" /* tsxModifier */;
|
|
126882
|
-
case ".d.mts" /* Dmts */: return ".d.mts" /* dmtsModifier */;
|
|
126883
|
-
case ".mjs" /* Mjs */: return ".mjs" /* mjsModifier */;
|
|
126884
|
-
case ".mts" /* Mts */: return ".mts" /* mtsModifier */;
|
|
126885
|
-
case ".d.cts" /* Dcts */: return ".d.cts" /* dctsModifier */;
|
|
126886
|
-
case ".cjs" /* Cjs */: return ".cjs" /* cjsModifier */;
|
|
126887
|
-
case ".cts" /* Cts */: return ".cts" /* ctsModifier */;
|
|
126888
126169
|
case ".tsbuildinfo" /* TsBuildInfo */: return ts.Debug.fail("Extension " + ".tsbuildinfo" /* TsBuildInfo */ + " is unsupported.");
|
|
126889
126170
|
case undefined: return "" /* none */;
|
|
126890
126171
|
default:
|
|
@@ -127079,7 +126360,7 @@ var ts;
|
|
|
127079
126360
|
}
|
|
127080
126361
|
function getExtensionOptions(compilerOptions, includeExtensionsOption) {
|
|
127081
126362
|
if (includeExtensionsOption === void 0) { includeExtensionsOption = 0 /* Exclude */; }
|
|
127082
|
-
return { extensions:
|
|
126363
|
+
return { extensions: getSupportedExtensionsForModuleResolution(compilerOptions), includeExtensionsOption: includeExtensionsOption };
|
|
127083
126364
|
}
|
|
127084
126365
|
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, preferences) {
|
|
127085
126366
|
var includeExtensions = preferences.importModuleSpecifierEnding === "js" ? 2 /* ModuleSpecifierCompletion */ : 0 /* Exclude */;
|
|
@@ -127093,8 +126374,8 @@ var ts;
|
|
|
127093
126374
|
}
|
|
127094
126375
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
127095
126376
|
var extensions = ts.getSupportedExtensions(compilerOptions);
|
|
127096
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ?
|
|
127097
|
-
|
|
126377
|
+
return compilerOptions.resolveJsonModule && ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ?
|
|
126378
|
+
extensions.concat(".json" /* Json */) :
|
|
127098
126379
|
extensions;
|
|
127099
126380
|
}
|
|
127100
126381
|
/**
|
|
@@ -127772,15 +127053,15 @@ var ts;
|
|
|
127772
127053
|
var entries = [];
|
|
127773
127054
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
127774
127055
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
127775
|
-
/* contextToken */ undefined, location, sourceFile, typeChecker,
|
|
127776
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames,
|
|
127056
|
+
/* contextToken */ undefined, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
127057
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); // TODO: GH#18217
|
|
127777
127058
|
}
|
|
127778
127059
|
else {
|
|
127779
127060
|
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
127780
127061
|
return undefined;
|
|
127781
127062
|
}
|
|
127782
127063
|
getCompletionEntriesFromSymbols(symbols, entries,
|
|
127783
|
-
/* contextToken */ undefined, location, sourceFile, typeChecker,
|
|
127064
|
+
/* contextToken */ undefined, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
127784
127065
|
}
|
|
127785
127066
|
if (keywordFilters !== 0 /* None */) {
|
|
127786
127067
|
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
@@ -127951,6 +127232,32 @@ var ts;
|
|
|
127951
127232
|
data = originToCompletionEntryData(origin);
|
|
127952
127233
|
hasAction = !importCompletionNode;
|
|
127953
127234
|
}
|
|
127235
|
+
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location); // TODO: GH#18217
|
|
127236
|
+
if (kind === "JSX attribute" /* jsxAttribute */ && preferences.jsxSnippetCompletion && preferences.jsxSnippetCompletion !== "none") {
|
|
127237
|
+
var useBraces_1 = preferences.jsxSnippetCompletion === "braces";
|
|
127238
|
+
var type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
127239
|
+
// If is boolean like or undefined, don't return a snippet we want just to return the completion.
|
|
127240
|
+
if (preferences.jsxSnippetCompletion === "auto"
|
|
127241
|
+
&& !(type.flags & 528 /* BooleanLike */)
|
|
127242
|
+
&& !(type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (528 /* BooleanLike */ | 32768 /* Undefined */)); }))) {
|
|
127243
|
+
if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
|
|
127244
|
+
// If is string like or undefined use quotes
|
|
127245
|
+
insertText = name + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
127246
|
+
isSnippet = true;
|
|
127247
|
+
}
|
|
127248
|
+
else {
|
|
127249
|
+
// Use braces for everything else
|
|
127250
|
+
useBraces_1 = true;
|
|
127251
|
+
}
|
|
127252
|
+
}
|
|
127253
|
+
if (useBraces_1) {
|
|
127254
|
+
insertText = name + "={$1}";
|
|
127255
|
+
isSnippet = true;
|
|
127256
|
+
}
|
|
127257
|
+
if (isSnippet) {
|
|
127258
|
+
replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
|
|
127259
|
+
}
|
|
127260
|
+
}
|
|
127954
127261
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
127955
127262
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
127956
127263
|
// really we should consider passing the meaning for the node so that we don't report
|
|
@@ -127960,7 +127267,7 @@ var ts;
|
|
|
127960
127267
|
// entries (like JavaScript identifier entries).
|
|
127961
127268
|
return {
|
|
127962
127269
|
name: name,
|
|
127963
|
-
kind:
|
|
127270
|
+
kind: kind,
|
|
127964
127271
|
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
|
|
127965
127272
|
sortText: sortText,
|
|
127966
127273
|
source: getSourceFromOrigin(origin),
|
|
@@ -128164,7 +127471,7 @@ var ts;
|
|
|
128164
127471
|
// completion entry.
|
|
128165
127472
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
128166
127473
|
var origin = symbolToOriginInfoMap[index];
|
|
128167
|
-
var info = getCompletionEntryDisplayNameForSymbol(symbol,
|
|
127474
|
+
var info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target, origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
128168
127475
|
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
128169
127476
|
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
128170
127477
|
: undefined;
|
|
@@ -128241,7 +127548,7 @@ var ts;
|
|
|
128241
127548
|
var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
|
|
128242
127549
|
var moduleSymbol = origin.moduleSymbol;
|
|
128243
127550
|
var exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
|
|
128244
|
-
var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol,
|
|
127551
|
+
var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, compilerOptions.target), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
|
|
128245
127552
|
ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
|
|
128246
127553
|
return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
|
|
128247
127554
|
}
|
|
@@ -130794,7 +130101,7 @@ var ts;
|
|
|
130794
130101
|
}
|
|
130795
130102
|
function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {
|
|
130796
130103
|
scriptKind = ts.ensureScriptKind(fileName, scriptKind);
|
|
130797
|
-
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ :
|
|
130104
|
+
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ : compilationSettings.target || 1 /* ES5 */;
|
|
130798
130105
|
var bucket = ts.getOrUpdate(buckets, key, function () { return new ts.Map(); });
|
|
130799
130106
|
var bucketEntry = bucket.get(path);
|
|
130800
130107
|
var entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
@@ -132065,7 +131372,7 @@ var ts;
|
|
|
132065
131372
|
if (!options.implementations && ts.isStringLiteralLike(node)) {
|
|
132066
131373
|
if (ts.isModuleSpecifierLike(node)) {
|
|
132067
131374
|
var fileIncludeReasons = program.getFileIncludeReasons();
|
|
132068
|
-
var referencedFileName = (_b = (_a = node.getSourceFile().resolvedModules) === null || _a === void 0 ? void 0 : _a.get(node.text
|
|
131375
|
+
var referencedFileName = (_b = (_a = node.getSourceFile().resolvedModules) === null || _a === void 0 ? void 0 : _a.get(node.text)) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
132069
131376
|
var referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : undefined;
|
|
132070
131377
|
if (referencedFile) {
|
|
132071
131378
|
return [{ definition: { type: 4 /* String */, node: node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || ts.emptyArray }];
|
|
@@ -134223,10 +133530,9 @@ var ts;
|
|
|
134223
133530
|
return newFileName === undefined ? { newFileName: oldFileName, updated: false } : { newFileName: newFileName, updated: true };
|
|
134224
133531
|
}
|
|
134225
133532
|
else {
|
|
134226
|
-
var mode = ts.getModeForResolutionAtIndex({ statements: importingSourceFile.statements, imports: [importLiteral], moduleAugmentations: [], impliedNodeFormat: importingSourceFile.impliedNodeFormat }, 0);
|
|
134227
133533
|
var resolved = host.resolveModuleNames
|
|
134228
|
-
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName
|
|
134229
|
-
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName
|
|
133534
|
+
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName)
|
|
133535
|
+
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName);
|
|
134230
133536
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
134231
133537
|
}
|
|
134232
133538
|
}
|
|
@@ -134451,10 +133757,10 @@ var ts;
|
|
|
134451
133757
|
var file = program.getLibFileFromReference(libReferenceDirective);
|
|
134452
133758
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
134453
133759
|
}
|
|
134454
|
-
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size
|
|
133760
|
+
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size) {
|
|
134455
133761
|
var node = ts.getTokenAtPosition(sourceFile, position);
|
|
134456
|
-
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text
|
|
134457
|
-
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text
|
|
133762
|
+
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text)) {
|
|
133763
|
+
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text)) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
134458
133764
|
var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
|
|
134459
133765
|
return {
|
|
134460
133766
|
file: program.getSourceFile(fileName),
|
|
@@ -139162,7 +138468,7 @@ var ts;
|
|
|
139162
138468
|
var name = importNameForConvertToDefaultImport(importNode);
|
|
139163
138469
|
if (!name)
|
|
139164
138470
|
continue;
|
|
139165
|
-
var module_1 = ts.getResolvedModule(sourceFile, moduleSpecifier.text
|
|
138471
|
+
var module_1 = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
|
|
139166
138472
|
var resolvedFile = module_1 && program.getSourceFile(module_1.resolvedFileName);
|
|
139167
138473
|
if (resolvedFile && resolvedFile.externalModuleIndicator && ts.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
139168
138474
|
diags.push(ts.createDiagnosticForNode(name, ts.Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -140062,7 +139368,7 @@ var ts;
|
|
|
140062
139368
|
options.allowNonTsExtensions = true;
|
|
140063
139369
|
// if jsx is specified then treat file as .tsx
|
|
140064
139370
|
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
|
|
140065
|
-
var sourceFile = ts.createSourceFile(inputFileName, input,
|
|
139371
|
+
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
|
|
140066
139372
|
if (transpileOptions.moduleName) {
|
|
140067
139373
|
sourceFile.moduleName = transpileOptions.moduleName;
|
|
140068
139374
|
}
|
|
@@ -145634,7 +144940,7 @@ var ts;
|
|
|
145634
144940
|
return propName;
|
|
145635
144941
|
}
|
|
145636
144942
|
if (ts.isStringLiteralLike(propName)) {
|
|
145637
|
-
return ts.isIdentifierText(propName.text,
|
|
144943
|
+
return ts.isIdentifierText(propName.text, compilerOptions.target) ? ts.factory.createIdentifier(propName.text)
|
|
145638
144944
|
: ts.isNoSubstitutionTemplateLiteral(propName) ? ts.factory.createStringLiteral(propName.text, quotePreference === 0 /* Single */)
|
|
145639
144945
|
: propName;
|
|
145640
144946
|
}
|
|
@@ -146382,7 +145688,7 @@ var ts;
|
|
|
146382
145688
|
getCodeActions: function (context) {
|
|
146383
145689
|
var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences;
|
|
146384
145690
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
|
|
146385
|
-
var moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes,
|
|
145691
|
+
var moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, program.getCompilerOptions().target, ts.getQuotePreference(sourceFile, preferences));
|
|
146386
145692
|
if (moduleExportsChangedToDefault) {
|
|
146387
145693
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
146388
145694
|
var importingFile = _a[_i];
|
|
@@ -146397,7 +145703,7 @@ var ts;
|
|
|
146397
145703
|
function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
|
|
146398
145704
|
for (var _i = 0, _a = importingFile.imports; _i < _a.length; _i++) {
|
|
146399
145705
|
var moduleSpecifier = _a[_i];
|
|
146400
|
-
var imported = ts.getResolvedModule(importingFile, moduleSpecifier.text
|
|
145706
|
+
var imported = ts.getResolvedModule(importingFile, moduleSpecifier.text);
|
|
146401
145707
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
146402
145708
|
continue;
|
|
146403
145709
|
}
|
|
@@ -147348,7 +146654,7 @@ var ts;
|
|
|
147348
146654
|
return;
|
|
147349
146655
|
}
|
|
147350
146656
|
var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
147351
|
-
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol,
|
|
146657
|
+
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
|
|
147352
146658
|
result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson });
|
|
147353
146659
|
}
|
|
147354
146660
|
for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
|
|
@@ -147643,9 +146949,6 @@ var ts;
|
|
|
147643
146949
|
case ts.ModuleKind.None:
|
|
147644
146950
|
// Fall back to the `import * as ns` style import.
|
|
147645
146951
|
return 2 /* Namespace */;
|
|
147646
|
-
case ts.ModuleKind.Node12:
|
|
147647
|
-
case ts.ModuleKind.NodeNext:
|
|
147648
|
-
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
147649
146952
|
default:
|
|
147650
146953
|
return ts.Debug.assertNever(moduleKind, "Unexpected moduleKind " + moduleKind);
|
|
147651
146954
|
}
|
|
@@ -147700,7 +147003,7 @@ var ts;
|
|
|
147700
147003
|
cancellationToken.throwIfCancellationRequested();
|
|
147701
147004
|
var compilerOptions = program.getCompilerOptions();
|
|
147702
147005
|
var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
147703
|
-
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol,
|
|
147006
|
+
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
|
|
147704
147007
|
addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson);
|
|
147705
147008
|
}
|
|
147706
147009
|
// check exports with the same name
|
|
@@ -148207,6 +147510,7 @@ var ts;
|
|
|
148207
147510
|
ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
|
|
148208
147511
|
ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,
|
|
148209
147512
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,
|
|
147513
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,
|
|
148210
147514
|
// for JSX class components
|
|
148211
147515
|
ts.Diagnostics.No_overload_matches_this_call.code,
|
|
148212
147516
|
// for JSX FC
|
|
@@ -148220,14 +147524,14 @@ var ts;
|
|
|
148220
147524
|
if (!info)
|
|
148221
147525
|
return undefined;
|
|
148222
147526
|
var node = info.node, suggestedSymbol = info.suggestedSymbol;
|
|
148223
|
-
var target =
|
|
147527
|
+
var target = context.host.getCompilationSettings().target;
|
|
148224
147528
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestedSymbol, target); });
|
|
148225
147529
|
return [codefix.createCodeFixAction("spelling", changes, [ts.Diagnostics.Change_spelling_to_0, ts.symbolName(suggestedSymbol)], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)];
|
|
148226
147530
|
},
|
|
148227
147531
|
fixIds: [fixId],
|
|
148228
147532
|
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148229
147533
|
var info = getInfo(diag.file, diag.start, context, diag.code);
|
|
148230
|
-
var target =
|
|
147534
|
+
var target = context.host.getCompilationSettings().target;
|
|
148231
147535
|
if (info)
|
|
148232
147536
|
doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
148233
147537
|
}); },
|
|
@@ -148320,7 +147624,7 @@ var ts;
|
|
|
148320
147624
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
148321
147625
|
if (!importDeclaration || !ts.isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
148322
147626
|
return undefined;
|
|
148323
|
-
var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text
|
|
147627
|
+
var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text);
|
|
148324
147628
|
if (!resolvedModule)
|
|
148325
147629
|
return undefined;
|
|
148326
147630
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -149367,8 +148671,8 @@ var ts;
|
|
|
149367
148671
|
(function (codefix) {
|
|
149368
148672
|
codefix.registerCodeFix({
|
|
149369
148673
|
errorCodes: [
|
|
149370
|
-
ts.Diagnostics.
|
|
149371
|
-
ts.Diagnostics.
|
|
148674
|
+
ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
148675
|
+
ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
149372
148676
|
],
|
|
149373
148677
|
getCodeActions: function (context) {
|
|
149374
148678
|
var compilerOptions = context.program.getCompilerOptions();
|