{"action":"created","comment":{"url":"https://api.github.com/repos/babel/babel/pulls/comments/46593261","id":46593261,"diff_hunk":"@@ -359,21 +359,28 @@ export default class File extends Store {\n         sourceRoot: inputMapConsumer.sourceRoot\n       });\n \n+      // This assumes the output map always has a single source, since Babel always compiles a single source file to a\n+      // single output file.\n+      const source = outputMapConsumer.sources[0];","path":"packages/babel-core/src/transformation/file/index.js","position":6,"original_position":6,"commit_id":"9c27f1e86a9c90312d7ae91249d8163b10b9067a","original_commit_id":"9c27f1e86a9c90312d7ae91249d8163b10b9067a","user":{"login":"hzoo","id":588473,"avatar_url":"https://avatars.githubusercontent.com/u/588473?v=3","gravatar_id":"","url":"https://api.github.com/users/hzoo","html_url":"https://github.com/hzoo","followers_url":"https://api.github.com/users/hzoo/followers","following_url":"https://api.github.com/users/hzoo/following{/other_user}","gists_url":"https://api.github.com/users/hzoo/gists{/gist_id}","starred_url":"https://api.github.com/users/hzoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzoo/subscriptions","organizations_url":"https://api.github.com/users/hzoo/orgs","repos_url":"https://api.github.com/users/hzoo/repos","events_url":"https://api.github.com/users/hzoo/events{/privacy}","received_events_url":"https://api.github.com/users/hzoo/received_events","type":"User","site_admin":false},"body":"If this is true - this should be `inputMapConsumer` correct?","created_at":"2015-12-03T18:50:03Z","updated_at":"2015-12-03T18:50:03Z","html_url":"https://github.com/babel/babel/pull/3108#discussion_r46593261","pull_request_url":"https://api.github.com/repos/babel/babel/pulls/3108","_links":{"self":{"href":"https://api.github.com/repos/babel/babel/pulls/comments/46593261"},"html":{"href":"https://github.com/babel/babel/pull/3108#discussion_r46593261"},"pull_request":{"href":"https://api.github.com/repos/babel/babel/pulls/3108"}}},"pull_request":{"url":"https://api.github.com/repos/babel/babel/pulls/3108","id":51719651,"html_url":"https://github.com/babel/babel/pull/3108","diff_url":"https://github.com/babel/babel/pull/3108.diff","patch_url":"https://github.com/babel/babel/pull/3108.patch","issue_url":"https://api.github.com/repos/babel/babel/issues/3108","number":3108,"state":"open","locked":false,"title":"Fix T2864","user":{"login":"cspotcode","id":376504,"avatar_url":"https://avatars.githubusercontent.com/u/376504?v=3","gravatar_id":"","url":"https://api.github.com/users/cspotcode","html_url":"https://github.com/cspotcode","followers_url":"https://api.github.com/users/cspotcode/followers","following_url":"https://api.github.com/users/cspotcode/following{/other_user}","gists_url":"https://api.github.com/users/cspotcode/gists{/gist_id}","starred_url":"https://api.github.com/users/cspotcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cspotcode/subscriptions","organizations_url":"https://api.github.com/users/cspotcode/orgs","repos_url":"https://api.github.com/users/cspotcode/repos","events_url":"https://api.github.com/users/cspotcode/events{/privacy}","received_events_url":"https://api.github.com/users/cspotcode/received_events","type":"User","site_admin":false},"body":"This PR fixes [issue 2864](https://phabricator.babeljs.io/T2864) as well as another, minor mistake.\r\n\r\nBabel doesn't generate mappings for leading comments, but it assumes its own sourcemap can map any input position.  Other tools, such as Typescript, *do* create mappings for leading comments.  Babel's sourcemap can't handle those mappings, hence the \"Invalid mapping.\"  Fortunately, it's fine to omit them, which is what my patch does.\r\n\r\nThe second commit fixes the `source` path being passed to `generatedPositionFor`.  The output sourcemap's `file` and `source[0]` were, coincidentally, both `\"unknown\"`, which is why the mistake wasn't causing a bug.  I still think this change is warranted since it clarifies the code and avoids a possible future bug.\r\n\r\nLet me know if I need to reformat for code style or split this into two PRs.  Thanks!","created_at":"2015-11-24T21:29:07Z","updated_at":"2015-12-03T18:50:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"648c3b3842bdb54d30d98f435ae82b8659005193","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/babel/babel/pulls/3108/commits","review_comments_url":"https://api.github.com/repos/babel/babel/pulls/3108/comments","review_comment_url":"https://api.github.com/repos/babel/babel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/babel/babel/issues/3108/comments","statuses_url":"https://api.github.com/repos/babel/babel/statuses/9c27f1e86a9c90312d7ae91249d8163b10b9067a","head":{"label":"cspotcode:feature/fix-T2864","ref":"feature/fix-T2864","sha":"9c27f1e86a9c90312d7ae91249d8163b10b9067a","user":{"login":"cspotcode","id":376504,"avatar_url":"https://avatars.githubusercontent.com/u/376504?v=3","gravatar_id":"","url":"https://api.github.com/users/cspotcode","html_url":"https://github.com/cspotcode","followers_url":"https://api.github.com/users/cspotcode/followers","following_url":"https://api.github.com/users/cspotcode/following{/other_user}","gists_url":"https://api.github.com/users/cspotcode/gists{/gist_id}","starred_url":"https://api.github.com/users/cspotcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cspotcode/subscriptions","organizations_url":"https://api.github.com/users/cspotcode/orgs","repos_url":"https://api.github.com/users/cspotcode/repos","events_url":"https://api.github.com/users/cspotcode/events{/privacy}","received_events_url":"https://api.github.com/users/cspotcode/received_events","type":"User","site_admin":false},"repo":{"id":46817400,"name":"babel","full_name":"cspotcode/babel","owner":{"login":"cspotcode","id":376504,"avatar_url":"https://avatars.githubusercontent.com/u/376504?v=3","gravatar_id":"","url":"https://api.github.com/users/cspotcode","html_url":"https://github.com/cspotcode","followers_url":"https://api.github.com/users/cspotcode/followers","following_url":"https://api.github.com/users/cspotcode/following{/other_user}","gists_url":"https://api.github.com/users/cspotcode/gists{/gist_id}","starred_url":"https://api.github.com/users/cspotcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cspotcode/subscriptions","organizations_url":"https://api.github.com/users/cspotcode/orgs","repos_url":"https://api.github.com/users/cspotcode/repos","events_url":"https://api.github.com/users/cspotcode/events{/privacy}","received_events_url":"https://api.github.com/users/cspotcode/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cspotcode/babel","description":"Babel is a compiler for writing next generation JavaScript.","fork":true,"url":"https://api.github.com/repos/cspotcode/babel","forks_url":"https://api.github.com/repos/cspotcode/babel/forks","keys_url":"https://api.github.com/repos/cspotcode/babel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cspotcode/babel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cspotcode/babel/teams","hooks_url":"https://api.github.com/repos/cspotcode/babel/hooks","issue_events_url":"https://api.github.com/repos/cspotcode/babel/issues/events{/number}","events_url":"https://api.github.com/repos/cspotcode/babel/events","assignees_url":"https://api.github.com/repos/cspotcode/babel/assignees{/user}","branches_url":"https://api.github.com/repos/cspotcode/babel/branches{/branch}","tags_url":"https://api.github.com/repos/cspotcode/babel/tags","blobs_url":"https://api.github.com/repos/cspotcode/babel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cspotcode/babel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cspotcode/babel/git/refs{/sha}","trees_url":"https://api.github.com/repos/cspotcode/babel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cspotcode/babel/statuses/{sha}","languages_url":"https://api.github.com/repos/cspotcode/babel/languages","stargazers_url":"https://api.github.com/repos/cspotcode/babel/stargazers","contributors_url":"https://api.github.com/repos/cspotcode/babel/contributors","subscribers_url":"https://api.github.com/repos/cspotcode/babel/subscribers","subscription_url":"https://api.github.com/repos/cspotcode/babel/subscription","commits_url":"https://api.github.com/repos/cspotcode/babel/commits{/sha}","git_commits_url":"https://api.github.com/repos/cspotcode/babel/git/commits{/sha}","comments_url":"https://api.github.com/repos/cspotcode/babel/comments{/number}","issue_comment_url":"https://api.github.com/repos/cspotcode/babel/issues/comments{/number}","contents_url":"https://api.github.com/repos/cspotcode/babel/contents/{+path}","compare_url":"https://api.github.com/repos/cspotcode/babel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cspotcode/babel/merges","archive_url":"https://api.github.com/repos/cspotcode/babel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cspotcode/babel/downloads","issues_url":"https://api.github.com/repos/cspotcode/babel/issues{/number}","pulls_url":"https://api.github.com/repos/cspotcode/babel/pulls{/number}","milestones_url":"https://api.github.com/repos/cspotcode/babel/milestones{/number}","notifications_url":"https://api.github.com/repos/cspotcode/babel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cspotcode/babel/labels{/name}","releases_url":"https://api.github.com/repos/cspotcode/babel/releases{/id}","created_at":"2015-11-24T20:42:02Z","updated_at":"2015-11-24T20:42:13Z","pushed_at":"2015-11-24T21:18:58Z","git_url":"git://github.com/cspotcode/babel.git","ssh_url":"git@github.com:cspotcode/babel.git","clone_url":"https://github.com/cspotcode/babel.git","svn_url":"https://github.com/cspotcode/babel","homepage":"https://babeljs.io/","size":12201,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"babel:master","ref":"master","sha":"5c1d2ab92fbfdaf8a43ff6c5d6f0e1ec76310781","user":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"repo":{"id":24560307,"name":"babel","full_name":"babel/babel","owner":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/babel/babel","description":"Babel is a compiler for writing next generation JavaScript.","fork":false,"url":"https://api.github.com/repos/babel/babel","forks_url":"https://api.github.com/repos/babel/babel/forks","keys_url":"https://api.github.com/repos/babel/babel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/babel/babel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/babel/babel/teams","hooks_url":"https://api.github.com/repos/babel/babel/hooks","issue_events_url":"https://api.github.com/repos/babel/babel/issues/events{/number}","events_url":"https://api.github.com/repos/babel/babel/events","assignees_url":"https://api.github.com/repos/babel/babel/assignees{/user}","branches_url":"https://api.github.com/repos/babel/babel/branches{/branch}","tags_url":"https://api.github.com/repos/babel/babel/tags","blobs_url":"https://api.github.com/repos/babel/babel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/babel/babel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/babel/babel/git/refs{/sha}","trees_url":"https://api.github.com/repos/babel/babel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/babel/babel/statuses/{sha}","languages_url":"https://api.github.com/repos/babel/babel/languages","stargazers_url":"https://api.github.com/repos/babel/babel/stargazers","contributors_url":"https://api.github.com/repos/babel/babel/contributors","subscribers_url":"https://api.github.com/repos/babel/babel/subscribers","subscription_url":"https://api.github.com/repos/babel/babel/subscription","commits_url":"https://api.github.com/repos/babel/babel/commits{/sha}","git_commits_url":"https://api.github.com/repos/babel/babel/git/commits{/sha}","comments_url":"https://api.github.com/repos/babel/babel/comments{/number}","issue_comment_url":"https://api.github.com/repos/babel/babel/issues/comments{/number}","contents_url":"https://api.github.com/repos/babel/babel/contents/{+path}","compare_url":"https://api.github.com/repos/babel/babel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/babel/babel/merges","archive_url":"https://api.github.com/repos/babel/babel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/babel/babel/downloads","issues_url":"https://api.github.com/repos/babel/babel/issues{/number}","pulls_url":"https://api.github.com/repos/babel/babel/pulls{/number}","milestones_url":"https://api.github.com/repos/babel/babel/milestones{/number}","notifications_url":"https://api.github.com/repos/babel/babel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/babel/babel/labels{/name}","releases_url":"https://api.github.com/repos/babel/babel/releases{/id}","created_at":"2014-09-28T13:38:23Z","updated_at":"2015-12-03T17:24:25Z","pushed_at":"2015-12-03T15:34:19Z","git_url":"git://github.com/babel/babel.git","ssh_url":"git@github.com:babel/babel.git","clone_url":"https://github.com/babel/babel.git","svn_url":"https://github.com/babel/babel","homepage":"https://babeljs.io/","size":12766,"stargazers_count":11977,"watchers_count":11977,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":721,"mirror_url":null,"open_issues_count":173,"forks":721,"open_issues":173,"watchers":11977,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/babel/babel/pulls/3108"},"html":{"href":"https://github.com/babel/babel/pull/3108"},"issue":{"href":"https://api.github.com/repos/babel/babel/issues/3108"},"comments":{"href":"https://api.github.com/repos/babel/babel/issues/3108/comments"},"review_comments":{"href":"https://api.github.com/repos/babel/babel/pulls/3108/comments"},"review_comment":{"href":"https://api.github.com/repos/babel/babel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/babel/babel/pulls/3108/commits"},"statuses":{"href":"https://api.github.com/repos/babel/babel/statuses/9c27f1e86a9c90312d7ae91249d8163b10b9067a"}}}}