{"name":"babel-explode-module","description":"Serialize a module into an easier format to work with","version":"2.0.0","main":"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":"8c7dc37e248a3148406de5e04f42b8128a7b0a03","bugs":{"url":"https://github.com/thejameskyle/babel-explode-module/issues"},"homepage":"https://github.com/thejameskyle/babel-explode-module#readme","_id":"babel-explode-module@2.0.0","_shasum":"d635653b44b1bdf1d5ceafacafb891611876ce3b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"8.0.0","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"shasum":"d635653b44b1bdf1d5ceafacafb891611876ce3b","tarball":"http://registry-npm.ywwl.com/babel-explode-module/download/babel-explode-module-2.0.0.tgz","integrity":"sha512-Z8KXcWwZvC7/ePUXpNCJOc4QlyUihssmH0RI362iyEMAb+iEwpfLThwkrXR0lXY5HpoPk+nS/hsWOZzg353XrA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDtXqvIlIP4sQGtkVGyTH2nrVG2000ZPrOgiltmSiLtgIgHj7UT42fJSoEF3uSK97RVRop0JqI0bDVK+I5YbAmvDU="}],"size":4095,"noattachment":false,"key":"/babel-explode-module/-/babel-explode-module-2.0.0.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-explode-module-2.0.0.tgz_1498702566944_0.8319477715995163"},"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":1498702567815,"_cnpm_publish_time":1498702567815,"dist-tags":{"latest":"3.0.0"}}