Update LKG
This commit is contained in:
Родитель
5b764205fe
Коммит
a44d8e76c6
192
lib/tsc.js
192
lib/tsc.js
|
@ -1431,6 +1431,8 @@ var ts;
|
|||
Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" },
|
||||
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." },
|
||||
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
|
||||
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
|
||||
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
@ -3760,21 +3762,21 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
ts.arrayIsEqualTo = arrayIsEqualTo;
|
||||
function hasResolvedModuleName(sourceFile, moduleNameText) {
|
||||
function hasResolvedModule(sourceFile, moduleNameText) {
|
||||
return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
ts.hasResolvedModuleName = hasResolvedModuleName;
|
||||
function getResolvedModuleFileName(sourceFile, moduleNameText) {
|
||||
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
ts.hasResolvedModule = hasResolvedModule;
|
||||
function getResolvedModule(sourceFile, moduleNameText) {
|
||||
return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
}
|
||||
ts.getResolvedModuleFileName = getResolvedModuleFileName;
|
||||
function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) {
|
||||
ts.getResolvedModule = getResolvedModule;
|
||||
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
||||
if (!sourceFile.resolvedModules) {
|
||||
sourceFile.resolvedModules = {};
|
||||
}
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedModule;
|
||||
}
|
||||
ts.setResolvedModuleName = setResolvedModuleName;
|
||||
ts.setResolvedModule = setResolvedModule;
|
||||
function containsParseError(node) {
|
||||
aggregateChildData(node);
|
||||
return (node.parserContextFlags & 64) !== 0;
|
||||
|
@ -4976,11 +4978,21 @@ var ts;
|
|||
add: add,
|
||||
getGlobalDiagnostics: getGlobalDiagnostics,
|
||||
getDiagnostics: getDiagnostics,
|
||||
getModificationCount: getModificationCount
|
||||
getModificationCount: getModificationCount,
|
||||
reattachFileDiagnostics: reattachFileDiagnostics
|
||||
};
|
||||
function getModificationCount() {
|
||||
return modificationCount;
|
||||
}
|
||||
function reattachFileDiagnostics(newFile) {
|
||||
if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {
|
||||
var diagnostic = _a[_i];
|
||||
diagnostic.file = newFile;
|
||||
}
|
||||
}
|
||||
function add(diagnostic) {
|
||||
var diagnostics;
|
||||
if (diagnostic.file) {
|
||||
|
@ -10966,8 +10978,8 @@ var ts;
|
|||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = fileName && host.getSourceFile(fileName);
|
||||
var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
|
@ -25985,6 +25997,9 @@ var ts;
|
|||
}
|
||||
function emitExportSpecifierInSystemModule(specifier) {
|
||||
ts.Debug.assert(compilerOptions.module === 4);
|
||||
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) {
|
||||
return;
|
||||
}
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
write(exportFunctionForFile + "(\"");
|
||||
|
@ -28253,7 +28268,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node)) {
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
|
@ -29379,10 +29394,12 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
|
||||
var resolvedFileName = loadNodeModuleFromFile(candidate, false, failedLookupLocations, host);
|
||||
if (resolvedFileName) {
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, false, failedLookupLocations, host);
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return resolvedFileName
|
||||
? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
|
||||
|
@ -29440,11 +29457,11 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
|
||||
var result = loadNodeModuleFromFile(candidate, true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
result = loadNodeModuleFromDirectory(candidate, true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(directory);
|
||||
|
@ -29453,36 +29470,15 @@ var ts;
|
|||
}
|
||||
directory = parentPath;
|
||||
}
|
||||
return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) {
|
||||
ts.Debug.assert(baseUrl !== undefined);
|
||||
var normalizedModuleName = ts.normalizeSlashes(moduleName);
|
||||
var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile);
|
||||
var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName));
|
||||
var failedLookupLocations = [];
|
||||
return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
function tryLoadFile(location) {
|
||||
if (host.fileExists(location)) {
|
||||
return { resolvedFileName: location, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(location);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver;
|
||||
function nameStartsWithDotSlashOrDotDotSlash(name) {
|
||||
var i = name.lastIndexOf("./", 1);
|
||||
return i === 0 || (i === 1 && name.charCodeAt(0) === 46);
|
||||
}
|
||||
function useBaseUrl(moduleName) {
|
||||
return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName);
|
||||
}
|
||||
function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
|
||||
if (moduleName.indexOf('!') != -1) {
|
||||
return { resolvedFileName: undefined, failedLookupLocations: [] };
|
||||
return { resolvedModule: undefined, failedLookupLocations: [] };
|
||||
}
|
||||
var searchPath = ts.getDirectoryPath(containingFile);
|
||||
var searchName;
|
||||
|
@ -29511,7 +29507,9 @@ var ts;
|
|||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations };
|
||||
return referencedSourceFile
|
||||
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
ts.classicNameResolver = classicNameResolver;
|
||||
ts.defaultInitCompilerOptions = {
|
||||
|
@ -29624,7 +29622,8 @@ var ts;
|
|||
function createProgram(rootNames, options, host, oldProgram) {
|
||||
var program;
|
||||
var files = [];
|
||||
var diagnostics = ts.createDiagnosticCollection();
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var programDiagnostics = ts.createDiagnosticCollection();
|
||||
var commonSourceDirectory;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
|
@ -29632,8 +29631,9 @@ var ts;
|
|||
var skipDefaultLib = options.noLib;
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames ||
|
||||
(function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); });
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames
|
||||
? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); })
|
||||
: (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); });
|
||||
var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
if (oldProgram) {
|
||||
var oldOptions = oldProgram.getCompilerOptions();
|
||||
|
@ -29673,7 +29673,8 @@ var ts;
|
|||
getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },
|
||||
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
|
||||
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
|
||||
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }
|
||||
};
|
||||
return program;
|
||||
function getClassifiableNames() {
|
||||
|
@ -29697,6 +29698,7 @@ var ts;
|
|||
return false;
|
||||
}
|
||||
var newSourceFiles = [];
|
||||
var modifiedSourceFiles = [];
|
||||
for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {
|
||||
var oldSourceFile = _a[_i];
|
||||
var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target);
|
||||
|
@ -29718,13 +29720,20 @@ var ts;
|
|||
var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; });
|
||||
var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
|
||||
for (var i = 0; i < moduleNames.length; ++i) {
|
||||
var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
|
||||
if (oldResolution !== resolutions[i]) {
|
||||
var newResolution = resolutions[i];
|
||||
var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]);
|
||||
var resolutionChanged = oldResolution
|
||||
? !newResolution ||
|
||||
oldResolution.resolvedFileName !== newResolution.resolvedFileName ||
|
||||
!!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport
|
||||
: newResolution;
|
||||
if (resolutionChanged) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
||||
modifiedSourceFiles.push(newSourceFile);
|
||||
}
|
||||
else {
|
||||
newSourceFile = oldSourceFile;
|
||||
|
@ -29736,6 +29745,11 @@ var ts;
|
|||
filesByName.set(file.fileName, file);
|
||||
}
|
||||
files = newSourceFiles;
|
||||
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
||||
for (var _c = 0; _c < modifiedSourceFiles.length; _c++) {
|
||||
var modifiedFile = modifiedSourceFiles[_c];
|
||||
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile);
|
||||
}
|
||||
oldProgram.structureIsReused = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -29817,8 +29831,9 @@ var ts;
|
|||
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
var bindDiagnostics = sourceFile.bindDiagnostics;
|
||||
var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken);
|
||||
var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics);
|
||||
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile);
|
||||
});
|
||||
}
|
||||
function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
|
||||
|
@ -29832,7 +29847,8 @@ var ts;
|
|||
}
|
||||
function getOptionsDiagnostics() {
|
||||
var allDiagnostics = [];
|
||||
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
|
||||
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
function getGlobalDiagnostics() {
|
||||
|
@ -29922,10 +29938,10 @@ var ts;
|
|||
}
|
||||
if (diagnostic) {
|
||||
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29942,10 +29958,10 @@ var ts;
|
|||
}
|
||||
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
filesByName.set(canonicalName, file);
|
||||
|
@ -29973,10 +29989,10 @@ var ts;
|
|||
var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29997,9 +30013,23 @@ var ts;
|
|||
var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
|
||||
for (var i = 0; i < file.imports.length; ++i) {
|
||||
var resolution = resolutions[i];
|
||||
ts.setResolvedModuleName(file, moduleNames[i], resolution);
|
||||
ts.setResolvedModule(file, moduleNames[i], resolution);
|
||||
if (resolution && !options.noResolve) {
|
||||
findModuleSourceFile(resolution, file.imports[i]);
|
||||
var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
if (!ts.isExternalModule(importedFile)) {
|
||||
var start_2 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName));
|
||||
}
|
||||
else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) {
|
||||
var start_3 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
else if (importedFile.referencedFiles.length) {
|
||||
var firstRef = importedFile.referencedFiles[0];
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30008,7 +30038,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
function findModuleSourceFile(fileName, nameLiteral) {
|
||||
return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end);
|
||||
return findSourceFile(fileName, false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end);
|
||||
}
|
||||
}
|
||||
function computeCommonSourceDirectory(sourceFiles) {
|
||||
|
@ -30027,7 +30057,7 @@ var ts;
|
|||
for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {
|
||||
if (commonPathComponents[i] !== sourcePathComponents[i]) {
|
||||
if (i === 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
return;
|
||||
}
|
||||
commonPathComponents.length = i;
|
||||
|
@ -30050,7 +30080,7 @@ var ts;
|
|||
if (!ts.isDeclarationFile(sourceFile)) {
|
||||
var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
||||
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
allFilesBelongToPath = false;
|
||||
}
|
||||
}
|
||||
|
@ -30061,43 +30091,43 @@ var ts;
|
|||
function verifyCompilerOptions() {
|
||||
if (options.isolatedModules) {
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
}
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
}
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSources) {
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
}
|
||||
}
|
||||
if (options.out && options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
}
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -30106,20 +30136,20 @@ var ts;
|
|||
var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; });
|
||||
if (options.isolatedModules) {
|
||||
if (!options.module && languageVersion < 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
}
|
||||
var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) {
|
||||
var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
if (options.module && languageVersion >= 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
if (options.outDir ||
|
||||
options.sourceRoot ||
|
||||
|
@ -30137,25 +30167,25 @@ var ts;
|
|||
}
|
||||
if (options.noEmit) {
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
}
|
||||
if (options.outDir) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
}
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
}
|
||||
}
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
219
lib/tsserver.js
219
lib/tsserver.js
|
@ -1431,6 +1431,8 @@ var ts;
|
|||
Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" },
|
||||
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." },
|
||||
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
|
||||
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
|
||||
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
@ -3508,21 +3510,21 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
ts.arrayIsEqualTo = arrayIsEqualTo;
|
||||
function hasResolvedModuleName(sourceFile, moduleNameText) {
|
||||
function hasResolvedModule(sourceFile, moduleNameText) {
|
||||
return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
ts.hasResolvedModuleName = hasResolvedModuleName;
|
||||
function getResolvedModuleFileName(sourceFile, moduleNameText) {
|
||||
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
ts.hasResolvedModule = hasResolvedModule;
|
||||
function getResolvedModule(sourceFile, moduleNameText) {
|
||||
return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
}
|
||||
ts.getResolvedModuleFileName = getResolvedModuleFileName;
|
||||
function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) {
|
||||
ts.getResolvedModule = getResolvedModule;
|
||||
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
||||
if (!sourceFile.resolvedModules) {
|
||||
sourceFile.resolvedModules = {};
|
||||
}
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedModule;
|
||||
}
|
||||
ts.setResolvedModuleName = setResolvedModuleName;
|
||||
ts.setResolvedModule = setResolvedModule;
|
||||
function containsParseError(node) {
|
||||
aggregateChildData(node);
|
||||
return (node.parserContextFlags & 64) !== 0;
|
||||
|
@ -4724,11 +4726,21 @@ var ts;
|
|||
add: add,
|
||||
getGlobalDiagnostics: getGlobalDiagnostics,
|
||||
getDiagnostics: getDiagnostics,
|
||||
getModificationCount: getModificationCount
|
||||
getModificationCount: getModificationCount,
|
||||
reattachFileDiagnostics: reattachFileDiagnostics
|
||||
};
|
||||
function getModificationCount() {
|
||||
return modificationCount;
|
||||
}
|
||||
function reattachFileDiagnostics(newFile) {
|
||||
if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {
|
||||
var diagnostic = _a[_i];
|
||||
diagnostic.file = newFile;
|
||||
}
|
||||
}
|
||||
function add(diagnostic) {
|
||||
var diagnostics;
|
||||
if (diagnostic.file) {
|
||||
|
@ -11428,8 +11440,8 @@ var ts;
|
|||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = fileName && host.getSourceFile(fileName);
|
||||
var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
|
@ -26447,6 +26459,9 @@ var ts;
|
|||
}
|
||||
function emitExportSpecifierInSystemModule(specifier) {
|
||||
ts.Debug.assert(compilerOptions.module === 4);
|
||||
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) {
|
||||
return;
|
||||
}
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
write(exportFunctionForFile + "(\"");
|
||||
|
@ -28715,7 +28730,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node)) {
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
|
@ -29841,10 +29856,12 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
|
||||
var resolvedFileName = loadNodeModuleFromFile(candidate, false, failedLookupLocations, host);
|
||||
if (resolvedFileName) {
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, false, failedLookupLocations, host);
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return resolvedFileName
|
||||
? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
|
||||
|
@ -29902,11 +29919,11 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
|
||||
var result = loadNodeModuleFromFile(candidate, true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
result = loadNodeModuleFromDirectory(candidate, true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(directory);
|
||||
|
@ -29915,36 +29932,15 @@ var ts;
|
|||
}
|
||||
directory = parentPath;
|
||||
}
|
||||
return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) {
|
||||
ts.Debug.assert(baseUrl !== undefined);
|
||||
var normalizedModuleName = ts.normalizeSlashes(moduleName);
|
||||
var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile);
|
||||
var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName));
|
||||
var failedLookupLocations = [];
|
||||
return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
function tryLoadFile(location) {
|
||||
if (host.fileExists(location)) {
|
||||
return { resolvedFileName: location, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(location);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver;
|
||||
function nameStartsWithDotSlashOrDotDotSlash(name) {
|
||||
var i = name.lastIndexOf("./", 1);
|
||||
return i === 0 || (i === 1 && name.charCodeAt(0) === 46);
|
||||
}
|
||||
function useBaseUrl(moduleName) {
|
||||
return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName);
|
||||
}
|
||||
function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
|
||||
if (moduleName.indexOf('!') != -1) {
|
||||
return { resolvedFileName: undefined, failedLookupLocations: [] };
|
||||
return { resolvedModule: undefined, failedLookupLocations: [] };
|
||||
}
|
||||
var searchPath = ts.getDirectoryPath(containingFile);
|
||||
var searchName;
|
||||
|
@ -29973,7 +29969,9 @@ var ts;
|
|||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations };
|
||||
return referencedSourceFile
|
||||
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
ts.classicNameResolver = classicNameResolver;
|
||||
ts.defaultInitCompilerOptions = {
|
||||
|
@ -30086,7 +30084,8 @@ var ts;
|
|||
function createProgram(rootNames, options, host, oldProgram) {
|
||||
var program;
|
||||
var files = [];
|
||||
var diagnostics = ts.createDiagnosticCollection();
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var programDiagnostics = ts.createDiagnosticCollection();
|
||||
var commonSourceDirectory;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
|
@ -30094,8 +30093,9 @@ var ts;
|
|||
var skipDefaultLib = options.noLib;
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames ||
|
||||
(function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); });
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames
|
||||
? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); })
|
||||
: (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); });
|
||||
var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
if (oldProgram) {
|
||||
var oldOptions = oldProgram.getCompilerOptions();
|
||||
|
@ -30135,7 +30135,8 @@ var ts;
|
|||
getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },
|
||||
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
|
||||
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
|
||||
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }
|
||||
};
|
||||
return program;
|
||||
function getClassifiableNames() {
|
||||
|
@ -30159,6 +30160,7 @@ var ts;
|
|||
return false;
|
||||
}
|
||||
var newSourceFiles = [];
|
||||
var modifiedSourceFiles = [];
|
||||
for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {
|
||||
var oldSourceFile = _a[_i];
|
||||
var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target);
|
||||
|
@ -30180,13 +30182,20 @@ var ts;
|
|||
var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; });
|
||||
var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
|
||||
for (var i = 0; i < moduleNames.length; ++i) {
|
||||
var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
|
||||
if (oldResolution !== resolutions[i]) {
|
||||
var newResolution = resolutions[i];
|
||||
var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]);
|
||||
var resolutionChanged = oldResolution
|
||||
? !newResolution ||
|
||||
oldResolution.resolvedFileName !== newResolution.resolvedFileName ||
|
||||
!!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport
|
||||
: newResolution;
|
||||
if (resolutionChanged) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
||||
modifiedSourceFiles.push(newSourceFile);
|
||||
}
|
||||
else {
|
||||
newSourceFile = oldSourceFile;
|
||||
|
@ -30198,6 +30207,11 @@ var ts;
|
|||
filesByName.set(file.fileName, file);
|
||||
}
|
||||
files = newSourceFiles;
|
||||
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
||||
for (var _c = 0; _c < modifiedSourceFiles.length; _c++) {
|
||||
var modifiedFile = modifiedSourceFiles[_c];
|
||||
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile);
|
||||
}
|
||||
oldProgram.structureIsReused = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -30279,8 +30293,9 @@ var ts;
|
|||
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
var bindDiagnostics = sourceFile.bindDiagnostics;
|
||||
var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken);
|
||||
var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics);
|
||||
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile);
|
||||
});
|
||||
}
|
||||
function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
|
||||
|
@ -30294,7 +30309,8 @@ var ts;
|
|||
}
|
||||
function getOptionsDiagnostics() {
|
||||
var allDiagnostics = [];
|
||||
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
|
||||
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
function getGlobalDiagnostics() {
|
||||
|
@ -30384,10 +30400,10 @@ var ts;
|
|||
}
|
||||
if (diagnostic) {
|
||||
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30404,10 +30420,10 @@ var ts;
|
|||
}
|
||||
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
filesByName.set(canonicalName, file);
|
||||
|
@ -30435,10 +30451,10 @@ var ts;
|
|||
var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30459,9 +30475,23 @@ var ts;
|
|||
var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
|
||||
for (var i = 0; i < file.imports.length; ++i) {
|
||||
var resolution = resolutions[i];
|
||||
ts.setResolvedModuleName(file, moduleNames[i], resolution);
|
||||
ts.setResolvedModule(file, moduleNames[i], resolution);
|
||||
if (resolution && !options.noResolve) {
|
||||
findModuleSourceFile(resolution, file.imports[i]);
|
||||
var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
if (!ts.isExternalModule(importedFile)) {
|
||||
var start_2 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName));
|
||||
}
|
||||
else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) {
|
||||
var start_3 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
else if (importedFile.referencedFiles.length) {
|
||||
var firstRef = importedFile.referencedFiles[0];
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30470,7 +30500,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
function findModuleSourceFile(fileName, nameLiteral) {
|
||||
return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end);
|
||||
return findSourceFile(fileName, false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end);
|
||||
}
|
||||
}
|
||||
function computeCommonSourceDirectory(sourceFiles) {
|
||||
|
@ -30489,7 +30519,7 @@ var ts;
|
|||
for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {
|
||||
if (commonPathComponents[i] !== sourcePathComponents[i]) {
|
||||
if (i === 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
return;
|
||||
}
|
||||
commonPathComponents.length = i;
|
||||
|
@ -30512,7 +30542,7 @@ var ts;
|
|||
if (!ts.isDeclarationFile(sourceFile)) {
|
||||
var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
||||
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
allFilesBelongToPath = false;
|
||||
}
|
||||
}
|
||||
|
@ -30523,43 +30553,43 @@ var ts;
|
|||
function verifyCompilerOptions() {
|
||||
if (options.isolatedModules) {
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
}
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
}
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSources) {
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
}
|
||||
}
|
||||
if (options.out && options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
}
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -30568,20 +30598,20 @@ var ts;
|
|||
var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; });
|
||||
if (options.isolatedModules) {
|
||||
if (!options.module && languageVersion < 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
}
|
||||
var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) {
|
||||
var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
if (options.module && languageVersion >= 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
if (options.outDir ||
|
||||
options.sourceRoot ||
|
||||
|
@ -30599,25 +30629,25 @@ var ts;
|
|||
}
|
||||
if (options.noEmit) {
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
}
|
||||
if (options.outDir) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
}
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
}
|
||||
}
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37213,9 +37243,9 @@ var ts;
|
|||
log("getCompletionData: Get previous token 1: " + (new Date().getTime() - start));
|
||||
var contextToken = previousToken;
|
||||
if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) {
|
||||
var start_2 = new Date().getTime();
|
||||
var start_4 = new Date().getTime();
|
||||
contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile);
|
||||
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_2));
|
||||
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_4));
|
||||
}
|
||||
var node = currentToken;
|
||||
var isRightOfDot = false;
|
||||
|
@ -37410,9 +37440,9 @@ var ts;
|
|||
if (contextToken.kind === 9
|
||||
|| contextToken.kind === 10
|
||||
|| ts.isTemplateLiteralKind(contextToken.kind)) {
|
||||
var start_3 = contextToken.getStart();
|
||||
var start_5 = contextToken.getStart();
|
||||
var end = contextToken.getEnd();
|
||||
if (start_3 < position && position < end) {
|
||||
if (start_5 < position && position < end) {
|
||||
return true;
|
||||
}
|
||||
if (position === end) {
|
||||
|
@ -41760,7 +41790,7 @@ var ts;
|
|||
LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) {
|
||||
var currentResolutionsInFile = this.resolvedModuleNames.get(containingFile);
|
||||
var newResolutions = {};
|
||||
var resolvedFileNames = [];
|
||||
var resolvedModules = [];
|
||||
var compilerOptions = this.getCompilationSettings();
|
||||
for (var _i = 0; _i < moduleNames.length; _i++) {
|
||||
var moduleName = moduleNames[_i];
|
||||
|
@ -41777,15 +41807,15 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.Debug.assert(resolution !== undefined);
|
||||
resolvedFileNames.push(resolution.resolvedFileName);
|
||||
resolvedModules.push(resolution.resolvedModule);
|
||||
}
|
||||
this.resolvedModuleNames.set(containingFile, newResolutions);
|
||||
return resolvedFileNames;
|
||||
return resolvedModules;
|
||||
function moduleResolutionIsValid(resolution) {
|
||||
if (!resolution) {
|
||||
return false;
|
||||
}
|
||||
if (resolution.resolvedFileName) {
|
||||
if (resolution.resolvedModule) {
|
||||
return true;
|
||||
}
|
||||
return resolution.failedLookupLocations.length === 0;
|
||||
|
@ -43749,7 +43779,10 @@ var ts;
|
|||
if ("getModuleResolutionsForFile" in this.shimHost) {
|
||||
this.resolveModuleNames = function (moduleNames, containingFile) {
|
||||
var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));
|
||||
return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); });
|
||||
return ts.map(moduleNames, function (name) {
|
||||
var result = ts.lookUp(resolutionsInFile, name);
|
||||
return result ? { resolvedFileName: result } : undefined;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -44224,7 +44257,11 @@ var ts;
|
|||
var _this = this;
|
||||
return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () {
|
||||
var compilerOptions = JSON.parse(compilerOptionsJson);
|
||||
return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
|
||||
var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
|
||||
return {
|
||||
resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined,
|
||||
failedLookupLocations: result.failedLookupLocations
|
||||
};
|
||||
});
|
||||
};
|
||||
CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) {
|
||||
|
|
|
@ -1382,9 +1382,12 @@ declare namespace ts {
|
|||
}
|
||||
interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
isExternalLibraryImport?: boolean;
|
||||
}
|
||||
interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModule;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
|
@ -1394,7 +1397,7 @@ declare namespace ts {
|
|||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface TextSpan {
|
||||
start: number;
|
||||
|
@ -1515,10 +1518,9 @@ declare namespace ts {
|
|||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
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[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
|
@ -1649,7 +1651,7 @@ declare namespace ts {
|
|||
trace?(s: string): void;
|
||||
error?(s: string): void;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface LanguageService {
|
||||
cleanupSemanticCache(): void;
|
||||
|
|
|
@ -2300,6 +2300,8 @@ var ts;
|
|||
Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" },
|
||||
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." },
|
||||
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
|
||||
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
|
||||
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
@ -5012,21 +5014,21 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
ts.arrayIsEqualTo = arrayIsEqualTo;
|
||||
function hasResolvedModuleName(sourceFile, moduleNameText) {
|
||||
function hasResolvedModule(sourceFile, moduleNameText) {
|
||||
return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
ts.hasResolvedModuleName = hasResolvedModuleName;
|
||||
function getResolvedModuleFileName(sourceFile, moduleNameText) {
|
||||
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
ts.hasResolvedModule = hasResolvedModule;
|
||||
function getResolvedModule(sourceFile, moduleNameText) {
|
||||
return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
}
|
||||
ts.getResolvedModuleFileName = getResolvedModuleFileName;
|
||||
function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) {
|
||||
ts.getResolvedModule = getResolvedModule;
|
||||
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
||||
if (!sourceFile.resolvedModules) {
|
||||
sourceFile.resolvedModules = {};
|
||||
}
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedModule;
|
||||
}
|
||||
ts.setResolvedModuleName = setResolvedModuleName;
|
||||
ts.setResolvedModule = setResolvedModule;
|
||||
// Returns true if this node contains a parse error anywhere underneath it.
|
||||
function containsParseError(node) {
|
||||
aggregateChildData(node);
|
||||
|
@ -6363,11 +6365,21 @@ var ts;
|
|||
add: add,
|
||||
getGlobalDiagnostics: getGlobalDiagnostics,
|
||||
getDiagnostics: getDiagnostics,
|
||||
getModificationCount: getModificationCount
|
||||
getModificationCount: getModificationCount,
|
||||
reattachFileDiagnostics: reattachFileDiagnostics
|
||||
};
|
||||
function getModificationCount() {
|
||||
return modificationCount;
|
||||
}
|
||||
function reattachFileDiagnostics(newFile) {
|
||||
if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {
|
||||
var diagnostic = _a[_i];
|
||||
diagnostic.file = newFile;
|
||||
}
|
||||
}
|
||||
function add(diagnostic) {
|
||||
var diagnostics;
|
||||
if (diagnostic.file) {
|
||||
|
@ -13745,8 +13757,8 @@ var ts;
|
|||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = fileName && host.getSourceFile(fileName);
|
||||
var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
|
@ -31225,6 +31237,9 @@ var ts;
|
|||
}
|
||||
function emitExportSpecifierInSystemModule(specifier) {
|
||||
ts.Debug.assert(compilerOptions.module === 4 /* System */);
|
||||
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) {
|
||||
return;
|
||||
}
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
write(exportFunctionForFile + "(\"");
|
||||
|
@ -33896,7 +33911,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node)) {
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
|
@ -35164,10 +35179,12 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
|
||||
var resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
if (resolvedFileName) {
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return resolvedFileName
|
||||
? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
|
||||
|
@ -35227,11 +35244,11 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
|
||||
var result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(directory);
|
||||
|
@ -35240,39 +35257,16 @@ var ts;
|
|||
}
|
||||
directory = parentPath;
|
||||
}
|
||||
return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) {
|
||||
ts.Debug.assert(baseUrl !== undefined);
|
||||
var normalizedModuleName = ts.normalizeSlashes(moduleName);
|
||||
var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile);
|
||||
var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName));
|
||||
var failedLookupLocations = [];
|
||||
return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
function tryLoadFile(location) {
|
||||
if (host.fileExists(location)) {
|
||||
return { resolvedFileName: location, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(location);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver;
|
||||
function nameStartsWithDotSlashOrDotDotSlash(name) {
|
||||
var i = name.lastIndexOf("./", 1);
|
||||
return i === 0 || (i === 1 && name.charCodeAt(0) === 46 /* dot */);
|
||||
}
|
||||
function useBaseUrl(moduleName) {
|
||||
// path is not rooted
|
||||
// module name does not start with './' or '../'
|
||||
return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName);
|
||||
}
|
||||
function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
|
||||
// module names that contain '!' are used to reference resources and are not resolved to actual files on disk
|
||||
if (moduleName.indexOf('!') != -1) {
|
||||
return { resolvedFileName: undefined, failedLookupLocations: [] };
|
||||
return { resolvedModule: undefined, failedLookupLocations: [] };
|
||||
}
|
||||
var searchPath = ts.getDirectoryPath(containingFile);
|
||||
var searchName;
|
||||
|
@ -35303,7 +35297,9 @@ var ts;
|
|||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations };
|
||||
return referencedSourceFile
|
||||
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
ts.classicNameResolver = classicNameResolver;
|
||||
/* @internal */
|
||||
|
@ -35420,7 +35416,8 @@ var ts;
|
|||
function createProgram(rootNames, options, host, oldProgram) {
|
||||
var program;
|
||||
var files = [];
|
||||
var diagnostics = ts.createDiagnosticCollection();
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var programDiagnostics = ts.createDiagnosticCollection();
|
||||
var commonSourceDirectory;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
|
@ -35428,8 +35425,9 @@ var ts;
|
|||
var skipDefaultLib = options.noLib;
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames ||
|
||||
(function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); });
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames
|
||||
? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); })
|
||||
: (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); });
|
||||
var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
if (oldProgram) {
|
||||
// check properties that can affect structure of the program or module resolution strategy
|
||||
|
@ -35476,7 +35474,8 @@ var ts;
|
|||
getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },
|
||||
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
|
||||
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
|
||||
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }
|
||||
};
|
||||
return program;
|
||||
function getClassifiableNames() {
|
||||
|
@ -35503,6 +35502,7 @@ var ts;
|
|||
}
|
||||
// check if program source files has changed in the way that can affect structure of the program
|
||||
var newSourceFiles = [];
|
||||
var modifiedSourceFiles = [];
|
||||
for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {
|
||||
var oldSourceFile = _a[_i];
|
||||
var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target);
|
||||
|
@ -35531,14 +35531,21 @@ var ts;
|
|||
var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
|
||||
// ensure that module resolution results are still correct
|
||||
for (var i = 0; i < moduleNames.length; ++i) {
|
||||
var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
|
||||
if (oldResolution !== resolutions[i]) {
|
||||
var newResolution = resolutions[i];
|
||||
var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]);
|
||||
var resolutionChanged = oldResolution
|
||||
? !newResolution ||
|
||||
oldResolution.resolvedFileName !== newResolution.resolvedFileName ||
|
||||
!!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport
|
||||
: newResolution;
|
||||
if (resolutionChanged) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// pass the cache of module resolutions from the old source file
|
||||
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
||||
modifiedSourceFiles.push(newSourceFile);
|
||||
}
|
||||
else {
|
||||
// file has no changes - use it as is
|
||||
|
@ -35553,6 +35560,11 @@ var ts;
|
|||
filesByName.set(file.fileName, file);
|
||||
}
|
||||
files = newSourceFiles;
|
||||
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
||||
for (var _c = 0; _c < modifiedSourceFiles.length; _c++) {
|
||||
var modifiedFile = modifiedSourceFiles[_c];
|
||||
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile);
|
||||
}
|
||||
oldProgram.structureIsReused = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -35654,8 +35666,9 @@ var ts;
|
|||
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
var bindDiagnostics = sourceFile.bindDiagnostics;
|
||||
var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken);
|
||||
var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics);
|
||||
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile);
|
||||
});
|
||||
}
|
||||
function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
|
||||
|
@ -35670,7 +35683,8 @@ var ts;
|
|||
}
|
||||
function getOptionsDiagnostics() {
|
||||
var allDiagnostics = [];
|
||||
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
|
||||
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
function getGlobalDiagnostics() {
|
||||
|
@ -35768,10 +35782,10 @@ var ts;
|
|||
}
|
||||
if (diagnostic) {
|
||||
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35791,10 +35805,10 @@ var ts;
|
|||
// We haven't looked for this file, do so now and cache result
|
||||
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
filesByName.set(canonicalName, file);
|
||||
|
@ -35824,10 +35838,10 @@ var ts;
|
|||
var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35848,9 +35862,23 @@ var ts;
|
|||
var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
|
||||
for (var i = 0; i < file.imports.length; ++i) {
|
||||
var resolution = resolutions[i];
|
||||
ts.setResolvedModuleName(file, moduleNames[i], resolution);
|
||||
ts.setResolvedModule(file, moduleNames[i], resolution);
|
||||
if (resolution && !options.noResolve) {
|
||||
findModuleSourceFile(resolution, file.imports[i]);
|
||||
var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
if (!ts.isExternalModule(importedFile)) {
|
||||
var start_2 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName));
|
||||
}
|
||||
else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) {
|
||||
var start_3 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
else if (importedFile.referencedFiles.length) {
|
||||
var firstRef = importedFile.referencedFiles[0];
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35860,7 +35888,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
function findModuleSourceFile(fileName, nameLiteral) {
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end);
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end);
|
||||
}
|
||||
}
|
||||
function computeCommonSourceDirectory(sourceFiles) {
|
||||
|
@ -35881,7 +35909,7 @@ var ts;
|
|||
for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {
|
||||
if (commonPathComponents[i] !== sourcePathComponents[i]) {
|
||||
if (i === 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
return;
|
||||
}
|
||||
// New common path found that is 0 -> i-1
|
||||
|
@ -35906,7 +35934,7 @@ var ts;
|
|||
if (!ts.isDeclarationFile(sourceFile)) {
|
||||
var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
||||
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
allFilesBelongToPath = false;
|
||||
}
|
||||
}
|
||||
|
@ -35917,44 +35945,44 @@ var ts;
|
|||
function verifyCompilerOptions() {
|
||||
if (options.isolatedModules) {
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
}
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
}
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSources) {
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
}
|
||||
}
|
||||
if (options.out && options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
}
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -35963,22 +35991,22 @@ var ts;
|
|||
var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; });
|
||||
if (options.isolatedModules) {
|
||||
if (!options.module && languageVersion < 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
}
|
||||
var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
// there has to be common source directory if user specified --outdir || --sourceRoot
|
||||
// if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted
|
||||
|
@ -36003,25 +36031,25 @@ var ts;
|
|||
}
|
||||
if (options.noEmit) {
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
}
|
||||
if (options.outDir) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
}
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
}
|
||||
}
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44003,9 +44031,9 @@ var ts;
|
|||
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
|
||||
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
|
||||
if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) {
|
||||
var start_2 = new Date().getTime();
|
||||
var start_4 = new Date().getTime();
|
||||
contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile);
|
||||
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_2));
|
||||
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_4));
|
||||
}
|
||||
// Find the node where completion is requested on.
|
||||
// Also determine whether we are trying to complete with members of that node
|
||||
|
@ -44253,13 +44281,13 @@ var ts;
|
|||
if (contextToken.kind === 9 /* StringLiteral */
|
||||
|| contextToken.kind === 10 /* RegularExpressionLiteral */
|
||||
|| ts.isTemplateLiteralKind(contextToken.kind)) {
|
||||
var start_3 = contextToken.getStart();
|
||||
var start_5 = contextToken.getStart();
|
||||
var end = contextToken.getEnd();
|
||||
// To be "in" one of these literals, the position has to be:
|
||||
// 1. entirely within the token text.
|
||||
// 2. at the end position of an unterminated token.
|
||||
// 3. at the end of a regular expression (due to trailing flags like '/foo/g').
|
||||
if (start_3 < position && position < end) {
|
||||
if (start_5 < position && position < end) {
|
||||
return true;
|
||||
}
|
||||
if (position === end) {
|
||||
|
@ -48631,7 +48659,10 @@ var ts;
|
|||
if ("getModuleResolutionsForFile" in this.shimHost) {
|
||||
this.resolveModuleNames = function (moduleNames, containingFile) {
|
||||
var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));
|
||||
return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); });
|
||||
return ts.map(moduleNames, function (name) {
|
||||
var result = ts.lookUp(resolutionsInFile, name);
|
||||
return result ? { resolvedFileName: result } : undefined;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -49178,7 +49209,11 @@ var ts;
|
|||
var _this = this;
|
||||
return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () {
|
||||
var compilerOptions = JSON.parse(compilerOptionsJson);
|
||||
return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
|
||||
var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
|
||||
return {
|
||||
resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined,
|
||||
failedLookupLocations: result.failedLookupLocations
|
||||
};
|
||||
});
|
||||
};
|
||||
CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) {
|
||||
|
|
|
@ -1382,9 +1382,12 @@ declare namespace ts {
|
|||
}
|
||||
interface ResolvedModule {
|
||||
resolvedFileName: string;
|
||||
isExternalLibraryImport?: boolean;
|
||||
}
|
||||
interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModule;
|
||||
failedLookupLocations: string[];
|
||||
}
|
||||
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
|
||||
interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
|
@ -1394,7 +1397,7 @@ declare namespace ts {
|
|||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface TextSpan {
|
||||
start: number;
|
||||
|
@ -1515,10 +1518,9 @@ declare namespace ts {
|
|||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
|
||||
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[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
|
@ -1649,7 +1651,7 @@ declare namespace ts {
|
|||
trace?(s: string): void;
|
||||
error?(s: string): void;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
|
||||
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
|
||||
}
|
||||
interface LanguageService {
|
||||
cleanupSemanticCache(): void;
|
||||
|
|
|
@ -2300,6 +2300,8 @@ var ts;
|
|||
Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" },
|
||||
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." },
|
||||
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
|
||||
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
|
||||
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
@ -5012,21 +5014,21 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
ts.arrayIsEqualTo = arrayIsEqualTo;
|
||||
function hasResolvedModuleName(sourceFile, moduleNameText) {
|
||||
function hasResolvedModule(sourceFile, moduleNameText) {
|
||||
return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
ts.hasResolvedModuleName = hasResolvedModuleName;
|
||||
function getResolvedModuleFileName(sourceFile, moduleNameText) {
|
||||
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
ts.hasResolvedModule = hasResolvedModule;
|
||||
function getResolvedModule(sourceFile, moduleNameText) {
|
||||
return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
|
||||
}
|
||||
ts.getResolvedModuleFileName = getResolvedModuleFileName;
|
||||
function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) {
|
||||
ts.getResolvedModule = getResolvedModule;
|
||||
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
||||
if (!sourceFile.resolvedModules) {
|
||||
sourceFile.resolvedModules = {};
|
||||
}
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
|
||||
sourceFile.resolvedModules[moduleNameText] = resolvedModule;
|
||||
}
|
||||
ts.setResolvedModuleName = setResolvedModuleName;
|
||||
ts.setResolvedModule = setResolvedModule;
|
||||
// Returns true if this node contains a parse error anywhere underneath it.
|
||||
function containsParseError(node) {
|
||||
aggregateChildData(node);
|
||||
|
@ -6363,11 +6365,21 @@ var ts;
|
|||
add: add,
|
||||
getGlobalDiagnostics: getGlobalDiagnostics,
|
||||
getDiagnostics: getDiagnostics,
|
||||
getModificationCount: getModificationCount
|
||||
getModificationCount: getModificationCount,
|
||||
reattachFileDiagnostics: reattachFileDiagnostics
|
||||
};
|
||||
function getModificationCount() {
|
||||
return modificationCount;
|
||||
}
|
||||
function reattachFileDiagnostics(newFile) {
|
||||
if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) {
|
||||
var diagnostic = _a[_i];
|
||||
diagnostic.file = newFile;
|
||||
}
|
||||
}
|
||||
function add(diagnostic) {
|
||||
var diagnostics;
|
||||
if (diagnostic.file) {
|
||||
|
@ -13745,8 +13757,8 @@ var ts;
|
|||
return symbol;
|
||||
}
|
||||
}
|
||||
var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = fileName && host.getSourceFile(fileName);
|
||||
var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text);
|
||||
var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
|
@ -31225,6 +31237,9 @@ var ts;
|
|||
}
|
||||
function emitExportSpecifierInSystemModule(specifier) {
|
||||
ts.Debug.assert(compilerOptions.module === 4 /* System */);
|
||||
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) {
|
||||
return;
|
||||
}
|
||||
writeLine();
|
||||
emitStart(specifier.name);
|
||||
write(exportFunctionForFile + "(\"");
|
||||
|
@ -33896,7 +33911,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node)) {
|
||||
if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
||||
if (!hoistedVars) {
|
||||
hoistedVars = [];
|
||||
}
|
||||
|
@ -35164,10 +35179,12 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
|
||||
var resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
if (resolvedFileName) {
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations };
|
||||
return resolvedFileName
|
||||
? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
|
||||
|
@ -35227,11 +35244,11 @@ var ts;
|
|||
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
|
||||
var result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedFileName: result, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(directory);
|
||||
|
@ -35240,39 +35257,16 @@ var ts;
|
|||
}
|
||||
directory = parentPath;
|
||||
}
|
||||
return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) {
|
||||
ts.Debug.assert(baseUrl !== undefined);
|
||||
var normalizedModuleName = ts.normalizeSlashes(moduleName);
|
||||
var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile);
|
||||
var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName));
|
||||
var failedLookupLocations = [];
|
||||
return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations };
|
||||
function tryLoadFile(location) {
|
||||
if (host.fileExists(location)) {
|
||||
return { resolvedFileName: location, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
else {
|
||||
failedLookupLocations.push(location);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver;
|
||||
function nameStartsWithDotSlashOrDotDotSlash(name) {
|
||||
var i = name.lastIndexOf("./", 1);
|
||||
return i === 0 || (i === 1 && name.charCodeAt(0) === 46 /* dot */);
|
||||
}
|
||||
function useBaseUrl(moduleName) {
|
||||
// path is not rooted
|
||||
// module name does not start with './' or '../'
|
||||
return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName);
|
||||
}
|
||||
function classicNameResolver(moduleName, containingFile, compilerOptions, host) {
|
||||
// module names that contain '!' are used to reference resources and are not resolved to actual files on disk
|
||||
if (moduleName.indexOf('!') != -1) {
|
||||
return { resolvedFileName: undefined, failedLookupLocations: [] };
|
||||
return { resolvedModule: undefined, failedLookupLocations: [] };
|
||||
}
|
||||
var searchPath = ts.getDirectoryPath(containingFile);
|
||||
var searchName;
|
||||
|
@ -35303,7 +35297,9 @@ var ts;
|
|||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations };
|
||||
return referencedSourceFile
|
||||
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations: failedLookupLocations };
|
||||
}
|
||||
ts.classicNameResolver = classicNameResolver;
|
||||
/* @internal */
|
||||
|
@ -35420,7 +35416,8 @@ var ts;
|
|||
function createProgram(rootNames, options, host, oldProgram) {
|
||||
var program;
|
||||
var files = [];
|
||||
var diagnostics = ts.createDiagnosticCollection();
|
||||
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
|
||||
var programDiagnostics = ts.createDiagnosticCollection();
|
||||
var commonSourceDirectory;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
|
@ -35428,8 +35425,9 @@ var ts;
|
|||
var skipDefaultLib = options.noLib;
|
||||
var start = new Date().getTime();
|
||||
host = host || createCompilerHost(options);
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames ||
|
||||
(function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); });
|
||||
var resolveModuleNamesWorker = host.resolveModuleNames
|
||||
? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); })
|
||||
: (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); });
|
||||
var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); });
|
||||
if (oldProgram) {
|
||||
// check properties that can affect structure of the program or module resolution strategy
|
||||
|
@ -35476,7 +35474,8 @@ var ts;
|
|||
getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },
|
||||
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
|
||||
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }
|
||||
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
|
||||
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }
|
||||
};
|
||||
return program;
|
||||
function getClassifiableNames() {
|
||||
|
@ -35503,6 +35502,7 @@ var ts;
|
|||
}
|
||||
// check if program source files has changed in the way that can affect structure of the program
|
||||
var newSourceFiles = [];
|
||||
var modifiedSourceFiles = [];
|
||||
for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {
|
||||
var oldSourceFile = _a[_i];
|
||||
var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target);
|
||||
|
@ -35531,14 +35531,21 @@ var ts;
|
|||
var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
|
||||
// ensure that module resolution results are still correct
|
||||
for (var i = 0; i < moduleNames.length; ++i) {
|
||||
var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
|
||||
if (oldResolution !== resolutions[i]) {
|
||||
var newResolution = resolutions[i];
|
||||
var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]);
|
||||
var resolutionChanged = oldResolution
|
||||
? !newResolution ||
|
||||
oldResolution.resolvedFileName !== newResolution.resolvedFileName ||
|
||||
!!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport
|
||||
: newResolution;
|
||||
if (resolutionChanged) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// pass the cache of module resolutions from the old source file
|
||||
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
||||
modifiedSourceFiles.push(newSourceFile);
|
||||
}
|
||||
else {
|
||||
// file has no changes - use it as is
|
||||
|
@ -35553,6 +35560,11 @@ var ts;
|
|||
filesByName.set(file.fileName, file);
|
||||
}
|
||||
files = newSourceFiles;
|
||||
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
||||
for (var _c = 0; _c < modifiedSourceFiles.length; _c++) {
|
||||
var modifiedFile = modifiedSourceFiles[_c];
|
||||
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile);
|
||||
}
|
||||
oldProgram.structureIsReused = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -35654,8 +35666,9 @@ var ts;
|
|||
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
var bindDiagnostics = sourceFile.bindDiagnostics;
|
||||
var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken);
|
||||
var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics);
|
||||
var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile);
|
||||
});
|
||||
}
|
||||
function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
|
||||
|
@ -35670,7 +35683,8 @@ var ts;
|
|||
}
|
||||
function getOptionsDiagnostics() {
|
||||
var allDiagnostics = [];
|
||||
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());
|
||||
ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
|
||||
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
function getGlobalDiagnostics() {
|
||||
|
@ -35768,10 +35782,10 @@ var ts;
|
|||
}
|
||||
if (diagnostic) {
|
||||
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35791,10 +35805,10 @@ var ts;
|
|||
// We haven't looked for this file, do so now and cache result
|
||||
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
filesByName.set(canonicalName, file);
|
||||
|
@ -35824,10 +35838,10 @@ var ts;
|
|||
var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
|
||||
diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35848,9 +35862,23 @@ var ts;
|
|||
var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
|
||||
for (var i = 0; i < file.imports.length; ++i) {
|
||||
var resolution = resolutions[i];
|
||||
ts.setResolvedModuleName(file, moduleNames[i], resolution);
|
||||
ts.setResolvedModule(file, moduleNames[i], resolution);
|
||||
if (resolution && !options.noResolve) {
|
||||
findModuleSourceFile(resolution, file.imports[i]);
|
||||
var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
if (!ts.isExternalModule(importedFile)) {
|
||||
var start_2 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName));
|
||||
}
|
||||
else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) {
|
||||
var start_3 = ts.getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
else if (importedFile.referencedFiles.length) {
|
||||
var firstRef = importedFile.referencedFiles[0];
|
||||
fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35860,7 +35888,7 @@ var ts;
|
|||
}
|
||||
return;
|
||||
function findModuleSourceFile(fileName, nameLiteral) {
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end);
|
||||
return findSourceFile(fileName, /* isDefaultLib */ false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end);
|
||||
}
|
||||
}
|
||||
function computeCommonSourceDirectory(sourceFiles) {
|
||||
|
@ -35881,7 +35909,7 @@ var ts;
|
|||
for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {
|
||||
if (commonPathComponents[i] !== sourcePathComponents[i]) {
|
||||
if (i === 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
return;
|
||||
}
|
||||
// New common path found that is 0 -> i-1
|
||||
|
@ -35906,7 +35934,7 @@ var ts;
|
|||
if (!ts.isDeclarationFile(sourceFile)) {
|
||||
var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
||||
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
|
||||
allFilesBelongToPath = false;
|
||||
}
|
||||
}
|
||||
|
@ -35917,44 +35945,44 @@ var ts;
|
|||
function verifyCompilerOptions() {
|
||||
if (options.isolatedModules) {
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
}
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
}
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap"));
|
||||
}
|
||||
}
|
||||
if (options.inlineSources) {
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
}
|
||||
}
|
||||
if (options.out && options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
}
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -35963,22 +35991,22 @@ var ts;
|
|||
var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; });
|
||||
if (options.isolatedModules) {
|
||||
if (!options.module && languageVersion < 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
}
|
||||
var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
// there has to be common source directory if user specified --outdir || --sourceRoot
|
||||
// if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted
|
||||
|
@ -36003,25 +36031,25 @@ var ts;
|
|||
}
|
||||
if (options.noEmit) {
|
||||
if (options.out) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
|
||||
}
|
||||
if (options.outFile) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
|
||||
}
|
||||
if (options.outDir) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
|
||||
}
|
||||
if (options.declaration) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
|
||||
}
|
||||
}
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== 2 /* ES6 */) {
|
||||
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44003,9 +44031,9 @@ var ts;
|
|||
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
|
||||
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
|
||||
if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) {
|
||||
var start_2 = new Date().getTime();
|
||||
var start_4 = new Date().getTime();
|
||||
contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile);
|
||||
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_2));
|
||||
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_4));
|
||||
}
|
||||
// Find the node where completion is requested on.
|
||||
// Also determine whether we are trying to complete with members of that node
|
||||
|
@ -44253,13 +44281,13 @@ var ts;
|
|||
if (contextToken.kind === 9 /* StringLiteral */
|
||||
|| contextToken.kind === 10 /* RegularExpressionLiteral */
|
||||
|| ts.isTemplateLiteralKind(contextToken.kind)) {
|
||||
var start_3 = contextToken.getStart();
|
||||
var start_5 = contextToken.getStart();
|
||||
var end = contextToken.getEnd();
|
||||
// To be "in" one of these literals, the position has to be:
|
||||
// 1. entirely within the token text.
|
||||
// 2. at the end position of an unterminated token.
|
||||
// 3. at the end of a regular expression (due to trailing flags like '/foo/g').
|
||||
if (start_3 < position && position < end) {
|
||||
if (start_5 < position && position < end) {
|
||||
return true;
|
||||
}
|
||||
if (position === end) {
|
||||
|
@ -48631,7 +48659,10 @@ var ts;
|
|||
if ("getModuleResolutionsForFile" in this.shimHost) {
|
||||
this.resolveModuleNames = function (moduleNames, containingFile) {
|
||||
var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile));
|
||||
return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); });
|
||||
return ts.map(moduleNames, function (name) {
|
||||
var result = ts.lookUp(resolutionsInFile, name);
|
||||
return result ? { resolvedFileName: result } : undefined;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -49178,7 +49209,11 @@ var ts;
|
|||
var _this = this;
|
||||
return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () {
|
||||
var compilerOptions = JSON.parse(compilerOptionsJson);
|
||||
return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
|
||||
var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host);
|
||||
return {
|
||||
resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined,
|
||||
failedLookupLocations: result.failedLookupLocations
|
||||
};
|
||||
});
|
||||
};
|
||||
CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче