{"name":"babel-explode-module","description":"Serialize a module into an easier format to work with","version":"1.3.0","main":"lib/index.js","author":{"name":"James Kyle","email":"me@thejameskyle.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/thejameskyle/babel-explode-module.git"},"files":[],"scripts":{"test":"jest","dev":"jest --watch","ci":"yarn flow && yarn test -- --runInBand --coverage"},"dependencies":{"babel-types":"^6.24.1"},"devDependencies":{"ast-pretty-print":"^1.1.5","babel-plugin-tester":"^3.0.0","babylon-options":"^1.1.2","flow-bin":"^0.46.0","jest":"^20.0.1"},"gitHead":"9679828a6fe88fa8a9ed68b1d67857cb71748249","bugs":{"url":"https://github.com/thejameskyle/babel-explode-module/issues"},"homepage":"https://github.com/thejameskyle/babel-explode-module#readme","_id":"babel-explode-module@1.3.0","_shasum":"f30aa4196f5d886d3786ae9c7fc518b9a3245e5a","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"shasum":"f30aa4196f5d886d3786ae9c7fc518b9a3245e5a","tarball":"http://registry-npm.ywwl.com/babel-explode-module/download/babel-explode-module-1.3.0.tgz","integrity":"sha512-wKPYEV0zyyBwUhi0eCXn5SMoIPJCuGii1ezH6FKfMevAfvDI/82phMVoUf5TGNLRot14V9HWJOIPd/rPsndczg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDY3o8O5Z32hOdNyFQp9fAJwqSqAryetrwrfBVYHmIYGAIhAOmYON/+GUKGzbjtljXNa7RW+u9OeRK1wue+6hCOlBQV"}],"size":2377,"noattachment":false,"key":"/babel-explode-module/-/babel-explode-module-1.3.0.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-explode-module-1.3.0.tgz_1496103502544_0.7901256680488586"},"directories":{},"readme":"# babel-explode-module\n\n> Serialize a module into an easier format to work with\n\n```js\nimport {foo, bar} from \"mod\";\n\nexport default function() {\n  // ...\n}\n\nconst baz = 42,\n      bat = class Bat {};\n\nexport {\n  baz,\n  bat\n};\n```\n\nCreating this AST:\n\n```yml\nProgram\n  body:\n    - ImportDeclaration\n        specifiers:\n          - ImportSpecifier\n          - ImportSpecifier\n    - ExportDefaultDeclaration\n        declaration: FunctionDeclaration\n    - VariableDeclaration\n        declarations:\n          - VariableDeclarator\n          - VariableDeclarator\n    - ExportNamedDeclaration\n        specifiers:\n          - ExportSpecifier\n          - ExportSpecifier\n```\n\nWill be exploded to this:\n\n```js\n{\n  imports: [\n    { kind: \"value\", local: \"foo\", external: \"foo\", source: \"mod\", loc: {...} },\n    { kind: \"value\", local: \"bar\", external: \"bar\", source: \"mod\", loc: {...} },\n  ],\n  exports: [\n    { local: \"_default\", external: \"default\", loc: {...} },\n    { local: \"baz\", external: \"baz\", loc: {...} },\n    { local: \"bat\", external: \"bat\", loc: {...} },\n  },\n  statements: [\n    { type: \"FunctionDeclaration\" },\n    { type: \"VariableDeclaration\", declarations: VariableDeclarator },\n    { type: \"VariableDeclaration\", declarations: VariableDeclarator },\n  ],\n}\n```\n\n#### Serializes imports/exports to an easy to work with format\n\n```js\n// input\nimport a, {b} from \"mod\";\nimport * as c from \"mod\";\nexport default function d() {}\nexport {e, f as g};\nexport {default as h} from \"mod\";\nexport * from \"mod\";\n```\n\n```js\n// output\n{\n  imports: [\n    { kind: \"value\", local: \"a\", external: \"a\", source: \"mod\" },\n    { kind: \"value\", local: \"b\", external: \"b\", source: \"mod\" },\n    { kind: \"value\", local: \"c\", source: \"d\" },\n  ],\n  exports: [\n    { local: \"d\", external: \"d\" },\n    { local: \"e\", external: \"e\" },\n    { local: \"f\", external: \"g\" },\n    { local: \"default\", external: \"g\", source: \"mod\" },\n    { source: \"mod\" },\n  ]\n}\n```\n\n#### Simplifies declarations to create 1 binding per statement (i.e. variables)\n\n```js\n// input\nfunction a() {}\nvar b,\n    c;\n```\n\n```js\n// output (printed)\nfunction a() {}\nvar b;\nvar c;\n```\n\n#### Splits export values away from their exports\n\n```js\n// input\nexport function a() {}\nexport default function() {}\n```\n\n```js\n// output (printed)\nfunction a() {}\nvar _default = function() {};\nexport {a};\nexport default _default;\n```\n","publish_time":1496103502623,"_cnpm_publish_time":1496103502623,"dist-tags":{"latest":"3.0.0"}}