mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Update LKG
This commit is contained in:
parent
59c4d3fc3b
commit
ac72affc6b
192
lib/tsc.js
192
lib/tsc.js
@ -825,10 +825,17 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@ -1093,6 +1100,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@ -1224,7 +1233,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@ -1243,7 +1252,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@ -1263,6 +1272,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@ -1435,7 +1445,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@ -1485,7 +1495,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@ -1533,6 +1543,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@ -2282,8 +2293,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
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." },
|
||||
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_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@ -4836,7 +4847,7 @@ var ts;
|
||||
}
|
||||
ts.isExpression = isExpression;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@ -6344,25 +6355,24 @@ var ts;
|
||||
return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@ -6785,6 +6795,8 @@ var ts;
|
||||
var scanner = ts.createScanner(2, true);
|
||||
var disallowInAndDecoratorContext = 4194304 | 16777216;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@ -6810,6 +6822,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@ -7116,7 +7130,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@ -10892,6 +10908,9 @@ var ts;
|
||||
case 55:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@ -15418,17 +15437,18 @@ var ts;
|
||||
if (declaration.kind === 235) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 && declaration.kind === 280 && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
if (!pushTypeResolution(symbol, 0)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
if (declaration.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172) {
|
||||
if (declaration.parent.kind === 187) {
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
if (declaration.kind === 187 ||
|
||||
declaration.kind === 172 && declaration.parent.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
@ -21935,7 +21955,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@ -23155,7 +23175,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@ -24098,9 +24118,14 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@ -25177,7 +25202,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@ -29900,7 +29925,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles);
|
||||
sourceMap.reset();
|
||||
@ -33550,13 +33575,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@ -35800,7 +35825,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@ -35880,12 +35905,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@ -36541,6 +36561,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@ -36616,7 +36652,7 @@ var ts;
|
||||
var resolvedTypeReferenceDirectives = {};
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
var modulesWithElidedImports = {};
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
@ -36840,8 +36876,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@ -37248,8 +37283,17 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@ -37266,6 +37310,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
var existingFile = filesByNameIgnoreCase.get(path);
|
||||
@ -37366,12 +37411,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@ -37379,8 +37421,8 @@ var ts;
|
||||
else if (shouldAddFile) {
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath, false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37699,12 +37741,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@ -38483,10 +38525,18 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var reportDiagnostic = reportDiagnosticSimply;
|
||||
var defaultFormatDiagnosticsHost = {
|
||||
getCurrentDirectory: function () { return ts.sys.getCurrentDirectory(); },
|
||||
getNewLine: function () { return ts.sys.newLine; },
|
||||
getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
|
||||
};
|
||||
var reportDiagnosticWorker = reportDiagnosticSimply;
|
||||
function reportDiagnostic(diagnostic, host) {
|
||||
reportDiagnosticWorker(diagnostic, host || defaultFormatDiagnosticsHost);
|
||||
}
|
||||
function reportDiagnostics(diagnostics, host) {
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {
|
||||
var diagnostic = diagnostics_2[_i];
|
||||
reportDiagnostic(diagnostic, host);
|
||||
}
|
||||
}
|
||||
@ -38557,19 +38607,8 @@ var ts;
|
||||
var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments);
|
||||
return diagnostic.messageText;
|
||||
}
|
||||
function getRelativeFileName(fileName, host) {
|
||||
return host ? ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : fileName;
|
||||
}
|
||||
function reportDiagnosticSimply(diagnostic, host) {
|
||||
var output = "";
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var relativeFileName = getRelativeFileName(diagnostic.file.fileName, host);
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine;
|
||||
ts.sys.write(output);
|
||||
ts.sys.write(ts.formatDiagnostics([diagnostic], host));
|
||||
}
|
||||
var redForegroundEscapeSequence = "\u001b[91m";
|
||||
var yellowForegroundEscapeSequence = "\u001b[93m";
|
||||
@ -38594,7 +38633,7 @@ var ts;
|
||||
var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
|
||||
var _b = ts.getLineAndCharacterOfPosition(file, start + length_3), lastLine = _b.line, lastLineChar = _b.character;
|
||||
var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
|
||||
var relativeFileName = getRelativeFileName(file.fileName, host);
|
||||
var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;
|
||||
var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
|
||||
var gutterWidth = (lastLine + 1 + "").length;
|
||||
if (hasMoreThanFiveLines) {
|
||||
@ -38783,7 +38822,8 @@ var ts;
|
||||
ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
return;
|
||||
}
|
||||
var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), ts.sys.getCurrentDirectory()), commandLine.options, configFileName);
|
||||
var cwd = ts.sys.getCurrentDirectory();
|
||||
var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), commandLine.options, ts.getNormalizedAbsolutePath(configFileName, cwd));
|
||||
if (configParseResult.errors.length > 0) {
|
||||
reportDiagnostics(configParseResult.errors, undefined);
|
||||
ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
@ -38820,7 +38860,7 @@ var ts;
|
||||
compilerHost.fileExists = cachedFileExists;
|
||||
}
|
||||
if (compilerOptions.pretty) {
|
||||
reportDiagnostic = reportDiagnosticWithColorAndContext;
|
||||
reportDiagnosticWorker = reportDiagnosticWithColorAndContext;
|
||||
}
|
||||
cachedExistingFiles = {};
|
||||
var compileResult = compile(rootFileNames, compilerOptions, compilerHost);
|
||||
@ -38983,7 +39023,7 @@ var ts;
|
||||
output += ts.sys.newLine + ts.sys.newLine;
|
||||
var padding = makePadding(marginLength);
|
||||
output += getDiagnosticText(ts.Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + ts.sys.newLine;
|
||||
output += padding + "tsc --out file.js file.ts" + ts.sys.newLine;
|
||||
output += padding + "tsc --outFile file.js file.ts" + ts.sys.newLine;
|
||||
output += padding + "tsc @args.txt" + ts.sys.newLine;
|
||||
output += ts.sys.newLine;
|
||||
output += getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine;
|
||||
|
||||
263
lib/tsserver.js
263
lib/tsserver.js
@ -830,10 +830,17 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@ -1098,6 +1105,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@ -1229,7 +1238,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@ -1248,7 +1257,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@ -1268,6 +1277,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@ -1440,7 +1450,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@ -1490,7 +1500,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@ -1538,6 +1548,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@ -2287,8 +2298,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
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." },
|
||||
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_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@ -3966,12 +3977,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@ -5754,7 +5765,7 @@ var ts;
|
||||
}
|
||||
ts.isExpression = isExpression;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@ -7262,25 +7273,24 @@ var ts;
|
||||
return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@ -7703,6 +7713,8 @@ var ts;
|
||||
var scanner = ts.createScanner(2, true);
|
||||
var disallowInAndDecoratorContext = 4194304 | 16777216;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@ -7728,6 +7740,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@ -8034,7 +8048,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@ -11810,6 +11826,9 @@ var ts;
|
||||
case 55:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@ -16336,17 +16355,18 @@ var ts;
|
||||
if (declaration.kind === 235) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 && declaration.kind === 280 && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
if (!pushTypeResolution(symbol, 0)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
if (declaration.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172) {
|
||||
if (declaration.parent.kind === 187) {
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
if (declaration.kind === 187 ||
|
||||
declaration.kind === 172 && declaration.parent.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
@ -22853,7 +22873,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@ -24073,7 +24093,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@ -25016,9 +25036,14 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@ -26095,7 +26120,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@ -30818,7 +30843,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles);
|
||||
sourceMap.reset();
|
||||
@ -34468,13 +34493,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@ -36718,7 +36743,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@ -36798,12 +36823,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@ -37459,6 +37479,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@ -37534,7 +37570,7 @@ var ts;
|
||||
var resolvedTypeReferenceDirectives = {};
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
var modulesWithElidedImports = {};
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
@ -37758,8 +37794,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@ -38166,8 +38201,17 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@ -38184,6 +38228,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
var existingFile = filesByNameIgnoreCase.get(path);
|
||||
@ -38284,12 +38329,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@ -38297,8 +38339,8 @@ var ts;
|
||||
else if (shouldAddFile) {
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath, false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39891,7 +39933,7 @@ var ts;
|
||||
return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text);
|
||||
}
|
||||
else {
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@ -40063,14 +40105,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
if (startsWithIgnoringCase(string, value, i)) {
|
||||
@ -41555,6 +41589,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10;
|
||||
}
|
||||
@ -41582,7 +41619,9 @@ var ts;
|
||||
? 3
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4
|
||||
: 0;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5
|
||||
: 0;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
}
|
||||
@ -41610,6 +41649,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4;
|
||||
}
|
||||
else if (expectedScanAction === 5) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0;
|
||||
}
|
||||
@ -43858,19 +43901,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@ -43905,14 +43949,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@ -43997,6 +44041,73 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@ -49677,6 +49788,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@ -52422,7 +52535,7 @@ var ts;
|
||||
done: false,
|
||||
leaf: function (relativeStart, relativeLength, ll) {
|
||||
if (!f(ll, relativeStart, relativeLength)) {
|
||||
this.done = true;
|
||||
walkFns.done = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -53072,7 +53185,7 @@ var ts;
|
||||
ioSession.listen();
|
||||
})(server = ts.server || (ts.server = {}));
|
||||
})(ts || (ts = {}));
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
var ts;
|
||||
(function (ts) {
|
||||
function logInternalError(logger, err) {
|
||||
|
||||
22
lib/tsserverlibrary.d.ts
vendored
22
lib/tsserverlibrary.d.ts
vendored
@ -405,7 +405,10 @@ declare namespace ts {
|
||||
interface ModifiersArray extends NodeArray<Modifier> {
|
||||
flags: NodeFlags;
|
||||
}
|
||||
interface Modifier extends Node {
|
||||
interface Token extends Node {
|
||||
__tokenTag: any;
|
||||
}
|
||||
interface Modifier extends Token {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
@ -2050,7 +2053,6 @@ declare namespace ts {
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
getDefaultTypeDirectiveNames?(rootPath: string): string[];
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
@ -2156,6 +2158,8 @@ declare namespace ts {
|
||||
function ensureTrailingDirectorySeparator(path: string): string;
|
||||
function comparePaths(a: string, b: string, currentDirectory: string, ignoreCase?: boolean): Comparison;
|
||||
function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
function fileExtensionIs(path: string, extension: string): boolean;
|
||||
function fileExtensionIsAny(path: string, extensions: string[]): boolean;
|
||||
function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude"): string;
|
||||
@ -2193,6 +2197,8 @@ declare namespace ts {
|
||||
function changeExtension<T extends string | Path>(path: T, newExtension: string): T;
|
||||
interface ObjectAllocator {
|
||||
getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node;
|
||||
getTokenConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token;
|
||||
getIdentifierConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Token;
|
||||
getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
|
||||
@ -6456,13 +6462,13 @@ declare namespace ts {
|
||||
key: string;
|
||||
message: string;
|
||||
};
|
||||
Report_Errors_on_Unused_Locals: {
|
||||
Report_errors_on_unused_locals: {
|
||||
code: number;
|
||||
category: DiagnosticCategory;
|
||||
key: string;
|
||||
message: string;
|
||||
};
|
||||
Report_Errors_on_Unused_Parameters: {
|
||||
Report_errors_on_unused_parameters: {
|
||||
code: number;
|
||||
category: DiagnosticCategory;
|
||||
key: string;
|
||||
@ -7143,8 +7149,6 @@ declare namespace ts {
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
let parseTime: number;
|
||||
@ -7225,6 +7229,12 @@ declare namespace ts {
|
||||
const defaultInitCompilerOptions: CompilerOptions;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
interface FormatDiagnosticsHost {
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
}
|
||||
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[];
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
|
||||
|
||||
@ -830,10 +830,17 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@ -1098,6 +1105,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@ -1229,7 +1238,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@ -1248,7 +1257,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@ -1268,6 +1277,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@ -1440,7 +1450,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@ -1490,7 +1500,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@ -1538,6 +1548,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@ -2287,8 +2298,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
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." },
|
||||
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_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@ -3966,12 +3977,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@ -5754,7 +5765,7 @@ var ts;
|
||||
}
|
||||
ts.isExpression = isExpression;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@ -7262,25 +7273,24 @@ var ts;
|
||||
return node.flags & 92 && node.parent.kind === 148 && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@ -7703,6 +7713,8 @@ var ts;
|
||||
var scanner = ts.createScanner(2, true);
|
||||
var disallowInAndDecoratorContext = 4194304 | 16777216;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@ -7728,6 +7740,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@ -8034,7 +8048,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@ -11810,6 +11826,9 @@ var ts;
|
||||
case 55:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@ -16336,17 +16355,18 @@ var ts;
|
||||
if (declaration.kind === 235) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 && declaration.kind === 280 && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
if (!pushTypeResolution(symbol, 0)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
if (declaration.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172) {
|
||||
if (declaration.parent.kind === 187) {
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
if (declaration.kind === 187 ||
|
||||
declaration.kind === 172 && declaration.parent.kind === 187) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
@ -22853,7 +22873,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@ -24073,7 +24093,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@ -25016,9 +25036,14 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@ -26095,7 +26120,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@ -30818,7 +30843,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles);
|
||||
sourceMap.reset();
|
||||
@ -34468,13 +34493,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@ -36718,7 +36743,7 @@ var ts;
|
||||
ts.emitTime = 0;
|
||||
ts.ioReadTime = 0;
|
||||
ts.ioWriteTime = 0;
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@ -36798,12 +36823,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@ -37459,6 +37479,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@ -37534,7 +37570,7 @@ var ts;
|
||||
var resolvedTypeReferenceDirectives = {};
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
var modulesWithElidedImports = {};
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
@ -37758,8 +37794,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@ -38166,8 +38201,17 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@ -38184,6 +38228,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
var existingFile = filesByNameIgnoreCase.get(path);
|
||||
@ -38284,12 +38329,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@ -38297,8 +38339,8 @@ var ts;
|
||||
else if (shouldAddFile) {
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath, false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39891,7 +39933,7 @@ var ts;
|
||||
return createPatternMatch(PatternMatchKind.exact, punctuationStripped, candidate === chunk.text);
|
||||
}
|
||||
else {
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@ -40063,14 +40105,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
if (startsWithIgnoringCase(string, value, i)) {
|
||||
@ -41555,6 +41589,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10;
|
||||
}
|
||||
@ -41582,7 +41619,9 @@ var ts;
|
||||
? 3
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4
|
||||
: 0;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5
|
||||
: 0;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
}
|
||||
@ -41610,6 +41649,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4;
|
||||
}
|
||||
else if (expectedScanAction === 5) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0;
|
||||
}
|
||||
@ -43858,19 +43901,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@ -43905,14 +43949,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@ -43997,6 +44041,73 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@ -49677,6 +49788,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@ -52422,7 +52535,7 @@ var ts;
|
||||
done: false,
|
||||
leaf: function (relativeStart, relativeLength, ll) {
|
||||
if (!f(ll, relativeStart, relativeLength)) {
|
||||
this.done = true;
|
||||
walkFns.done = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -52838,7 +52951,7 @@ var ts;
|
||||
server.LineLeaf = LineLeaf;
|
||||
})(server = ts.server || (ts.server = {}));
|
||||
})(ts || (ts = {}));
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
var ts;
|
||||
(function (ts) {
|
||||
function logInternalError(logger, err) {
|
||||
|
||||
14
lib/typescript.d.ts
vendored
14
lib/typescript.d.ts
vendored
@ -409,7 +409,10 @@ declare namespace ts {
|
||||
interface ModifiersArray extends NodeArray<Modifier> {
|
||||
flags: NodeFlags;
|
||||
}
|
||||
interface Modifier extends Node {
|
||||
interface Token extends Node {
|
||||
__tokenTag: any;
|
||||
}
|
||||
interface Modifier extends Token {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
@ -1696,7 +1699,6 @@ declare namespace ts {
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
getDefaultTypeDirectiveNames?(rootPath: string): string[];
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
@ -1842,8 +1844,6 @@ declare namespace ts {
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
@ -1868,6 +1868,12 @@ declare namespace ts {
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
interface FormatDiagnosticsHost {
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
}
|
||||
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
/**
|
||||
* Given a set of options and a set of root files, returns the set of type directive names
|
||||
|
||||
@ -1756,10 +1756,19 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
/* @internal */
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
/* @internal */
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@ -2070,6 +2079,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@ -2216,7 +2227,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@ -2235,7 +2246,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@ -2255,6 +2266,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@ -2444,7 +2456,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1 /* Directory */); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@ -2500,7 +2512,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@ -2548,6 +2560,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@ -3304,8 +3317,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
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." },
|
||||
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_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@ -6153,7 +6166,7 @@ var ts;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
// TypeScript 1.0 spec (April 2014): 11.2.1
|
||||
// An external module name is "relative" if the first term is "." or "..".
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@ -7916,15 +7929,6 @@ var ts;
|
||||
return node.flags & 92 /* ParameterPropertyModifier */ && node.parent.kind === 148 /* Constructor */ && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="utilities.ts"/>
|
||||
/// <reference path="scanner.ts"/>
|
||||
@ -7932,11 +7936,19 @@ var ts;
|
||||
(function (ts) {
|
||||
/* @internal */ ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256 /* SourceFile */) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69 /* Identifier */) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139 /* FirstNode */) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@ -8386,6 +8398,8 @@ var ts;
|
||||
var disallowInAndDecoratorContext = 4194304 /* DisallowInContext */ | 16777216 /* DecoratorContext */;
|
||||
// capture constructors in 'initializeState' to avoid null checks
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@ -8485,6 +8499,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@ -8855,7 +8871,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@ -13524,6 +13542,9 @@ var ts;
|
||||
case 55 /* AtToken */:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@ -18991,22 +19012,24 @@ var ts;
|
||||
if (declaration.kind === 235 /* ExportAssignment */) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 /* JavaScriptFile */ && declaration.kind === 280 /* JSDocPropertyTag */ && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
// Handle module.exports = expr or this.p = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172 /* PropertyAccessExpression */) {
|
||||
// Declarations only exist for property access expressions for certain
|
||||
// special assignment kinds
|
||||
if (declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
// Handle exports.p = expr or className.prototype.method = expr
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
// Handle certain special assignment kinds, which happen to union across multiple declarations:
|
||||
// * module.exports = expr
|
||||
// * exports.p = expr
|
||||
// * this.p = expr
|
||||
// * className.prototype.method = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */ ||
|
||||
declaration.kind === 172 /* PropertyAccessExpression */ && declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 /* BinaryExpression */ ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
||||
@ -26761,7 +26784,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@ -28202,7 +28225,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@ -29388,9 +29411,16 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
// Only report errors on the last declaration for the type parameter container;
|
||||
// this ensures that all uses have been accounted for.
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@ -30723,7 +30753,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@ -35987,7 +36017,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles);
|
||||
// reset the state
|
||||
@ -37884,7 +37914,7 @@ var ts;
|
||||
* if we should also export the value after its it changed
|
||||
* - check if node is a source level declaration to emit it differently,
|
||||
* i.e non-exported variable statement 'var x = 1' is hoisted so
|
||||
* we we emit variable statement 'var' should be dropped.
|
||||
* when we emit variable statement 'var' should be dropped.
|
||||
*/
|
||||
function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) {
|
||||
if (!node || !isCurrentFileSystemExternalModule()) {
|
||||
@ -40351,13 +40381,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@ -40376,7 +40406,9 @@ var ts;
|
||||
//
|
||||
// We'll emit:
|
||||
//
|
||||
// (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp)
|
||||
// let C_1 = class C{};
|
||||
// C_1.a = 1;
|
||||
// C_1.b = 2; // so forth and so on
|
||||
//
|
||||
// This keeps the expression as an expression, while ensuring that the static parts
|
||||
// of it have been initialized by the time it is used.
|
||||
@ -42940,7 +42972,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@ -43029,12 +43061,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@ -43801,6 +43828,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@ -43893,11 +43936,11 @@ var ts;
|
||||
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
|
||||
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
|
||||
// this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.
|
||||
var modulesWithElidedImports = {};
|
||||
// Track source files that are JavaScript files found by searching under node_modules, as these shouldn't be compiled.
|
||||
// Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
@ -44154,8 +44197,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@ -44607,9 +44649,19 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
// See if we need to reprocess the imports due to prior skipped imports
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
// If the file was previously found via a node_modules search, but is now being processed as a root file,
|
||||
// then everything it sucks in may also be marked incorrectly, and needs to be checked again.
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@ -44627,6 +44679,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
// for case-sensitive file systems check if we've already seen some file with similar filename ignoring case
|
||||
@ -44741,12 +44794,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@ -44755,8 +44805,8 @@ var ts;
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath,
|
||||
/*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -45094,12 +45144,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@ -47091,7 +47141,7 @@ var ts;
|
||||
else {
|
||||
// b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive
|
||||
// manner. If it does, return that there was a prefix match.
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@ -47357,14 +47407,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Assumes 'value' is already lowercase.
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
@ -49209,6 +49251,7 @@ var ts;
|
||||
ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken";
|
||||
ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken";
|
||||
ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier";
|
||||
ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText";
|
||||
})(ScanAction || (ScanAction = {}));
|
||||
function getFormattingScanner(sourceFile, startPos, endPos) {
|
||||
ts.Debug.assert(scanner === undefined);
|
||||
@ -49300,6 +49343,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244 /* JsxText */;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10 /* RegularExpressionLiteral */;
|
||||
}
|
||||
@ -49330,7 +49376,9 @@ var ts;
|
||||
? 3 /* RescanTemplateToken */
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4 /* RescanJsxIdentifier */
|
||||
: 0 /* Scan */;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5 /* RescanJsxText */
|
||||
: 0 /* Scan */;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
// readTokenInfo was called before with the same expected scan action.
|
||||
// No need to re-scan text, return existing 'lastTokenInfo'
|
||||
@ -49365,6 +49413,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4 /* RescanJsxIdentifier */;
|
||||
}
|
||||
else if (expectedScanAction === 5 /* RescanJsxText */) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5 /* RescanJsxText */;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0 /* Scan */;
|
||||
}
|
||||
@ -52037,19 +52089,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 /* FirstNode */ ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@ -52084,14 +52137,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@ -52177,6 +52230,74 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
// Set properties in same order as NodeObject
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69 /* Identifier */;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@ -58941,6 +59062,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@ -59566,7 +59689,7 @@ var ts;
|
||||
//
|
||||
/// <reference path='services.ts' />
|
||||
/* @internal */
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
// We need to use 'null' to interface with the managed side.
|
||||
/* tslint:disable:no-null-keyword */
|
||||
/* tslint:disable:no-in-operator */
|
||||
|
||||
14
lib/typescriptServices.d.ts
vendored
14
lib/typescriptServices.d.ts
vendored
@ -409,7 +409,10 @@ declare namespace ts {
|
||||
interface ModifiersArray extends NodeArray<Modifier> {
|
||||
flags: NodeFlags;
|
||||
}
|
||||
interface Modifier extends Node {
|
||||
interface Token extends Node {
|
||||
__tokenTag: any;
|
||||
}
|
||||
interface Modifier extends Token {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
@ -1696,7 +1699,6 @@ declare namespace ts {
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
getDefaultTypeDirectiveNames?(rootPath: string): string[];
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
@ -1842,8 +1844,6 @@ declare namespace ts {
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
|
||||
function startsWith(str: string, prefix: string): boolean;
|
||||
function endsWith(str: string, suffix: string): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
@ -1868,6 +1868,12 @@ declare namespace ts {
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
||||
interface FormatDiagnosticsHost {
|
||||
getCurrentDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
}
|
||||
function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string;
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
/**
|
||||
* Given a set of options and a set of root files, returns the set of type directive names
|
||||
|
||||
@ -1756,10 +1756,19 @@ var ts;
|
||||
return true;
|
||||
}
|
||||
ts.containsPath = containsPath;
|
||||
/* @internal */
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
/* @internal */
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
function fileExtensionIs(path, extension) {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
return path.length > extension.length && endsWith(path, extension);
|
||||
}
|
||||
ts.fileExtensionIs = fileExtensionIs;
|
||||
function fileExtensionIsAny(path, extensions) {
|
||||
@ -2070,6 +2079,8 @@ var ts;
|
||||
}
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return Node; },
|
||||
getTokenConstructor: function () { return Node; },
|
||||
getIdentifierConstructor: function () { return Node; },
|
||||
getSourceFileConstructor: function () { return Node; },
|
||||
getSymbolConstructor: function () { return Symbol; },
|
||||
getTypeConstructor: function () { return Type; },
|
||||
@ -2216,7 +2227,7 @@ var ts;
|
||||
function readDirectory(path, extensions, excludes, includes) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries);
|
||||
}
|
||||
return {
|
||||
var wscriptSystem = {
|
||||
args: args,
|
||||
newLine: "\r\n",
|
||||
useCaseSensitiveFileNames: false,
|
||||
@ -2235,7 +2246,7 @@ var ts;
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!wscriptSystem.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
},
|
||||
@ -2255,6 +2266,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
};
|
||||
return wscriptSystem;
|
||||
}
|
||||
function getNodeSystem() {
|
||||
var _fs = require("fs");
|
||||
@ -2444,7 +2456,7 @@ var ts;
|
||||
function getDirectories(path) {
|
||||
return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1 /* Directory */); });
|
||||
}
|
||||
return {
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
@ -2500,7 +2512,7 @@ var ts;
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
},
|
||||
@ -2548,6 +2560,7 @@ var ts;
|
||||
return _fs.realpathSync(path);
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
}
|
||||
function getChakraSystem() {
|
||||
var realpath = ChakraHost.realpath && (function (path) { return ChakraHost.realpath(path); });
|
||||
@ -3304,8 +3317,8 @@ var ts;
|
||||
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." },
|
||||
File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" },
|
||||
_0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." },
|
||||
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." },
|
||||
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_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
@ -6153,7 +6166,7 @@ var ts;
|
||||
function isExternalModuleNameRelative(moduleName) {
|
||||
// TypeScript 1.0 spec (April 2014): 11.2.1
|
||||
// An external module name is "relative" if the first term is "." or "..".
|
||||
return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\";
|
||||
return /^\.\.?($|[\\/])/.test(moduleName);
|
||||
}
|
||||
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
|
||||
function isInstantiatedModule(node, preserveConstEnums) {
|
||||
@ -7916,15 +7929,6 @@ var ts;
|
||||
return node.flags & 92 /* ParameterPropertyModifier */ && node.parent.kind === 148 /* Constructor */ && ts.isClassLike(node.parent.parent);
|
||||
}
|
||||
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
|
||||
function startsWith(str, prefix) {
|
||||
return str.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
ts.startsWith = startsWith;
|
||||
function endsWith(str, suffix) {
|
||||
var expectedPos = str.length - suffix.length;
|
||||
return str.indexOf(suffix, expectedPos) === expectedPos;
|
||||
}
|
||||
ts.endsWith = endsWith;
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="utilities.ts"/>
|
||||
/// <reference path="scanner.ts"/>
|
||||
@ -7932,11 +7936,19 @@ var ts;
|
||||
(function (ts) {
|
||||
/* @internal */ ts.parseTime = 0;
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
function createNode(kind, pos, end) {
|
||||
if (kind === 256 /* SourceFile */) {
|
||||
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind === 69 /* Identifier */) {
|
||||
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
|
||||
}
|
||||
else if (kind < 139 /* FirstNode */) {
|
||||
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end);
|
||||
}
|
||||
else {
|
||||
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end);
|
||||
}
|
||||
@ -8386,6 +8398,8 @@ var ts;
|
||||
var disallowInAndDecoratorContext = 4194304 /* DisallowInContext */ | 16777216 /* DecoratorContext */;
|
||||
// capture constructors in 'initializeState' to avoid null checks
|
||||
var NodeConstructor;
|
||||
var TokenConstructor;
|
||||
var IdentifierConstructor;
|
||||
var SourceFileConstructor;
|
||||
var sourceFile;
|
||||
var parseDiagnostics;
|
||||
@ -8485,6 +8499,8 @@ var ts;
|
||||
}
|
||||
function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) {
|
||||
NodeConstructor = ts.objectAllocator.getNodeConstructor();
|
||||
TokenConstructor = ts.objectAllocator.getTokenConstructor();
|
||||
IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
|
||||
SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
|
||||
sourceText = _sourceText;
|
||||
syntaxCursor = _syntaxCursor;
|
||||
@ -8855,7 +8871,9 @@ var ts;
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
return new NodeConstructor(kind, pos, pos);
|
||||
return kind >= 139 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) :
|
||||
new TokenConstructor(kind, pos, pos);
|
||||
}
|
||||
function finishNode(node, end) {
|
||||
node.end = end === undefined ? scanner.getStartPos() : end;
|
||||
@ -13524,6 +13542,9 @@ var ts;
|
||||
case 55 /* AtToken */:
|
||||
if (canParseTag) {
|
||||
parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral);
|
||||
if (!parentTagTerminated) {
|
||||
resumePos = scanner.getStartPos();
|
||||
}
|
||||
}
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
@ -18991,22 +19012,24 @@ var ts;
|
||||
if (declaration.kind === 235 /* ExportAssignment */) {
|
||||
return links.type = checkExpression(declaration.expression);
|
||||
}
|
||||
if (declaration.flags & 134217728 /* JavaScriptFile */ && declaration.kind === 280 /* JSDocPropertyTag */ && declaration.typeExpression) {
|
||||
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = undefined;
|
||||
// Handle module.exports = expr or this.p = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); }));
|
||||
}
|
||||
else if (declaration.kind === 172 /* PropertyAccessExpression */) {
|
||||
// Declarations only exist for property access expressions for certain
|
||||
// special assignment kinds
|
||||
if (declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
// Handle exports.p = expr or className.prototype.method = expr
|
||||
type = checkExpressionCached(declaration.parent.right);
|
||||
}
|
||||
// Handle certain special assignment kinds, which happen to union across multiple declarations:
|
||||
// * module.exports = expr
|
||||
// * exports.p = expr
|
||||
// * this.p = expr
|
||||
// * className.prototype.method = expr
|
||||
if (declaration.kind === 187 /* BinaryExpression */ ||
|
||||
declaration.kind === 172 /* PropertyAccessExpression */ && declaration.parent.kind === 187 /* BinaryExpression */) {
|
||||
type = getUnionType(ts.map(symbol.declarations, function (decl) { return decl.kind === 187 /* BinaryExpression */ ?
|
||||
checkExpressionCached(decl.right) :
|
||||
checkExpressionCached(decl.parent.right); }));
|
||||
}
|
||||
if (type === undefined) {
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
||||
@ -26761,7 +26784,7 @@ var ts;
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.inferredClassType) {
|
||||
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
|
||||
}
|
||||
return links.inferredClassType;
|
||||
}
|
||||
@ -28202,7 +28225,7 @@ var ts;
|
||||
checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
}
|
||||
if (!node.body) {
|
||||
if (noUnusedIdentifiers && !node.body) {
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
@ -29388,9 +29411,16 @@ var ts;
|
||||
function checkUnusedTypeParameters(node) {
|
||||
if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) {
|
||||
if (node.typeParameters) {
|
||||
// Only report errors on the last declaration for the type parameter container;
|
||||
// this ensures that all uses have been accounted for.
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var lastDeclaration = symbol && symbol.declarations && ts.lastOrUndefined(symbol.declarations);
|
||||
if (lastDeclaration !== node) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
|
||||
var typeParameter = _a[_i];
|
||||
if (!typeParameter.symbol.isReferenced) {
|
||||
if (!getMergedSymbol(typeParameter.symbol).isReferenced) {
|
||||
error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name);
|
||||
}
|
||||
}
|
||||
@ -30723,7 +30753,7 @@ var ts;
|
||||
ts.forEach(node.members, checkSourceElement);
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
}
|
||||
}
|
||||
function checkTypeAliasDeclaration(node) {
|
||||
@ -35987,7 +36017,7 @@ var ts;
|
||||
writeLine();
|
||||
var sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write("//# sourceMappingURL=" + sourceMappingURL);
|
||||
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment
|
||||
}
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles);
|
||||
// reset the state
|
||||
@ -37884,7 +37914,7 @@ var ts;
|
||||
* if we should also export the value after its it changed
|
||||
* - check if node is a source level declaration to emit it differently,
|
||||
* i.e non-exported variable statement 'var x = 1' is hoisted so
|
||||
* we we emit variable statement 'var' should be dropped.
|
||||
* when we emit variable statement 'var' should be dropped.
|
||||
*/
|
||||
function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) {
|
||||
if (!node || !isCurrentFileSystemExternalModule()) {
|
||||
@ -40351,13 +40381,13 @@ var ts;
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write("" + decoratedClassAlias);
|
||||
write("let " + decoratedClassAlias);
|
||||
}
|
||||
else {
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
write(" = ");
|
||||
@ -40376,7 +40406,9 @@ var ts;
|
||||
//
|
||||
// We'll emit:
|
||||
//
|
||||
// (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp)
|
||||
// let C_1 = class C{};
|
||||
// C_1.a = 1;
|
||||
// C_1.b = 2; // so forth and so on
|
||||
//
|
||||
// This keeps the expression as an expression, while ensuring that the static parts
|
||||
// of it have been initialized by the time it is used.
|
||||
@ -42940,7 +42972,7 @@ var ts;
|
||||
/* @internal */ ts.ioReadTime = 0;
|
||||
/* @internal */ ts.ioWriteTime = 0;
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "2.0.0";
|
||||
ts.version = "2.1.0";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
@ -43029,12 +43061,7 @@ var ts;
|
||||
return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function moduleHasNonRelativeName(moduleName) {
|
||||
if (ts.isRootedDiskPath(moduleName)) {
|
||||
return false;
|
||||
}
|
||||
var i = moduleName.lastIndexOf("./", 1);
|
||||
var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */);
|
||||
return !startsWithDotSlashOrDotDotSlash;
|
||||
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
|
||||
}
|
||||
function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
|
||||
var jsonContent;
|
||||
@ -43801,6 +43828,22 @@ var ts;
|
||||
return ts.sortAndDeduplicateDiagnostics(diagnostics);
|
||||
}
|
||||
ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
|
||||
function formatDiagnostics(diagnostics, host) {
|
||||
var output = "";
|
||||
for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
|
||||
var diagnostic = diagnostics_1[_i];
|
||||
if (diagnostic.file) {
|
||||
var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
|
||||
var fileName = diagnostic.file.fileName;
|
||||
var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): ";
|
||||
}
|
||||
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
|
||||
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.formatDiagnostics = formatDiagnostics;
|
||||
function flattenDiagnosticMessageText(messageText, newLine) {
|
||||
if (typeof messageText === "string") {
|
||||
return messageText;
|
||||
@ -43893,11 +43936,11 @@ var ts;
|
||||
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
|
||||
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
|
||||
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
|
||||
var currentNodeModulesJsDepth = 0;
|
||||
var currentNodeModulesDepth = 0;
|
||||
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
|
||||
// this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.
|
||||
var modulesWithElidedImports = {};
|
||||
// Track source files that are JavaScript files found by searching under node_modules, as these shouldn't be compiled.
|
||||
// Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
|
||||
var sourceFilesFoundSearchingNodeModules = {};
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
@ -44154,8 +44197,7 @@ var ts;
|
||||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false));
|
||||
}
|
||||
function emit(sourceFile, writeFileCallback, cancellationToken) {
|
||||
var _this = this;
|
||||
return runWithCancellationToken(function () { return emitWorker(_this, sourceFile, writeFileCallback, cancellationToken); });
|
||||
return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); });
|
||||
}
|
||||
function isEmitBlocked(emitFileName) {
|
||||
return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName));
|
||||
@ -44607,9 +44649,19 @@ var ts;
|
||||
if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
|
||||
}
|
||||
// See if we need to reprocess the imports due to prior skipped imports
|
||||
if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
|
||||
// If the file was previously found via a node_modules search, but is now being processed as a root file,
|
||||
// then everything it sucks in may also be marked incorrectly, and needs to be checked again.
|
||||
if (file_1 && ts.lookUp(sourceFilesFoundSearchingNodeModules, file_1.path) && currentNodeModulesDepth == 0) {
|
||||
sourceFilesFoundSearchingNodeModules[file_1.path] = false;
|
||||
if (!options.noResolve) {
|
||||
processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
|
||||
processTypeReferenceDirectives(file_1);
|
||||
}
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
else if (file_1 && ts.lookUp(modulesWithElidedImports, file_1.path)) {
|
||||
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
|
||||
modulesWithElidedImports[file_1.path] = false;
|
||||
processImportedModules(file_1, ts.getDirectoryPath(fileName));
|
||||
}
|
||||
@ -44627,6 +44679,7 @@ var ts;
|
||||
});
|
||||
filesByName.set(path, file);
|
||||
if (file) {
|
||||
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
|
||||
file.path = path;
|
||||
if (host.useCaseSensitiveFileNames()) {
|
||||
// for case-sensitive file systems check if we've already seen some file with similar filename ignoring case
|
||||
@ -44741,12 +44794,9 @@ var ts;
|
||||
var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport;
|
||||
var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName);
|
||||
if (isFromNodeModulesSearch) {
|
||||
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
|
||||
currentNodeModulesDepth++;
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth++;
|
||||
}
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
|
||||
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
|
||||
var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
|
||||
if (elideImport) {
|
||||
modulesWithElidedImports[file.path] = true;
|
||||
@ -44755,8 +44805,8 @@ var ts;
|
||||
findSourceFile(resolution.resolvedFileName, resolvedPath,
|
||||
/*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
}
|
||||
if (isJsFileFromNodeModules) {
|
||||
currentNodeModulesJsDepth--;
|
||||
if (isFromNodeModulesSearch) {
|
||||
currentNodeModulesDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -45094,12 +45144,12 @@ var ts;
|
||||
{
|
||||
name: "noUnusedLocals",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Locals
|
||||
description: ts.Diagnostics.Report_errors_on_unused_locals
|
||||
},
|
||||
{
|
||||
name: "noUnusedParameters",
|
||||
type: "boolean",
|
||||
description: ts.Diagnostics.Report_Errors_on_Unused_Parameters
|
||||
description: ts.Diagnostics.Report_errors_on_unused_parameters
|
||||
},
|
||||
{
|
||||
name: "noLib",
|
||||
@ -47091,7 +47141,7 @@ var ts;
|
||||
else {
|
||||
// b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive
|
||||
// manner. If it does, return that there was a prefix match.
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text));
|
||||
return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ ts.startsWith(candidate, chunk.text));
|
||||
}
|
||||
}
|
||||
var isLowercase = chunk.isLowerCase;
|
||||
@ -47357,14 +47407,6 @@ var ts;
|
||||
var str = String.fromCharCode(ch);
|
||||
return str === str.toLowerCase();
|
||||
}
|
||||
function startsWith(string, search) {
|
||||
for (var i = 0, n = search.length; i < n; i++) {
|
||||
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Assumes 'value' is already lowercase.
|
||||
function indexOfIgnoringCase(string, value) {
|
||||
for (var i = 0, n = string.length - value.length; i <= n; i++) {
|
||||
@ -49209,6 +49251,7 @@ var ts;
|
||||
ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken";
|
||||
ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken";
|
||||
ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier";
|
||||
ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText";
|
||||
})(ScanAction || (ScanAction = {}));
|
||||
function getFormattingScanner(sourceFile, startPos, endPos) {
|
||||
ts.Debug.assert(scanner === undefined);
|
||||
@ -49300,6 +49343,9 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function shouldRescanJsxText(node) {
|
||||
return node && node.kind === 244 /* JsxText */;
|
||||
}
|
||||
function shouldRescanSlashToken(container) {
|
||||
return container.kind === 10 /* RegularExpressionLiteral */;
|
||||
}
|
||||
@ -49330,7 +49376,9 @@ var ts;
|
||||
? 3 /* RescanTemplateToken */
|
||||
: shouldRescanJsxIdentifier(n)
|
||||
? 4 /* RescanJsxIdentifier */
|
||||
: 0 /* Scan */;
|
||||
: shouldRescanJsxText(n)
|
||||
? 5 /* RescanJsxText */
|
||||
: 0 /* Scan */;
|
||||
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
||||
// readTokenInfo was called before with the same expected scan action.
|
||||
// No need to re-scan text, return existing 'lastTokenInfo'
|
||||
@ -49365,6 +49413,10 @@ var ts;
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = 4 /* RescanJsxIdentifier */;
|
||||
}
|
||||
else if (expectedScanAction === 5 /* RescanJsxText */) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = 5 /* RescanJsxText */;
|
||||
}
|
||||
else {
|
||||
lastScanAction = 0 /* Scan */;
|
||||
}
|
||||
@ -52037,19 +52089,20 @@ var ts;
|
||||
"version"
|
||||
];
|
||||
var jsDocCompletionEntries;
|
||||
function createNode(kind, pos, end, flags, parent) {
|
||||
var node = new NodeObject(kind, pos, end);
|
||||
node.flags = flags;
|
||||
function createNode(kind, pos, end, parent) {
|
||||
var node = kind >= 139 /* FirstNode */ ? new NodeObject(kind, pos, end) :
|
||||
kind === 69 /* Identifier */ ? new IdentifierObject(kind, pos, end) :
|
||||
new TokenObject(kind, pos, end);
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
var NodeObject = (function () {
|
||||
function NodeObject(kind, pos, end) {
|
||||
this.kind = kind;
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
this.kind = kind;
|
||||
}
|
||||
NodeObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
@ -52084,14 +52137,14 @@ var ts;
|
||||
var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan();
|
||||
var textPos = scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, 0, this));
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
}
|
||||
pos = textPos;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
NodeObject.prototype.createSyntaxList = function (nodes) {
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, 0, this);
|
||||
var list = createNode(282 /* SyntaxList */, nodes.pos, nodes.end, this);
|
||||
list._children = [];
|
||||
var pos = nodes.pos;
|
||||
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
||||
@ -52177,6 +52230,74 @@ var ts;
|
||||
};
|
||||
return NodeObject;
|
||||
}());
|
||||
var TokenOrIdentifierObject = (function () {
|
||||
function TokenOrIdentifierObject(pos, end) {
|
||||
// Set properties in same order as NodeObject
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = 0 /* None */;
|
||||
this.parent = undefined;
|
||||
}
|
||||
TokenOrIdentifierObject.prototype.getSourceFile = function () {
|
||||
return ts.getSourceFileOfNode(this);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) {
|
||||
return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullStart = function () {
|
||||
return this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getEnd = function () {
|
||||
return this.end;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) {
|
||||
return this.getEnd() - this.getStart(sourceFile);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullWidth = function () {
|
||||
return this.end - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) {
|
||||
return this.getStart(sourceFile) - this.pos;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end);
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getText = function (sourceFile) {
|
||||
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) {
|
||||
return 0;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) {
|
||||
return emptyArray;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) {
|
||||
return undefined;
|
||||
};
|
||||
return TokenOrIdentifierObject;
|
||||
}());
|
||||
var TokenObject = (function (_super) {
|
||||
__extends(TokenObject, _super);
|
||||
function TokenObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
this.kind = kind;
|
||||
}
|
||||
return TokenObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
var IdentifierObject = (function (_super) {
|
||||
__extends(IdentifierObject, _super);
|
||||
function IdentifierObject(kind, pos, end) {
|
||||
_super.call(this, pos, end);
|
||||
}
|
||||
return IdentifierObject;
|
||||
}(TokenOrIdentifierObject));
|
||||
IdentifierObject.prototype.kind = 69 /* Identifier */;
|
||||
var SymbolObject = (function () {
|
||||
function SymbolObject(flags, name) {
|
||||
this.flags = flags;
|
||||
@ -58941,6 +59062,8 @@ var ts;
|
||||
function initializeServices() {
|
||||
ts.objectAllocator = {
|
||||
getNodeConstructor: function () { return NodeObject; },
|
||||
getTokenConstructor: function () { return TokenObject; },
|
||||
getIdentifierConstructor: function () { return IdentifierObject; },
|
||||
getSourceFileConstructor: function () { return SourceFileObject; },
|
||||
getSymbolConstructor: function () { return SymbolObject; },
|
||||
getTypeConstructor: function () { return TypeObject; },
|
||||
@ -59566,7 +59689,7 @@ var ts;
|
||||
//
|
||||
/// <reference path='services.ts' />
|
||||
/* @internal */
|
||||
var debugObjectHost = this;
|
||||
var debugObjectHost = new Function("return this")();
|
||||
// We need to use 'null' to interface with the managed side.
|
||||
/* tslint:disable:no-null-keyword */
|
||||
/* tslint:disable:no-in-operator */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user