{"name":"esbuild-plugin-replace","version":"1.0.4","keywords":["esbuild","plugin","replace","npm","module"],"author":{"name":"naecoo","email":"ocean_zyy@yeah.net"},"license":"MIT","_id":"esbuild-plugin-replace@1.0.4","maintainers":[{"name":"naeco","email":"847185911@qq.com"}],"homepage":"https://github.com/naecoo/esbuild-plugin-replace/blob/main/README.md","bugs":{"url":"https://github.com/naecoo/esbuild-plugin-replace/issues"},"dist":{"shasum":"7376384eee8d216fdf8cffeea56212055faf6f58","tarball":"http://registry-npm.ywwl.com/esbuild-plugin-replace/download/esbuild-plugin-replace-1.0.4.tgz","fileCount":5,"integrity":"sha512-OscZXEN6Moo+qqg5Q3G/6aptwzGuRmtdbLF+0b1lyix9PwE5fbCP3cARKJz7//FiJzSRHm89xjY8JAMuVImXow==","signatures":[{"sig":"MEUCIQDAivQ2OcNtcekbM0Qv7T3mLUz/H5z6mnpRq1hyDszM9QIgB9ASl6K9QvHnviGKocgjuqP0qd0+w/V1pK9YiwGjWEk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6365,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgVsUSCRA9TVsSAnZWagAArdIP/3NI0rks+ixZsGxNdQA7\nnVGgpxaiNwsP8SeCkL7J95EfpJgvks2LAoV4qGbUbSf9HrYYfq+f3f8wnGGx\ngpdqaAo/J63LxJrMNzqYJ1LJbeJw9MFYTx+z4X7+zkfS97US/RB3h+nJNBVU\nZiRz2vy5Ex484mjNzzJ2NA11Vq45tGGC6FJq07avL4YozjNKnhrz/gHm8Lf1\nytEgFr8DOSKJ/VjW5McyIYlSXiIh0p0U5rRluvC7zVYEgATZ/8PzbW8TnNeJ\n7s10ot2InHsVOQirTpiL8s2J1s5G6bPvREeFaVxyEgsjqJqOBMg71ONoG929\nlxbXuJ1MaG8UYMEo7Tv3Zwv1a95MjWGtlNy0OUtrpAylTGgyf5eL4pbhYl2P\nNUwVvXKS8bTBSYnG7oAOvSbadQoryRQASxUiNZkAdiNIx+u4c8l6igY2DO30\n/zAFHpoHfq8uIHIhH5BjfXaVOW+ej0nXpixkSgYBWu2rNeF090MhA3BzksR3\ntM6GahIOT0kCAnOFJlAgQZ2mJoL4EpgdmrJhWcdhSs6ATtw3rNdX218j/J0l\n6mJ6TEXmmF6WQIu+wrKdKHuoqfNqhAh7alpfK6k0OPiIuVaBFyvpR7vsOMYn\ne0Um2nNzter+zZG7LDJBDgVoYzKs7rSuINIO/tdGr0XB0lLuSiYqizuonMgS\nAro9\r\n=NgB6\r\n-----END PGP SIGNATURE-----\r\n","size":2993,"noattachment":false,"key":"/esbuild-plugin-replace/-/esbuild-plugin-replace-1.0.4.tgz"},"main":"src/index.js","types":"types/index.d.ts","gitHead":"7e5ecd6b5bd7141c9603c27a9e697d2ac3831c03","scripts":{"test":"npm run test:unit && npm run test:type","test:type":"tsc types/index.d.ts test/type.ts --noEmit","test:unit":"jest --no-cache","prepublish":"npm run test"},"_npmUser":{"name":"naeco","email":"847185911@qq.com"},"repository":{"url":"git+https://github.com/naecoo/esbuild-plugin-replace.git","type":"git"},"_npmVersion":"6.14.8","description":"Replace strings in files while bundling","directories":{},"_nodeVersion":"12.18.2","dependencies":{"magic-string":"^0.25.7"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","esbuild":"^0.9.3","typescript":"^4.2.3"},"_npmOperationalInternal":{"tmp":"tmp/esbuild-plugin-replace_1.0.4_1616299282044_0.16947878532498883","host":"s3://npm-registry-packages"},"readme":"# esbuild-plugin-replace\n\nAn esbuild plugin for replacing strings in files while bundling.\n\n> Based on [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)\n\n[![CI](https://github.com/naecoo/esbuild-plugin-replace/actions/workflows/ci.yml/badge.svg)](https://github.com/naecoo/esbuild-plugin-replace/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/esbuild-plugin-replace.svg)](https://www.npmjs.com/package/esbuild-plugin-replace)\n[![license](https://img.shields.io/npm/l/esbuild-plugin-replace.svg)](https://github.com/naecoo/esbuild-plugin-replace/blob/main/LICENSE)\n\n[Documentation](https://naecoo.github.io/esbuild-plugin-replace/) | [GitHub](https://github.com/naecoo/esbuild-plugin-replace)\n\n## Install\n\n```bash\nnpm install esbuild-plugin-replace --save-dev\n```\n\n## Quick Start\n\n```typescript\nimport { build } from \"esbuild\";\nimport { replace } from \"esbuild-plugin-replace\";\n\nawait build({\n  entryPoints: [\"src/index.js\"],\n  bundle: true,\n  plugins: [\n    replace({\n      __VERSION__: JSON.stringify(\"1.0.0\"),\n      __AUTHOR__: JSON.stringify(\"naecoo\"),\n    }),\n  ],\n});\n```\n\n## Options\n\n### Replacement Values\n\nSpecify replacements directly:\n\n```typescript\nreplace({\n  __VERSION__: JSON.stringify(\"1.0.0\"),\n});\n```\n\nOr use the `values` option:\n\n```typescript\nreplace({\n  values: {\n    __VERSION__: JSON.stringify(\"1.0.0\"),\n  },\n});\n```\n\nValues can also be functions:\n\n```typescript\nreplace({\n  __BUILD_TIME__: () => JSON.stringify(Date.now()),\n});\n```\n\n### Filtering\n\n- `include` - RegExp to match files to process (default: `/.*/`)\n- `exclude` - RegExp to match files to skip\n\n```typescript\nreplace({\n  include: /\\.js$/,\n  exclude: /node_modules/,\n  values: { __VERSION__: '\"1.0.0\"' },\n});\n```\n\n### Delimiters\n\nCustom delimiters for matching (default: word boundaries `\\b`):\n\n```typescript\nreplace({\n  delimiters: [\"\", \"\"],\n  \"@/src/\": \"./src/\",\n});\n```\n\n## TypeScript\n\nFull TypeScript support is included. Types are auto-generated.\n\n```typescript\nimport { replace, ReplaceOptions } from \"esbuild-plugin-replace\";\n\nconst options: ReplaceOptions = {\n  __VERSION__: JSON.stringify(\"1.0.0\"),\n};\n\nreplace(options);\n```\n\n## License\n\nMIT\n","publish_time":1616299282223,"_cnpm_publish_time":1616299282223,"dist-tags":{"latest":"2.0.0"}}