{"_id":"@astrapi69/vite-plugin-build-version","name":"@astrapi69/vite-plugin-build-version","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@astrapi69/vite-plugin-build-version","version":"0.1.0","description":"Vite plugin that emits the version.json build manifest and defines the build-time version/hash/date literals consumed by @astrapi69/pwa-update","license":"MIT","author":{"name":"Asterios Raptis"},"repository":{"type":"git","url":"git+https://github.com/astrapi69/pwa-update-kit.git","directory":"packages/vite-plugin"},"keywords":["vite","vite-plugin","pwa","version","build-info","manifest"],"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"scripts":{"build":"tsup"},"peerDependencies":{"vite":"^5 || ^6 || ^7 || ^8"},"publishConfig":{"access":"public"},"engines":{"node":">=20"},"gitHead":"0325af9d8eba62d04c7fa0b4e30fd1ff3c49167a","_id":"@astrapi69/vite-plugin-build-version@0.1.0","bugs":{"url":"https://github.com/astrapi69/pwa-update-kit/issues"},"homepage":"https://github.com/astrapi69/pwa-update-kit#readme","_nodeVersion":"24.15.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-jeNsjBMe28JAbVEfo30fFOTPa0ybhdQN/+qsUP7SvegfgmhL3BPJZBxF+NcyDL6aCdu1DZJizkgIuxbxHz/lyw==","shasum":"2bbc01d40d5d635bdd8cf352df7c561ce97880b5","tarball":"https://registry.npmjs.org/@astrapi69/vite-plugin-build-version/-/vite-plugin-build-version-0.1.0.tgz","fileCount":8,"unpackedSize":20791,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCDLEATbs+DqtpNICQaR1I37iIZ9YrQdfDtIpxYIOOFLwIgR10RkbZP0LsJvJLXY9b8nYfc6sYZd8/c4beBn9bFbrg="}]},"_npmUser":{"name":"astrapi69","email":"asterios.raptis@gmx.net"},"directories":{},"maintainers":[{"name":"astrapi69","email":"asterios.raptis@gmx.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-build-version_0.1.0_1784560856064_0.26040853918699924"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-20T15:20:55.796Z","0.1.0":"2026-07-20T15:20:56.207Z","modified":"2026-07-20T15:20:56.449Z"},"maintainers":[{"name":"astrapi69","email":"asterios.raptis@gmx.net"}],"description":"Vite plugin that emits the version.json build manifest and defines the build-time version/hash/date literals consumed by @astrapi69/pwa-update","homepage":"https://github.com/astrapi69/pwa-update-kit#readme","keywords":["vite","vite-plugin","pwa","version","build-info","manifest"],"repository":{"type":"git","url":"git+https://github.com/astrapi69/pwa-update-kit.git","directory":"packages/vite-plugin"},"author":{"name":"Asterios Raptis"},"bugs":{"url":"https://github.com/astrapi69/pwa-update-kit/issues"},"license":"MIT","readme":"# @astrapi69/vite-plugin-build-version\n\nThe build half of the PWA update kit: emits the `version.json` manifest next\nto your bundle and defines the build-time literals the runtime compares\nagainst.\n\n```bash\nnpm install -D @astrapi69/vite-plugin-build-version\n```\n\n## Usage\n\n```ts\nimport { defineConfig } from \"vite\";\nimport { buildVersion } from \"@astrapi69/vite-plugin-build-version\";\nimport pkg from \"./package.json\" with { type: \"json\" };\n\nexport default defineConfig({\n    plugins: [\n        buildVersion({\n            version: pkg.version,\n            buildHash: process.env.VITE_BUILD_HASH,\n            buildDate: process.env.VITE_BUILD_DATE,\n        }),\n    ],\n});\n```\n\nProduces:\n\n- `dist/version.json` → `{\"version\": \"...\", \"buildHash\": \"...\", \"buildDate\": \"...\"}`\n- `__APP_VERSION__`, `__BUILD_HASH__`, `__BUILD_DATE__` as build-time literals\n\nDeclare the literals for TypeScript:\n\n```ts\n// vite-env.d.ts\ndeclare const __APP_VERSION__: string;\ndeclare const __BUILD_HASH__: string;\ndeclare const __BUILD_DATE__: string;\n```\n\nExtra literals (a deploy channel, a branch) go through `extraDefines`.\n\n## Keep the manifest out of your precache\n\nWith `vite-plugin-pwa` / Workbox, do **not** include `json` in\n`workbox.globPatterns`. The manifest must always be fetched fresh — a\nprecached `version.json` reports the build it shipped with, forever.\n\n## Porting to another bundler\n\nThe runtime package is build-tool agnostic. Reimplementing this plugin is the\nwhole port:\n\n1. Write `{version, buildHash, buildDate}` to `version.json` in the output dir.\n2. Define the three literals (or pass the values into `createUpdateStore`\n   directly from anywhere else).\n\n## License\n\nMIT © Asterios Raptis\n","readmeFilename":"README.md","_rev":"1-7b4276225ffcbb53f4f8c89edea0440a"}