{"name":"babel-explode-module","description":"Serialize a module into an easier format to work with","version":"3.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":"^7.0.0-beta.56"},"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":"4754f44ba73d84d8f08a90dbee9036ddbf5cfa03","bugs":{"url":"https://github.com/thejameskyle/babel-explode-module/issues"},"homepage":"https://github.com/thejameskyle/babel-explode-module#readme","_id":"babel-explode-module@3.0.0","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"integrity":"sha512-dR2Q9+GnJa2Ylsa0MVubpcASaQGAk6y06jF9NvLC8lJ5e9Iu4sFULsjOeWV7HZCYWQq8EmjjuVe4k1dIDYB+RA==","shasum":"5989f6db02d205ca538f514ba0b9108d43590f6d","tarball":"http://registry-npm.ywwl.com/babel-explode-module/download/babel-explode-module-3.0.0.tgz","fileCount":4,"unpackedSize":11542,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbf5SCRA9TVsSAnZWagAAO3UQAIzz22dRPK0u4J7ClZ5k\nV34lxC0KvwK7pbZVstJuxjCvL8LWx+k3p6LUETZIsysPAZ03NqFJcrpMn5N8\nT6CmBv/pl/jUKDwMsvHG8akcULCzZPBiGL0k+I7GVK0uF9QsHi/yPEu1TBh7\nda0TbgzVH3IB/zFAwLyLGmJgPpFpMsB1XrOLOAH/JOrjMo4OMaCGHxllu/q5\ntSivGTLqS+mbEvX83PtWisLNgc1WvKYEUdXDyIEB8KwH9eOYbhhJ7f8jXaIn\nCVbG/cyiHjm+080BVj0uhUQvLCsn70L2Ik6jL7ehLfA1zpXh/mXTwa491SHK\nX3dT2IM9TLNn3pChPYn4yXPVC9d5BHLv5WTql8Twku6lUeXzTGt8UGN/2FZw\nBEJL5GK9kRCs9sC/dgsJpVmCYMP2QAF/O6yxPeB7MwusgDEsAXLZWjkUJ6et\nrpU9S28gj4UbR2MTfVFpfn0bRaoW7eVcGeIGckUEIycWJDOi4H6hX7NvNHN3\nyU7GQ/BSOQp0tAnjlsHnj/RBbdgHCKCNV6LlwtI8DJv8RsBg8ViDzUvxErbS\nJEV047stg7vjc3/s3YbsA4HG0hjtBJrz2mPgiASIThpKoDc4XS/NMJOZQVnu\neu94FwHfyE5umeBHzsLBkPp9xhTr8HGTIYijXsObj3jG5YRxet8BGtX4LOmD\nxczg\r\n=GE3Q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICB6lx8N/9WbJD6GoC/xG8A64ARDLBwQAOCkFCG+8Eh4AiEAvLpXy8lx/Ed+sDfqB0BrCNCsb/nHFjJExeAorG4upZU="}],"size":3490,"noattachment":false,"key":"/babel-explode-module/-/babel-explode-module-3.0.0.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-explode-module_3.0.0_1533935186163_0.43937787594895505"},"_hasShrinkwrap":false,"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":1533935186281,"_cnpm_publish_time":1533935186281,"dist-tags":{"latest":"3.0.0"}}