{"_id":"babel-helper-module-imports","_rev":"68698","name":"babel-helper-module-imports","description":"Babel helper functions for inserting module loads","dist-tags":{"latest":"7.0.0-beta.3","next":"7.0.0-beta.3"},"maintainers":[{"name":"hzoo","email":"hi@henryzoo.com"}],"time":{"modified":"2023-03-20T10:09:40.000Z","created":"2017-10-15T13:11:48.784Z","7.0.0-beta.3":"2017-10-15T13:11:48.784Z"},"users":{},"author":{"name":"Logan Smyth","email":"loganfsmyth@gmail.com"},"repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-helper-module-imports"},"versions":{"7.0.0-beta.3":{"name":"babel-helper-module-imports","version":"7.0.0-beta.3","description":"Babel helper functions for inserting module loads","author":{"name":"Logan Smyth","email":"loganfsmyth@gmail.com"},"homepage":"https://babeljs.io/","license":"MIT","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-helper-module-imports"},"main":"lib/index.js","dependencies":{"babel-types":"7.0.0-beta.3","lodash":"^4.2.0"},"_id":"babel-helper-module-imports@7.0.0-beta.3","_npmVersion":"5.5.1","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"e15764e3af9c8e11810c09f78f498a2bdc71585a","size":3834,"noattachment":false,"key":"/babel-helper-module-imports/-/babel-helper-module-imports-7.0.0-beta.3.tgz","tarball":"http://name.csiicloud.com:7001/babel-helper-module-imports/download/babel-helper-module-imports-7.0.0-beta.3.tgz"},"maintainers":[{"name":"hzoo","email":"hi@henryzoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-helper-module-imports-7.0.0-beta.3.tgz_1508073107879_0.9157842530403286"},"directories":{},"publish_time":1508073108784,"_cnpm_publish_time":1508073108784,"_hasShrinkwrap":false}},"readme":"# babel-helper-module-imports\n\n## Installation\n\n```sh\nnpm install babel-helper-module-imports --save\n```\n\n## Usage\n\n### `import \"source\"`\n\n```js\nimport { addSideEffect } from \"babel-helper-module-imports\";\naddSideEffect(path, 'source');\n```\n\n### `import { named } from \"source\"`\n\n```js\nimport { addNamed } from \"babel-helper-module-imports\";\naddNamed(path, 'named', 'source');\n```\n\n### `import { named as _hintedName } from \"source\"`\n\n```js\nimport { addNamed } from \"babel-helper-module-imports\";\naddNamed(path, 'named', 'source', { nameHint: \"hintedName\" });\n```\n\n### `import _default from \"source\"`\n\n```js\nimport { addDefault } from \"babel-helper-module-imports\";\naddDefault(path, 'source');\n```\n\n### `import hintedName from \"source\"`\n\n```js\nimport { addDefault } from \"babel-helper-module-imports\";\naddDefault(path, 'source', { nameHint: \"hintedName\" })\n```\n\n### `import * as _namespace from \"source\"`\n\n```js\nimport { addNamespace } from \"babel-helper-module-imports\";\naddNamespace(path, 'source');\n```\n\n## Examples\n\n### Adding a named import\n\n```js\nimport { addNamed } from \"babel-helper-module-imports\";\n\nexport default function({ types: t }) {\n  return {\n    visitor: {\n      ReferencedIdentifier(path) {\n        let importName = this.importName;\n        if (importName) {\n          importName = t.cloneDeep(importName);\n        } else {\n          // require('bluebird').coroutine\n          importName = this.importName = addNamed(path, 'coroutine', 'bluebird');\n        }\n\n        path.replaceWith(importName);\n      }\n    },\n  };\n}\n```\n","_attachments":{},"homepage":"https://babeljs.io/","license":"MIT"}