{"action":"created","issue":{"url":"https://api.github.com/repos/hax/hax.github.com/issues/31","labels_url":"https://api.github.com/repos/hax/hax.github.com/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/hax/hax.github.com/issues/31/comments","events_url":"https://api.github.com/repos/hax/hax.github.com/issues/31/events","html_url":"https://github.com/hax/hax.github.com/issues/31","id":120719897,"number":31,"title":"Babel plugin 体系的缺点","user":{"login":"hax","id":159840,"avatar_url":"https://avatars.githubusercontent.com/u/159840?v=3","gravatar_id":"","url":"https://api.github.com/users/hax","html_url":"https://github.com/hax","followers_url":"https://api.github.com/users/hax/followers","following_url":"https://api.github.com/users/hax/following{/other_user}","gists_url":"https://api.github.com/users/hax/gists{/gist_id}","starred_url":"https://api.github.com/users/hax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hax/subscriptions","organizations_url":"https://api.github.com/users/hax/orgs","repos_url":"https://api.github.com/users/hax/repos","events_url":"https://api.github.com/users/hax/events{/privacy}","received_events_url":"https://api.github.com/users/hax/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hax/hax.github.com/labels/%E9%BB%91","name":"黑","color":"333333"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-07T08:02:42Z","updated_at":"2015-12-10T02:04:37Z","closed_at":null,"body":"0. Babel 的 syntax plugins 毫无意义。仅仅是开启 babylon parser 的选项，并没有真正可插拔的语法扩展能力\r\n\r\n0. Babel 的 plugins 可以声明直接依赖关系（inherits），但无法声明其他关系（排斥、顺序要求），并且暂时拒绝此提议（https://github.com/thejameskyle/babel-plugin-handbook/issues/17 ）\r\n\r\n0. Babel 的一些官方 plugins 的职责切分有问题，导致一些微妙的 bug，如\r\n  - https://phabricator.babeljs.io/T2776#67632\r\n  - https://phabricator.babeljs.io/T6779 （transform-es2015-shorthand-properties 和 transform-es2015-function-name 如何转换包含 super 的 method ？实际上 transform-2015-object-super 应该被合并到 transform-es2015-shorthand-properties，或者从 transform-es2015-shorthand-properties 拆分单独的 transform-es2015-shorthand-methods）"},"comment":{"url":"https://api.github.com/repos/hax/hax.github.com/issues/comments/163463171","html_url":"https://github.com/hax/hax.github.com/issues/31#issuecomment-163463171","issue_url":"https://api.github.com/repos/hax/hax.github.com/issues/31","id":163463171,"user":{"login":"nighca","id":1492263,"avatar_url":"https://avatars.githubusercontent.com/u/1492263?v=3","gravatar_id":"","url":"https://api.github.com/users/nighca","html_url":"https://github.com/nighca","followers_url":"https://api.github.com/users/nighca/followers","following_url":"https://api.github.com/users/nighca/following{/other_user}","gists_url":"https://api.github.com/users/nighca/gists{/gist_id}","starred_url":"https://api.github.com/users/nighca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nighca/subscriptions","organizations_url":"https://api.github.com/users/nighca/orgs","repos_url":"https://api.github.com/users/nighca/repos","events_url":"https://api.github.com/users/nighca/events{/privacy}","received_events_url":"https://api.github.com/users/nighca/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T02:04:37Z","updated_at":"2015-12-10T02:04:37Z","body":"> Babel 的 plugins 可以声明直接依赖关系（inherits），但无法声明其他关系（排斥、顺序要求），并且暂时拒绝此提议（thejameskyle/babel-plugin-handbook#17 ）\r\n\r\n我看了这个 issue，我觉得 thejameskyle 说得挺有道理的。我的理解是，继承是实现层面的关系，而排斥、顺序是运行时的关系，并不是同一种关系，不好类比的。如果 plugin 间的顺序/排斥关系依赖 plugin 的显式声明，那么必然是不可靠的（因为  plugin 的集合是没有边界的，永远不知道会不会哪天冒出一个新的 plugin 与现有的 plugin 有排斥/顺序上的关系要求）。而正因为不管从哪个独立 plugin 出发，这种声明都是不可靠的，所以不应该由 plugin 自己来维护管理这种关系。"}}