{"_id":"@charcuterie/vite-config","_rev":"4-4e8412a40679b88c306408b0eb8437de","name":"@charcuterie/vite-config","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@charcuterie/vite-config","version":"1.0.0","license":"MIT","_id":"@charcuterie/vite-config@1.0.0","maintainers":[{"name":"sawtaytoes","email":"saturn2888+npm@gmail.com"}],"homepage":"https://github.com/Sawtaytoes/charcuterie#readme","bugs":{"url":"https://github.com/Sawtaytoes/charcuterie/issues"},"dist":{"shasum":"95d4f267c983f4bbe1aaaffd7228eb3123a93953","tarball":"https://registry.npmjs.org/@charcuterie/vite-config/-/vite-config-1.0.0.tgz","fileCount":3,"integrity":"sha512-g4U4M3jP1UGP3Q7XwDYIqn/exX0KIu4SNxiFWuYtvDLPpoYDUf6sHTdTePaZOwV2s5WV0LDCothpnHc7WmdUAg==","signatures":[{"sig":"MEYCIQDha028NeV1u+h+dZ79jE30dNJ/dbNv57n0BwXL7ZrJBAIhAP/zm+SV7MTktMANMR3zSAnUnhP49V8bFbKtYj9/yemO","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2486},"main":"./src/index.js","type":"module","exports":{".":"./src/index.js","./*":"./src/*"},"scripts":{"typecheck":"tsc --noEmit"},"_npmUser":{"name":"sawtaytoes","email":"saturn2888+npm@gmail.com"},"repository":{"url":"git+https://github.com/Sawtaytoes/charcuterie.git","type":"git","directory":"packages/vite-config"},"_npmVersion":"11.16.0","description":"A shared Vite config factory for the Charcuterie fleet — call createViteConfig(overrides) and add your own plugins.","directories":{},"_nodeVersion":"24.18.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/node":"^25.6.2"},"peerDependencies":{"vite":">=5"},"_npmOperationalInternal":{"tmp":"tmp/vite-config_1.0.0_1786160403532_0.26833497193547284","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@charcuterie/vite-config","version":"1.0.1","license":"MIT","_id":"@charcuterie/vite-config@1.0.1","maintainers":[{"name":"sawtaytoes","email":"saturn2888+npm@gmail.com"}],"homepage":"https://github.com/Sawtaytoes/charcuterie#readme","bugs":{"url":"https://github.com/Sawtaytoes/charcuterie/issues"},"dist":{"shasum":"5870ee6ca0d6bff9ed68b54a7fa6154510416151","tarball":"https://registry.npmjs.org/@charcuterie/vite-config/-/vite-config-1.0.1.tgz","fileCount":4,"integrity":"sha512-0QhtReRJD+00bw6ZOvFsoHYsCO8+eqqpOSN6hJG8YQjvyeQCh/kHpLUlUe9dO2AAyYgl5Knr5Shfxtcl1zknGg==","signatures":[{"sig":"MEUCICbyJHNiDRyU9RRdQceZxkxW7MOXfyF+mEOqyoeaSRPdAiEAgfwSG+TEWecmmthcGJS2mgcY9nWRqMx9qRSfp111rEE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@charcuterie%2fvite-config@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":2843},"main":"./src/index.js","type":"module","types":"./src/index.d.ts","exports":{".":{"types":"./src/index.d.ts","default":"./src/index.js"},"./*":"./src/*"},"scripts":{"typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d20e9680-c2c1-44ae-8857-1cfdf78bf51b"}},"repository":{"url":"git+https://github.com/Sawtaytoes/charcuterie.git","type":"git","directory":"packages/vite-config"},"_npmVersion":"11.19.0","description":"A shared Vite config factory for the Charcuterie fleet — call createViteConfig(overrides) and add your own plugins.","directories":{},"_nodeVersion":"26.7.0","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/node":"^25.6.2"},"peerDependencies":{"vite":">=5"},"_npmOperationalInternal":{"tmp":"tmp/vite-config_1.0.1_1786162873425_0.38202410966258693","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@charcuterie/vite-config","version":"1.0.2","license":"MIT","_id":"@charcuterie/vite-config@1.0.2","maintainers":[{"name":"sawtaytoes","email":"saturn2888+npm@gmail.com"}],"homepage":"https://github.com/Sawtaytoes/charcuterie#readme","bugs":{"url":"https://github.com/Sawtaytoes/charcuterie/issues"},"dist":{"shasum":"98560775a55128b8b3b7f6f6d65a8a4d18cdb044","tarball":"https://registry.npmjs.org/@charcuterie/vite-config/-/vite-config-1.0.2.tgz","fileCount":5,"integrity":"sha512-I/QQm7Wam6S5AS+G81TR5WpmBbf5Io9353fJwmq3fw5DFRjpYZel3Z3afLcsQvBqbKchyYcgTJAXRDVgY4wsGQ==","signatures":[{"sig":"MEYCIQCeNoR0JUTxg2DUsBEPXiu91jqyuFbHhw1rjoD/1UwpeQIhAPC5iz76OnDwJIgk61o9Z5evKzRmrZGujFeXKpaNSUar","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@charcuterie%2fvite-config@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":5919},"main":"./src/index.js","type":"module","types":"./src/index.d.ts","exports":{".":{"types":"./src/index.d.ts","default":"./src/index.js"},"./*":"./src/*"},"scripts":{"test":"vitest","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d20e9680-c2c1-44ae-8857-1cfdf78bf51b"}},"repository":{"url":"git+https://github.com/Sawtaytoes/charcuterie.git","type":"git","directory":"packages/vite-config"},"_npmVersion":"11.19.0","description":"A shared Vite config factory for the Charcuterie fleet — call createViteConfig(overrides) and add your own plugins.","directories":{},"_nodeVersion":"26.7.0","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/node":"^25.6.2"},"peerDependencies":{"vite":">=5"},"_npmOperationalInternal":{"tmp":"tmp/vite-config_1.0.2_1786430022837_0.1772076283441122","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@charcuterie/vite-config","version":"1.1.0","description":"A shared Vite config factory for the Charcuterie fleet — call createViteConfig(overrides) and add your own plugins.","license":"MIT","type":"module","main":"./src/index.js","types":"./src/index.d.ts","exports":{".":{"types":"./src/index.d.ts","default":"./src/index.js"},"./*":"./src/*"},"publishConfig":{"access":"public","provenance":true},"scripts":{"test":"vitest","typecheck":"tsc --noEmit"},"peerDependencies":{"vite":">=5"},"devDependencies":{"@types/node":"^25.6.2","typescript":"^6.0.3"},"repository":{"type":"git","url":"git+https://github.com/Sawtaytoes/charcuterie.git","directory":"packages/vite-config"},"_id":"@charcuterie/vite-config@1.1.0","bugs":{"url":"https://github.com/Sawtaytoes/charcuterie/issues"},"homepage":"https://github.com/Sawtaytoes/charcuterie#readme","_nodeVersion":"26.7.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-rPrdgrJIkO0/UqCVIOOHRVWJXyWCJsf1EYNQ1kEwUQCivD9N8b/hBK1eP5aBHd35qaLa3DSYk4RLZ3DNSIbMmg==","shasum":"1ad13b12c54e4bd43998f9ac0e0ea6386dcdf703","tarball":"https://registry.npmjs.org/@charcuterie/vite-config/-/vite-config-1.1.0.tgz","fileCount":12,"unpackedSize":49800,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@charcuterie%2fvite-config@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDTOIp/hQpqPkQc1YDmhsIdJUUtcjWLNyGO/OTusOHGHAiAQLdi8w9IsC6TS4gGNyWieqvxKrvR8KDrJTeoVzdYsjg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d20e9680-c2c1-44ae-8857-1cfdf78bf51b"}},"directories":{},"maintainers":[{"name":"sawtaytoes","email":"saturn2888+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-config_1.1.0_1786597528201_0.6846415499890028"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-08T03:40:03.342Z","modified":"2026-08-13T05:05:28.695Z","1.0.0":"2026-08-08T03:40:03.681Z","1.0.1":"2026-08-08T04:21:13.565Z","1.0.2":"2026-08-11T06:33:42.966Z","1.1.0":"2026-08-13T05:05:28.364Z"},"bugs":{"url":"https://github.com/Sawtaytoes/charcuterie/issues"},"license":"MIT","homepage":"https://github.com/Sawtaytoes/charcuterie#readme","repository":{"type":"git","url":"git+https://github.com/Sawtaytoes/charcuterie.git","directory":"packages/vite-config"},"description":"A shared Vite config factory for the Charcuterie fleet — call createViteConfig(overrides) and add your own plugins.","maintainers":[{"name":"sawtaytoes","email":"saturn2888+npm@gmail.com"}],"readme":"# @charcuterie/vite-config\n\nA shared Vite config **factory** for the Charcuterie fleet. Ships the build/server\ndefaults every app wants and leaves plugins to the caller, so one preset serves a React\nSPA, an Electron renderer, and a library build.\n\n## Usage\n\n```ts\n// vite.config.ts\nimport { createViteConfig } from \"@charcuterie/vite-config\"\nimport react from \"@vitejs/plugin-react\"\n\nexport default createViteConfig({\n  plugins: [react()],\n  build: { outDir: \"dist/web\" },\n})\n```\n\nOverrides are **deep-merged** over the base via Vite's own `mergeConfig`. Apps with\nmultiple targets (e.g. image-viewer's Electron main/preload/renderer) call it once per\ntarget with different overrides.\n\n`vite` is a peer dependency — the app owns the Vite version; Renovate bumps this\npackage's range fleet-wide when the shared defaults change.\n\n## The `index.html` guard\n\nThe base ships **one plugin**, `charcuterie:no-shadowed-injection-anchors`, and it is not\nopt-in. It fails the build — and the dev server, at startup — when a structural tag\nliteral sits inside an HTML comment *before* the real tag it shadows.\n\nVite finds its script-injection points with plain regexes over the raw HTML\n(`/<head[^>]*>/i` and siblings for `</head>`, `<body>`, `</body>`, `</html>`). They are\ncomment-blind, so the **first** literal `<head>` in the file wins even inside\n`<!-- … -->`, and everything Vite meant to inject lands in the comment where the browser\nnever parses it. In dev that is `@vitejs/plugin-react`'s react-refresh preamble and\n`/@vite/client`: the console says *\"@vitejs/plugin-react can't detect preamble\"*,\n`$RefreshReg$` is undefined, HMR is dead, and the page is blank.\n\n**Production builds are unaffected, which is exactly why this needs a mechanism.**\n`typecheck`, `lint`, `unit-tests`, `e2e`, `build-budget` and `storybook-build` all stay\ngreen while `yarn dev` serves nothing. It shipped twice, six days apart — image-viewer on\n2026-08-05 (whose **Locked** decision record reached nobody else) and mux-magic on\n2026-08-11 ([#200](https://github.com/Sawtaytoes/mux-magic/issues/200)) — which is what\nmoved it into the shared build seam instead of a twelfth copy of the same paragraph.\n\n```\n[@charcuterie/vite-config] packages/web/index.html would break the dev server.\n\n  line 10: a literal `<head>` inside an HTML comment comes before the real one\n    the `@charcuterie/tokens` `buildFirstPaintScript` snippet in <head> below,\n  …\n  Fix: drop the angle brackets in the prose (`head`, not `<head>`), or\n  move the comment below the real tag. Both are one line.\n```\n\nThree things about its scope are deliberate:\n\n- **\"Before the real tag\", not \"never in a comment\".** mux-magic's shipped fix keeps the\n  word `<head>` in its comment — it moved the comment *inside* `<head>`, so the first\n  literal in the file is now the real element. That file is correct and a blanket ban\n  would fail it. The condition checked is Vite's actual failure condition, so the rule is\n  exactly as strict as the bug.\n- **Open `<html>` is not an anchor.** Vite has no head-of-`html` injection point, so\n  image-viewer's leading comment naming `` `<html>` `` shadows nothing and passes.\n- **It runs in `build` as well as `serve`.** Production is unaffected by the bug, so a\n  serve-only check would leave CI exactly as blind as it was both times this shipped.\n\nIt fires in two hooks: `configResolved` reads `index.html` (and any HTML rollup input)\noff disk so `yarn dev` dies at **startup** with the reason printed, and\n`transformIndexHtml` (`order: \"pre\"`) catches the served document. A check that only ran\non the first request would let the server come up looking healthy — which is the exact\nexperience being fixed.\n\nThe pure half is exported for anything that wants to check HTML without a Vite config:\n\n```ts\nimport { findShadowedInjectionAnchors } from \"@charcuterie/vite-config\"\n\nfindShadowedInjectionAnchors(html)\n// [{ anchor: \"<head>\", line: 10, snippet: \"…snippet in <head> below,\" }]\n```\n\nAn app that builds its Vite config by hand can add\n`createStructuralTagCommentGuard()` to its own `plugins`.\n","readmeFilename":"README.md"}