{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6964","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6964/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6964/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6964/events","html_url":"https://github.com/Microsoft/TypeScript/issues/6964","id":132211970,"number":6964,"title":"Discovering .ts files under node_modules resulting in them being compiled","user":{"login":"billti","id":993909,"avatar_url":"https://avatars.githubusercontent.com/u/993909?v=3","gravatar_id":"","url":"https://api.github.com/users/billti","html_url":"https://github.com/billti","followers_url":"https://api.github.com/users/billti/followers","following_url":"https://api.github.com/users/billti/following{/other_user}","gists_url":"https://api.github.com/users/billti/gists{/gist_id}","starred_url":"https://api.github.com/users/billti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billti/subscriptions","organizations_url":"https://api.github.com/users/billti/orgs","repos_url":"https://api.github.com/users/billti/repos","events_url":"https://api.github.com/users/billti/events{/privacy}","received_events_url":"https://api.github.com/users/billti/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Fixed","name":"Fixed","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":{"login":"billti","id":993909,"avatar_url":"https://avatars.githubusercontent.com/u/993909?v=3","gravatar_id":"","url":"https://api.github.com/users/billti","html_url":"https://github.com/billti","followers_url":"https://api.github.com/users/billti/followers","following_url":"https://api.github.com/users/billti/following{/other_user}","gists_url":"https://api.github.com/users/billti/gists{/gist_id}","starred_url":"https://api.github.com/users/billti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billti/subscriptions","organizations_url":"https://api.github.com/users/billti/orgs","repos_url":"https://api.github.com/users/billti/repos","events_url":"https://api.github.com/users/billti/events{/privacy}","received_events_url":"https://api.github.com/users/billti/received_events","type":"User","site_admin":false},"assignees":[{"login":"billti","id":993909,"avatar_url":"https://avatars.githubusercontent.com/u/993909?v=3","gravatar_id":"","url":"https://api.github.com/users/billti","html_url":"https://github.com/billti","followers_url":"https://api.github.com/users/billti/followers","following_url":"https://api.github.com/users/billti/following{/other_user}","gists_url":"https://api.github.com/users/billti/gists{/gist_id}","starred_url":"https://api.github.com/users/billti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billti/subscriptions","organizations_url":"https://api.github.com/users/billti/orgs","repos_url":"https://api.github.com/users/billti/repos","events_url":"https://api.github.com/users/billti/events{/privacy}","received_events_url":"https://api.github.com/users/billti/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/1","html_url":"https://github.com/Microsoft/TypeScript/milestones/TypeScript%202.0","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/1/labels","id":721040,"number":1,"title":"TypeScript 2.0","description":"","creator":{"login":"RyanCavanaugh","id":6685088,"avatar_url":"https://avatars.githubusercontent.com/u/6685088?v=3","gravatar_id":"","url":"https://api.github.com/users/RyanCavanaugh","html_url":"https://github.com/RyanCavanaugh","followers_url":"https://api.github.com/users/RyanCavanaugh/followers","following_url":"https://api.github.com/users/RyanCavanaugh/following{/other_user}","gists_url":"https://api.github.com/users/RyanCavanaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanCavanaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanCavanaugh/subscriptions","organizations_url":"https://api.github.com/users/RyanCavanaugh/orgs","repos_url":"https://api.github.com/users/RyanCavanaugh/repos","events_url":"https://api.github.com/users/RyanCavanaugh/events{/privacy}","received_events_url":"https://api.github.com/users/RyanCavanaugh/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":523,"state":"closed","created_at":"2014-07-14T23:24:03Z","updated_at":"2016-09-21T04:06:07Z","due_on":null,"closed_at":"2016-07-11T17:23:08Z"},"comments":26,"created_at":"2016-02-08T17:46:55Z","updated_at":"2016-10-04T22:35:20Z","closed_at":"2016-07-01T02:47:34Z","body":"I uncovered this general issue while testing loading JavaScript files from `node_modules`, but realized (and confirmed) this applies to TypeScript files also.\r\n\r\nBasically, when we search the `node_modules` folder, we [look for all supported extensions](https://github.com/Microsoft/TypeScript/blob/release-1.8/src/compiler/program.ts#L139) and add them to the compilation. Currently this means that if we find a TypeScript file in a Node module (e.g. someone published their package including the source), then we compile this also.\r\n\r\nFor example, if module `sausages` was published as follows (with the original source besides the compiler files):\r\n\r\n```\r\n - node_modules\r\n |- sausages\r\n   |- package.json\r\n   |- core.ts\r\n   |- core.js\r\n```\r\n\r\nThen we get the benefit of loading the `.ts` and getting the types from this. However on compiling an app which uses the `sausages/core` module, with `outDir: \"out\"`, I get the resulting output (notice how `core.js` from the `sausages` package has been compiled into a `node_modules` folder in my `outDir`).\r\n\r\n<img width=\"133\" alt=\"screen shot 2016-02-08 at 9 42 56 am\" src=\"https://cloud.githubusercontent.com/assets/993909/12893862/7ec807b8-ce48-11e5-9b00-15608d67d28c.png\">\r\n\r\nI already added a flag to denote if a file was found by searching Node modules in [this pull request](https://github.com/Microsoft/TypeScript/pull/6928/files#diff-08a3cc4f1f9a51dbb468c2810f5229d3R72). I can refactor this to eliminate this issue if that seems reasonable."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/251533543","html_url":"https://github.com/Microsoft/TypeScript/issues/6964#issuecomment-251533543","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6964","id":251533543,"user":{"login":"billti","id":993909,"avatar_url":"https://avatars.githubusercontent.com/u/993909?v=3","gravatar_id":"","url":"https://api.github.com/users/billti","html_url":"https://github.com/billti","followers_url":"https://api.github.com/users/billti/followers","following_url":"https://api.github.com/users/billti/following{/other_user}","gists_url":"https://api.github.com/users/billti/gists{/gist_id}","starred_url":"https://api.github.com/users/billti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billti/subscriptions","organizations_url":"https://api.github.com/users/billti/orgs","repos_url":"https://api.github.com/users/billti/repos","events_url":"https://api.github.com/users/billti/events{/privacy}","received_events_url":"https://api.github.com/users/billti/received_events","type":"User","site_admin":false},"created_at":"2016-10-04T22:35:20Z","updated_at":"2016-10-04T22:35:20Z","body":"OK. Looks like this is still as intended, and my memory is rusty. The compiler still defaults to excluding node_modules, bower_components, etc... if no specific `exclude` setting is provided (see https://github.com/Microsoft/TypeScript/blob/master/src/compiler/commandLineParser.ts#L934 ). You'll see in the test case I pointed to, an `exclude` property is given. \r\n\r\nIn fact, if you specify an exclude, then we default to all files in all folders (if `files` or `include` aren't given), so simply replace your line `\"include\": [\"**/*\"]` with `\"exclude\": []`, and that should fix it by including everything.\r\n\r\nAnother (separate) point which may be just in your sample, but for your module you have no `main` property, just `typings`, which works for the TypeScript resolution, but when running under node it won't be able to locate the module entry file (as your one module in the package is not the default `index.js`).\r\n\r\nHope this clears things up! I'll try and get it documented a little clearer."}}
{"actor":{"display_login":"billti"}}