{"_id":"@blendmedia/babel-plugin-wildcard","_rev":"2-0f1022ac5c61efb6e39c76dc99160b7a","name":"@blendmedia/babel-plugin-wildcard","dist-tags":{"latest":"7.0.0"},"versions":{"7.0.0":{"name":"@blendmedia/babel-plugin-wildcard","version":"7.0.0","description":"`import` now works with directories","main":"lib/index.js","scripts":{"build":"babel -d ./lib ./src","prepublish":"babel -d ./lib ./src --minified","test":"node test"},"bin":{"bpwc":"./index.js"},"repository":{"type":"git","url":"git+https://github.com/vihanb/babel-plugin-wildcard.git"},"author":{"name":"Vihan B","email":"vihan@vihan.org","url":"vihan.org"},"license":"MIT","bugs":{"url":"https://github.com/vihanb/babel-plugin-wildcard/issues"},"homepage":"https://github.com/vihanb/babel-plugin-wildcard#readme","devDependencies":{"babel":"^6.5.2","babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","chalk":"^1.1.3","clear":"0.0.1","diff":"^3.0.1"},"dependencies":{"rimraf":"^2.6.2"},"gitHead":"4529ead290b5f6f8ac684143d09879b6a4b5b855","_id":"@blendmedia/babel-plugin-wildcard@7.0.0","_nodeVersion":"12.8.0","_npmVersion":"6.10.2","dist":{"integrity":"sha512-qL6vDLsiLcbUAK/OP9Di9+bbI3/owQmhu2UyPckfs/MsjMjSljPpj/1Ppdhp11b9MGjqP/+VFOjJ3ql5wPjQKA==","shasum":"36bf8c0bccd5eacbb7d21bec0b7d3907339cd127","tarball":"https://registry.npmjs.org/@blendmedia/babel-plugin-wildcard/-/babel-plugin-wildcard-7.0.0.tgz","fileCount":42,"unpackedSize":18960,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfBbw+CRA9TVsSAnZWagAARpMP/RJnSpwWPcZvWjTuwKOq\nQyh617cVIlunuH0AphJwwYAZ3EHsVwm8VbXG8j5n8q4Srmao6mrsDnHJ+VhK\ny1p+nSawAPsLYZywd5wDVMeEPc+vdxwqAzC9cis6M3WlPVRo+1+ego68Bf70\nJp0XFcwLMza2lecTfGToOQYZpyOl0Bhz3rdp5sGL2Tud7tT8xIPmp7BzoSu9\n/he9szNhboTiFhLAViEo8Udcvw4/amks2OE6KxYIuVeEEKXNcUACPEzPl70z\nn0EQhVZEYP607h1dD4UnTNVoQbXu/VEKc4gIejw36qPM3uNalL5dxfgfPWf4\nHuWpcr4KUolFYGMX4n6RybKwLgP8TTrfLfRXFt3Z+a8VZCXfbZUrFQ/PwgUw\nlwq4Dc/nwcANShuW3c3eDAzvyT7sM2qI092rNU4nhgbyd6WUfDMqMsSXsNyz\nLPyTvK5oUypGsB2hjUA3OpCd42KRHSDJfh6eImiA14Z9+9xsmURDOx4o7+8z\npQBB5GeeNbBkK8WXsVH4kNcnNi7l92lBTuglMPEGQJdT/1C6WmyXy5o6Bh/r\nf3ZeJCC+hLxkEgfqNxY1wYdBtrY0uaXPgUJuYQhFjzldBPHKAQU5wNSQh2yx\n50cv/PkWU2zx7wlCgvcvUvbs+obzwp77Sg8TmlyxYGSHV3+LtOXwubcncm8h\nfRUY\r\n=u5ud\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDgdU3vq7R7JmV+nqRMKpylXfL/sKlkInsM/DHM9Jj79wIgF6VIj7gbEnOCE1NnjV2Tj/rh7rTg/d5op58cuNqvkfk="}]},"maintainers":[{"name":"joehart","email":"joehart42@gmail.com"},{"name":"ashleyblurton","email":"ashley@blend.media"}],"_npmUser":{"name":"ashleyblurton","email":"ashley@blend.media"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-wildcard_7.0.0_1594211390183_0.44180326241596046"},"_hasShrinkwrap":false}},"time":{"created":"2020-07-08T12:29:50.028Z","7.0.0":"2020-07-08T12:29:50.324Z","modified":"2022-04-04T19:31:55.975Z"},"maintainers":[{"email":"ashley@blend.media","name":"ashleyblurton"}],"description":"`import` now works with directories","homepage":"https://github.com/vihanb/babel-plugin-wildcard#readme","repository":{"type":"git","url":"git+https://github.com/vihanb/babel-plugin-wildcard.git"},"author":{"name":"Vihan B","email":"vihan@vihan.org","url":"vihan.org"},"bugs":{"url":"https://github.com/vihanb/babel-plugin-wildcard/issues"},"license":"MIT","readme":"# babel-plugin-wildcard\n\nAllows you to `import` all files from a directory at compile-time.\n\n## Installation\n\n```sh\n$ npm install babel-plugin-wildcard\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"wildcard\"]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins include script.js\n```\n\n### Via Node API\n\n```javascript\nrequire('babel').transform('code', {\n  plugins: ['wildcard']\n});\n```\n\n## Example\n\nWith the following folder structure:\n\n```\n|- index.js\n|- dir\n    |- a.js\n    |- b.js\n    |- c.js\n```\n\nthe following JS:\n\n```javascript\nimport * as Items from './dir';\n```\n\nwill be compiled to:\n\n```javascript\nconst Items = {};\nimport _wcImport from \"./dir/a\";\nItems.A = _wcImport;\nimport _wcImport1 from \"./dir/b\";\nItems.B = _wcImport1;\nimport _wcImport2 from \"./dir/c\";\nItems.C = _wcImport2;\n```\n\nmeaning you will be able to access the items using `Items.A` and `Items.B`.\n\n---\n\nYou can also selectively choose files using:\n\n```javascript\nimport { A, C } from \"dir/*\";\n```\n\nwhich in the above example would convert to:\n\n```\nimport A from \"./dir/a\";\nimport C from \"./dir/c\";\n```\n\nThe above is like doing:\n\n```\nimport * as temp from \"dir\";\nconst { A, C } = temp;\n```\n\n---\n\nThere is also simple Glob support so given the directory structure:\n\n```\n|- index.js\n|- dir\n    |- a.js\n    |- a.spec.js\n    |- b.js\n    |- b.spec.js\n```\n\nthis import:\n\n```javascript\nimport * as tests from './dir/*.spec';\n```\n\nwill compile to:\n\n```javascript\nimport aSpec from './dir/a.spec';\nimport bSpec from './dir/b.spec';\n```\n\n---\n\nFiles are automatically camel-cased and in the `import` statements the extensions are clipped unless specified otherwise (see below)\n\n## Information\n\n - File extensions are removed in the resulting variable. Dotfiles will be imported without their preceding `.` (e.g. `.foo` -> `Foo` or `foo` depending on settings)\n - in an `import { ... } from 'foo/*'`, the identifiers inside { ... } are the same as what their name\n would be if you were to import the whole directory. This means it is the files' names' pascal/camel-cased and extensions removed etc. by default (depending on settings of course).\n\n## Options\n\n`babel-plugin-wildcard` allows you to change various settings by providing an options object by using the following instead:\n\n```javascript\n{\n    plugins: [\n        ['wildcard', { options }]\n    ]\n}\n```\n\nwhere `{ options }` is the options object. The following options are available:\n\n### `exts`\nBy default, the files with the following extensions: `[\"js\", \"es6\", \"es\", \"jsx\"]`, will be imported. You can change this using:\n\n```javascript\n{\n    plugins: [\n        ['wildcard', {\n            'exts': [\"js\", \"es6\", \"es\", \"jsx\", \"javascript\"]\n        }]\n    ]\n}\n```\n\nIf you add the extension `\"\"`, it will also import subdirectories.\n\n### `nostrip`\nBy default, the file extension will be removed in the generated `import` statements, you can change this using:\n\n```javascript\n{\n    plugins: [\n        ['wildcard', {\n            'nostrip': true\n        }]\n    ]\n}\n```\n\nThis is useful when the extension of your source files is different from the outputted ones. (e.g. `.jsx` to `.js`).\n\n### `useCamelCase`\nBy default the name is converted to PascalCase, if you prefer camelCase, you may set this option to true:\n\n```\n{\n    plugins: [\n        ['wildcard', {\n            'useCamelCase': true\n        }]\n    ]\n}\n```\n\n### `noModifyCase`\nBy default, the name will be automatically pascal cased, the following regex is used to extract the words, those words then have their first letter capitalized and are joined together:\n\n```\n[A-Z][a-z]+(?![a-z])|[A-Z]+(?![a-z])|([a-zA-Z\\d]+(?=-))|[a-zA-Z\\d]+(?=_)|[a-z]+(?=[A-Z])|[A-Za-z0-9]+\n```\n\nyou can disable this behavior using:\n\n```javascript\n{\n    plugins: [\n        ['wildcard', {\n            'noModifyCase': true\n        }]\n    ]\n}\n```\n\nExtensions are still removed (except dotfiles, see \"Information\").\n","readmeFilename":"README.md"}