Changelog
Unreleased
Added
- Marketing-style README. Drop-in
vite.config.tsexamples, an option-by-option reference table, the env-file resolution chain, a full options reference, a Caveats section, and worked examples for minimal SPA setup, CDN base URL via env, Apache.htaccess+ prerender deploy, multi-stage builds, and env-only mode. llms.txt/llms-full.txt. AI-discoverable index and concatenated reference matching the@mongez/atomshape so the docs aggregator picks them up.skills/folder. Reference cards for tool-assisted development —README(index),overview(pitch + mental model), per-feature cards (env-loading,env-in-html,tsconfig-aliases,auto-open-browser,production-base-url,build-zip,htaccess,prerender), andrecipes(cross-feature compositions and workedvite.config.tsfiles).- Vitest test suite. 70 passing assertions across ten test files covering the plugin factory shape, default options table, in-HTML env interpolation, the dev-server browser auto-open helper, tsconfig path mirroring,
.env.<env>file resolution per command, theproductionEnvNameoverride, production base URL derivation, optimizeDeps installation, the prerender PHP template, an integration test that drives the fullconfig()hook with chdir’d fixture directories, and regression guards for the four bugs fixed below. - CI workflow. GitHub Actions matrix matching the rest of the
@mongez/*family: Node 18 / 20 / 22 on Ubuntu, plus Node 20 on Windows. - Vitest config. Self-detecting sibling-alias pattern — when run inside the monorepo it resolves
@mongez/events,@mongez/reinforcements, and@mongez/dotenvto the sibling sources for live cross-package edits; in CI / standalone checkouts those aliases are dropped and resolution falls back tonode_modules. package.jsonpolish. Expandeddescription(now lists every feature, not just “manage development and build process”),sideEffects: falsefor tree-shaking by downstream consumers (note: the package is itself a Vite plugin so this is mostly informational), additionalkeywordsfor npm searchability (vite-plugin,spa,single-page-application,htaccess,prerender, etc.),test/test:watchscripts wired to vitest, andvite+vitestadded underdevDependenciesso the package canyarn installstandalone.
Fixed
Each was reproduced as a .skip() test in src/__tests__/known-bugs.test.ts; the tests have been unskipped and now assert the fix:
src/generateHtaccess.ts:1—import { MongezViteOptions } from ".types"(missing slash). Survived runtime because the import is type-only and esbuild elides it, buttsc --noEmitagainst the source would fail. Fixed: import now readsfrom "./types".src/compressBuild.tsscheduled the zip job insetTimeout(..., 1000)despitewriteBundlebeing declaredsequential: true. Vite considered the handler done before the zip was created — consumers runningvite build && upload-dist.shcould upload an incomplete artifact. Fixed: dropped thesetTimeoutwrapper. The function now awaits the archive pipeline directly, so by the timecompressBuild()resolves the zip is on disk. Backward-compatible: Vite’swriteBundlehook supports async returns natively.preRender.urlhad no default and no runtime guard — passingpreRender: {}interpolated the literal stringundefinedinto both the rewrite rule and the generatedprerender.php. Fixed:generateHtaccess()now throws a descriptive build-time error ifpreRenderis truthy butpreRender.urlis missing. The throwing approach (rather than tightening the TypeScript type) catches the bug at runtime for JS consumers too.- Legacy README naming:
envPrefix/envSuffix. Older revisions documented option keys that the runtime never read; the source readshtmlEnvPrefix/htmlEnvSuffix. Fixed: the README andskills/env-in-html.mduse the correct names. A regression-guard test asserts the doc surfaces stay in sync.
Dependency notes
@mongez/reinforcementsis pinned to^2.3.1independencies. The rest of the@mongez/*family has moved to3.x. The two surfaces this package uses (rtrim) are API-compatible across both major versions, so the pin is not blocking — but bumping to^3.0.0would align with siblings and avoid a duplicate package innode_modulesfor consumers using both.viteis declared as apeerDependency(>=5.0.0) and now also as adevDependency(^5.0.0) so the test suite can resolve it without a containing app providing it.
Tests
70 passed | 0 skipped