Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't emit any source files found under node_modules #9421

Merged
merged 5 commits into from
Jul 1, 2016

Conversation

billti
Copy link
Member

@billti billti commented Jun 29, 2016

This fixes #6964 to suppress emit for any source files located by searching in node_modules, not just JavaScript files.

@@ -1378,7 +1378,7 @@ namespace ts {
getSourceFile: program.getSourceFile,
getSourceFileByPath: program.getSourceFileByPath,
getSourceFiles: program.getSourceFiles,
getFilesFromNodeModules: () => jsFilesFoundSearchingNodeModules,
isSourceFileFromNodeModules: (file: SourceFile) => !!lookUp(sourceFilesFoundSearchingNodeModules, file.path),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have isExternalLibraryImport, so why not call this isSourceFileFromExternalLibrary ?

@mhegazy
Copy link
Contributor

mhegazy commented Jun 29, 2016

👍

@billti
Copy link
Member Author

billti commented Jun 30, 2016

Added fix for #9427, which was caused by related changes for JavaScript. Also changed the API per @mhegazy 's suggestion.

@billti
Copy link
Member Author

billti commented Jun 30, 2016

Hmmm, must have missed a test file in a commit... all passed on my machine. Will take a look shortly.

@@ -1,4 +1,5 @@
maxDepthIncreased/root.ts(4,1): error TS2322: Type 'string' is not assignable to type 'number'.
maxDepthIncreased/root.ts(7,1): error TS2322: Type 'string' is not assignable to type 'number'.
maxDepthIncreased/root.ts(8,13): error TS2339: Property 'test' does not exist on type 'typeof "C:/src/TypeScript/tests/cases/projects/NodeModulesSearch/maxDepthIncreased/node_modules/@...'.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing the issue in the GitHub build... need to figure out where the full path is creeping in to the error message.

@billti
Copy link
Member Author

billti commented Jun 30, 2016

I removed that one check causing the full path to be in the error for now. The subsequent line would be in error if the wrong file was referenced anyway, so this doesn't really lose any coverage. Hopefully the tests will be green on the CI server (eventually 😩 ) after this change.

@billti billti merged commit 613e2d3 into master Jul 1, 2016
@billti billti deleted the dontEmitNodeModules branch July 1, 2016 02:47
billti added a commit that referenced this pull request Jul 1, 2016
Port #9421 to not compile files under from node_modules
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discovering .ts files under node_modules resulting in them being compiled
4 participants