summaryrefslogtreecommitdiff
path: root/node_modules/typescript/lib/typingsInstaller.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/typescript/lib/typingsInstaller.js')
-rw-r--r--node_modules/typescript/lib/typingsInstaller.js173
1 files changed, 124 insertions, 49 deletions
diff --git a/node_modules/typescript/lib/typingsInstaller.js b/node_modules/typescript/lib/typingsInstaller.js
index 13912d296..904f1444d 100644
--- a/node_modules/typescript/lib/typingsInstaller.js
+++ b/node_modules/typescript/lib/typingsInstaller.js
@@ -137,6 +137,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ ts.version = "2.2.0-dev.20161127";
+})(ts || (ts = {}));
+(function (ts) {
var createObject = Object.create;
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
function createMap(template) {
@@ -606,7 +609,7 @@ var ts;
if (value === undefined)
return to;
if (to === undefined)
- to = [];
+ return [value];
to.push(value);
return to;
}
@@ -621,6 +624,14 @@ var ts;
return to;
}
ts.addRange = addRange;
+ function stableSort(array, comparer) {
+ if (comparer === void 0) { comparer = compareValues; }
+ return array
+ .map(function (_, i) { return i; })
+ .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })
+ .map(function (i) { return array[i]; });
+ }
+ ts.stableSort = stableSort;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -775,6 +786,15 @@ var ts;
}
}
ts.copyProperties = copyProperties;
+ function appendProperty(map, key, value) {
+ if (key === undefined || value === undefined)
+ return map;
+ if (map === undefined)
+ map = createMap();
+ map[key] = value;
+ return map;
+ }
+ ts.appendProperty = appendProperty;
function assign(t) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
@@ -1227,6 +1247,14 @@ var ts;
getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions) {
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ }
+ return moduleResolution;
+ }
+ ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
for (var i = 0; i < str.length; i++) {
@@ -1777,6 +1805,16 @@ var ts;
}
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
+ function orderedRemoveItem(array, item) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === item) {
+ orderedRemoveItemAt(array, i);
+ return true;
+ }
+ }
+ return false;
+ }
+ ts.orderedRemoveItem = orderedRemoveItem;
function orderedRemoveItemAt(array, index) {
for (var i = index; i < array.length - 1; i++) {
array[i] = array[i + 1];
@@ -2811,7 +2849,7 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
- Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
@@ -2876,7 +2914,8 @@ var ts;
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
- An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2947,6 +2986,7 @@ var ts;
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
@@ -3161,9 +3201,9 @@ var ts;
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
- Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
+ Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
- The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
@@ -3175,6 +3215,9 @@ var ts;
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
+ Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
+ Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
+ Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
};
})(ts || (ts = {}));
var ts;
@@ -5176,12 +5219,16 @@ var ts;
description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
}
];
- ts.typingOptionDeclarations = [
+ ts.typeAcquisitionDeclarations = [
{
name: "enableAutoDiscovery",
type: "boolean",
},
{
+ name: "enable",
+ type: "boolean",
+ },
+ {
name: "include",
type: "list",
element: {
@@ -5205,6 +5252,18 @@ var ts;
sourceMap: false,
};
var optionNameMapCache;
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
+ if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
+ var result = {
+ enable: typeAcquisition.enableAutoDiscovery,
+ include: typeAcquisition.include || [],
+ exclude: typeAcquisition.exclude || []
+ };
+ return result;
+ }
+ return typeAcquisition;
+ }
+ ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
function getOptionNameMap() {
if (optionNameMapCache) {
return optionNameMapCache;
@@ -5484,14 +5543,15 @@ var ts;
return {
options: {},
fileNames: [],
- typingOptions: {},
+ typeAcquisition: {},
raw: json,
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
wildcardDirectories: {}
};
}
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
+ var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
if (json["extends"]) {
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
if (typeof json["extends"] === "string") {
@@ -5518,7 +5578,7 @@ var ts;
return {
options: options,
fileNames: fileNames,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
raw: json,
errors: errors,
wildcardDirectories: wildcardDirectories,
@@ -5526,7 +5586,7 @@ var ts;
};
function tryExtendsName(extendedConfig) {
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return;
}
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
@@ -5589,7 +5649,7 @@ var ts;
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
}
else {
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
excludeSpecs.push(outDir);
@@ -5624,12 +5684,12 @@ var ts;
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
return { options: options, errors: errors };
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
@@ -5637,9 +5697,10 @@ var ts;
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
+ var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
+ convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
return options;
}
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
@@ -5858,9 +5919,9 @@ var ts;
"constants", "process", "v8", "timers", "console"
];
var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; });
- function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) {
+ function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {
var inferredTypings = ts.createMap();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ if (!typeAcquisition || !typeAcquisition.enable) {
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
}
fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {
@@ -5874,8 +5935,8 @@ var ts;
var filesToWatch = [];
var searchDirs = [];
var exclude = [];
- mergeTypings(typingOptions.include);
- exclude = typingOptions.exclude || [];
+ mergeTypings(typeAcquisition.include);
+ exclude = typeAcquisition.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
@@ -6058,6 +6119,7 @@ var ts;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
+ ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
@@ -6619,9 +6681,17 @@ var ts;
isEnabled: function () { return false; },
writeLine: ts.noop
};
- function typingToFileName(cachePath, packageName, installTypingHost) {
- var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
- return result.resolvedModule && result.resolvedModule.resolvedFileName;
+ function typingToFileName(cachePath, packageName, installTypingHost, log) {
+ try {
+ var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
+ return result.resolvedModule && result.resolvedModule.resolvedFileName;
+ }
+ catch (e) {
+ if (log.isEnabled()) {
+ log.writeLine("Failed to resolve " + packageName + " in folder '" + cachePath + "': " + e.message);
+ }
+ return undefined;
+ }
}
var PackageNameValidationResult;
(function (PackageNameValidationResult) {
@@ -6710,7 +6780,7 @@ var ts;
}
this.processCacheLocation(req.cachePath);
}
- var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typingOptions, req.unresolvedImports);
+ var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typeAcquisition, req.unresolvedImports);
if (this.log.isEnabled()) {
this.log.writeLine("Finished typings discovery: " + JSON.stringify(discoverTypingsResult));
}
@@ -6750,8 +6820,9 @@ var ts;
if (!packageName) {
continue;
}
- var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost);
+ var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost, this.log);
if (!typingFile) {
+ this.missingTypingsSet[packageName] = true;
continue;
}
var existingTypingFile = this.packageNameToTypingLocation[packageName];
@@ -6782,7 +6853,7 @@ var ts;
var result = [];
for (var _i = 0, typingsToInstall_1 = typingsToInstall; _i < typingsToInstall_1.length; _i++) {
var typing = typingsToInstall_1[_i];
- if (this.missingTypingsSet[typing]) {
+ if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) {
continue;
}
var validationResult = validatePackageName(typing);
@@ -6858,7 +6929,8 @@ var ts;
_this.sendResponse({
kind: server.EventInstall,
packagesToInstall: scopedTypings,
- installSuccess: ok
+ installSuccess: ok,
+ typingsInstallerVersion: ts.version
});
}
if (!ok) {
@@ -6872,17 +6944,14 @@ var ts;
return;
}
if (_this.log.isEnabled()) {
- _this.log.writeLine("Requested to install typings " + JSON.stringify(scopedTypings) + ", installed typings " + JSON.stringify(scopedTypings));
+ _this.log.writeLine("Installed typings " + JSON.stringify(scopedTypings));
}
var installedTypingFiles = [];
- for (var _a = 0, scopedTypings_1 = scopedTypings; _a < scopedTypings_1.length; _a++) {
- var t = scopedTypings_1[_a];
- var packageName = ts.getBaseFileName(t);
- if (!packageName) {
- continue;
- }
- var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost);
+ for (var _a = 0, filteredTypings_2 = filteredTypings; _a < filteredTypings_2.length; _a++) {
+ var packageName = filteredTypings_2[_a];
+ var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost, _this.log);
if (!typingFile) {
+ _this.missingTypingsSet[packageName] = true;
continue;
}
if (!_this.packageNameToTypingLocation[packageName]) {
@@ -6931,7 +7000,7 @@ var ts;
TypingsInstaller.prototype.createSetTypings = function (request, typings) {
return {
projectName: request.projectName,
- typingOptions: request.typingOptions,
+ typeAcquisition: request.typeAcquisition,
compilerOptions: request.compilerOptions,
typings: typings,
unresolvedImports: request.unresolvedImports,
@@ -7022,14 +7091,13 @@ var ts;
_this.log.writeLine("Process id: " + process.pid);
}
_this.npmPath = getNPMLocation(process.argv[0]);
- var execSync;
- (_a = require("child_process"), _this.exec = _a.exec, execSync = _a.execSync, _a);
+ (_this.execSync = require("child_process").execSync);
_this.ensurePackageDirectoryExists(globalTypingsCacheLocation);
try {
if (_this.log.isEnabled()) {
_this.log.writeLine("Updating " + TypesRegistryPackageName + " npm package...");
}
- execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" });
+ _this.execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" });
}
catch (e) {
if (_this.log.isEnabled()) {
@@ -7038,7 +7106,6 @@ var ts;
}
_this.typesRegistry = loadTypesRegistryFile(getTypesRegistryFileLocation(globalTypingsCacheLocation), _this.installTypingHost, _this.log);
return _this;
- var _a;
}
NodeTypingsInstaller.prototype.listen = function () {
var _this = this;
@@ -7062,18 +7129,26 @@ var ts;
}
};
NodeTypingsInstaller.prototype.installWorker = function (requestId, args, cwd, onRequestCompleted) {
- var _this = this;
if (this.log.isEnabled()) {
this.log.writeLine("#" + requestId + " with arguments'" + JSON.stringify(args) + "'.");
}
- var command = this.npmPath + " install " + args.join(" ") + " --save-dev";
+ var command = this.npmPath + " install " + args.join(" ") + " --save-dev --user-agent=\"typesInstaller/" + ts.version + "\"";
var start = Date.now();
- this.exec(command, { cwd: cwd }, function (err, stdout, stderr) {
- if (_this.log.isEnabled()) {
- _this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + stdout + ts.sys.newLine + "stderr: " + stderr);
- }
- onRequestCompleted(!err);
- });
+ var stdout;
+ var stderr;
+ var hasError = false;
+ try {
+ stdout = this.execSync(command, { cwd: cwd });
+ }
+ catch (e) {
+ stdout = e.stdout;
+ stderr = e.stderr;
+ hasError = true;
+ }
+ if (this.log.isEnabled()) {
+ this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + (stdout && stdout.toString()) + ts.sys.newLine + "stderr: " + (stderr && stderr.toString()));
+ }
+ onRequestCompleted(!hasError);
};
return NodeTypingsInstaller;
}(typingsInstaller.TypingsInstaller));