fix(bun-plugin): write the base CSS the imports resolve to - #634
Conversation
Changepacks@devup-ui/wasm@1.0.75 → 1.0.76 - bindings/devup-ui-wasm/package.jsonPatch
@devup-ui/bun-plugin@1.0.12 → 1.0.13 - packages/bun-plugin/package.jsonPatch
@devup-ui/components@0.1.50 → 0.1.51 - packages/components/package.jsonPatch
@devup-ui/next-plugin@1.0.80 → 1.0.81 - packages/next-plugin/package.jsonPatch
@devup-ui/plugin-utils@1.0.10 → 1.0.11 - packages/plugin-utils/package.jsonPatch
@devup-ui/react@1.0.37 → 1.0.38 - packages/react/package.jsonPatch
@devup-ui/reset-css@1.0.24 → 1.0.25 - packages/reset-css/package.jsonPatch
@devup-ui/rsbuild-plugin@1.0.58 → 1.0.59 - packages/rsbuild-plugin/package.jsonPatch
@devup-ui/vite-plugin@1.0.64 → 1.0.65 - packages/vite-plugin/package.jsonPatch
@devup-ui/webpack-plugin@1.0.63 → 1.0.64 - packages/webpack-plugin/package.jsonPatch
|
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
|
Closing this: both claims in the description were wrong, and I verified that only after opening it. "The plugin never writes the base CSS its imports resolve to." " The real symptom I started from - a second checkout resolving Sorry for the noise. |
Two problems
1. The plugin never wrote the file its own imports resolve to.
onResolvemaps everydevup-ui.cssimport todf/devup-ui/devup-ui.css, butwriteDataFiles()only created the directory.codeExtractreturns the collected styles andupdatedBaseStyle, and both were discarded:So the plugin resolved imports to a path it never produced. It appeared to work only where another plugin had already left a file there. In a checkout without one - a fresh clone, a git worktree, CI - the first import fails to resolve and the run dies before any style is collected.
plugin.test.tsalready spies ongetCss, which the source never called.2.
registerShorthandswas called without being imported.Introduced in #632. The next, vite, rsbuild and webpack plugins all import it from
@devup-ui/wasm; the bun plugin does not, so it throwsReferenceError: registerShorthands is not definedon startup.bun test packages/bun-pluginfails onmaintoday for this reason.Change
initialize, so the first resolve has a targetcodeExtractreportsupdatedBaseStyle, matchingwebpack-plugin/src/loader.tsregisterShorthandsfrom@devup-ui/wasmVerification
On
mainthe same test command fails with the ReferenceError.How this surfaced
In another repository the frontend suite failed only outside the primary checkout:
It reproduced on an untouched worktree and on a clean clone of the same commit, and disappeared with
BUN_RUNTIME_TRANSPILER_CACHE_PATH=0- Bun's transpiler cache is keyed by file content, so identical sources in a second checkout reused a resolution belonging to the first. That is only reachable because the resolved file is absent in the second checkout; once the plugin writes its own base stylesheet, each checkout resolves to a file it actually has.