{"name":"rewrite-imports","version":"1.1.1","repository":{"type":"git","url":"git+https://github.com/lukeed/rewrite-imports.git"},"description":"Rewrite `import` statements as `require()`s; via RegExp","browser":"dist/rewrite-imports.es5.js","main":"dist/rewrite-imports.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=4"},"scripts":{"build":"node builder","test":"tape test/*.js | tap-spec"},"files":["dist"],"keywords":["regex","rewrite","modules","imports","requires","aliases"],"devDependencies":{"buble":"^0.19.3","mk-dirs":"^1.0.0","tap-spec":"^4.1.1","tape":"^4.7.0"},"gitHead":"f7eeecfd55c3341a8159d1089e49160974d35b46","bugs":{"url":"https://github.com/lukeed/rewrite-imports/issues"},"homepage":"https://github.com/lukeed/rewrite-imports#readme","_id":"rewrite-imports@1.1.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-x+au8wT3KUvJdgA8CVANJh+PGQ5VfDh0MUMb+dI/YDUcLFLJcZvxqM4JlPGZYfUUq9G6tgUOH7wXYeE7f9J8FA==","shasum":"dd692353aeddd857d8ee2dfcf91da5bacbe22888","tarball":"http://registry-npm.ywwl.com/rewrite-imports/download/rewrite-imports-1.1.1.tgz","fileCount":5,"unpackedSize":5092,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbdqwCRA9TVsSAnZWagAAfP0P/36da+iobHzr6i9/1D3R\ncjrhQZmA1K3vef+w+bAHSgN4rvON32A0unoDdg/rE6onBOTQnwdsVhr/noV3\nCbmSlmjz7mDAhtzkbKCuOOo3WxyOmkcaWBHSgYYyPooWbzqFBo/pRiuN5xEy\naF1vZZhHTu4FUlaG6oRaDZKMk75etJyU/RXBdH6WteGcbyelgGR2TWgJNl/3\nAnVDuJSFft3YKVI7TfZyT52fkBzgtodUFXKYVlJFy2lvbkHlQ40YOX2HMOan\nT21JsEJQnggkkC1KX+myA+k9NzMMUBe0vPYks21pkxDirGgCP7b2Lcr6wwXp\n/njZkVpvLDgXlHSeTaEJIQsWusSnFobBwK/XYagsgj4BuFdW1iVeBHWT86J0\nhnUJptkqD+Fl8tuLhS9DhyuDBtZX6/sNdzydLOx3kNdjthiMBMADr8MX9Gpi\nQxSnSCpMJ6LLwb9cFSW782Bgvs2Y0zI2dVizYjFXUX0LZtsiQiUjiL/bGQlN\nPXq3z0A78bWXBkUwc/FQ9di0xdhAI8TrdIlvz2LVU59u2UKWxLWXoQh4BxdS\nwm1F92uiQ5E9zSG1xfa0yb9zjLFaI9egz7y7F5UcrWpc57pI5QUDSklmRm9T\n7kxS8Ckw9RGXOUwcb4eCxgSSgXbLi142Sw2nQyyisSif2J4vx7pBIO4leTuE\nzL3d\r\n=6M+n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGfma4gKEXZkFj4OJrnsUwn2WIKVzuE3gb0FyjVJTPX5AiEAvDVbd2geqG9W69XLyZZTBPLlChbX/1YKEEVnlFe+WDY="}],"size":2347,"noattachment":false,"key":"/rewrite-imports/-/rewrite-imports-1.1.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rewrite-imports_1.1.1_1533926064235_0.524692669309547"},"_hasShrinkwrap":false,"readme":"# rewrite-imports [![CI](https://github.com/lukeed/rewrite-imports/actions/workflows/ci.yml/badge.svg)](https://github.com/lukeed/rewrite-imports/actions/workflows/ci.yml)\n\nA tiny (349B) utility to transform various `import` statements into `require()` calls, using regular expressions.\n\n> ***Looking for something _more_ backwards compatible?*** <br>\n> Check out [`v1.4.0`](https://github.com/lukeed/rewrite-imports/tree/v1.4.0) which does not rely on destructured assignment!\n\n\n## Caveats\n\nThis module returns a string and **does not** provide a runtime nor does it evaluate the output.\n\n> :bulb: For this behavior, use [`rewrite-module`](https://github.com/lukeed/rewrite-module) or check out [`@taskr/esnext`](https://github.com/lukeed/taskr/tree/master/packages/esnext) for an example.\n\nThe output requires a JavaScript runtime that supports `require` calls and [destructuring assignments](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Object_destructuring) with Objects.\n\n  * At least `Node 6.x` is required\n\n  * Or, for browsers:\n    * A `require` shim is always needed – see [`fn`](#fn)\n    * Ensure your target browsers support destructuring – see [chart](https://kangax.github.io/compat-table/es6/#test-destructuring,_assignment)\n\nIf you have [false positives](https://github.com/lukeed/rewrite-imports/issues/8), you may want to use an AST to find actual `import` statements before transformation.\n\n> Check out an [example implementation](https://github.com/styleguidist/react-styleguidist/blob/82f22d217044dee6215e60696c39791ee168fc14/src/client/utils/transpileImports.js).\n\n\n## Install\n\n```\n$ npm install --save rewrite-imports\n```\n\n\n## Usage\n\n```js\nimport { rewrite } from 'rewrite-imports';\n// or\nconst { rewrite } = require('rewrite-imports');\n\nrewrite(`import foo from '../bar'`);\n//=> const foo = require('../bar');\n\nrewrite(`import { foo } from 'bar'`);\n//=> const { foo } = require('bar');\n\nrewrite(`import * as path from 'path';`);\n//=> const path = require('path');\n\nrewrite(`import { foo as bar, baz as bat, lol } from 'quz';`);\n//=> const { foo:bar, baz:bat, lol } = require('quz');\n\nrewrite(`import foobar, { foo as FOO, bar } from 'foobar';`);\n//=> const foobar = require('foobar');\n//=> const { foo:FOO, bar } = foobar;\n```\n\n\n## API\n\n### rewrite(input, fn)\n\n#### input\nType: `String`\n\nThe `import` statement(s) or the code containing `import` statement(s).\n\n> See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) for valid `import` statement syntax.\n\n#### fn\nType: `String`<br>\nDefault: `'require'`\n\nThe `require`-like function name to use. Defaults to `require` but you may choose to pass the name of a custom shim function; for example, `__webpack_require__` may work for webpack in the browser.\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","publish_time":1533926064323,"_cnpm_publish_time":1533926064323,"dist-tags":{"latest":"3.0.0"}}