{"name":"esbuild-plugin-replace","version":"1.1.0","keywords":["esbuild","plugin","replace","npm","module"],"author":{"name":"naecoo","email":"ocean_zyy@yeah.net"},"license":"MIT","_id":"esbuild-plugin-replace@1.1.0","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":"5bbff180fffe9f35f7bd71f8a8fa3f64c7fdd3e7","tarball":"http://registry-npm.ywwl.com/esbuild-plugin-replace/download/esbuild-plugin-replace-1.1.0.tgz","fileCount":6,"integrity":"sha512-NxyLnzR2jCtS94vFVTbXlLehXkZEj2bMl5uPN9IepMCrkjVG8xdGEVPempWB8pmZuN19XuzKItNdKSVEPI0tmA==","signatures":[{"sig":"MEUCIQClS3QpRz24BSvQyph7Ei0fgji/NrUewuBOMcrMGM5lUwIgY6LkRiRRl3sJQ9d+Q0rEsq528HxFFtRXG+XEALqNF0g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48440,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh0qPgCRA9TVsSAnZWagAAbgsP/jYZPVB8tLXU5NFoErUj\nzt2MCV7PTJtuD22JVUEGHMWreRzckNsrIZ54EfNguJ7bxwtvy0n2hw4UbGAy\n3jSfJabUm5g3xuiuM/CcsbrA+Zalw7w/lMWLlUHimf5v2KbSR2ca3gZiQ/vM\nOsc3k0UNCTSFMGMmz0hzmalTIKJAHUjjIGyFZUi+yzmAYRuZgP2aGJvOnNJf\n6BeRrvwxCwCS78LHFwzER3V8fZYThU3V0ARqin3Krv1fV5StusU+L9CJykcd\nfL1G1uz2FR1LkxGhbQKw/XxTB8/MbifsZero90hL4TMBIhoW6TNCbz6ienS3\nIxEOiHYIfuWXUsuklzp0cQoFz7RHrd6LA0CW3WU8000W+G8mcR+WBU1RVOnE\n4UyHTQ6BXt4iKxEULTw0K3+frqwrquRxa+S/BA/dpBXxl8Q7wjSTU1Q9/Foi\nUaSjafKQFmIqZclXh4SlLmprUH/80LKa8MKeDBlz/OlbBR2Z8kihjVEpsw6q\ndC1bGOsV724I25eK3nlGIS0ASQsFBKXqSGotLVqsWOOYo5k1ENTD6x7SIovd\nb1Ud+KztpK+rqj5zvpCY4ZM3UKpk/dk1wpW5ltRX/rdfNYErUo6jHRFKpTGa\nJgW5owosDJGyQ8zPjpY69GneCAO9rjf0Q8DvI6v1RQrPjYAD+GKdIHtVgnez\n6OVx\r\n=Vo8L\r\n-----END PGP SIGNATURE-----\r\n","size":9473,"noattachment":false,"key":"/esbuild-plugin-replace/-/esbuild-plugin-replace-1.1.0.tgz"},"main":"dist/index.js","types":"types/index.d.ts","module":"dist/index.mjs","gitHead":"e68b304516655aa7034ea7cabcebb6ba81cb1e04","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":"7.7.5","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.1.0_1641194464026_0.1611190039694621","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":1641194464267,"_cnpm_publish_time":1641194464267,"dist-tags":{"latest":"2.0.0"}}