{"_id":"@aparna036/babel-explode-module","_rev":"1-3283a97add73eb37aed542d29f0a5923","name":"@aparna036/babel-explode-module","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.1":{"name":"@aparna036/babel-explode-module","description":"Serialize a module into an easier format to work with","version":"2.0.1","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"},"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":"110667aac7fe1efdb06e0e978c8dbb6eb6846e4b","bugs":{"url":"https://github.com/thejameskyle/babel-explode-module/issues"},"homepage":"https://github.com/thejameskyle/babel-explode-module#readme","_id":"@aparna036/babel-explode-module@2.0.1","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"aparna036","email":"aparna036@gmail.com"},"dist":{"integrity":"sha512-0E7h/wnIyH2ReiS2+S9FchNcssVQclrFgOBKdpQR5iiwrZq5pAkSz8R2IKy0qaJNLPvIucSaL3rLHQenlC8RPw==","shasum":"a6584580466b3256390fbd17fb2a6d9aab8b237f","tarball":"https://registry.npmjs.org/@aparna036/babel-explode-module/-/babel-explode-module-2.0.1.tgz","fileCount":4,"unpackedSize":11590,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc7LvaCRA9TVsSAnZWagAAnI0P/iVqUuFAytQ9sgBI/f0d\nmIpJXAG/XyFmsoR3bJgkgACoaIeZaJ36IunTA+GfCy7/TzX5GwqwqjFoyMOQ\nTZIVdH/KzSC/4IyLGPQCZxe7Znzv5F77IB/GLcb/isCN5H/iRuBso7ZgUpnR\nBmpQkOgx4d8JcyNjy+T0AGw9GMshjnPT+axYvPnwmQgVt+gxJATkktKGrkFT\nLRhXX+AzlWQ38c6O+h46CEfN6yj38HTRUSmKa2tl9/7Ft5M9H5H3bdnJgIhV\niSICg3cnnzUeaDqHIiWRD+kiqc5xGBvjgJHeFwqQ34cjxr8wXy3x6YaSh7lB\nNh1ecf/dcWUZGXUMurDgWEZr8sxhiAH5kW+/KuakfDcf+VlcdpTlozpxrosz\nG577q/iTpqxvKt7Yhgbty+xrjKB8H+06uxqcQYNbh1DLqBDXlD7LAPpWFuF8\nV2jL7Iin4vRymJexEKBmAsrSuuyKGrvKOpchGYTG2LhYx7lFwR/6MRkjNd4v\nBHAGnYwoZq8zqujcyUPvlnMRFK6hr9DiJ0nmK4OLaRm94U1k51rXboFQPYbZ\nYOnz/IZ3rxBbzcklnRbCmqO/MkoBu3GJyOyTI+OWZa7jykAq+h6TZnMkk81W\nKC1izB+c1dp8pc+hORF8FP/hegAPzwtTqMSXoo2R5DsbWB0VT1/kjHvbxM6w\nUOhd\r\n=2l5L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrvzmUtiXtjPAhMPA9Z+G3INQ3ilDPYTkzuf74pvdQ+AIhAKmjeZTpJZmCZXKpH+j9rM39yusxX5fC3myWKcAMJx0q"}]},"maintainers":[{"name":"aparna036","email":"aparna036@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-explode-module_2.0.1_1559018457792_0.848479856469236"},"_hasShrinkwrap":false}},"time":{"created":"2019-05-28T04:40:57.763Z","2.0.1":"2019-05-28T04:40:57.920Z","modified":"2022-04-04T14:32:14.178Z"},"maintainers":[{"name":"aparna036","email":"aparna036@gmail.com"}],"description":"Serialize a module into an easier format to work with","homepage":"https://github.com/thejameskyle/babel-explode-module#readme","repository":{"type":"git","url":"git+https://github.com/thejameskyle/babel-explode-module.git"},"author":{"name":"James Kyle","email":"me@thejameskyle.com"},"bugs":{"url":"https://github.com/thejameskyle/babel-explode-module/issues"},"license":"MIT","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","readmeFilename":"README.md"}