{"action":"created","issue":{"url":"https://api.github.com/repos/d3/d3-selection/issues/33","labels_url":"https://api.github.com/repos/d3/d3-selection/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/d3/d3-selection/issues/33/comments","events_url":"https://api.github.com/repos/d3/d3-selection/issues/33/events","html_url":"https://github.com/d3/d3-selection/pull/33","id":81635671,"number":33,"title":"add ES6 module index and expose as jsnext:main","user":{"login":"Rich-Harris","id":1162160,"avatar_url":"https://avatars.githubusercontent.com/u/1162160?v=3","gravatar_id":"","url":"https://api.github.com/users/Rich-Harris","html_url":"https://github.com/Rich-Harris","followers_url":"https://api.github.com/users/Rich-Harris/followers","following_url":"https://api.github.com/users/Rich-Harris/following{/other_user}","gists_url":"https://api.github.com/users/Rich-Harris/gists{/gist_id}","starred_url":"https://api.github.com/users/Rich-Harris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rich-Harris/subscriptions","organizations_url":"https://api.github.com/users/Rich-Harris/orgs","repos_url":"https://api.github.com/users/Rich-Harris/repos","events_url":"https://api.github.com/users/Rich-Harris/events{/privacy}","received_events_url":"https://api.github.com/users/Rich-Harris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-05-27T21:37:30Z","updated_at":"2015-05-29T06:34:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/d3/d3-selection/pulls/33","html_url":"https://github.com/d3/d3-selection/pull/33","diff_url":"https://github.com/d3/d3-selection/pull/33.diff","patch_url":"https://github.com/d3/d3-selection/pull/33.patch"},"body":"This PR adds an additional ES6 module that defines the API and exposes it via the `jsnext:main` field. The purpose of `jsnext:main` is to allow ES6 module bundlers to work with the modules natively, rather than via the prebuilt UMD bundle. Currently there isn't much tooling that can take advantage of it, largely because of chickens and eggs, but it's future-proof ('official' package.json fields can't contain colons) and unobtrusive (it doesn't affect browserify/webpack et al)."},"comment":{"url":"https://api.github.com/repos/d3/d3-selection/issues/comments/106708934","html_url":"https://github.com/d3/d3-selection/pull/33#issuecomment-106708934","issue_url":"https://api.github.com/repos/d3/d3-selection/issues/33","id":106708934,"user":{"login":"mbostock","id":230541,"avatar_url":"https://avatars.githubusercontent.com/u/230541?v=3","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T06:34:59Z","updated_at":"2015-05-29T06:34:59Z","body":"Aside from a few bugs (and the lack of nesting in named exports), I’m pretty excited about the way Rollup & d3-bundler is taking shape. In theory it lets you concisely specify what code you need:\r\n\r\n```js\r\nimport {event, select, selectAll} from \"d3-selection\";\r\nimport \"d3-selection-multi\";\r\nexport {event, select, selectAll};\r\n```\r\n\r\nAnd then you build that into a UMD (or whatever), and have a nice day.\r\n\r\nIt behooves us to take the most forward-looking approach, while making sure that today’s environments are still served gracefully. In my view, this means that the D3 submodules should only provide an ES6 API, and not pre-built UMD’s that can be composed the Old Way. Instead, composition happens through ES6, with the precision offered by Rollup, and then you lock down what parts you need by running d3-bundler to build a UMD (or whatever).\r\n\r\nProbably most people will do this through a web interface and remain blissfully unaware of the underlying machinery of ES6 modules and transpilation—they’ll just get a `d3` global that has what they need. It’ll work, which is all that matters. And the D3 default build in the CDN will still be a UMD as it is today. But this is still a big improvement over SMASH: not only does it offer the cleaner ES6 syntax and smarter code elimination, but it also means the code can be published in separate repositories that merely need to be `npm install`’d."}}