diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c56debdf251c5..2e4492efa7b14 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1383,7 +1383,7 @@ namespace ts { getSourceFile: program.getSourceFile, getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, - isSourceFileFromNodeModules: (file: SourceFile) => !!lookUp(sourceFilesFoundSearchingNodeModules, file.path), + isSourceFileFromExternalLibrary: (file: SourceFile) => !!lookUp(sourceFilesFoundSearchingNodeModules, file.path), writeFile: writeFileCallback || ( (fileName, data, writeByteOrderMark, onError, sourceFiles) => host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles)), isEmitBlocked, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e4111e3f92563..7892af6624f3c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -36,7 +36,7 @@ namespace ts { getSourceFiles(): SourceFile[]; /* @internal */ - isSourceFileFromNodeModules(file: SourceFile): boolean; + isSourceFileFromExternalLibrary(file: SourceFile): boolean; getCommonSourceDirectory(): string; getCanonicalFileName(fileName: string): string; @@ -2279,7 +2279,7 @@ namespace ts { const sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; for (const sourceFile of sourceFiles) { // Don't emit if source file is a declaration file, or was located under node_modules - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromNodeModules(sourceFile)) { + if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { onSingleFileEmit(host, sourceFile); } } @@ -2315,7 +2315,7 @@ namespace ts { // --module or --target es6 specified. Files included by searching under node_modules are also not emitted. const bundledSources = filter(host.getSourceFiles(), sourceFile => !isDeclarationFile(sourceFile) && - !host.isSourceFileFromNodeModules(sourceFile) && + !host.isSourceFileFromExternalLibrary(sourceFile) && (!isExternalModule(sourceFile) || !!getEmitModuleKind(options))); if (bundledSources.length) {