mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-14 16:56:06 -05:00
Update LKG.
This commit is contained in:
2
lib/lib.es2015.collection.d.ts
vendored
2
lib/lib.es2015.collection.d.ts
vendored
@@ -30,7 +30,7 @@ interface Map<K, V> {
|
||||
|
||||
interface MapConstructor {
|
||||
new(): Map<any, any>;
|
||||
new<K, V>(entries?: ReadonlyArray<[K, V]> | null): Map<K, V>;
|
||||
new<K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): Map<K, V>;
|
||||
readonly prototype: Map<any, any>;
|
||||
}
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
2
lib/lib.es2015.iterable.d.ts
vendored
2
lib/lib.es2015.iterable.d.ts
vendored
@@ -149,7 +149,7 @@ interface ReadonlyMap<K, V> {
|
||||
}
|
||||
|
||||
interface MapConstructor {
|
||||
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
|
||||
new <K, V>(iterable: Iterable<readonly [K, V]>): Map<K, V>;
|
||||
}
|
||||
|
||||
interface WeakMap<K extends object, V> { }
|
||||
|
||||
209
lib/tsc.js
209
lib/tsc.js
@@ -2962,7 +2962,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries);
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
try {
|
||||
@@ -12689,7 +12689,7 @@ var ts;
|
||||
return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i");
|
||||
}
|
||||
ts.getRegexFromPattern = getRegexFromPattern;
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) {
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
||||
path = ts.normalizePath(path);
|
||||
currentDirectory = ts.normalizePath(currentDirectory);
|
||||
var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
@@ -12697,12 +12697,18 @@ var ts;
|
||||
var includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames);
|
||||
var excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames);
|
||||
var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
|
||||
var visited = ts.createMap();
|
||||
var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
|
||||
var basePath = _a[_i];
|
||||
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
||||
}
|
||||
return ts.flatten(results);
|
||||
function visitDirectory(path, absolutePath, depth) {
|
||||
var canonicalPath = toCanonical(realpath(absolutePath));
|
||||
if (visited.has(canonicalPath))
|
||||
return;
|
||||
visited.set(canonicalPath, true);
|
||||
var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
|
||||
var _loop_1 = function (current) {
|
||||
var name = combinePaths(path, current);
|
||||
@@ -33572,11 +33578,21 @@ var ts;
|
||||
var trueType = instantiateType(root.trueType, mapper);
|
||||
var falseType = instantiateType(root.falseType, mapper);
|
||||
var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result) {
|
||||
return result;
|
||||
if (conditionalTypes.has(instantiationId)) {
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
var deferred = getDeferredConditionalType(root, mapper, undefined, checkType, extendsType, trueType, falseType);
|
||||
conditionalTypes.set(instantiationId, deferred);
|
||||
return deferred;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, undefined);
|
||||
var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
|
||||
var cachedRecursiveResult = conditionalTypes.get(instantiationId);
|
||||
if (cachedRecursiveResult) {
|
||||
return cachedRecursiveResult;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, newResult);
|
||||
return newResult;
|
||||
}
|
||||
@@ -33621,6 +33637,9 @@ var ts;
|
||||
return instantiateType(root.trueType, combinedMapper || mapper);
|
||||
}
|
||||
}
|
||||
return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
|
||||
}
|
||||
function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
|
||||
var erasedCheckType = getActualTypeVariable(checkType);
|
||||
var result = createType(16777216);
|
||||
result.root = root;
|
||||
@@ -67451,6 +67470,81 @@ var ts;
|
||||
return ".js";
|
||||
}
|
||||
ts.getOutputExtension = getOutputExtension;
|
||||
function rootDirOfOptions(configFile) {
|
||||
return configFile.options.rootDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath));
|
||||
}
|
||||
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
|
||||
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts") && ts.hasTSFileExtension(inputFileName));
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts");
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json");
|
||||
var outputFileName = ts.changeExtension(outputPath, isJsonFile ?
|
||||
".json" :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx") && configFile.options.jsx === 1 ?
|
||||
".jsx" :
|
||||
".js");
|
||||
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.assertDefined(configFile.options.configFilePath), ignoreCase) !== 0 ?
|
||||
outputFileName :
|
||||
undefined;
|
||||
}
|
||||
function getAllProjectOutputs(configFile, ignoreCase) {
|
||||
var outputs;
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var _a = getOutputPathsForBundle(configFile.options, false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
addOutput(buildInfoPath);
|
||||
}
|
||||
else {
|
||||
for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) {
|
||||
var inputFileName = _c[_b];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts"))
|
||||
continue;
|
||||
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json"))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
addOutput(dts + ".map");
|
||||
}
|
||||
}
|
||||
}
|
||||
addOutput(getOutputPathForBuildInfo(configFile.options));
|
||||
}
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
function getFirstProjectOutput(configFile, ignoreCase) {
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var jsFilePath = getOutputPathsForBundle(configFile.options, false).jsFilePath;
|
||||
return ts.Debug.assertDefined(jsFilePath, "project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
||||
var inputFileName = _b[_a];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts"))
|
||||
continue;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
}
|
||||
return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
ts.getFirstProjectOutput = getFirstProjectOutput;
|
||||
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
|
||||
var compilerOptions = host.getCompilerOptions();
|
||||
var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
|
||||
@@ -71374,7 +71468,8 @@ var ts;
|
||||
writeFile: host.writeFile && writeFile,
|
||||
addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory,
|
||||
addOrDeleteFile: addOrDeleteFile,
|
||||
clearCache: clearCache
|
||||
clearCache: clearCache,
|
||||
realpath: host.realpath && realpath
|
||||
};
|
||||
function toPath(fileName) {
|
||||
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
@@ -71465,7 +71560,7 @@ var ts;
|
||||
var rootDirPath = toPath(rootDir);
|
||||
var result = tryReadDirectory(rootDir, rootDirPath);
|
||||
if (result) {
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries);
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
|
||||
}
|
||||
return host.readDirectory(rootDir, extensions, excludes, includes, depth);
|
||||
function getFileSystemEntries(dir) {
|
||||
@@ -71476,6 +71571,9 @@ var ts;
|
||||
return tryReadDirectory(dir, path) || ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function realpath(s) {
|
||||
return host.realpath ? host.realpath(s) : s;
|
||||
}
|
||||
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
||||
var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
||||
if (existingResult) {
|
||||
@@ -72274,7 +72372,7 @@ var ts;
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts") && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), false, false, undefined);
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), false, false, undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73414,7 +73512,7 @@ var ts;
|
||||
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
|
||||
return out ?
|
||||
ts.changeExtension(out, ".d.ts") :
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine);
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
||||
}
|
||||
function getResolvedProjectReferenceToRedirect(fileName) {
|
||||
if (mapFromFileToProjectReferenceRedirects === undefined) {
|
||||
@@ -76741,54 +76839,6 @@ var ts;
|
||||
function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
|
||||
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, ts.createMap);
|
||||
}
|
||||
function getOutputDeclarationFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, true);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts");
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, true);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
var newExtension = ts.fileExtensionIs(inputFileName, ".json") ? ".json" :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx") && configFile.options.jsx === 1 ? ".jsx" : ".js";
|
||||
return ts.changeExtension(outputPath, newExtension);
|
||||
}
|
||||
function getOutputFileNames(inputFileName, configFile) {
|
||||
if (configFile.options.outFile || configFile.options.out || ts.fileExtensionIs(inputFileName, ".d.ts")) {
|
||||
return ts.emptyArray;
|
||||
}
|
||||
var outputs = [];
|
||||
var js = getOutputJSFileName(inputFileName, configFile);
|
||||
outputs.push(js);
|
||||
if (configFile.options.sourceMap) {
|
||||
outputs.push(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && !ts.fileExtensionIs(inputFileName, ".json")) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile);
|
||||
outputs.push(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
outputs.push(dts + ".map");
|
||||
}
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
function getOutFileOutputs(project, ignoreBuildInfo) {
|
||||
ts.Debug.assert(!!project.options.outFile || !!project.options.out, "outFile must be set");
|
||||
var _a = ts.getOutputPathsForBundle(project.options, false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
var outputs = [];
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
if (!ignoreBuildInfo)
|
||||
addOutput(buildInfoPath);
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
function rootDirOfOptions(opts, configFileName) {
|
||||
return opts.rootDir || ts.getDirectoryPath(configFileName);
|
||||
}
|
||||
function newer(date1, date2) {
|
||||
return date2 > date1 ? date2 : date1;
|
||||
}
|
||||
@@ -77044,7 +77094,7 @@ var ts;
|
||||
newestInputFileTime = inputTime;
|
||||
}
|
||||
}
|
||||
var outputs = getAllProjectOutputs(project);
|
||||
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
||||
if (outputs.length === 0) {
|
||||
return {
|
||||
type: UpToDateStatusType.ContainerOnly
|
||||
@@ -77434,7 +77484,7 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile)
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
diagnostics.removeKey(proj);
|
||||
projectStatus.setValue(proj, status);
|
||||
@@ -77513,12 +77563,12 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
oldestOutputFileName: ts.getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
|
||||
if (!skipOutputs || outputs.length !== skipOutputs.getSize()) {
|
||||
if (options.verbose) {
|
||||
reportStatus(verboseMessage, proj.options.configFilePath);
|
||||
@@ -77550,7 +77600,7 @@ var ts;
|
||||
reportParseConfigFileDiagnostic(proj);
|
||||
continue;
|
||||
}
|
||||
var outputs = getAllProjectOutputs(parsed);
|
||||
var outputs = ts.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
|
||||
for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
|
||||
var output = outputs_3[_b];
|
||||
if (host.fileExists(output)) {
|
||||
@@ -77687,36 +77737,6 @@ var ts;
|
||||
return ts.combinePaths(project, "tsconfig.json");
|
||||
}
|
||||
ts.resolveConfigFileProjectName = resolveConfigFileProjectName;
|
||||
function getAllProjectOutputs(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return getOutFileOutputs(project);
|
||||
}
|
||||
else {
|
||||
var outputs = [];
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
|
||||
}
|
||||
var buildInfoPath = ts.getOutputPathForBuildInfo(project.options);
|
||||
if (buildInfoPath)
|
||||
outputs.push(buildInfoPath);
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
function getFirstProjectOutput(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return ts.first(getOutFileOutputs(project));
|
||||
}
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
var outputs = getOutputFileNames(inputFile, project);
|
||||
if (outputs.length) {
|
||||
return ts.first(outputs);
|
||||
}
|
||||
}
|
||||
return ts.Debug.fail("project " + project.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
|
||||
switch (status.type) {
|
||||
case UpToDateStatusType.OutOfDateWithSelf:
|
||||
@@ -78059,9 +78079,10 @@ var ts;
|
||||
if (buildOptions.watch) {
|
||||
reportWatchModeWithoutSysSupport();
|
||||
}
|
||||
// Use default createProgram
|
||||
var buildHost = buildOptions.watch ?
|
||||
ts.createSolutionBuilderWithWatchHost(ts.sys, ts.createEmitAndSemanticDiagnosticsBuilderProgram, reportDiagnostic, ts.createBuilderStatusReporter(ts.sys, shouldBePretty()), createWatchStatusReporter()) :
|
||||
ts.createSolutionBuilderHost(ts.sys, ts.createAbstractBuilder, reportDiagnostic, ts.createBuilderStatusReporter(ts.sys, shouldBePretty()), createReportErrorSummary(buildOptions));
|
||||
ts.createSolutionBuilderWithWatchHost(ts.sys, /*createProgram*/ undefined, reportDiagnostic, ts.createBuilderStatusReporter(ts.sys, shouldBePretty()), createWatchStatusReporter()) :
|
||||
ts.createSolutionBuilderHost(ts.sys, /*createProgram*/ undefined, reportDiagnostic, ts.createBuilderStatusReporter(ts.sys, shouldBePretty()), createReportErrorSummary(buildOptions));
|
||||
updateCreateProgram(buildHost);
|
||||
buildHost.afterProgramEmitAndDiagnostics = function (program) { return reportStatistics(program.getProgram()); };
|
||||
var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
|
||||
|
||||
227
lib/tsserver.js
227
lib/tsserver.js
@@ -5008,7 +5008,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries);
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
try {
|
||||
@@ -15874,7 +15874,7 @@ var ts;
|
||||
}
|
||||
ts.getRegexFromPattern = getRegexFromPattern;
|
||||
/** @param path directory of the tsconfig.json */
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) {
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
||||
path = ts.normalizePath(path);
|
||||
currentDirectory = ts.normalizePath(currentDirectory);
|
||||
var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
@@ -15884,12 +15884,18 @@ var ts;
|
||||
// Associate an array of results with each include regex. This keeps results in order of the "include" order.
|
||||
// If there are no "includes", then just put everything in results[0].
|
||||
var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
|
||||
var visited = ts.createMap();
|
||||
var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
|
||||
var basePath = _a[_i];
|
||||
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
||||
}
|
||||
return ts.flatten(results);
|
||||
function visitDirectory(path, absolutePath, depth) {
|
||||
var canonicalPath = toCanonical(realpath(absolutePath));
|
||||
if (visited.has(canonicalPath))
|
||||
return;
|
||||
visited.set(canonicalPath, true);
|
||||
var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
|
||||
var _loop_1 = function (current) {
|
||||
var name = combinePaths(path, current);
|
||||
@@ -40423,11 +40429,24 @@ var ts;
|
||||
var trueType = instantiateType(root.trueType, mapper);
|
||||
var falseType = instantiateType(root.falseType, mapper);
|
||||
var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result) {
|
||||
return result;
|
||||
if (conditionalTypes.has(instantiationId)) {
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
// Somehow the conditional type depends on itself - usually via `infer` types in the `extends` clause
|
||||
// paired with a (potentially deferred) circularly constrained type.
|
||||
// The conditional _must_ be deferred.
|
||||
var deferred = getDeferredConditionalType(root, mapper, /*combinedMapper*/ undefined, checkType, extendsType, trueType, falseType);
|
||||
conditionalTypes.set(instantiationId, deferred);
|
||||
return deferred;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, undefined);
|
||||
var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
|
||||
var cachedRecursiveResult = conditionalTypes.get(instantiationId);
|
||||
if (cachedRecursiveResult) {
|
||||
return cachedRecursiveResult;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, newResult);
|
||||
return newResult;
|
||||
}
|
||||
@@ -40489,6 +40508,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Return a deferred type for a check that is neither definitely true nor definitely false
|
||||
return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
|
||||
}
|
||||
function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
|
||||
var erasedCheckType = getActualTypeVariable(checkType);
|
||||
var result = createType(16777216 /* Conditional */);
|
||||
result.root = root;
|
||||
@@ -82944,6 +82966,84 @@ var ts;
|
||||
return ".js" /* Js */;
|
||||
}
|
||||
ts.getOutputExtension = getOutputExtension;
|
||||
function rootDirOfOptions(configFile) {
|
||||
return configFile.options.rootDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath));
|
||||
}
|
||||
/* @internal */
|
||||
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
|
||||
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(inputFileName));
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(outputPath, isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ?
|
||||
".jsx" /* Jsx */ :
|
||||
".js" /* Js */);
|
||||
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.assertDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
||||
outputFileName :
|
||||
undefined;
|
||||
}
|
||||
/*@internal*/
|
||||
function getAllProjectOutputs(configFile, ignoreCase) {
|
||||
var outputs;
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var _a = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
addOutput(buildInfoPath);
|
||||
}
|
||||
else {
|
||||
for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) {
|
||||
var inputFileName = _c[_b];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
addOutput(dts + ".map");
|
||||
}
|
||||
}
|
||||
}
|
||||
addOutput(getOutputPathForBuildInfo(configFile.options));
|
||||
}
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
/*@internal*/
|
||||
function getFirstProjectOutput(configFile, ignoreCase) {
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var jsFilePath = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false).jsFilePath;
|
||||
return ts.Debug.assertDefined(jsFilePath, "project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
||||
var inputFileName = _b[_a];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
}
|
||||
return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
ts.getFirstProjectOutput = getFirstProjectOutput;
|
||||
/*@internal*/
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
|
||||
@@ -87238,7 +87338,8 @@ var ts;
|
||||
writeFile: host.writeFile && writeFile,
|
||||
addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory,
|
||||
addOrDeleteFile: addOrDeleteFile,
|
||||
clearCache: clearCache
|
||||
clearCache: clearCache,
|
||||
realpath: host.realpath && realpath
|
||||
};
|
||||
function toPath(fileName) {
|
||||
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
@@ -87335,7 +87436,7 @@ var ts;
|
||||
var rootDirPath = toPath(rootDir);
|
||||
var result = tryReadDirectory(rootDir, rootDirPath);
|
||||
if (result) {
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries);
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
|
||||
}
|
||||
return host.readDirectory(rootDir, extensions, excludes, includes, depth);
|
||||
function getFileSystemEntries(dir) {
|
||||
@@ -87346,6 +87447,9 @@ var ts;
|
||||
return tryReadDirectory(dir, path) || ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function realpath(s) {
|
||||
return host.realpath ? host.realpath(s) : s;
|
||||
}
|
||||
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
||||
var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
||||
if (existingResult) {
|
||||
@@ -88246,7 +88350,7 @@ var ts;
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89587,7 +89691,7 @@ var ts;
|
||||
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
|
||||
return out ?
|
||||
ts.changeExtension(out, ".d.ts" /* Dts */) :
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine);
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
||||
}
|
||||
/**
|
||||
* Get the referenced project if the file is input file from that reference project
|
||||
@@ -93477,55 +93581,6 @@ var ts;
|
||||
function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
|
||||
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, ts.createMap);
|
||||
}
|
||||
function getOutputDeclarationFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
var newExtension = ts.fileExtensionIs(inputFileName, ".json" /* Json */) ? ".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ? ".jsx" /* Jsx */ : ".js" /* Js */;
|
||||
return ts.changeExtension(outputPath, newExtension);
|
||||
}
|
||||
function getOutputFileNames(inputFileName, configFile) {
|
||||
// outFile is handled elsewhere; .d.ts files don't generate outputs
|
||||
if (configFile.options.outFile || configFile.options.out || ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */)) {
|
||||
return ts.emptyArray;
|
||||
}
|
||||
var outputs = [];
|
||||
var js = getOutputJSFileName(inputFileName, configFile);
|
||||
outputs.push(js);
|
||||
if (configFile.options.sourceMap) {
|
||||
outputs.push(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile);
|
||||
outputs.push(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
outputs.push(dts + ".map");
|
||||
}
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
function getOutFileOutputs(project, ignoreBuildInfo) {
|
||||
ts.Debug.assert(!!project.options.outFile || !!project.options.out, "outFile must be set");
|
||||
var _a = ts.getOutputPathsForBundle(project.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
var outputs = [];
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
if (!ignoreBuildInfo)
|
||||
addOutput(buildInfoPath);
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
function rootDirOfOptions(opts, configFileName) {
|
||||
return opts.rootDir || ts.getDirectoryPath(configFileName);
|
||||
}
|
||||
function newer(date1, date2) {
|
||||
return date2 > date1 ? date2 : date1;
|
||||
}
|
||||
@@ -93798,7 +93853,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Collect the expected outputs of this project
|
||||
var outputs = getAllProjectOutputs(project);
|
||||
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
||||
if (outputs.length === 0) {
|
||||
return {
|
||||
type: UpToDateStatusType.ContainerOnly
|
||||
@@ -94231,7 +94286,7 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile)
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
diagnostics.removeKey(proj);
|
||||
projectStatus.setValue(proj, status);
|
||||
@@ -94313,12 +94368,12 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
oldestOutputFileName: ts.getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
|
||||
if (!skipOutputs || outputs.length !== skipOutputs.getSize()) {
|
||||
if (options.verbose) {
|
||||
reportStatus(verboseMessage, proj.options.configFilePath);
|
||||
@@ -94352,7 +94407,7 @@ var ts;
|
||||
reportParseConfigFileDiagnostic(proj);
|
||||
continue;
|
||||
}
|
||||
var outputs = getAllProjectOutputs(parsed);
|
||||
var outputs = ts.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
|
||||
for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
|
||||
var output = outputs_3[_b];
|
||||
if (host.fileExists(output)) {
|
||||
@@ -94502,36 +94557,6 @@ var ts;
|
||||
return ts.combinePaths(project, "tsconfig.json");
|
||||
}
|
||||
ts.resolveConfigFileProjectName = resolveConfigFileProjectName;
|
||||
function getAllProjectOutputs(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return getOutFileOutputs(project);
|
||||
}
|
||||
else {
|
||||
var outputs = [];
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
|
||||
}
|
||||
var buildInfoPath = ts.getOutputPathForBuildInfo(project.options);
|
||||
if (buildInfoPath)
|
||||
outputs.push(buildInfoPath);
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
function getFirstProjectOutput(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return ts.first(getOutFileOutputs(project));
|
||||
}
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
var outputs = getOutputFileNames(inputFile, project);
|
||||
if (outputs.length) {
|
||||
return ts.first(outputs);
|
||||
}
|
||||
}
|
||||
return ts.Debug.fail("project " + project.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
|
||||
switch (status.type) {
|
||||
case UpToDateStatusType.OutOfDateWithSelf:
|
||||
@@ -98962,6 +98987,14 @@ var ts;
|
||||
case 189 /* PropertyAccessExpression */:
|
||||
propertyAccessToConvert = parent;
|
||||
node = propertyAccessToConvert.expression;
|
||||
if (node.end === contextToken.pos &&
|
||||
ts.isCallExpression(node) &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) {
|
||||
// This is likely dot from incorrectly parsed call expression and user is starting to write spread
|
||||
// eg: Math.min(./**/)
|
||||
return undefined;
|
||||
}
|
||||
break;
|
||||
case 148 /* QualifiedName */:
|
||||
node = parent.left;
|
||||
@@ -99349,6 +99382,8 @@ var ts;
|
||||
return parentKind === 242 /* TypeAliasDeclaration */;
|
||||
case 119 /* AsKeyword */:
|
||||
return parentKind === 212 /* AsExpression */;
|
||||
case 86 /* ExtendsKeyword */:
|
||||
return parentKind === 150 /* TypeParameter */;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -100972,7 +101007,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* `import x = require("./x") or `import * as x from "./x"`.
|
||||
* `import x = require("./x")` or `import * as x from "./x"`.
|
||||
* An `export =` may be imported by this syntax, so it may be a direct import.
|
||||
* If it's not a direct import, it will be in `indirectUsers`, so we don't have to do anything here.
|
||||
*/
|
||||
@@ -102381,7 +102416,9 @@ var ts;
|
||||
}
|
||||
// For `export { foo as bar }`, rename `foo`, but not `bar`.
|
||||
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
|
||||
var exportKind = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */ ? 1 /* Default */ : 0 /* Named */;
|
||||
var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
|
||||
|| exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
|
||||
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
|
||||
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
|
||||
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
|
||||
searchForImportsOfExport(referenceLocation, exportSymbol, exportInfo, state);
|
||||
|
||||
@@ -5007,7 +5007,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries);
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
try {
|
||||
@@ -15873,7 +15873,7 @@ var ts;
|
||||
}
|
||||
ts.getRegexFromPattern = getRegexFromPattern;
|
||||
/** @param path directory of the tsconfig.json */
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) {
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
||||
path = ts.normalizePath(path);
|
||||
currentDirectory = ts.normalizePath(currentDirectory);
|
||||
var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
@@ -15883,12 +15883,18 @@ var ts;
|
||||
// Associate an array of results with each include regex. This keeps results in order of the "include" order.
|
||||
// If there are no "includes", then just put everything in results[0].
|
||||
var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
|
||||
var visited = ts.createMap();
|
||||
var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
|
||||
var basePath = _a[_i];
|
||||
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
||||
}
|
||||
return ts.flatten(results);
|
||||
function visitDirectory(path, absolutePath, depth) {
|
||||
var canonicalPath = toCanonical(realpath(absolutePath));
|
||||
if (visited.has(canonicalPath))
|
||||
return;
|
||||
visited.set(canonicalPath, true);
|
||||
var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
|
||||
var _loop_1 = function (current) {
|
||||
var name = combinePaths(path, current);
|
||||
@@ -40422,11 +40428,24 @@ var ts;
|
||||
var trueType = instantiateType(root.trueType, mapper);
|
||||
var falseType = instantiateType(root.falseType, mapper);
|
||||
var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result) {
|
||||
return result;
|
||||
if (conditionalTypes.has(instantiationId)) {
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
// Somehow the conditional type depends on itself - usually via `infer` types in the `extends` clause
|
||||
// paired with a (potentially deferred) circularly constrained type.
|
||||
// The conditional _must_ be deferred.
|
||||
var deferred = getDeferredConditionalType(root, mapper, /*combinedMapper*/ undefined, checkType, extendsType, trueType, falseType);
|
||||
conditionalTypes.set(instantiationId, deferred);
|
||||
return deferred;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, undefined);
|
||||
var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
|
||||
var cachedRecursiveResult = conditionalTypes.get(instantiationId);
|
||||
if (cachedRecursiveResult) {
|
||||
return cachedRecursiveResult;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, newResult);
|
||||
return newResult;
|
||||
}
|
||||
@@ -40488,6 +40507,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Return a deferred type for a check that is neither definitely true nor definitely false
|
||||
return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
|
||||
}
|
||||
function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
|
||||
var erasedCheckType = getActualTypeVariable(checkType);
|
||||
var result = createType(16777216 /* Conditional */);
|
||||
result.root = root;
|
||||
@@ -82943,6 +82965,84 @@ var ts;
|
||||
return ".js" /* Js */;
|
||||
}
|
||||
ts.getOutputExtension = getOutputExtension;
|
||||
function rootDirOfOptions(configFile) {
|
||||
return configFile.options.rootDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath));
|
||||
}
|
||||
/* @internal */
|
||||
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
|
||||
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(inputFileName));
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(outputPath, isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ?
|
||||
".jsx" /* Jsx */ :
|
||||
".js" /* Js */);
|
||||
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.assertDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
||||
outputFileName :
|
||||
undefined;
|
||||
}
|
||||
/*@internal*/
|
||||
function getAllProjectOutputs(configFile, ignoreCase) {
|
||||
var outputs;
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var _a = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
addOutput(buildInfoPath);
|
||||
}
|
||||
else {
|
||||
for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) {
|
||||
var inputFileName = _c[_b];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
addOutput(dts + ".map");
|
||||
}
|
||||
}
|
||||
}
|
||||
addOutput(getOutputPathForBuildInfo(configFile.options));
|
||||
}
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
/*@internal*/
|
||||
function getFirstProjectOutput(configFile, ignoreCase) {
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var jsFilePath = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false).jsFilePath;
|
||||
return ts.Debug.assertDefined(jsFilePath, "project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
||||
var inputFileName = _b[_a];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
}
|
||||
return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
ts.getFirstProjectOutput = getFirstProjectOutput;
|
||||
/*@internal*/
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
|
||||
@@ -87237,7 +87337,8 @@ var ts;
|
||||
writeFile: host.writeFile && writeFile,
|
||||
addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory,
|
||||
addOrDeleteFile: addOrDeleteFile,
|
||||
clearCache: clearCache
|
||||
clearCache: clearCache,
|
||||
realpath: host.realpath && realpath
|
||||
};
|
||||
function toPath(fileName) {
|
||||
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
@@ -87334,7 +87435,7 @@ var ts;
|
||||
var rootDirPath = toPath(rootDir);
|
||||
var result = tryReadDirectory(rootDir, rootDirPath);
|
||||
if (result) {
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries);
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
|
||||
}
|
||||
return host.readDirectory(rootDir, extensions, excludes, includes, depth);
|
||||
function getFileSystemEntries(dir) {
|
||||
@@ -87345,6 +87446,9 @@ var ts;
|
||||
return tryReadDirectory(dir, path) || ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function realpath(s) {
|
||||
return host.realpath ? host.realpath(s) : s;
|
||||
}
|
||||
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
||||
var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
||||
if (existingResult) {
|
||||
@@ -88245,7 +88349,7 @@ var ts;
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89586,7 +89690,7 @@ var ts;
|
||||
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
|
||||
return out ?
|
||||
ts.changeExtension(out, ".d.ts" /* Dts */) :
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine);
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
||||
}
|
||||
/**
|
||||
* Get the referenced project if the file is input file from that reference project
|
||||
@@ -93476,55 +93580,6 @@ var ts;
|
||||
function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
|
||||
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, ts.createMap);
|
||||
}
|
||||
function getOutputDeclarationFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
var newExtension = ts.fileExtensionIs(inputFileName, ".json" /* Json */) ? ".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ? ".jsx" /* Jsx */ : ".js" /* Js */;
|
||||
return ts.changeExtension(outputPath, newExtension);
|
||||
}
|
||||
function getOutputFileNames(inputFileName, configFile) {
|
||||
// outFile is handled elsewhere; .d.ts files don't generate outputs
|
||||
if (configFile.options.outFile || configFile.options.out || ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */)) {
|
||||
return ts.emptyArray;
|
||||
}
|
||||
var outputs = [];
|
||||
var js = getOutputJSFileName(inputFileName, configFile);
|
||||
outputs.push(js);
|
||||
if (configFile.options.sourceMap) {
|
||||
outputs.push(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile);
|
||||
outputs.push(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
outputs.push(dts + ".map");
|
||||
}
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
function getOutFileOutputs(project, ignoreBuildInfo) {
|
||||
ts.Debug.assert(!!project.options.outFile || !!project.options.out, "outFile must be set");
|
||||
var _a = ts.getOutputPathsForBundle(project.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
var outputs = [];
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
if (!ignoreBuildInfo)
|
||||
addOutput(buildInfoPath);
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
function rootDirOfOptions(opts, configFileName) {
|
||||
return opts.rootDir || ts.getDirectoryPath(configFileName);
|
||||
}
|
||||
function newer(date1, date2) {
|
||||
return date2 > date1 ? date2 : date1;
|
||||
}
|
||||
@@ -93797,7 +93852,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Collect the expected outputs of this project
|
||||
var outputs = getAllProjectOutputs(project);
|
||||
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
||||
if (outputs.length === 0) {
|
||||
return {
|
||||
type: UpToDateStatusType.ContainerOnly
|
||||
@@ -94230,7 +94285,7 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile)
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
diagnostics.removeKey(proj);
|
||||
projectStatus.setValue(proj, status);
|
||||
@@ -94312,12 +94367,12 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
oldestOutputFileName: ts.getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
|
||||
if (!skipOutputs || outputs.length !== skipOutputs.getSize()) {
|
||||
if (options.verbose) {
|
||||
reportStatus(verboseMessage, proj.options.configFilePath);
|
||||
@@ -94351,7 +94406,7 @@ var ts;
|
||||
reportParseConfigFileDiagnostic(proj);
|
||||
continue;
|
||||
}
|
||||
var outputs = getAllProjectOutputs(parsed);
|
||||
var outputs = ts.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
|
||||
for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
|
||||
var output = outputs_3[_b];
|
||||
if (host.fileExists(output)) {
|
||||
@@ -94501,36 +94556,6 @@ var ts;
|
||||
return ts.combinePaths(project, "tsconfig.json");
|
||||
}
|
||||
ts.resolveConfigFileProjectName = resolveConfigFileProjectName;
|
||||
function getAllProjectOutputs(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return getOutFileOutputs(project);
|
||||
}
|
||||
else {
|
||||
var outputs = [];
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
|
||||
}
|
||||
var buildInfoPath = ts.getOutputPathForBuildInfo(project.options);
|
||||
if (buildInfoPath)
|
||||
outputs.push(buildInfoPath);
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
function getFirstProjectOutput(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return ts.first(getOutFileOutputs(project));
|
||||
}
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
var outputs = getOutputFileNames(inputFile, project);
|
||||
if (outputs.length) {
|
||||
return ts.first(outputs);
|
||||
}
|
||||
}
|
||||
return ts.Debug.fail("project " + project.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
|
||||
switch (status.type) {
|
||||
case UpToDateStatusType.OutOfDateWithSelf:
|
||||
@@ -99301,6 +99326,14 @@ var ts;
|
||||
case 189 /* PropertyAccessExpression */:
|
||||
propertyAccessToConvert = parent;
|
||||
node = propertyAccessToConvert.expression;
|
||||
if (node.end === contextToken.pos &&
|
||||
ts.isCallExpression(node) &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) {
|
||||
// This is likely dot from incorrectly parsed call expression and user is starting to write spread
|
||||
// eg: Math.min(./**/)
|
||||
return undefined;
|
||||
}
|
||||
break;
|
||||
case 148 /* QualifiedName */:
|
||||
node = parent.left;
|
||||
@@ -99688,6 +99721,8 @@ var ts;
|
||||
return parentKind === 242 /* TypeAliasDeclaration */;
|
||||
case 119 /* AsKeyword */:
|
||||
return parentKind === 212 /* AsExpression */;
|
||||
case 86 /* ExtendsKeyword */:
|
||||
return parentKind === 150 /* TypeParameter */;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -101311,7 +101346,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* `import x = require("./x") or `import * as x from "./x"`.
|
||||
* `import x = require("./x")` or `import * as x from "./x"`.
|
||||
* An `export =` may be imported by this syntax, so it may be a direct import.
|
||||
* If it's not a direct import, it will be in `indirectUsers`, so we don't have to do anything here.
|
||||
*/
|
||||
@@ -102720,7 +102755,9 @@ var ts;
|
||||
}
|
||||
// For `export { foo as bar }`, rename `foo`, but not `bar`.
|
||||
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
|
||||
var exportKind = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */ ? 1 /* Default */ : 0 /* Named */;
|
||||
var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
|
||||
|| exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
|
||||
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
|
||||
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
|
||||
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
|
||||
searchForImportsOfExport(referenceLocation, exportSymbol, exportInfo, state);
|
||||
|
||||
@@ -4998,7 +4998,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries);
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
try {
|
||||
@@ -15864,7 +15864,7 @@ var ts;
|
||||
}
|
||||
ts.getRegexFromPattern = getRegexFromPattern;
|
||||
/** @param path directory of the tsconfig.json */
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) {
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
||||
path = ts.normalizePath(path);
|
||||
currentDirectory = ts.normalizePath(currentDirectory);
|
||||
var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
@@ -15874,12 +15874,18 @@ var ts;
|
||||
// Associate an array of results with each include regex. This keeps results in order of the "include" order.
|
||||
// If there are no "includes", then just put everything in results[0].
|
||||
var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
|
||||
var visited = ts.createMap();
|
||||
var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
|
||||
var basePath = _a[_i];
|
||||
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
||||
}
|
||||
return ts.flatten(results);
|
||||
function visitDirectory(path, absolutePath, depth) {
|
||||
var canonicalPath = toCanonical(realpath(absolutePath));
|
||||
if (visited.has(canonicalPath))
|
||||
return;
|
||||
visited.set(canonicalPath, true);
|
||||
var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
|
||||
var _loop_1 = function (current) {
|
||||
var name = combinePaths(path, current);
|
||||
@@ -40413,11 +40419,24 @@ var ts;
|
||||
var trueType = instantiateType(root.trueType, mapper);
|
||||
var falseType = instantiateType(root.falseType, mapper);
|
||||
var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result) {
|
||||
return result;
|
||||
if (conditionalTypes.has(instantiationId)) {
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
// Somehow the conditional type depends on itself - usually via `infer` types in the `extends` clause
|
||||
// paired with a (potentially deferred) circularly constrained type.
|
||||
// The conditional _must_ be deferred.
|
||||
var deferred = getDeferredConditionalType(root, mapper, /*combinedMapper*/ undefined, checkType, extendsType, trueType, falseType);
|
||||
conditionalTypes.set(instantiationId, deferred);
|
||||
return deferred;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, undefined);
|
||||
var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
|
||||
var cachedRecursiveResult = conditionalTypes.get(instantiationId);
|
||||
if (cachedRecursiveResult) {
|
||||
return cachedRecursiveResult;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, newResult);
|
||||
return newResult;
|
||||
}
|
||||
@@ -40479,6 +40498,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Return a deferred type for a check that is neither definitely true nor definitely false
|
||||
return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
|
||||
}
|
||||
function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
|
||||
var erasedCheckType = getActualTypeVariable(checkType);
|
||||
var result = createType(16777216 /* Conditional */);
|
||||
result.root = root;
|
||||
@@ -82934,6 +82956,84 @@ var ts;
|
||||
return ".js" /* Js */;
|
||||
}
|
||||
ts.getOutputExtension = getOutputExtension;
|
||||
function rootDirOfOptions(configFile) {
|
||||
return configFile.options.rootDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath));
|
||||
}
|
||||
/* @internal */
|
||||
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
|
||||
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(inputFileName));
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(outputPath, isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ?
|
||||
".jsx" /* Jsx */ :
|
||||
".js" /* Js */);
|
||||
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.assertDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
||||
outputFileName :
|
||||
undefined;
|
||||
}
|
||||
/*@internal*/
|
||||
function getAllProjectOutputs(configFile, ignoreCase) {
|
||||
var outputs;
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var _a = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
addOutput(buildInfoPath);
|
||||
}
|
||||
else {
|
||||
for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) {
|
||||
var inputFileName = _c[_b];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
addOutput(dts + ".map");
|
||||
}
|
||||
}
|
||||
}
|
||||
addOutput(getOutputPathForBuildInfo(configFile.options));
|
||||
}
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
/*@internal*/
|
||||
function getFirstProjectOutput(configFile, ignoreCase) {
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var jsFilePath = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false).jsFilePath;
|
||||
return ts.Debug.assertDefined(jsFilePath, "project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
||||
var inputFileName = _b[_a];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
}
|
||||
return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
ts.getFirstProjectOutput = getFirstProjectOutput;
|
||||
/*@internal*/
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
|
||||
@@ -87228,7 +87328,8 @@ var ts;
|
||||
writeFile: host.writeFile && writeFile,
|
||||
addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory,
|
||||
addOrDeleteFile: addOrDeleteFile,
|
||||
clearCache: clearCache
|
||||
clearCache: clearCache,
|
||||
realpath: host.realpath && realpath
|
||||
};
|
||||
function toPath(fileName) {
|
||||
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
@@ -87325,7 +87426,7 @@ var ts;
|
||||
var rootDirPath = toPath(rootDir);
|
||||
var result = tryReadDirectory(rootDir, rootDirPath);
|
||||
if (result) {
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries);
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
|
||||
}
|
||||
return host.readDirectory(rootDir, extensions, excludes, includes, depth);
|
||||
function getFileSystemEntries(dir) {
|
||||
@@ -87336,6 +87437,9 @@ var ts;
|
||||
return tryReadDirectory(dir, path) || ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function realpath(s) {
|
||||
return host.realpath ? host.realpath(s) : s;
|
||||
}
|
||||
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
||||
var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
||||
if (existingResult) {
|
||||
@@ -88236,7 +88340,7 @@ var ts;
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89577,7 +89681,7 @@ var ts;
|
||||
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
|
||||
return out ?
|
||||
ts.changeExtension(out, ".d.ts" /* Dts */) :
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine);
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
||||
}
|
||||
/**
|
||||
* Get the referenced project if the file is input file from that reference project
|
||||
@@ -93467,55 +93571,6 @@ var ts;
|
||||
function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
|
||||
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, ts.createMap);
|
||||
}
|
||||
function getOutputDeclarationFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
var newExtension = ts.fileExtensionIs(inputFileName, ".json" /* Json */) ? ".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ? ".jsx" /* Jsx */ : ".js" /* Js */;
|
||||
return ts.changeExtension(outputPath, newExtension);
|
||||
}
|
||||
function getOutputFileNames(inputFileName, configFile) {
|
||||
// outFile is handled elsewhere; .d.ts files don't generate outputs
|
||||
if (configFile.options.outFile || configFile.options.out || ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */)) {
|
||||
return ts.emptyArray;
|
||||
}
|
||||
var outputs = [];
|
||||
var js = getOutputJSFileName(inputFileName, configFile);
|
||||
outputs.push(js);
|
||||
if (configFile.options.sourceMap) {
|
||||
outputs.push(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile);
|
||||
outputs.push(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
outputs.push(dts + ".map");
|
||||
}
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
function getOutFileOutputs(project, ignoreBuildInfo) {
|
||||
ts.Debug.assert(!!project.options.outFile || !!project.options.out, "outFile must be set");
|
||||
var _a = ts.getOutputPathsForBundle(project.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
var outputs = [];
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
if (!ignoreBuildInfo)
|
||||
addOutput(buildInfoPath);
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
function rootDirOfOptions(opts, configFileName) {
|
||||
return opts.rootDir || ts.getDirectoryPath(configFileName);
|
||||
}
|
||||
function newer(date1, date2) {
|
||||
return date2 > date1 ? date2 : date1;
|
||||
}
|
||||
@@ -93788,7 +93843,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Collect the expected outputs of this project
|
||||
var outputs = getAllProjectOutputs(project);
|
||||
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
||||
if (outputs.length === 0) {
|
||||
return {
|
||||
type: UpToDateStatusType.ContainerOnly
|
||||
@@ -94221,7 +94276,7 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile)
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
diagnostics.removeKey(proj);
|
||||
projectStatus.setValue(proj, status);
|
||||
@@ -94303,12 +94358,12 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
oldestOutputFileName: ts.getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
|
||||
if (!skipOutputs || outputs.length !== skipOutputs.getSize()) {
|
||||
if (options.verbose) {
|
||||
reportStatus(verboseMessage, proj.options.configFilePath);
|
||||
@@ -94342,7 +94397,7 @@ var ts;
|
||||
reportParseConfigFileDiagnostic(proj);
|
||||
continue;
|
||||
}
|
||||
var outputs = getAllProjectOutputs(parsed);
|
||||
var outputs = ts.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
|
||||
for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
|
||||
var output = outputs_3[_b];
|
||||
if (host.fileExists(output)) {
|
||||
@@ -94492,36 +94547,6 @@ var ts;
|
||||
return ts.combinePaths(project, "tsconfig.json");
|
||||
}
|
||||
ts.resolveConfigFileProjectName = resolveConfigFileProjectName;
|
||||
function getAllProjectOutputs(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return getOutFileOutputs(project);
|
||||
}
|
||||
else {
|
||||
var outputs = [];
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
|
||||
}
|
||||
var buildInfoPath = ts.getOutputPathForBuildInfo(project.options);
|
||||
if (buildInfoPath)
|
||||
outputs.push(buildInfoPath);
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
function getFirstProjectOutput(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return ts.first(getOutFileOutputs(project));
|
||||
}
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
var outputs = getOutputFileNames(inputFile, project);
|
||||
if (outputs.length) {
|
||||
return ts.first(outputs);
|
||||
}
|
||||
}
|
||||
return ts.Debug.fail("project " + project.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
|
||||
switch (status.type) {
|
||||
case UpToDateStatusType.OutOfDateWithSelf:
|
||||
@@ -99292,6 +99317,14 @@ var ts;
|
||||
case 189 /* PropertyAccessExpression */:
|
||||
propertyAccessToConvert = parent;
|
||||
node = propertyAccessToConvert.expression;
|
||||
if (node.end === contextToken.pos &&
|
||||
ts.isCallExpression(node) &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) {
|
||||
// This is likely dot from incorrectly parsed call expression and user is starting to write spread
|
||||
// eg: Math.min(./**/)
|
||||
return undefined;
|
||||
}
|
||||
break;
|
||||
case 148 /* QualifiedName */:
|
||||
node = parent.left;
|
||||
@@ -99679,6 +99712,8 @@ var ts;
|
||||
return parentKind === 242 /* TypeAliasDeclaration */;
|
||||
case 119 /* AsKeyword */:
|
||||
return parentKind === 212 /* AsExpression */;
|
||||
case 86 /* ExtendsKeyword */:
|
||||
return parentKind === 150 /* TypeParameter */;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -101302,7 +101337,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* `import x = require("./x") or `import * as x from "./x"`.
|
||||
* `import x = require("./x")` or `import * as x from "./x"`.
|
||||
* An `export =` may be imported by this syntax, so it may be a direct import.
|
||||
* If it's not a direct import, it will be in `indirectUsers`, so we don't have to do anything here.
|
||||
*/
|
||||
@@ -102711,7 +102746,9 @@ var ts;
|
||||
}
|
||||
// For `export { foo as bar }`, rename `foo`, but not `bar`.
|
||||
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
|
||||
var exportKind = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */ ? 1 /* Default */ : 0 /* Named */;
|
||||
var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
|
||||
|| exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
|
||||
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
|
||||
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
|
||||
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
|
||||
searchForImportsOfExport(referenceLocation, exportSymbol, exportInfo, state);
|
||||
|
||||
@@ -4998,7 +4998,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries);
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
try {
|
||||
@@ -15864,7 +15864,7 @@ var ts;
|
||||
}
|
||||
ts.getRegexFromPattern = getRegexFromPattern;
|
||||
/** @param path directory of the tsconfig.json */
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) {
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
||||
path = ts.normalizePath(path);
|
||||
currentDirectory = ts.normalizePath(currentDirectory);
|
||||
var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
@@ -15874,12 +15874,18 @@ var ts;
|
||||
// Associate an array of results with each include regex. This keeps results in order of the "include" order.
|
||||
// If there are no "includes", then just put everything in results[0].
|
||||
var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
|
||||
var visited = ts.createMap();
|
||||
var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
|
||||
var basePath = _a[_i];
|
||||
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
||||
}
|
||||
return ts.flatten(results);
|
||||
function visitDirectory(path, absolutePath, depth) {
|
||||
var canonicalPath = toCanonical(realpath(absolutePath));
|
||||
if (visited.has(canonicalPath))
|
||||
return;
|
||||
visited.set(canonicalPath, true);
|
||||
var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
|
||||
var _loop_1 = function (current) {
|
||||
var name = combinePaths(path, current);
|
||||
@@ -40413,11 +40419,24 @@ var ts;
|
||||
var trueType = instantiateType(root.trueType, mapper);
|
||||
var falseType = instantiateType(root.falseType, mapper);
|
||||
var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result) {
|
||||
return result;
|
||||
if (conditionalTypes.has(instantiationId)) {
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
// Somehow the conditional type depends on itself - usually via `infer` types in the `extends` clause
|
||||
// paired with a (potentially deferred) circularly constrained type.
|
||||
// The conditional _must_ be deferred.
|
||||
var deferred = getDeferredConditionalType(root, mapper, /*combinedMapper*/ undefined, checkType, extendsType, trueType, falseType);
|
||||
conditionalTypes.set(instantiationId, deferred);
|
||||
return deferred;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, undefined);
|
||||
var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
|
||||
var cachedRecursiveResult = conditionalTypes.get(instantiationId);
|
||||
if (cachedRecursiveResult) {
|
||||
return cachedRecursiveResult;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, newResult);
|
||||
return newResult;
|
||||
}
|
||||
@@ -40479,6 +40498,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Return a deferred type for a check that is neither definitely true nor definitely false
|
||||
return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
|
||||
}
|
||||
function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
|
||||
var erasedCheckType = getActualTypeVariable(checkType);
|
||||
var result = createType(16777216 /* Conditional */);
|
||||
result.root = root;
|
||||
@@ -82934,6 +82956,84 @@ var ts;
|
||||
return ".js" /* Js */;
|
||||
}
|
||||
ts.getOutputExtension = getOutputExtension;
|
||||
function rootDirOfOptions(configFile) {
|
||||
return configFile.options.rootDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath));
|
||||
}
|
||||
/* @internal */
|
||||
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
|
||||
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(inputFileName));
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(outputPath, isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ?
|
||||
".jsx" /* Jsx */ :
|
||||
".js" /* Js */);
|
||||
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.assertDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
||||
outputFileName :
|
||||
undefined;
|
||||
}
|
||||
/*@internal*/
|
||||
function getAllProjectOutputs(configFile, ignoreCase) {
|
||||
var outputs;
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var _a = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
addOutput(buildInfoPath);
|
||||
}
|
||||
else {
|
||||
for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) {
|
||||
var inputFileName = _c[_b];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
addOutput(dts + ".map");
|
||||
}
|
||||
}
|
||||
}
|
||||
addOutput(getOutputPathForBuildInfo(configFile.options));
|
||||
}
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
/*@internal*/
|
||||
function getFirstProjectOutput(configFile, ignoreCase) {
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var jsFilePath = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false).jsFilePath;
|
||||
return ts.Debug.assertDefined(jsFilePath, "project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
||||
var inputFileName = _b[_a];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
}
|
||||
return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
ts.getFirstProjectOutput = getFirstProjectOutput;
|
||||
/*@internal*/
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
|
||||
@@ -87228,7 +87328,8 @@ var ts;
|
||||
writeFile: host.writeFile && writeFile,
|
||||
addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory,
|
||||
addOrDeleteFile: addOrDeleteFile,
|
||||
clearCache: clearCache
|
||||
clearCache: clearCache,
|
||||
realpath: host.realpath && realpath
|
||||
};
|
||||
function toPath(fileName) {
|
||||
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
@@ -87325,7 +87426,7 @@ var ts;
|
||||
var rootDirPath = toPath(rootDir);
|
||||
var result = tryReadDirectory(rootDir, rootDirPath);
|
||||
if (result) {
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries);
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
|
||||
}
|
||||
return host.readDirectory(rootDir, extensions, excludes, includes, depth);
|
||||
function getFileSystemEntries(dir) {
|
||||
@@ -87336,6 +87437,9 @@ var ts;
|
||||
return tryReadDirectory(dir, path) || ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function realpath(s) {
|
||||
return host.realpath ? host.realpath(s) : s;
|
||||
}
|
||||
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
||||
var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
||||
if (existingResult) {
|
||||
@@ -88236,7 +88340,7 @@ var ts;
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89577,7 +89681,7 @@ var ts;
|
||||
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
|
||||
return out ?
|
||||
ts.changeExtension(out, ".d.ts" /* Dts */) :
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine);
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
||||
}
|
||||
/**
|
||||
* Get the referenced project if the file is input file from that reference project
|
||||
@@ -93467,55 +93571,6 @@ var ts;
|
||||
function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
|
||||
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, ts.createMap);
|
||||
}
|
||||
function getOutputDeclarationFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
var newExtension = ts.fileExtensionIs(inputFileName, ".json" /* Json */) ? ".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ? ".jsx" /* Jsx */ : ".js" /* Js */;
|
||||
return ts.changeExtension(outputPath, newExtension);
|
||||
}
|
||||
function getOutputFileNames(inputFileName, configFile) {
|
||||
// outFile is handled elsewhere; .d.ts files don't generate outputs
|
||||
if (configFile.options.outFile || configFile.options.out || ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */)) {
|
||||
return ts.emptyArray;
|
||||
}
|
||||
var outputs = [];
|
||||
var js = getOutputJSFileName(inputFileName, configFile);
|
||||
outputs.push(js);
|
||||
if (configFile.options.sourceMap) {
|
||||
outputs.push(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile);
|
||||
outputs.push(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
outputs.push(dts + ".map");
|
||||
}
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
function getOutFileOutputs(project, ignoreBuildInfo) {
|
||||
ts.Debug.assert(!!project.options.outFile || !!project.options.out, "outFile must be set");
|
||||
var _a = ts.getOutputPathsForBundle(project.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
var outputs = [];
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
if (!ignoreBuildInfo)
|
||||
addOutput(buildInfoPath);
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
function rootDirOfOptions(opts, configFileName) {
|
||||
return opts.rootDir || ts.getDirectoryPath(configFileName);
|
||||
}
|
||||
function newer(date1, date2) {
|
||||
return date2 > date1 ? date2 : date1;
|
||||
}
|
||||
@@ -93788,7 +93843,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Collect the expected outputs of this project
|
||||
var outputs = getAllProjectOutputs(project);
|
||||
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
||||
if (outputs.length === 0) {
|
||||
return {
|
||||
type: UpToDateStatusType.ContainerOnly
|
||||
@@ -94221,7 +94276,7 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile)
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
diagnostics.removeKey(proj);
|
||||
projectStatus.setValue(proj, status);
|
||||
@@ -94303,12 +94358,12 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
oldestOutputFileName: ts.getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
|
||||
if (!skipOutputs || outputs.length !== skipOutputs.getSize()) {
|
||||
if (options.verbose) {
|
||||
reportStatus(verboseMessage, proj.options.configFilePath);
|
||||
@@ -94342,7 +94397,7 @@ var ts;
|
||||
reportParseConfigFileDiagnostic(proj);
|
||||
continue;
|
||||
}
|
||||
var outputs = getAllProjectOutputs(parsed);
|
||||
var outputs = ts.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
|
||||
for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
|
||||
var output = outputs_3[_b];
|
||||
if (host.fileExists(output)) {
|
||||
@@ -94492,36 +94547,6 @@ var ts;
|
||||
return ts.combinePaths(project, "tsconfig.json");
|
||||
}
|
||||
ts.resolveConfigFileProjectName = resolveConfigFileProjectName;
|
||||
function getAllProjectOutputs(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return getOutFileOutputs(project);
|
||||
}
|
||||
else {
|
||||
var outputs = [];
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
|
||||
}
|
||||
var buildInfoPath = ts.getOutputPathForBuildInfo(project.options);
|
||||
if (buildInfoPath)
|
||||
outputs.push(buildInfoPath);
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
function getFirstProjectOutput(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return ts.first(getOutFileOutputs(project));
|
||||
}
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
var outputs = getOutputFileNames(inputFile, project);
|
||||
if (outputs.length) {
|
||||
return ts.first(outputs);
|
||||
}
|
||||
}
|
||||
return ts.Debug.fail("project " + project.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
|
||||
switch (status.type) {
|
||||
case UpToDateStatusType.OutOfDateWithSelf:
|
||||
@@ -99292,6 +99317,14 @@ var ts;
|
||||
case 189 /* PropertyAccessExpression */:
|
||||
propertyAccessToConvert = parent;
|
||||
node = propertyAccessToConvert.expression;
|
||||
if (node.end === contextToken.pos &&
|
||||
ts.isCallExpression(node) &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) {
|
||||
// This is likely dot from incorrectly parsed call expression and user is starting to write spread
|
||||
// eg: Math.min(./**/)
|
||||
return undefined;
|
||||
}
|
||||
break;
|
||||
case 148 /* QualifiedName */:
|
||||
node = parent.left;
|
||||
@@ -99679,6 +99712,8 @@ var ts;
|
||||
return parentKind === 242 /* TypeAliasDeclaration */;
|
||||
case 119 /* AsKeyword */:
|
||||
return parentKind === 212 /* AsExpression */;
|
||||
case 86 /* ExtendsKeyword */:
|
||||
return parentKind === 150 /* TypeParameter */;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -101302,7 +101337,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* `import x = require("./x") or `import * as x from "./x"`.
|
||||
* `import x = require("./x")` or `import * as x from "./x"`.
|
||||
* An `export =` may be imported by this syntax, so it may be a direct import.
|
||||
* If it's not a direct import, it will be in `indirectUsers`, so we don't have to do anything here.
|
||||
*/
|
||||
@@ -102711,7 +102746,9 @@ var ts;
|
||||
}
|
||||
// For `export { foo as bar }`, rename `foo`, but not `bar`.
|
||||
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
|
||||
var exportKind = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */ ? 1 /* Default */ : 0 /* Named */;
|
||||
var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
|
||||
|| exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
|
||||
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
|
||||
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
|
||||
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
|
||||
searchForImportsOfExport(referenceLocation, exportSymbol, exportInfo, state);
|
||||
|
||||
@@ -4999,7 +4999,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries);
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
try {
|
||||
@@ -15865,7 +15865,7 @@ var ts;
|
||||
}
|
||||
ts.getRegexFromPattern = getRegexFromPattern;
|
||||
/** @param path directory of the tsconfig.json */
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) {
|
||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
|
||||
path = ts.normalizePath(path);
|
||||
currentDirectory = ts.normalizePath(currentDirectory);
|
||||
var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
@@ -15875,12 +15875,18 @@ var ts;
|
||||
// Associate an array of results with each include regex. This keeps results in order of the "include" order.
|
||||
// If there are no "includes", then just put everything in results[0].
|
||||
var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
|
||||
var visited = ts.createMap();
|
||||
var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
|
||||
var basePath = _a[_i];
|
||||
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
||||
}
|
||||
return ts.flatten(results);
|
||||
function visitDirectory(path, absolutePath, depth) {
|
||||
var canonicalPath = toCanonical(realpath(absolutePath));
|
||||
if (visited.has(canonicalPath))
|
||||
return;
|
||||
visited.set(canonicalPath, true);
|
||||
var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
|
||||
var _loop_1 = function (current) {
|
||||
var name = combinePaths(path, current);
|
||||
@@ -40414,11 +40420,24 @@ var ts;
|
||||
var trueType = instantiateType(root.trueType, mapper);
|
||||
var falseType = instantiateType(root.falseType, mapper);
|
||||
var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result) {
|
||||
return result;
|
||||
if (conditionalTypes.has(instantiationId)) {
|
||||
var result = conditionalTypes.get(instantiationId);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
// Somehow the conditional type depends on itself - usually via `infer` types in the `extends` clause
|
||||
// paired with a (potentially deferred) circularly constrained type.
|
||||
// The conditional _must_ be deferred.
|
||||
var deferred = getDeferredConditionalType(root, mapper, /*combinedMapper*/ undefined, checkType, extendsType, trueType, falseType);
|
||||
conditionalTypes.set(instantiationId, deferred);
|
||||
return deferred;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, undefined);
|
||||
var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
|
||||
var cachedRecursiveResult = conditionalTypes.get(instantiationId);
|
||||
if (cachedRecursiveResult) {
|
||||
return cachedRecursiveResult;
|
||||
}
|
||||
conditionalTypes.set(instantiationId, newResult);
|
||||
return newResult;
|
||||
}
|
||||
@@ -40480,6 +40499,9 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Return a deferred type for a check that is neither definitely true nor definitely false
|
||||
return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
|
||||
}
|
||||
function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
|
||||
var erasedCheckType = getActualTypeVariable(checkType);
|
||||
var result = createType(16777216 /* Conditional */);
|
||||
result.root = root;
|
||||
@@ -82935,6 +82957,84 @@ var ts;
|
||||
return ".js" /* Js */;
|
||||
}
|
||||
ts.getOutputExtension = getOutputExtension;
|
||||
function rootDirOfOptions(configFile) {
|
||||
return configFile.options.rootDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath));
|
||||
}
|
||||
/* @internal */
|
||||
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
|
||||
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(inputFileName));
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile), inputFileName, ignoreCase);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(ts.Debug.assertDefined(configFile.options.configFilePath)), relativePath);
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(outputPath, isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ?
|
||||
".jsx" /* Jsx */ :
|
||||
".js" /* Js */);
|
||||
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.assertDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
||||
outputFileName :
|
||||
undefined;
|
||||
}
|
||||
/*@internal*/
|
||||
function getAllProjectOutputs(configFile, ignoreCase) {
|
||||
var outputs;
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var _a = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
addOutput(buildInfoPath);
|
||||
}
|
||||
else {
|
||||
for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) {
|
||||
var inputFileName = _c[_b];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
addOutput(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
addOutput(dts + ".map");
|
||||
}
|
||||
}
|
||||
}
|
||||
addOutput(getOutputPathForBuildInfo(configFile.options));
|
||||
}
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
/*@internal*/
|
||||
function getFirstProjectOutput(configFile, ignoreCase) {
|
||||
if (configFile.options.outFile || configFile.options.out) {
|
||||
var jsFilePath = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false).jsFilePath;
|
||||
return ts.Debug.assertDefined(jsFilePath, "project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
||||
var inputFileName = _b[_a];
|
||||
if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
|
||||
continue;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
}
|
||||
return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
ts.getFirstProjectOutput = getFirstProjectOutput;
|
||||
/*@internal*/
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
|
||||
@@ -87229,7 +87329,8 @@ var ts;
|
||||
writeFile: host.writeFile && writeFile,
|
||||
addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory,
|
||||
addOrDeleteFile: addOrDeleteFile,
|
||||
clearCache: clearCache
|
||||
clearCache: clearCache,
|
||||
realpath: host.realpath && realpath
|
||||
};
|
||||
function toPath(fileName) {
|
||||
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
@@ -87326,7 +87427,7 @@ var ts;
|
||||
var rootDirPath = toPath(rootDir);
|
||||
var result = tryReadDirectory(rootDir, rootDirPath);
|
||||
if (result) {
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries);
|
||||
return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
|
||||
}
|
||||
return host.readDirectory(rootDir, extensions, excludes, includes, depth);
|
||||
function getFileSystemEntries(dir) {
|
||||
@@ -87337,6 +87438,9 @@ var ts;
|
||||
return tryReadDirectory(dir, path) || ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function realpath(s) {
|
||||
return host.realpath ? host.realpath(s) : s;
|
||||
}
|
||||
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
||||
var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
||||
if (existingResult) {
|
||||
@@ -88237,7 +88341,7 @@ var ts;
|
||||
for (var _a = 0, _b = parsedRef.commandLine.fileNames; _a < _b.length; _a++) {
|
||||
var fileName = _b[_a];
|
||||
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && ts.hasTSFileExtension(fileName)) {
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89578,7 +89682,7 @@ var ts;
|
||||
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
|
||||
return out ?
|
||||
ts.changeExtension(out, ".d.ts" /* Dts */) :
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine);
|
||||
ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
||||
}
|
||||
/**
|
||||
* Get the referenced project if the file is input file from that reference project
|
||||
@@ -93468,55 +93572,6 @@ var ts;
|
||||
function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
|
||||
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, ts.createMap);
|
||||
}
|
||||
function getOutputDeclarationFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.declarationDir || configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
return ts.changeExtension(outputPath, ".d.ts" /* Dts */);
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile) {
|
||||
var relativePath = ts.getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
|
||||
var outputPath = ts.resolvePath(configFile.options.outDir || ts.getDirectoryPath(configFile.options.configFilePath), relativePath);
|
||||
var newExtension = ts.fileExtensionIs(inputFileName, ".json" /* Json */) ? ".json" /* Json */ :
|
||||
ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) && configFile.options.jsx === 1 /* Preserve */ ? ".jsx" /* Jsx */ : ".js" /* Js */;
|
||||
return ts.changeExtension(outputPath, newExtension);
|
||||
}
|
||||
function getOutputFileNames(inputFileName, configFile) {
|
||||
// outFile is handled elsewhere; .d.ts files don't generate outputs
|
||||
if (configFile.options.outFile || configFile.options.out || ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */)) {
|
||||
return ts.emptyArray;
|
||||
}
|
||||
var outputs = [];
|
||||
var js = getOutputJSFileName(inputFileName, configFile);
|
||||
outputs.push(js);
|
||||
if (configFile.options.sourceMap) {
|
||||
outputs.push(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */)) {
|
||||
var dts = getOutputDeclarationFileName(inputFileName, configFile);
|
||||
outputs.push(dts);
|
||||
if (configFile.options.declarationMap) {
|
||||
outputs.push(dts + ".map");
|
||||
}
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
function getOutFileOutputs(project, ignoreBuildInfo) {
|
||||
ts.Debug.assert(!!project.options.outFile || !!project.options.out, "outFile must be set");
|
||||
var _a = ts.getOutputPathsForBundle(project.options, /*forceDtsPaths*/ false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
||||
var outputs = [];
|
||||
var addOutput = function (path) { return path && (outputs || (outputs = [])).push(path); };
|
||||
addOutput(jsFilePath);
|
||||
addOutput(sourceMapFilePath);
|
||||
addOutput(declarationFilePath);
|
||||
addOutput(declarationMapPath);
|
||||
if (!ignoreBuildInfo)
|
||||
addOutput(buildInfoPath);
|
||||
return outputs || ts.emptyArray;
|
||||
}
|
||||
function rootDirOfOptions(opts, configFileName) {
|
||||
return opts.rootDir || ts.getDirectoryPath(configFileName);
|
||||
}
|
||||
function newer(date1, date2) {
|
||||
return date2 > date1 ? date2 : date1;
|
||||
}
|
||||
@@ -93789,7 +93844,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
// Collect the expected outputs of this project
|
||||
var outputs = getAllProjectOutputs(project);
|
||||
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
||||
if (outputs.length === 0) {
|
||||
return {
|
||||
type: UpToDateStatusType.ContainerOnly
|
||||
@@ -94222,7 +94277,7 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile)
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
diagnostics.removeKey(proj);
|
||||
projectStatus.setValue(proj, status);
|
||||
@@ -94304,12 +94359,12 @@ var ts;
|
||||
var status = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
oldestOutputFileName: ts.getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames())
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath, status);
|
||||
}
|
||||
function updateOutputTimestampsWorker(proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
|
||||
var outputs = getAllProjectOutputs(proj);
|
||||
var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
|
||||
if (!skipOutputs || outputs.length !== skipOutputs.getSize()) {
|
||||
if (options.verbose) {
|
||||
reportStatus(verboseMessage, proj.options.configFilePath);
|
||||
@@ -94343,7 +94398,7 @@ var ts;
|
||||
reportParseConfigFileDiagnostic(proj);
|
||||
continue;
|
||||
}
|
||||
var outputs = getAllProjectOutputs(parsed);
|
||||
var outputs = ts.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
|
||||
for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
|
||||
var output = outputs_3[_b];
|
||||
if (host.fileExists(output)) {
|
||||
@@ -94493,36 +94548,6 @@ var ts;
|
||||
return ts.combinePaths(project, "tsconfig.json");
|
||||
}
|
||||
ts.resolveConfigFileProjectName = resolveConfigFileProjectName;
|
||||
function getAllProjectOutputs(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return getOutFileOutputs(project);
|
||||
}
|
||||
else {
|
||||
var outputs = [];
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
|
||||
}
|
||||
var buildInfoPath = ts.getOutputPathForBuildInfo(project.options);
|
||||
if (buildInfoPath)
|
||||
outputs.push(buildInfoPath);
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
ts.getAllProjectOutputs = getAllProjectOutputs;
|
||||
function getFirstProjectOutput(project) {
|
||||
if (project.options.outFile || project.options.out) {
|
||||
return ts.first(getOutFileOutputs(project));
|
||||
}
|
||||
for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
|
||||
var inputFile = _a[_i];
|
||||
var outputs = getOutputFileNames(inputFile, project);
|
||||
if (outputs.length) {
|
||||
return ts.first(outputs);
|
||||
}
|
||||
}
|
||||
return ts.Debug.fail("project " + project.options.configFilePath + " expected to have at least one output");
|
||||
}
|
||||
function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
|
||||
switch (status.type) {
|
||||
case UpToDateStatusType.OutOfDateWithSelf:
|
||||
|
||||
Reference in New Issue
Block a user