Repository navigation
Scoped styles target polish: docs, Vite runtime tests, bundler READMEs - #63
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jonkwheeler
marked this pull request as ready for review
September 4, 2026 15:18
Contributor
Contributor
|
i think the style documentation might already by covered by #53 |
Contributor
|
ah, this is actually against #53 didn't notice that. ok, if we end up merging it then. |
Contributor
|
READY FOR REVIEW |
The shared features page already covers themes. Getting Started now shows the same apply and $class patterns per target, with className on React and class on Preact, Solid, and Vue. Co-authored-by: Jon Wheeler <[email protected]>
Rspack and Turbopack plugins had no README. Add usage notes that match the Bun plugins and call the emitted CSS sibling-scoped. Co-authored-by: Jon Wheeler <[email protected]>
Mount a theme module plus applier in React, Preact, Solid, and Vue and assert computed colors plus stylesheet order. Also lock the D13 layer 3 cycle: an applier evaluated before its imported theme throws ReferenceError when it reads theme.$class. Co-authored-by: Jon Wheeler <[email protected]>
Prepending the virtual CSS import evaluated a module's stylesheet before its imported themes, so equal-specificity local rules lost the cascade. Emit the CSS import after existing imports so theme sheets land first. Co-authored-by: Jon Wheeler <[email protected]>
Solid and Vue rewrite .tsrx tests to virtual ids, so fixture imports go through aliases. The D13 cycle still fails the import; Vite binds the uninitialized theme as undefined and throws TypeError instead of ReferenceError. Co-authored-by: Jon Wheeler <[email protected]>
Co-authored-by: Jon Wheeler <[email protected]>
…docs The getting-started snippets now show the theme module they import, so "Green: opted in" matches the theme they apply, and the prose uses the Style composition wording (a theme with $class, the local rule wins at equal specificity). The Rspack Solid README paragraph no longer breaks into a list, and the Vite changeset says why the import moves. Co-Authored-By: Claude Fable 5.1 <[email protected]>
leonidaz
force-pushed
the
cursor/scoped-styles-target-polish-c786
branch
from
September 5, 2026 18:11
3bfe058 to
7cbd703
Compare
Merged
leonidaz
added a commit
that referenced
this pull request
Sep 5, 2026
The Rspack, Turbopack, and Bun plugins prepended the virtual `?tsrx-css&lang.css` import, so a module's stylesheet entered the asset graph before the stylesheets of the themes it imports and a rule in the applying scope lost to the theme's at equal specificity. Vite got the same fix in #63; this makes every bundler honor the documented order. The import now follows the module's own imports. Nothing above it moves, so the Rspack and Turbopack loaders keep the compiler's source map instead of dropping it, and the Turbopack directive scanner is no longer needed. Tests assert the import lands after an existing import in every loader, and a real Rspack 2 build proves an imported theme's CSS is emitted before the module that applies it. Co-authored-by: Claude Fable 5.1 <[email protected]>
1 task done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49.
Target-facing follow-up to the sibling-scoped
<style>/$class/applywork already onfeat/scoped-styles-apply. Core still applies throughcreateJsxTransform; this PR adds docs, bundler README wording, and Vite runtime proof for React, Preact, Solid, and Vue.Docs
apply/$classon the React, Preact, Solid, and Vue Vite pages (React usesclassName; the others useclass), with a link to Style composition.<style>emission. Bun READMEs already used that wording.Runtime tests
packages/vite-plugin-*/tests/scoped-styles.runtime.test.tsrxmounts a theme module + applier module and asserts computed colors (local rule wins;$classopt-in still gets the theme) and<style>order (theme sheet before applier sheet).theme.$classwhile the theme is uninitialized. Native ESM would throwReferenceError; Vite's transform binds the cycle asundefinedand throwsTypeError.Vite CSS import order
The runtime tests found that each Vite plugin prepended the virtual CSS import, so a module's stylesheet evaluated before its imported themes and equal-specificity local rules lost. The four Vite plugins now emit that import after existing JS imports. Patch changeset included.
Validation
vitest run --project tsrx-react-runtime --project tsrx-preact-runtime --project tsrx-solid-runtime --project tsrx-vue-runtime --project vite-plugin-react --project vite-plugin-preact --project vite-plugin-solid --project vite-plugin-vue: 22 files, 277 tests passed.