@@ -13051,30 +13051,31 @@ var ts;
13051
13051
* @param host An EmitHost.
13052
13052
* @param targetSourceFile An optional target source file to emit.
13053
13053
*/
13054
- function getSourceFilesToEmit(host, targetSourceFile) {
13054
+ function getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit ) {
13055
13055
var options = host.getCompilerOptions();
13056
- var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); };
13057
- var getResolvedProjectReferenceToRedirect = function (fileName) { return host.getResolvedProjectReferenceToRedirect(fileName); };
13058
13056
if (options.outFile || options.out) {
13059
13057
var moduleKind = ts.getEmitModuleKind(options);
13060
13058
var moduleEmitEnabled_1 = options.emitDeclarationOnly || moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;
13061
13059
// Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified
13062
13060
return ts.filter(host.getSourceFiles(), function (sourceFile) {
13063
- return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect);
13061
+ return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) &&
13062
+ sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit);
13064
13063
});
13065
13064
}
13066
13065
else {
13067
13066
var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
13068
- return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect ); });
13067
+ return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit ); });
13069
13068
}
13070
13069
}
13071
13070
ts.getSourceFilesToEmit = getSourceFilesToEmit;
13072
13071
/** Don't call this for `--outFile`, just for `--outDir` or plain emit. `--outFile` needs additional checks. */
13073
- function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect) {
13072
+ function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) {
13073
+ var options = host.getCompilerOptions();
13074
13074
return !(options.noEmitForJsFiles && isSourceFileJS(sourceFile)) &&
13075
13075
!sourceFile.isDeclarationFile &&
13076
- !isSourceFileFromExternalLibrary(sourceFile) &&
13077
- !(isJsonSourceFile(sourceFile) && getResolvedProjectReferenceToRedirect(sourceFile.fileName));
13076
+ !host.isSourceFileFromExternalLibrary(sourceFile) &&
13077
+ !(isJsonSourceFile(sourceFile) && host.getResolvedProjectReferenceToRedirect(sourceFile.fileName)) &&
13078
+ (forceDtsEmit || !host.isSourceOfProjectReferenceRedirect(sourceFile.fileName));
13078
13079
}
13079
13080
ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted;
13080
13081
function getSourceFilePathInNewDir(fileName, host, newDirPath) {
@@ -42703,7 +42704,8 @@ var ts;
42703
42704
}
42704
42705
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
42705
42706
var isImportTypeWithQualifier = node.kind === 187 /* ImportType */ && node.qualifier;
42706
- if (isRequireAlias || isImportTypeWithQualifier || isDelayedMergeClass) {
42707
+ // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL}
42708
+ if (valueType.symbol && (isRequireAlias || isImportTypeWithQualifier || isDelayedMergeClass)) {
42707
42709
typeType = getTypeReferenceType(node, valueType.symbol);
42708
42710
}
42709
42711
}
@@ -89389,7 +89391,7 @@ var ts;
89389
89391
*/
89390
89392
function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo) {
89391
89393
if (forceDtsEmit === void 0) { forceDtsEmit = false; }
89392
- var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile);
89394
+ var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit );
89393
89395
var options = host.getCompilerOptions();
89394
89396
if (options.outFile || options.out) {
89395
89397
var prepends = host.getPrependNodes();
@@ -89633,7 +89635,7 @@ var ts;
89633
89635
var exportedModulesFromDeclarationEmit;
89634
89636
// Emit each output file
89635
89637
enter();
89636
- forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
89638
+ forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit ), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
89637
89639
exit();
89638
89640
return {
89639
89641
emitSkipped: emitSkipped,
@@ -90021,6 +90023,7 @@ var ts;
90021
90023
getLibFileFromReference: ts.notImplemented,
90022
90024
isSourceFileFromExternalLibrary: ts.returnFalse,
90023
90025
getResolvedProjectReferenceToRedirect: ts.returnUndefined,
90026
+ isSourceOfProjectReferenceRedirect: ts.returnFalse,
90024
90027
writeFile: function (name, text, writeByteOrderMark) {
90025
90028
switch (name) {
90026
90029
case jsFilePath:
@@ -95137,14 +95140,9 @@ var ts;
95137
95140
function toPath(fileName) {
95138
95141
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
95139
95142
}
95140
- function isValidSourceFileForEmit(file) {
95141
- // source file is allowed to be emitted and its not source of project reference redirect
95142
- return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect) &&
95143
- !isSourceOfProjectReferenceRedirect(file.fileName);
95144
- }
95145
95143
function getCommonSourceDirectory() {
95146
95144
if (commonSourceDirectory === undefined) {
95147
- var emittedFiles = ts.filter(files, function (file) { return isValidSourceFileForEmit (file); });
95145
+ var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted (file, program ); });
95148
95146
if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) {
95149
95147
// If a rootDir is specified use it as the commonSourceDirectory
95150
95148
commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory);
@@ -95547,6 +95545,7 @@ var ts;
95547
95545
return __assign(__assign({ getPrependNodes: getPrependNodes,
95548
95546
getCanonicalFileName: getCanonicalFileName, getCommonSourceDirectory: program.getCommonSourceDirectory, getCompilerOptions: program.getCompilerOptions, getCurrentDirectory: function () { return currentDirectory; }, getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, getLibFileFromReference: program.getLibFileFromReference, isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
95549
95547
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
95548
+ isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
95550
95549
getProbableSymlinks: getProbableSymlinks, writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), isEmitBlocked: isEmitBlocked, readFile: function (f) { return host.readFile(f); }, fileExists: function (f) {
95551
95550
// Use local caches
95552
95551
var path = toPath(f);
@@ -96767,7 +96766,7 @@ var ts;
96767
96766
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
96768
96767
var file = files_3[_i];
96769
96768
// Ignore file that is not emitted
96770
- if (isValidSourceFileForEmit (file) && !rootPaths.has(file.path)) {
96769
+ if (ts.sourceFileMayBeEmitted (file, program ) && !rootPaths.has(file.path)) {
96771
96770
addProgramDiagnosticAtRefPath(file, rootPaths, ts.Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName, options.configFilePath || "");
96772
96771
}
96773
96772
}
@@ -135732,7 +135731,11 @@ var ts;
135732
135731
ConfiguredProject.prototype.directoryExistsIfProjectReferenceDeclDir = function (dir) {
135733
135732
var dirPath = this.toPath(dir);
135734
135733
var dirPathWithTrailingDirectorySeparator = "" + dirPath + ts.directorySeparator;
135735
- return ts.forEachKey(this.mapOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath || ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator); });
135734
+ return ts.forEachKey(this.mapOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath ||
135735
+ // Any parent directory of declaration dir
135736
+ ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) ||
135737
+ // Any directory inside declaration dir
135738
+ ts.startsWith(dirPath, declDirPath + "/"); });
135736
135739
};
135737
135740
/**
135738
135741
* This implementation of directoryExists checks if the directory being requested is
@@ -135767,6 +135770,15 @@ var ts;
135767
135770
}
135768
135771
return this.fileOrDirectoryExistsUsingSource(path, /*isFile*/ false);
135769
135772
};
135773
+ /**
135774
+ * Call super.getDirectories only if directory actually present on the host
135775
+ * This is needed to ensure that we arent getting directories that we fake about presence for
135776
+ */
135777
+ ConfiguredProject.prototype.getDirectories = function (path) {
135778
+ return !this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks || _super.prototype.directoryExists.call(this, path) ?
135779
+ _super.prototype.getDirectories.call(this, path) :
135780
+ [];
135781
+ };
135770
135782
ConfiguredProject.prototype.realpathIfSymlinkedProjectReferenceDts = function (s) {
135771
135783
return this.symlinkedFiles && this.symlinkedFiles.get(this.toPath(s));
135772
135784
};
@@ -135785,7 +135797,7 @@ var ts;
135785
135797
var directoryPath = ts.ensureTrailingDirectorySeparator(this.toPath(directory));
135786
135798
if (this.symlinkedDirectories.has(directoryPath))
135787
135799
return;
135788
- var real = this.projectService.host.realpath(directory);
135800
+ var real = ts.normalizePath( this.projectService.host.realpath(directory) );
135789
135801
var realPath;
135790
135802
if (real === directory ||
135791
135803
(realPath = ts.ensureTrailingDirectorySeparator(this.toPath(real))) === directoryPath) {
0 commit comments