@@ -13051,30 +13051,31 @@ var ts;
1305113051 * @param host An EmitHost.
1305213052 * @param targetSourceFile An optional target source file to emit.
1305313053 */
13054- function getSourceFilesToEmit(host, targetSourceFile) {
13054+ function getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit ) {
1305513055 var options = host.getCompilerOptions();
13056- var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); };
13057- var getResolvedProjectReferenceToRedirect = function (fileName) { return host.getResolvedProjectReferenceToRedirect(fileName); };
1305813056 if (options.outFile || options.out) {
1305913057 var moduleKind = ts.getEmitModuleKind(options);
1306013058 var moduleEmitEnabled_1 = options.emitDeclarationOnly || moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;
1306113059 // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified
1306213060 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);
1306413063 });
1306513064 }
1306613065 else {
1306713066 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 ); });
1306913068 }
1307013069 }
1307113070 ts.getSourceFilesToEmit = getSourceFilesToEmit;
1307213071 /** 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();
1307413074 return !(options.noEmitForJsFiles && isSourceFileJS(sourceFile)) &&
1307513075 !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));
1307813079 }
1307913080 ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted;
1308013081 function getSourceFilePathInNewDir(fileName, host, newDirPath) {
@@ -42703,7 +42704,8 @@ var ts;
4270342704 }
4270442705 var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
4270542706 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)) {
4270742709 typeType = getTypeReferenceType(node, valueType.symbol);
4270842710 }
4270942711 }
@@ -89389,7 +89391,7 @@ var ts;
8938989391 */
8939089392 function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo) {
8939189393 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 );
8939389395 var options = host.getCompilerOptions();
8939489396 if (options.outFile || options.out) {
8939589397 var prepends = host.getPrependNodes();
@@ -89633,7 +89635,7 @@ var ts;
8963389635 var exportedModulesFromDeclarationEmit;
8963489636 // Emit each output file
8963589637 enter();
89636- forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
89638+ forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit ), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
8963789639 exit();
8963889640 return {
8963989641 emitSkipped: emitSkipped,
@@ -90021,6 +90023,7 @@ var ts;
9002190023 getLibFileFromReference: ts.notImplemented,
9002290024 isSourceFileFromExternalLibrary: ts.returnFalse,
9002390025 getResolvedProjectReferenceToRedirect: ts.returnUndefined,
90026+ isSourceOfProjectReferenceRedirect: ts.returnFalse,
9002490027 writeFile: function (name, text, writeByteOrderMark) {
9002590028 switch (name) {
9002690029 case jsFilePath:
@@ -95137,14 +95140,9 @@ var ts;
9513795140 function toPath(fileName) {
9513895141 return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
9513995142 }
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- }
9514595143 function getCommonSourceDirectory() {
9514695144 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 ); });
9514895146 if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) {
9514995147 // If a rootDir is specified use it as the commonSourceDirectory
9515095148 commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory);
@@ -95547,6 +95545,7 @@ var ts;
9554795545 return __assign(__assign({ getPrependNodes: getPrependNodes,
9554895546 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,
9554995547 getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
95548+ isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
9555095549 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) {
9555195550 // Use local caches
9555295551 var path = toPath(f);
@@ -96767,7 +96766,7 @@ var ts;
9676796766 for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
9676896767 var file = files_3[_i];
9676996768 // Ignore file that is not emitted
96770- if (isValidSourceFileForEmit (file) && !rootPaths.has(file.path)) {
96769+ if (ts.sourceFileMayBeEmitted (file, program ) && !rootPaths.has(file.path)) {
9677196770 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 || "");
9677296771 }
9677396772 }
@@ -135732,7 +135731,11 @@ var ts;
135732135731 ConfiguredProject.prototype.directoryExistsIfProjectReferenceDeclDir = function (dir) {
135733135732 var dirPath = this.toPath(dir);
135734135733 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 + "/"); });
135736135739 };
135737135740 /**
135738135741 * This implementation of directoryExists checks if the directory being requested is
@@ -135767,6 +135770,15 @@ var ts;
135767135770 }
135768135771 return this.fileOrDirectoryExistsUsingSource(path, /*isFile*/ false);
135769135772 };
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+ };
135770135782 ConfiguredProject.prototype.realpathIfSymlinkedProjectReferenceDts = function (s) {
135771135783 return this.symlinkedFiles && this.symlinkedFiles.get(this.toPath(s));
135772135784 };
@@ -135785,7 +135797,7 @@ var ts;
135785135797 var directoryPath = ts.ensureTrailingDirectorySeparator(this.toPath(directory));
135786135798 if (this.symlinkedDirectories.has(directoryPath))
135787135799 return;
135788- var real = this.projectService.host.realpath(directory);
135800+ var real = ts.normalizePath( this.projectService.host.realpath(directory) );
135789135801 var realPath;
135790135802 if (real === directory ||
135791135803 (realPath = ts.ensureTrailingDirectorySeparator(this.toPath(real))) === directoryPath) {
0 commit comments