{"name":"esbuild-plugin-replace","version":"1.2.1","keywords":["esbuild","plugin","replace","npm","module"],"author":{"name":"naecoo","email":"ocean_zyy@yeah.net"},"license":"MIT","_id":"esbuild-plugin-replace@1.2.1","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":"33dba07ded717df3b167ef2bc9e2176546240160","tarball":"http://registry-npm.ywwl.com/esbuild-plugin-replace/download/esbuild-plugin-replace-1.2.1.tgz","fileCount":6,"integrity":"sha512-8tLWnMLVH52I2kCSntwV5uW0NtS5Pj5mi1ni0yzlYizNPhg+XLMCmnVkSOpU2VESxvpVYvt37E0fMvOL7ZbP+g==","signatures":[{"sig":"MEQCIAI+yhrb4sys8eNWcmbOqrxK2HLPkw2GeUCoGArwl1r/AiB8OQx5jpAwa3opgfzKHKq+GM0dMh/d7PZnqqoL7JtfOw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":49080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjUAdAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAMxAAmumszplPD7wqD/OHDUQyHMYjyjkq7kBL6K9wDU4PI73E19UW\r\nn8O7JDltRoqru8mOuR7zs62hpnmdR0BiI361idz+RYNpraoiJnuzQXiHRNOv\r\nQ8tdHyDy8GpB16VbAlO6UVW1IAnBO6+UgiINOe4NC9Qo09tTZBw5gIWjEvsP\r\n6BgFC3bhvfKwYV+ihpWs6UjBKZklObGhcL05kekUBxrVZ4yMoDwSUU13Oo7D\r\ncgtR6UHue5viUWO91MrD0dMH8JVGRrCwBbMx2Q6KLF6u/zzkzgJbZEWMiChT\r\n5MBH5uGW+f0aoNfSeJip5hcvFvvsTL289HGIlMHOuVl3HKW2nyUTNwlgEJPx\r\nbRLBb3LaOyWIWqTkl77Pt2AY57aOF/2XouzGQceIM/pfJDDseQ+NL7Jb1s4j\r\ncxiGFmg2zZDxVEwFioi7ic8C7ZcPH0IWP19ElUD/+b0mX8y1ndCXAK9/sZD8\r\n4cUEKXqKRMA8GQmgFo3RsSTJYbyOz1DjrpIYYCqmiblx6GpEfkvX5niZqg/e\r\nPUGp02ARgDHrzbanY5R+rWKTl4VObNaFJhAEmPIXcbMwal6Io+UO/mO5BO97\r\nQsW+jqttG360yc/HUWczY0q0XCsYEPMfH27t9yjysMkAjPGFPl2/DMph6Arp\r\nNeS8JeUVD7mMM+nyyY8zINXd+OgnEkNAJvw=\r\n=WFqa\r\n-----END PGP SIGNATURE-----\r\n","size":9692,"noattachment":false,"key":"/esbuild-plugin-replace/-/esbuild-plugin-replace-1.2.1.tgz"},"main":"dist/index.js","types":"types/index.d.ts","module":"dist/index.mjs","gitHead":"6fe00285801625e9b10703ecb99c59e6c00bffd5","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.17.0","description":"Replace strings in files while bundling","directories":{},"_nodeVersion":"16.16.0","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.2.1_1666189119982_0.5690398510957178","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":1666189120198,"_cnpm_publish_time":1666189120198,"dist-tags":{"latest":"2.0.0"}}