Update LKG

This commit is contained in:
Mohamed Hegazy
2016-10-05 21:30:00 -07:00
parent d48a3b19e5
commit c1a69f8ee6
7 changed files with 249 additions and 48 deletions
+29 -5
View File
@@ -7603,7 +7603,7 @@ var ts;
case 16:
return token() === 18 || token() === 20;
case 18:
return token() === 27 || token() === 17;
return token() !== 24;
case 20:
return token() === 15 || token() === 16;
case 13:
@@ -17976,7 +17976,24 @@ var ts;
}
return false;
}
function isSetOfLiteralsFromSameEnum(types) {
var first = types[0];
if (first.flags & 256) {
var firstEnum = getParentOfSymbol(first.symbol);
for (var i = 1; i < types.length; i++) {
var other = types[i];
if (!(other.flags & 256) || (firstEnum !== getParentOfSymbol(other.symbol))) {
return false;
}
}
return true;
}
return false;
}
function removeSubtypes(types) {
if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {
return;
}
var i = types.length;
while (i > 0) {
i--;
@@ -26959,9 +26976,11 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
if (node.parent.kind !== 256 && node.parent.kind !== 226 && node.parent.kind !== 225) {
return grammarErrorOnFirstToken(node, errorMessage);
var isInAppropriateContext = node.parent.kind === 256 || node.parent.kind === 226 || node.parent.kind === 225;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
return !isInAppropriateContext;
}
function checkExportSpecifier(node) {
checkAliasSymbol(node);
@@ -27533,6 +27552,9 @@ var ts;
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, false)) {
return resolveExternalModuleName(node, node);
}
case 8:
if (node.parent.kind === 173 && node.parent.argumentExpression === node) {
var objectType = checkExpression(node.parent.expression);
@@ -37108,7 +37130,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
ts.version = "2.0.5";
ts.version = "2.0.6";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -39264,7 +39286,9 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }
: {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
+36 -9
View File
@@ -4914,7 +4914,9 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }
: {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
@@ -9415,7 +9417,7 @@ var ts;
case 16:
return token() === 18 || token() === 20;
case 18:
return token() === 27 || token() === 17;
return token() !== 24;
case 20:
return token() === 15 || token() === 16;
case 13:
@@ -19360,7 +19362,24 @@ var ts;
}
return false;
}
function isSetOfLiteralsFromSameEnum(types) {
var first = types[0];
if (first.flags & 256) {
var firstEnum = getParentOfSymbol(first.symbol);
for (var i = 1; i < types.length; i++) {
var other = types[i];
if (!(other.flags & 256) || (firstEnum !== getParentOfSymbol(other.symbol))) {
return false;
}
}
return true;
}
return false;
}
function removeSubtypes(types) {
if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {
return;
}
var i = types.length;
while (i > 0) {
i--;
@@ -28343,9 +28362,11 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
if (node.parent.kind !== 256 && node.parent.kind !== 226 && node.parent.kind !== 225) {
return grammarErrorOnFirstToken(node, errorMessage);
var isInAppropriateContext = node.parent.kind === 256 || node.parent.kind === 226 || node.parent.kind === 225;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
return !isInAppropriateContext;
}
function checkExportSpecifier(node) {
checkAliasSymbol(node);
@@ -28917,6 +28938,9 @@ var ts;
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, false)) {
return resolveExternalModuleName(node, node);
}
case 8:
if (node.parent.kind === 173 && node.parent.argumentExpression === node) {
var objectType = checkExpression(node.parent.expression);
@@ -38492,7 +38516,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
ts.version = "2.0.5";
ts.version = "2.0.6";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -40896,7 +40920,7 @@ var ts;
return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
}
}
var collator = typeof Intl === "undefined" ? undefined : new Intl.Collator();
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
for (var i = 0; i < Math.min(a.length, b.length); i++) {
@@ -47677,7 +47701,7 @@ var ts;
}
var entries = [];
if (ts.isSourceFileJavaScript(sourceFile)) {
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, false);
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true);
ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
}
else {
@@ -47772,7 +47796,9 @@ var ts;
if (!node || node.kind !== 9) {
return undefined;
}
if (node.parent.kind === 253 && node.parent.parent.kind === 171) {
if (node.parent.kind === 253 &&
node.parent.parent.kind === 171 &&
node.parent.name === node) {
return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent);
}
else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) {
@@ -53521,7 +53547,7 @@ var ts;
}
}
if (info) {
if (fileContent) {
if (fileContent !== undefined) {
info.reload(fileContent);
}
if (openedByClient) {
@@ -56355,6 +56381,7 @@ var ts;
process.on("uncaughtException", function (err) {
ioSession.logError(err, "unknown");
});
process.noAsar = true;
ioSession.listen();
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
+1
View File
@@ -1,5 +1,6 @@
/// <reference path="../../src/server/types.d.ts" />
/// <reference path="../../src/server/protocol.d.ts" />
/// <reference types="node" />
declare namespace ts {
interface MapLike<T> {
[index: string]: T;
+35 -9
View File
@@ -4914,7 +4914,9 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }
: {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
@@ -9415,7 +9417,7 @@ var ts;
case 16:
return token() === 18 || token() === 20;
case 18:
return token() === 27 || token() === 17;
return token() !== 24;
case 20:
return token() === 15 || token() === 16;
case 13:
@@ -19360,7 +19362,24 @@ var ts;
}
return false;
}
function isSetOfLiteralsFromSameEnum(types) {
var first = types[0];
if (first.flags & 256) {
var firstEnum = getParentOfSymbol(first.symbol);
for (var i = 1; i < types.length; i++) {
var other = types[i];
if (!(other.flags & 256) || (firstEnum !== getParentOfSymbol(other.symbol))) {
return false;
}
}
return true;
}
return false;
}
function removeSubtypes(types) {
if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {
return;
}
var i = types.length;
while (i > 0) {
i--;
@@ -28343,9 +28362,11 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
if (node.parent.kind !== 256 && node.parent.kind !== 226 && node.parent.kind !== 225) {
return grammarErrorOnFirstToken(node, errorMessage);
var isInAppropriateContext = node.parent.kind === 256 || node.parent.kind === 226 || node.parent.kind === 225;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
return !isInAppropriateContext;
}
function checkExportSpecifier(node) {
checkAliasSymbol(node);
@@ -28917,6 +28938,9 @@ var ts;
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, false)) {
return resolveExternalModuleName(node, node);
}
case 8:
if (node.parent.kind === 173 && node.parent.argumentExpression === node) {
var objectType = checkExpression(node.parent.expression);
@@ -38492,7 +38516,7 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
ts.version = "2.0.5";
ts.version = "2.0.6";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -40896,7 +40920,7 @@ var ts;
return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
}
}
var collator = typeof Intl === "undefined" ? undefined : new Intl.Collator();
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
for (var i = 0; i < Math.min(a.length, b.length); i++) {
@@ -47677,7 +47701,7 @@ var ts;
}
var entries = [];
if (ts.isSourceFileJavaScript(sourceFile)) {
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, false);
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true);
ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
}
else {
@@ -47772,7 +47796,9 @@ var ts;
if (!node || node.kind !== 9) {
return undefined;
}
if (node.parent.kind === 253 && node.parent.parent.kind === 171) {
if (node.parent.kind === 253 &&
node.parent.parent.kind === 171 &&
node.parent.name === node) {
return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent);
}
else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) {
@@ -53521,7 +53547,7 @@ var ts;
}
}
if (info) {
if (fileContent) {
if (fileContent !== undefined) {
info.reload(fileContent);
}
if (openedByClient) {
+35 -9
View File
@@ -9537,8 +9537,8 @@ var ts;
// Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery
return token() === 18 /* CloseParenToken */ || token() === 20 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/;
case 18 /* TypeArguments */:
// Tokens other than '>' are here for better error recovery
return token() === 27 /* GreaterThanToken */ || token() === 17 /* OpenParenToken */;
// All other tokens should cause the type-argument to terminate except comma token
return token() !== 24 /* CommaToken */;
case 20 /* HeritageClauses */:
return token() === 15 /* OpenBraceToken */ || token() === 16 /* CloseBraceToken */;
case 13 /* JsxAttributes */:
@@ -22039,7 +22039,24 @@ var ts;
}
return false;
}
function isSetOfLiteralsFromSameEnum(types) {
var first = types[0];
if (first.flags & 256 /* EnumLiteral */) {
var firstEnum = getParentOfSymbol(first.symbol);
for (var i = 1; i < types.length; i++) {
var other = types[i];
if (!(other.flags & 256 /* EnumLiteral */) || (firstEnum !== getParentOfSymbol(other.symbol))) {
return false;
}
}
return true;
}
return false;
}
function removeSubtypes(types) {
if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {
return;
}
var i = types.length;
while (i > 0) {
i--;
@@ -32940,9 +32957,11 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
if (node.parent.kind !== 256 /* SourceFile */ && node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 225 /* ModuleDeclaration */) {
return grammarErrorOnFirstToken(node, errorMessage);
var isInAppropriateContext = node.parent.kind === 256 /* SourceFile */ || node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 225 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
return !isInAppropriateContext;
}
function checkExportSpecifier(node) {
checkAliasSymbol(node);
@@ -33574,6 +33593,9 @@ var ts;
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) {
return resolveExternalModuleName(node, node);
}
// Fall through
case 8 /* NumericLiteral */:
// index access
@@ -44638,7 +44660,7 @@ var ts;
var ts;
(function (ts) {
/** The version of the TypeScript compiler release */
ts.version = "2.0.5";
ts.version = "2.0.6";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -47015,7 +47037,9 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }
: {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
@@ -47995,7 +48019,7 @@ var ts;
}
}
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
var collator = typeof Intl === "undefined" ? undefined : new Intl.Collator();
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
// Intl is missing in Safari, and node 0.10 treats "a" as greater than "B".
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
@@ -56454,7 +56478,7 @@ var ts;
}
var entries = [];
if (ts.isSourceFileJavaScript(sourceFile)) {
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ false);
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true);
ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
}
else {
@@ -56565,7 +56589,9 @@ var ts;
if (!node || node.kind !== 9 /* StringLiteral */) {
return undefined;
}
if (node.parent.kind === 253 /* PropertyAssignment */ && node.parent.parent.kind === 171 /* ObjectLiteralExpression */) {
if (node.parent.kind === 253 /* PropertyAssignment */ &&
node.parent.parent.kind === 171 /* ObjectLiteralExpression */ &&
node.parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
// 'jspm:dev': string
+35 -9
View File
@@ -9537,8 +9537,8 @@ var ts;
// Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery
return token() === 18 /* CloseParenToken */ || token() === 20 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/;
case 18 /* TypeArguments */:
// Tokens other than '>' are here for better error recovery
return token() === 27 /* GreaterThanToken */ || token() === 17 /* OpenParenToken */;
// All other tokens should cause the type-argument to terminate except comma token
return token() !== 24 /* CommaToken */;
case 20 /* HeritageClauses */:
return token() === 15 /* OpenBraceToken */ || token() === 16 /* CloseBraceToken */;
case 13 /* JsxAttributes */:
@@ -22039,7 +22039,24 @@ var ts;
}
return false;
}
function isSetOfLiteralsFromSameEnum(types) {
var first = types[0];
if (first.flags & 256 /* EnumLiteral */) {
var firstEnum = getParentOfSymbol(first.symbol);
for (var i = 1; i < types.length; i++) {
var other = types[i];
if (!(other.flags & 256 /* EnumLiteral */) || (firstEnum !== getParentOfSymbol(other.symbol))) {
return false;
}
}
return true;
}
return false;
}
function removeSubtypes(types) {
if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {
return;
}
var i = types.length;
while (i > 0) {
i--;
@@ -32940,9 +32957,11 @@ var ts;
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
if (node.parent.kind !== 256 /* SourceFile */ && node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 225 /* ModuleDeclaration */) {
return grammarErrorOnFirstToken(node, errorMessage);
var isInAppropriateContext = node.parent.kind === 256 /* SourceFile */ || node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 225 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
return !isInAppropriateContext;
}
function checkExportSpecifier(node) {
checkAliasSymbol(node);
@@ -33574,6 +33593,9 @@ var ts;
node.parent.moduleSpecifier === node)) {
return resolveExternalModuleName(node, node);
}
if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) {
return resolveExternalModuleName(node, node);
}
// Fall through
case 8 /* NumericLiteral */:
// index access
@@ -44638,7 +44660,7 @@ var ts;
var ts;
(function (ts) {
/** The version of the TypeScript compiler release */
ts.version = "2.0.5";
ts.version = "2.0.6";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -47015,7 +47037,9 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }
: {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
@@ -47995,7 +48019,7 @@ var ts;
}
}
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
var collator = typeof Intl === "undefined" ? undefined : new Intl.Collator();
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
// Intl is missing in Safari, and node 0.10 treats "a" as greater than "B".
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
@@ -56454,7 +56478,7 @@ var ts;
}
var entries = [];
if (ts.isSourceFileJavaScript(sourceFile)) {
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ false);
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true);
ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
}
else {
@@ -56565,7 +56589,9 @@ var ts;
if (!node || node.kind !== 9 /* StringLiteral */) {
return undefined;
}
if (node.parent.kind === 253 /* PropertyAssignment */ && node.parent.parent.kind === 171 /* ObjectLiteralExpression */) {
if (node.parent.kind === 253 /* PropertyAssignment */ &&
node.parent.parent.kind === 171 /* ObjectLiteralExpression */ &&
node.parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
// 'jspm:dev': string
+78 -7
View File
@@ -4914,7 +4914,9 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }
: {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
@@ -5695,6 +5697,36 @@ var ts;
var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
return result.resolvedModule && result.resolvedModule.resolvedFileName;
}
(function (PackageNameValidationResult) {
PackageNameValidationResult[PackageNameValidationResult["Ok"] = 0] = "Ok";
PackageNameValidationResult[PackageNameValidationResult["ScopedPackagesNotSupported"] = 1] = "ScopedPackagesNotSupported";
PackageNameValidationResult[PackageNameValidationResult["NameTooLong"] = 2] = "NameTooLong";
PackageNameValidationResult[PackageNameValidationResult["NameStartsWithDot"] = 3] = "NameStartsWithDot";
PackageNameValidationResult[PackageNameValidationResult["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore";
PackageNameValidationResult[PackageNameValidationResult["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters";
})(typingsInstaller.PackageNameValidationResult || (typingsInstaller.PackageNameValidationResult = {}));
var PackageNameValidationResult = typingsInstaller.PackageNameValidationResult;
typingsInstaller.MaxPackageNameLength = 214;
function validatePackageName(packageName) {
ts.Debug.assert(!!packageName, "Package name is not specified");
if (packageName.length > typingsInstaller.MaxPackageNameLength) {
return PackageNameValidationResult.NameTooLong;
}
if (packageName.charCodeAt(0) === 46) {
return PackageNameValidationResult.NameStartsWithDot;
}
if (packageName.charCodeAt(0) === 95) {
return PackageNameValidationResult.NameStartsWithUnderscore;
}
if (/^@[^/]+\/[^/]+$/.test(packageName)) {
return PackageNameValidationResult.ScopedPackagesNotSupported;
}
if (encodeURIComponent(packageName) !== packageName) {
return PackageNameValidationResult.NameContainsNonURISafeCharacters;
}
return PackageNameValidationResult.Ok;
}
typingsInstaller.validatePackageName = validatePackageName;
typingsInstaller.NpmViewRequest = "npm view";
typingsInstaller.NpmInstallRequest = "npm install";
var TypingsInstaller = (function () {
@@ -5817,15 +5849,54 @@ var ts;
}
this.knownCachesSet[cacheLocation] = true;
};
TypingsInstaller.prototype.filterTypings = function (typingsToInstall) {
if (typingsToInstall.length === 0) {
return typingsToInstall;
}
var result = [];
for (var _i = 0, typingsToInstall_1 = typingsToInstall; _i < typingsToInstall_1.length; _i++) {
var typing = typingsToInstall_1[_i];
if (this.missingTypingsSet[typing]) {
continue;
}
var validationResult = validatePackageName(typing);
if (validationResult === PackageNameValidationResult.Ok) {
result.push(typing);
}
else {
this.missingTypingsSet[typing] = true;
if (this.log.isEnabled()) {
switch (validationResult) {
case PackageNameValidationResult.NameTooLong:
this.log.writeLine("Package name '" + typing + "' should be less than " + typingsInstaller.MaxPackageNameLength + " characters");
break;
case PackageNameValidationResult.NameStartsWithDot:
this.log.writeLine("Package name '" + typing + "' cannot start with '.'");
break;
case PackageNameValidationResult.NameStartsWithUnderscore:
this.log.writeLine("Package name '" + typing + "' cannot start with '_'");
break;
case PackageNameValidationResult.ScopedPackagesNotSupported:
this.log.writeLine("Package '" + typing + "' is scoped and currently is not supported");
break;
case PackageNameValidationResult.NameContainsNonURISafeCharacters:
this.log.writeLine("Package name '" + typing + "' contains non URI safe characters");
break;
}
}
}
}
return result;
};
TypingsInstaller.prototype.installTypings = function (req, cachePath, currentlyCachedTypings, typingsToInstall) {
var _this = this;
if (this.log.isEnabled()) {
this.log.writeLine("Installing typings " + JSON.stringify(typingsToInstall));
}
typingsToInstall = ts.filter(typingsToInstall, function (x) { return !_this.missingTypingsSet[x]; });
typingsToInstall = this.filterTypings(typingsToInstall);
if (typingsToInstall.length === 0) {
if (this.log.isEnabled()) {
this.log.writeLine("All typings are known to be missing - no need to go any further");
this.log.writeLine("All typings are known to be missing or invalid - no need to go any further");
}
return;
}
@@ -5865,8 +5936,8 @@ var ts;
if (_this.log.isEnabled()) {
_this.log.writeLine("Installed typing files " + JSON.stringify(installedTypingFiles));
}
for (var _a = 0, typingsToInstall_1 = typingsToInstall; _a < typingsToInstall_1.length; _a++) {
var toInstall = typingsToInstall_1[_a];
for (var _a = 0, typingsToInstall_2 = typingsToInstall; _a < typingsToInstall_2.length; _a++) {
var toInstall = typingsToInstall_2[_a];
if (!installedPackages[toInstall]) {
if (_this.log.isEnabled()) {
_this.log.writeLine("New missing typing package '" + toInstall + "'");
@@ -5882,8 +5953,8 @@ var ts;
this.installRunCount++;
var execInstallCmdCount = 0;
var filteredTypings = [];
for (var _i = 0, typingsToInstall_2 = typingsToInstall; _i < typingsToInstall_2.length; _i++) {
var typing = typingsToInstall_2[_i];
for (var _i = 0, typingsToInstall_3 = typingsToInstall; _i < typingsToInstall_3.length; _i++) {
var typing = typingsToInstall_3[_i];
execNpmViewTyping(this, typing);
}
function execNpmViewTyping(self, typing) {