Repository navigation
fix: keep multi-style tsrx components analyzable under tsrx-tsc - #745
Merged
Merged
Conversation
One component may split its scoped CSS across several <style> blocks — compile.js rebases every sheet onto the first block's canonical hash, and tests/_fixtures/return-style.tsrx proves it through mount, SSR, and hydration. @tsrx/core's shared type-only JSX transform instead threw "TSRX fragments can only have one style tag", and tsrx-tsc's fallback then presented the raw source as the virtual TSX, so every CSS brace surfaced as TS1381/TS1005 parse errors and the syntactic abort hid the rest of the program's diagnostics. Patch @tsrx/core 0.1.56 (pnpm patch) so the TYPE-ONLY path accepts multiple sheets and rebases them onto the first sheet's hash; runtime transforms keep the throw, so @tsrx/react's differential compile is unchanged. Add a volar regression test that fails with the original throw on unpatched core, type the fixture's props param, and stop the typecheck-files walker from descending into hidden directories (the differential rig's .react-cache compiled output was entering sweeps as JS roots and flipping allowJs). Co-Authored-By: Claude Fable 5 <[email protected]>
trueadm
marked this pull request as ready for review
August 12, 2026 21:39
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.
Summary
pnpm typecheck:files packages/octane/tests/_fixtures/return-style.tsrx(or any selection including it) failed with 8 parse errors — TS1381 "Unexpected token. Did you mean{'}'}" / TS1005 "'}' expected" — on a fixture that is valid octane tsrx.Root cause is in the tsrx type-only toolchain, not the fixture: one component may split its scoped CSS across several
<style>blocks (compile.jsapplyCssScopingrebases every sheet onto the first block's canonical hash, andreturn-style.test.tsproves it through mount, SSR, and hydration), but@tsrx/core's shared type-only JSX transform threwTSRX fragments can only have one style tag. When the volar compile throws, tsrx-tsc falls back to presenting the raw source as the virtual TSX, so every CSS brace becomes a TSX parse error.Changes
patches/@[email protected](+pnpm-workspace.yamlentry): the type-only path now accepts multiple sheets per component scope and rebases them onto the first sheet's hash (per-sheetapply_css_definition_metadataaccumulates into the component's class-map metadata, so style refs compose). Runtime (non-typeOnly) transforms keep the throw —@tsrx/react's differential-rig compile is unchanged. Remove once the fix ships upstream (same precedent as the superseded 0.1.37/0.1.40 parse patches).tests/compiler/volar.test.ts: regression — a split-style component stays analyzable (no errors, both CSS blocks surface as embedded regions, no raw CSS leaks into the TSX). Fails with the original throw on unpatched core, so a core bump that drops the patch prematurely trips it.tests/_fixtures/return-style.tsrx: typed thepropsparameter (an untypedpropsis anoImplicitAnyerror per the authoring rules; visible once the semantic phase can run).scripts/typecheck-files.mjs: the directory walker now skips hidden directories — the differential rig's.react-cache/compiled output was entering sweeps as JS roots and silently flippingallowJsfor the program depending on whether the differential suite had run.packages/*/audit/react-parity.json+ evals manifest:pnpm syncregeneration (lockfile hash re-pin after the patch entry).Validation
pnpm format:checkpnpm typecheckpnpm test— 20,934/20,938; the 4 failures were real-browser Playwright suites (doom-production,browser/native-change: matcher/waitForFunction timeouts and a vite504 Outdated Optimize Deprace under full-suite load); both pass in isolation (7/7 and 12/12) and don't touch this change's surfacetests/compiler/volar.test.ts14/14 (incl. new regression);return-style+style+style-map+deopt-style-patch+ differentialbasic/features-namespace— 172/172pnpm typecheck:files packages/octane/tests/_fixtures/return-style.tsrxclean; thepackages/octane/testssweep contains zero TS1381/TS1005Deliberately left unverified: nothing in this diff, but see the follow-up below for what the sweep now honestly reports.
Risk / follow-ups
pnpm typecheck:files packages/octane/testsreports ~3,094 pre-existing semantic errors (untyped fixture props TS7006,{n as string}number casts TS2352,.tsx-extension imports TS5097, …) — each reproducible per-file on pristine main (e.g.pnpm typecheck:files packages/octane/tests/_fixtures/hooks.tsrx). Corpus cleanup is spun off as its own task..tsrxunder the @tsrx/react platform (the differential devDependency wins the plugin's workspace walk); a tsconfig root-level"tsrx": { "compiler": "octane/compiler/volar" }overrides it, but flipping platforms changes the corpus's error mix and should be decided deliberately.@tsrx/core, so their editors/tsrx-tsc still hit the throw on multi-style components until the typeOnly allowance is upstreamed to the ripple monorepo.Provenance
agent-authored)🤖 Generated with Claude Code
Note
Low Risk
Low risk: scoped to type-only @tsrx/core transform and tooling; runtime still throws on multiple style tags. Patch maintenance if core is bumped without upstream fix.
Overview
Fixes tsrx-tsc / Volar breaking on Octane components that split scoped CSS across multiple
<style>blocks. A patched@tsrx/[email protected]lets the type-only JSX transform accept several sheets per scope, rebase them onto one hash, and keep emitting proper virtual TSX instead of falling back to raw source (which turned CSS braces into TS1381/TS1005).Adds a Volar regression test for split-style components, types
return-style.tsrxprops, and updatestypecheck-files.mjsto skip hidden dirs (e.g..react-cache/) so compiled artifacts do not pollute sweeps.pnpm-lock.yaml, package react-parity audits, and evals overlay lockfile hashes are refreshed for the new patch.Reviewed by Cursor Bugbot for commit 3c7f47a. Bugbot is set up for automated code reviews on this repo. Configure here.