{"name":"esbuild-plugin-replace","version":"1.0.3","keywords":["esbuild","plugin","replace","npm","module"],"author":{"name":"naecoo","email":"ocean_zyy@yeah.net"},"license":"MIT","_id":"esbuild-plugin-replace@1.0.3","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":"368560b4d97e34c59ebc42a5f0245a0b6dd6d1e6","tarball":"http://registry-npm.ywwl.com/esbuild-plugin-replace/download/esbuild-plugin-replace-1.0.3.tgz","fileCount":5,"integrity":"sha512-uggdyAhanqoFomWaeYSXvSS0Seo1+21ts56oEf7FpTD36Hs93VIpc/6OCV5FYg6MA2RbHjG2eUKGjpjTkHAo+g==","signatures":[{"sig":"MEUCIFgWuXVkzyNyegNGVzjSlrj54WQNx2pGMncc7iOXopv5AiEAg90D8t40qOu/oyFWnhK7+HqiD/X4SJbhyqA7vLD8nAY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6245,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgVZwsCRA9TVsSAnZWagAAGHMP/0ahDYq7sA3swbibtcnF\nQv4iLAhX7DF1X3go6o1YLiZZt6DrJpp++Nnqw78JdoXdkNwR0BIpyij367mp\ntTgAeAJ1aIFUW07bjnLogI4G4omMDGX3QhG/3ttE7LgaY96wkYm7bYKxbJCK\nV997VFhySuaJwBQe/JSbVjmXMiV64ZmhBy9x0vL9SdiIwcAw1//a6MvwOE2B\nVlxbkchJaTHqk9yD75u1YswyHYrl8p5xoc/dAVl7R5XfMk/uJfKaS1E9P3u0\nCaH/tN340XEgZCSCM+auJSJKbxbQT8fbX/4dQAieiUPlrT80abDfDYPhJrZ8\nRJ0lUIkmrvXhtNV78PSiDC9/gDQXa4z25HRZ0rFV1S8hw4bQvwmf3KY0ieTR\npZQF+c4UOSRTEsHBENbcQ7DptuG/l7rbxoWLDtDhvBeyPcsKVG4zYtdZsyI2\npVtLO1TWk7oL/Ln0n9yp1NuWYt71wiJ+3yhGvMs50n9vfT/ziYPep/IL562b\nNaMRtIu5HKNLMpGVEbKTp7G1L0YaoIaTZxylx3PE2Gi1QoTYdztkR3r3i4HN\nymITRcRnGi50QI/GpRMFJ9Y7GfDamsia7h6vYcz5SZsJneje2W2kFSje8gL1\n0h32dlHHl0U2/4tF6zr2sboCvzPv3B2v9/HW7P/lqE3l/gfR4/JG15CRMDww\nmg2M\r\n=96RW\r\n-----END PGP SIGNATURE-----\r\n","size":2949,"noattachment":false,"key":"/esbuild-plugin-replace/-/esbuild-plugin-replace-1.0.3.tgz"},"main":"src/index.js","types":"types/index.d.ts","gitHead":"166d36d3a80d5328c7aeaaf273d1cf204587f796","scripts":{"test":"echo 'test'","test:ts":"tsc types/index.d.ts test/types.ts --noEmit"},"_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":{"esbuild":"^0.9.3","typescript":"^4.2.3"},"_npmOperationalInternal":{"tmp":"tmp/esbuild-plugin-replace_1.0.3_1616223275595_0.45686859088144405","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":1616223275814,"_cnpm_publish_time":1616223275814,"dist-tags":{"latest":"2.0.0"}}