mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update LKG
This commit is contained in:
Vendored
+3
-4
@@ -734,9 +734,9 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
formatOptions?: FormatCodeSettings;
|
||||
/**
|
||||
* The host's additional supported file extensions
|
||||
* The host's additional supported .js file extensions
|
||||
*/
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
extraFileExtensions?: JsFileExtensionInfo[];
|
||||
}
|
||||
/**
|
||||
* Configure request; value of command field is "configure". Specifies
|
||||
@@ -1861,9 +1861,8 @@ declare namespace ts.server.protocol {
|
||||
[option: string]: string[] | boolean | undefined;
|
||||
}
|
||||
|
||||
interface FileExtensionInfo {
|
||||
interface JsFileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
|
||||
|
||||
+424
-244
File diff suppressed because it is too large
Load Diff
+427
-247
File diff suppressed because it is too large
Load Diff
Vendored
+21
-12
@@ -1421,9 +1421,21 @@ declare namespace ts {
|
||||
ArrayMutation = 256,
|
||||
Referenced = 512,
|
||||
Shared = 1024,
|
||||
PreFinally = 2048,
|
||||
AfterFinally = 4096,
|
||||
Label = 12,
|
||||
Condition = 96,
|
||||
}
|
||||
interface FlowLock {
|
||||
locked?: boolean;
|
||||
}
|
||||
interface AfterFinallyFlow extends FlowNode, FlowLock {
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
interface PreFinallyFlow extends FlowNode {
|
||||
antecedent: FlowNode;
|
||||
lock: FlowLock;
|
||||
}
|
||||
interface FlowNode {
|
||||
flags: FlowFlags;
|
||||
id?: number;
|
||||
@@ -1630,6 +1642,7 @@ declare namespace ts {
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
SuppressAnyReturnType = 2048,
|
||||
AddUndefined = 4096,
|
||||
}
|
||||
const enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
@@ -1679,13 +1692,10 @@ declare namespace ts {
|
||||
ExportType = 2097152,
|
||||
ExportNamespace = 4194304,
|
||||
Alias = 8388608,
|
||||
Instantiated = 16777216,
|
||||
Merged = 33554432,
|
||||
Transient = 67108864,
|
||||
Prototype = 134217728,
|
||||
SyntheticProperty = 268435456,
|
||||
Optional = 536870912,
|
||||
ExportStar = 1073741824,
|
||||
Prototype = 16777216,
|
||||
ExportStar = 33554432,
|
||||
Optional = 67108864,
|
||||
Transient = 134217728,
|
||||
Enum = 384,
|
||||
Variable = 3,
|
||||
Value = 107455,
|
||||
@@ -1865,9 +1875,8 @@ declare namespace ts {
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
interface JsFileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
@@ -2267,7 +2276,7 @@ declare namespace ts {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: JsFileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
@@ -3648,7 +3657,7 @@ declare namespace ts.server.protocol {
|
||||
hostInfo?: string;
|
||||
file?: string;
|
||||
formatOptions?: FormatCodeSettings;
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
extraFileExtensions?: JsFileExtensionInfo[];
|
||||
}
|
||||
interface ConfigureRequest extends Request {
|
||||
command: CommandTypes.Configure;
|
||||
@@ -4730,7 +4739,7 @@ declare namespace ts.server {
|
||||
interface HostConfiguration {
|
||||
formatCodeOptions: FormatCodeSettings;
|
||||
hostInfo: string;
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
extraFileExtensions?: JsFileExtensionInfo[];
|
||||
}
|
||||
interface OpenConfiguredProjectResult {
|
||||
configFileName?: NormalizedPath;
|
||||
|
||||
+427
-247
File diff suppressed because it is too large
Load Diff
Vendored
+19
-10
@@ -1448,9 +1448,21 @@ declare namespace ts {
|
||||
ArrayMutation = 256,
|
||||
Referenced = 512,
|
||||
Shared = 1024,
|
||||
PreFinally = 2048,
|
||||
AfterFinally = 4096,
|
||||
Label = 12,
|
||||
Condition = 96,
|
||||
}
|
||||
interface FlowLock {
|
||||
locked?: boolean;
|
||||
}
|
||||
interface AfterFinallyFlow extends FlowNode, FlowLock {
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
interface PreFinallyFlow extends FlowNode {
|
||||
antecedent: FlowNode;
|
||||
lock: FlowLock;
|
||||
}
|
||||
interface FlowNode {
|
||||
flags: FlowFlags;
|
||||
id?: number;
|
||||
@@ -1697,6 +1709,7 @@ declare namespace ts {
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
SuppressAnyReturnType = 2048,
|
||||
AddUndefined = 4096,
|
||||
}
|
||||
enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
@@ -1746,13 +1759,10 @@ declare namespace ts {
|
||||
ExportType = 2097152,
|
||||
ExportNamespace = 4194304,
|
||||
Alias = 8388608,
|
||||
Instantiated = 16777216,
|
||||
Merged = 33554432,
|
||||
Transient = 67108864,
|
||||
Prototype = 134217728,
|
||||
SyntheticProperty = 268435456,
|
||||
Optional = 536870912,
|
||||
ExportStar = 1073741824,
|
||||
Prototype = 16777216,
|
||||
ExportStar = 33554432,
|
||||
Optional = 67108864,
|
||||
Transient = 134217728,
|
||||
Enum = 384,
|
||||
Variable = 3,
|
||||
Value = 107455,
|
||||
@@ -1943,9 +1953,8 @@ declare namespace ts {
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
interface JsFileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
@@ -2918,7 +2927,7 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: JsFileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
|
||||
+525
-267
File diff suppressed because it is too large
Load Diff
Vendored
+19
-10
@@ -1448,9 +1448,21 @@ declare namespace ts {
|
||||
ArrayMutation = 256,
|
||||
Referenced = 512,
|
||||
Shared = 1024,
|
||||
PreFinally = 2048,
|
||||
AfterFinally = 4096,
|
||||
Label = 12,
|
||||
Condition = 96,
|
||||
}
|
||||
interface FlowLock {
|
||||
locked?: boolean;
|
||||
}
|
||||
interface AfterFinallyFlow extends FlowNode, FlowLock {
|
||||
antecedent: FlowNode;
|
||||
}
|
||||
interface PreFinallyFlow extends FlowNode {
|
||||
antecedent: FlowNode;
|
||||
lock: FlowLock;
|
||||
}
|
||||
interface FlowNode {
|
||||
flags: FlowFlags;
|
||||
id?: number;
|
||||
@@ -1697,6 +1709,7 @@ declare namespace ts {
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
SuppressAnyReturnType = 2048,
|
||||
AddUndefined = 4096,
|
||||
}
|
||||
enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
@@ -1746,13 +1759,10 @@ declare namespace ts {
|
||||
ExportType = 2097152,
|
||||
ExportNamespace = 4194304,
|
||||
Alias = 8388608,
|
||||
Instantiated = 16777216,
|
||||
Merged = 33554432,
|
||||
Transient = 67108864,
|
||||
Prototype = 134217728,
|
||||
SyntheticProperty = 268435456,
|
||||
Optional = 536870912,
|
||||
ExportStar = 1073741824,
|
||||
Prototype = 16777216,
|
||||
ExportStar = 33554432,
|
||||
Optional = 67108864,
|
||||
Transient = 134217728,
|
||||
Enum = 384,
|
||||
Variable = 3,
|
||||
Value = 107455,
|
||||
@@ -1943,9 +1953,8 @@ declare namespace ts {
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
interface JsFileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
@@ -2918,7 +2927,7 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: JsFileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
|
||||
+525
-267
File diff suppressed because it is too large
Load Diff
+73
-77
@@ -1763,13 +1763,13 @@ var ts;
|
||||
var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);
|
||||
function getSupportedExtensions(options, extraFileExtensions) {
|
||||
var needAllExtensions = options && options.allowJs;
|
||||
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
||||
if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) {
|
||||
return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
|
||||
}
|
||||
var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0);
|
||||
var extensions = allSupportedExtensions.slice(0);
|
||||
for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) {
|
||||
var extInfo = extraFileExtensions_1[_i];
|
||||
if (needAllExtensions || extInfo.scriptKind === 3) {
|
||||
if (extensions.indexOf(extInfo.extension) === -1) {
|
||||
extensions.push(extInfo.extension);
|
||||
}
|
||||
}
|
||||
@@ -1800,30 +1800,30 @@ var ts;
|
||||
function getExtensionPriority(path, supportedExtensions) {
|
||||
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
|
||||
if (fileExtensionIs(path, supportedExtensions[i])) {
|
||||
return adjustExtensionPriority(i);
|
||||
return adjustExtensionPriority(i, supportedExtensions);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ts.getExtensionPriority = getExtensionPriority;
|
||||
function adjustExtensionPriority(extensionPriority) {
|
||||
function adjustExtensionPriority(extensionPriority, supportedExtensions) {
|
||||
if (extensionPriority < 2) {
|
||||
return 0;
|
||||
}
|
||||
else if (extensionPriority < 5) {
|
||||
else if (extensionPriority < supportedExtensions.length) {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return 5;
|
||||
return supportedExtensions.length;
|
||||
}
|
||||
}
|
||||
ts.adjustExtensionPriority = adjustExtensionPriority;
|
||||
function getNextLowestExtensionPriority(extensionPriority) {
|
||||
function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) {
|
||||
if (extensionPriority < 2) {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return 5;
|
||||
return supportedExtensions.length;
|
||||
}
|
||||
}
|
||||
ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;
|
||||
@@ -2689,6 +2689,7 @@ var ts;
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." },
|
||||
Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." },
|
||||
Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." },
|
||||
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." },
|
||||
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." },
|
||||
Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." },
|
||||
@@ -2968,6 +2969,7 @@ var ts;
|
||||
Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." },
|
||||
Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." },
|
||||
A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." },
|
||||
Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." },
|
||||
JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." },
|
||||
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." },
|
||||
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." },
|
||||
@@ -3221,7 +3223,7 @@ var ts;
|
||||
File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." },
|
||||
Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." },
|
||||
Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." },
|
||||
package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." },
|
||||
package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." },
|
||||
package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." },
|
||||
Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." },
|
||||
Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." },
|
||||
@@ -3258,7 +3260,6 @@ var ts;
|
||||
Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." },
|
||||
Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." },
|
||||
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" },
|
||||
No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" },
|
||||
Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." },
|
||||
Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." },
|
||||
Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." },
|
||||
@@ -6001,7 +6002,7 @@ var ts;
|
||||
}
|
||||
function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
|
||||
var extensionPriority = ts.getExtensionPriority(file, extensions);
|
||||
var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority);
|
||||
var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions);
|
||||
for (var i = 0; i < adjustedExtensionPriority; i++) {
|
||||
var higherPriorityExtension = extensions[i];
|
||||
var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));
|
||||
@@ -6013,7 +6014,7 @@ var ts;
|
||||
}
|
||||
function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
|
||||
var extensionPriority = ts.getExtensionPriority(file, extensions);
|
||||
var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority);
|
||||
var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions);
|
||||
for (var i = nextExtensionPriority; i < extensions.length; i++) {
|
||||
var lowerPriorityExtension = extensions[i];
|
||||
var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));
|
||||
@@ -6249,37 +6250,28 @@ var ts;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
|
||||
function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) {
|
||||
function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent = readJson(packageJsonPath, state.host);
|
||||
switch (extensions) {
|
||||
case Extensions.DtsOnly:
|
||||
case Extensions.TypeScript:
|
||||
return tryReadFromField("typings") || tryReadFromField("types");
|
||||
case Extensions.JavaScript:
|
||||
if (typeof jsonContent.main === "string") {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main);
|
||||
}
|
||||
return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main));
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main");
|
||||
function tryReadFromField(fieldName) {
|
||||
if (ts.hasProperty(jsonContent, fieldName)) {
|
||||
var typesFile = jsonContent[fieldName];
|
||||
if (typeof typesFile === "string") {
|
||||
var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile));
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath);
|
||||
}
|
||||
return typesFilePath;
|
||||
}
|
||||
else {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile);
|
||||
}
|
||||
if (!ts.hasProperty(jsonContent, fieldName)) {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var fileName = jsonContent[fieldName];
|
||||
if (typeof fileName !== "string") {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
function readJson(path, host) {
|
||||
@@ -6680,7 +6672,8 @@ var ts;
|
||||
}
|
||||
return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
function tryResolve(extensions) {
|
||||
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state);
|
||||
var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, true); };
|
||||
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state);
|
||||
if (resolved) {
|
||||
return toSearchResult({ resolved: resolved, isExternalLibraryImport: false });
|
||||
}
|
||||
@@ -6693,7 +6686,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
|
||||
var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state);
|
||||
var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state, true);
|
||||
return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false });
|
||||
}
|
||||
}
|
||||
@@ -6709,7 +6702,7 @@ var ts;
|
||||
}
|
||||
return real;
|
||||
}
|
||||
function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
|
||||
function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]);
|
||||
}
|
||||
@@ -6737,7 +6730,7 @@ var ts;
|
||||
onlyRecordFailures = true;
|
||||
}
|
||||
}
|
||||
return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
|
||||
return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson);
|
||||
}
|
||||
function directoryProbablyExists(directoryName, host) {
|
||||
return !host.directoryExists || host.directoryExists(directoryName);
|
||||
@@ -6794,45 +6787,48 @@ var ts;
|
||||
failedLookupLocations.push(fileName);
|
||||
return undefined;
|
||||
}
|
||||
function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) {
|
||||
var packageJsonPath = pathToPackageJson(candidate);
|
||||
function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) {
|
||||
if (considerPackageJson === void 0) { considerPackageJson = true; }
|
||||
var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host);
|
||||
if (directoryExists && state.host.fileExists(packageJsonPath)) {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
||||
}
|
||||
var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state);
|
||||
if (mainOrTypesFile) {
|
||||
var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host);
|
||||
var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state);
|
||||
if (fromExactFile) {
|
||||
var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile);
|
||||
if (resolved_3) {
|
||||
return resolved_3;
|
||||
}
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile);
|
||||
}
|
||||
}
|
||||
var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state);
|
||||
if (resolved) {
|
||||
return resolved;
|
||||
if (considerPackageJson) {
|
||||
var packageJsonPath = pathToPackageJson(candidate);
|
||||
if (directoryExists && state.host.fileExists(packageJsonPath)) {
|
||||
var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state);
|
||||
if (fromPackageJson) {
|
||||
return fromPackageJson;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field);
|
||||
if (directoryExists && state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);
|
||||
}
|
||||
failedLookupLocations.push(packageJsonPath);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (directoryExists && state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);
|
||||
}
|
||||
failedLookupLocations.push(packageJsonPath);
|
||||
}
|
||||
return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state);
|
||||
}
|
||||
function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) {
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
||||
}
|
||||
var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host);
|
||||
var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
|
||||
if (fromFile) {
|
||||
var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile);
|
||||
if (resolved) {
|
||||
return resolved;
|
||||
}
|
||||
if (state.traceEnabled) {
|
||||
trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile);
|
||||
}
|
||||
}
|
||||
var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions;
|
||||
return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, false);
|
||||
}
|
||||
function resolvedIfExtensionMatches(extensions, path) {
|
||||
var extension = ts.tryGetExtensionFromPath(path);
|
||||
return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined;
|
||||
@@ -6919,7 +6915,7 @@ var ts;
|
||||
}
|
||||
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName);
|
||||
if (moduleHasNonRelativeName(moduleName)) {
|
||||
var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) {
|
||||
var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) {
|
||||
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host);
|
||||
if (resolutionFromCache) {
|
||||
return resolutionFromCache;
|
||||
@@ -6927,8 +6923,8 @@ var ts;
|
||||
var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
|
||||
return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state));
|
||||
});
|
||||
if (resolved_4) {
|
||||
return resolved_4;
|
||||
if (resolved_3) {
|
||||
return resolved_3;
|
||||
}
|
||||
if (extensions === Extensions.TypeScript) {
|
||||
return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state);
|
||||
|
||||
Reference in New Issue
Block a user