{"_id":"esbuild-plugin-import-pattern","name":"esbuild-plugin-import-pattern","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"esbuild-plugin-import-pattern","description":"esbuild plugin that imports modules based on wildcard patterns.","version":"0.1.0","license":"MIT","author":{"name":"Tim De Pauw","url":"https://tmdpw.eu"},"funding":{"type":"github","url":"https://github.com/sponsors/timdp"},"repository":{"type":"git","url":"https://github.com/timdp/esbuild-plugin-import-pattern.git"},"main":"index.js","scripts":{"test":"eslint \"**/*.js\" && ava","format":"prettier-eslint --write \"$PWD/**/*.js\"","prepare":"husky install","postversion":"git push && git push --tags"},"dependencies":{"fast-glob":"^3.2.12"},"devDependencies":{"ava":"^5.0.1","esbuild":"^0.15.12","eslint":"^8.24.0","eslint-config-standard":"^17.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-n":"^15.3.0","eslint-plugin-promise":"^6.0.1","eslint-plugin-simple-import-sort":"^8.0.0","husky":"^8.0.1","lint-staged":"^13.0.3","prettier-eslint-cli":"^7.1.0","temp":"^0.9.4"},"licenseText":"Copyright (c) 2022 Tim De Pauw <https://tmdpw.eu>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"esbuild-plugin-import-pattern@0.1.0","dist":{"shasum":"6497aa2e474ae4648ae848c2646dd736c5e356d6","integrity":"sha512-BEOCNItVUIY1bdOvAed9QjdHpXIWCr8UT9CaBjYbim40A1GD6rxFOjIJj9UFyFv31ui7g/Euwzan+/EdfdfvZw==","tarball":"https://registry.npmjs.org/esbuild-plugin-import-pattern/-/esbuild-plugin-import-pattern-0.1.0.tgz","fileCount":5,"unpackedSize":7362,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDCP39l0qzgD8SPu0yWsNW4rOevlPvXIGrmDMK5sMD/zQIhAIB3Yz5gNUdaWr/0NvYJM52PFiBqXzmWH+lzlyY9NDo2"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjWmP/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoixQ//fxqGGzI9uD3WIL1ozjuS126RDmxUP1ro9gP9kxAFmXzL/VlQ\r\nAQ+WUy4rcGjBvQKSR6W0nQdmkr4MgBcp+9D1zeeNHOXQ+09Vzt16GdKIR7P5\r\n4pQLZxigAn6vwUY69NHlLniD52kQ5P2U3E/3Xf+ojyBHMCBzVJtegraib/L3\r\nqLTPu0PheNc5IQ9aHeeeI2hs23yxIMCbbWBHh18sbIPRG1yHNBlq5pv4ePK1\r\nGGtN8mnVyYWtzaKNZoK0af8RFfIB22TjiwsN9FVPbKqZWbRe34rbiZQGUhqR\r\nC6DmLdovdxImYG7SOn16d0+EbvYCbEG8niLuYESKrxsjEsJsOPAKhnkYEe8o\r\nUMuptlVVOeVIQ8Yf0JQ4a1lOniS1FL9grLx2rn/3aol0D4pYtqiqbzfVNyJy\r\nWbGOk6zWlNIi0v8pZNnJBEVbyl8RV04xrGdEJom0VjmZTkNeZR48fymtRObm\r\nN0kvto7GnxT2gKXZVbrZeHfun0J1Xx7regPqVDgX29OG7e5C5ktBF2GZHJPr\r\nXTKibZf1egX70LVz6nqeOi4/GwfwScDGJ+dWmxv97Ac5c0hC/Pwf5tCKtn97\r\nZ4eXD8LeQzlb7wTwu+3uSdFKyN8Pp2bdy15psCnsFGgMKkiTkpQJSKD9uz+L\r\nG3smGY/4t2ISOeKr5HXMuMmsEoBI3+l0mVI=\r\n=I8np\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"timdp","email":"hi@tmdpw.eu"},"directories":{},"maintainers":[{"name":"timdp","email":"hi@tmdpw.eu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esbuild-plugin-import-pattern_0.1.0_1666868222944_0.6104218973974498"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-27T10:57:02.943Z","0.1.0":"2022-10-27T10:57:03.125Z","modified":"2022-10-27T10:57:03.250Z"},"maintainers":[{"name":"timdp","email":"hi@tmdpw.eu"}],"description":"esbuild plugin that imports modules based on wildcard patterns.","repository":{"type":"git","url":"https://github.com/timdp/esbuild-plugin-import-pattern.git"},"author":{"name":"Tim De Pauw","url":"https://tmdpw.eu"},"license":"MIT","readme":"# esbuild-plugin-import-pattern\n\n[![npm](https://img.shields.io/npm/v/esbuild-plugin-import-pattern.svg)](https://www.npmjs.com/package/esbuild-plugin-import-pattern) [![JavaScript Standard Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://standardjs.com)\n\n[esbuild](https://esbuild.github.io/) plugin that imports modules based on\nwildcard patterns.\n\nAttempts to improve upon the ergonomics of\n[esbuild-plugin-import-glob](https://www.npmjs.com/package/esbuild-plugin-import-glob).\n\n## Installation\n\nInstall the dependency:\n\n```bash\nnpm install esbuild-plugin-import-pattern --save-dev\n```\n\nConfigure esbuild:\n\n```js\nconst esbuild = require('esbuild')\nconst { importPatternPlugin } = require('esbuild-plugin-import-pattern')\n\nesbuild.build({\n  ...\n  bundle: true,\n  plugins: [importPatternPlugin()]\n})\n```\n\n## Usage\n\nImport something using a wildcard pattern:\n\n```js\nimport { entries } from './files/*.js'\n\nconsole.log(entries)\n```\n\nThis will produce an array of tuples, each containing the path to an imported\nfile and its exports:\n\n```js\n[\n  ['./files/one.js', {  // Source:\n    default: 'one'      //   export default 'one'\n  }],\n  ['./files/two.js', {  // Source:\n    default: 2,         //   export default 2\n    noun: 'two'         //   export const noun = 'two'\n  }],\n  ...\n]\n```\n\nIf you're only interested in the exports, import `modules` instead of `entries`.\nSimilarly, you can choose to import `paths`.\n\n## Tips\n\nIf you want to look modules up by their path, you can feed `entries` directly\ninto `Object.fromEntries(entries)` or `new Map(entries)`.\n\nTo use multiple imports in the same module, be sure to rename them using the\n`as` keyword:\n\n```js\nimport { entries as cats } from './cats/*.js'\nimport { entries as dogs } from './dogs/*.js'\n```\n\nOther than `*`, you can also use any pattern supported by\n[fast-glob](https://www.npmjs.com/package/fast-glob). However, the pattern needs\nto contain at least one `*` character.\n\n## Selecting Named Imports\n\nBy default, each matching import will expose all of its exports. Currently, this\nmakes esbuild produce some unnecessary code. If bundle size is a concern, you\nwill want to avoid this.\n\nAs long as all imports export the same name(s), you can tell the plugin to _only_\nimport those. You do this by appending a hash symbol to the pattern, followed by\nthe names, separated by commas.\n\nFor example, to only get the default exports from `files/*.js`, you would write:\n\n```js\nimport { modules } from './files/*.js#default'\n\nconsole.log('Default exports:', modules.map((module) => module.default))\n```\n\nNote that omitting `#default` will not change the behavior of this script.\nHowever, the generated bundle will be bigger.\n\n## Author\n\n[Tim De Pauw](https://tmdpw.eu)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}