{"name":"esbuild-plugin-replace","version":"1.0.9","keywords":["esbuild","plugin","replace","npm","module"],"author":{"name":"naecoo","email":"ocean_zyy@yeah.net"},"license":"MIT","_id":"esbuild-plugin-replace@1.0.9","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":"43cfddfbecf3730bcde0cc6393322af8c471ae89","tarball":"http://registry-npm.ywwl.com/esbuild-plugin-replace/download/esbuild-plugin-replace-1.0.9.tgz","fileCount":6,"integrity":"sha512-dWzw8YLzp87lE+CaNbs41b1rtL2JC5M9770F9Av8EgUT6z/buKmgfYHH15Dy3lpL6gCK0AREJ8yTKSgXB5L2bg==","signatures":[{"sig":"MEUCIQDVB0+HdnOwls5D5ouLZgfzvdftEuka0oSzb/DkXBYN0QIgE+YuVV6aeIzsvEIyC4j8H/Z2w/E1Cszf8vcudh2/cQU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47731,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqCu9CRA9TVsSAnZWagAAABsP+QB1D6go+EdIEMtV/90s\njuRD+mAXvCDAawC0D1BQsxn8V98rtAegbKBWxXT1vmb7VK4CwMwqljVobHeK\nUr3JPh6m6rwNFKKia9z3T/DgW/Lk0b/NtEjgpigy5hvUsE3cIlDBhNDwowyH\n21+LElrqWXQIlwOjvl6nRpqYABnmlIJjd4kMN4TRgdnxEob14hhsaKEOI6vh\n1ddGm5++4WAA7yAgX2oAActPVTQKN/MNknY4JgJ16NdDjlEm3U0MECjE7C8Z\nrA2iKWssgDTdGc/4861DhnAaN+T1Tpm+9KuItqJgovt0CJIKT/ugnz6KJCkH\n6SsYwGvBvD+lHrXyC5FxXm3GTWjE/5XzPAQLXyIs9GlhfmSxGOcMQ2h1PknA\nKe4Hkk1q+9Y5bdR+ZQ8+YIq0OzS2vpIdZBa0aGqkYzhvbxdgL401buD0Aa4b\nl9Q99p6kdfRvmYLsbRNdhizg4BEAYphRzNN9hwq9vgS1WUkKix/dhtdo92QU\nJKbAZox5GBq1ZauQGH9E/s2DrZWpKdbWb5vtnHyAOPErVxNfl5ho4MYHPkUq\nCq4hkkI2/rwZ4NZ4nHGS6yJsPk1hXkDpEUwyzgPk7InQ1M5UCqRAd85cfhT9\nwzxr/apJs3ObIYY/AiG26ZxKTxdFBOlDtmuf5grs3RYKQ5WlkXicDtoFHXP0\nGTCq\r\n=pwQz\r\n-----END PGP SIGNATURE-----\r\n","size":9373,"noattachment":false,"key":"/esbuild-plugin-replace/-/esbuild-plugin-replace-1.0.9.tgz"},"main":"dist/index.js","types":"types/index.d.ts","module":"dist/index.mjs","gitHead":"197697475d461d640b093224cbfcf355a947fb2b","scripts":{"test":"npm run test:unit && npm run test:type","build":"node build.js","test:type":"tsc types/index.d.ts test/type.ts --noEmit","test:unit":"jest --no-cache","prepublish":"npm run test && npm run build"},"_npmUser":{"name":"naeco","email":"847185911@qq.com"},"repository":{"url":"git+https://github.com/naecoo/esbuild-plugin-replace.git","type":"git"},"_npmVersion":"8.1.1","description":"Replace strings in files while bundling","directories":{},"_nodeVersion":"14.17.4","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.9_1638411197084_0.4688717485718432","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":1638411197259,"_cnpm_publish_time":1638411197259,"dist-tags":{"latest":"2.0.0"}}