{"_id":"@awenovations/vite-plugin-replace","name":"@awenovations/vite-plugin-replace","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@awenovations/vite-plugin-replace","version":"1.0.0","description":"With this plugin text in sourcecode could be replaced before bundling.","author":{"name":"Martin Oppitz","email":"npmjs@martinoppitz.com"},"homepage":"https://leanupjs.org","license":"MIT","keywords":["vite","plugin","replace"],"repository":{"type":"git","url":"git+https://github.com/awenovations/vite-plugin-replace.git"},"bugs":{"url":"https://github.com/awenovations/vite-plugin-replace/issues"},"devDependencies":{"@typescript-eslint/eslint-plugin":"8.24.0","@typescript-eslint/parser":"8.24.0","eslint":"9.20.1","npm-check-updates":"17.1.14","prettier":"3.5.1","typescript":"5.7.3","vite":"6.1.0"},"peerDependencies":{"vite":"^6"},"scripts":{"prepack":"rm -rf index.* && tsc"},"_id":"@awenovations/vite-plugin-replace@1.0.0","gitHead":"b7e377e45a9e2e5547fddab77facc8a8f232d2fe","types":"./index.d.ts","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-dQKj2e3eWTmMlh9miguL4M2dVE9vAzh2yQKlTaOR9LrvwSjbgo6+LQsH8u5RF87+EbXC5PZLSzObA4kpVLbJZw==","shasum":"78b7ebad8e13187b780afb5ffc7f4295b369489c","tarball":"https://registry.npmjs.org/@awenovations/vite-plugin-replace/-/vite-plugin-replace-1.0.0.tgz","fileCount":6,"unpackedSize":7118,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBbya5aXhsJzbbqurHuJBTg+LYj6QNbifVpD/c4evEHXAiAnXIslv9MprRFGgeLzwPdTJ4t30fXWbztozD+Rx4R4+Q=="}]},"_npmUser":{"name":"benjaminknox","email":"bknox.contact@gmail.com"},"directories":{},"maintainers":[{"name":"benjaminknox","email":"bknox.contact@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-replace_1.0.0_1739803590359_0.22074874083588925"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-17T14:46:30.253Z","1.0.0":"2025-02-17T14:46:30.545Z","modified":"2025-02-17T14:46:30.804Z"},"maintainers":[{"name":"benjaminknox","email":"bknox.contact@gmail.com"}],"description":"With this plugin text in sourcecode could be replaced before bundling.","homepage":"https://leanupjs.org","keywords":["vite","plugin","replace"],"repository":{"type":"git","url":"git+https://github.com/awenovations/vite-plugin-replace.git"},"author":{"name":"Martin Oppitz","email":"npmjs@martinoppitz.com"},"bugs":{"url":"https://github.com/awenovations/vite-plugin-replace/issues"},"license":"MIT","readme":"# Vite Plugin Replace\n\nWith this plugin text in sourcecode could be replaced before bundling.\n\n## Fork Details\nOriginally forked from [leanupjs/vite-plugin-replace](https://github.com/leanupjs/vite-plugin-replace), because it doesn't seem to be maintained anymore and is now out of date with critical vulns.\n\n### Fork Changes\nUpdates all packages and peer dependencies to the latest.\n\n## Motivation\n\nThe initial reason for implementing a new plugin to replace it was that the approach of [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace) is not flexible enough. So we looked at what [JavaScript replace](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/String/replace) actually offers us.\n\n### Declaration of the Replacement (interface):\n\n```ts\ninterface Replacement {\n  from: RegExp | string;\n  to: string | Function\n}\n```\n\n| Attribute | Type | Description |\n| -- | -- | -- |\n| `from` | `regexp` \\| `string` | \n| `to` | `string` \\| `string` |\n\n## Installation\n\n```bash\nnpm i -D vite-plugin-replace\n```\n\n## Usage\n\n```js\nimport packageJson from \"./package.json\";\nimport { replaceCodePlugin } from \"vite-plugin-replace\";\n\nmodule.exports = mergeConfig(config, {\n  plugins: [\n    replaceCodePlugin({\n      replacements: [\n        {\n          from: \"__CLI_NAME__\",\n          to: packageJson.name,\n        },\n        {\n          from: /__CLI_VERSION__/g,\n          to: packageJson.version,\n        },\n      ],\n    }),\n  ],\n});\n```\n","readmeFilename":"README.md"}