Point @source at the components again - #5
Merged
Merged
Conversation
`@source` resolves relative to the stylesheet, and moving the stylesheet into src/theme/ moved the target with it: `@source "."` went from meaning `src/`, which holds the components, to meaning `src/theme/`, which holds none. A consumer's Tailwind auto-detects the consumer's own files and never walks node_modules, so that directive is the only thing putting this package's class strings in front of the compiler. The cost, measured by compiling the published stylesheet the way a consumer does: 0.1.1 emits 103,857 bytes with `h-8`, `line-clamp-1` and `py-2` present; 0.2.0 emits 22,248 with none of them. Every component ships with the token declarations and almost no utilities. A plain SelectTrigger renders 38px instead of 32 because `h-8` was never generated, which is how this surfaced — in a consumer's browser suite, since nothing in this repository compiles CSS. Nothing here could have caught it, so src/gates/design.test.ts now resolves every @source in the stylesheet and fails unless one of them reaches src/components. Confirmed failing against the broken value before the fix went in.
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.
The bug
@sourceresolves relative to the stylesheet. Movingstyles.cssintosrc/theme/moved the target with it:@source "."stopped meaningsrc/,which holds
components/, and started meaningsrc/theme/, which holds nocomponent at all.
A consumer's Tailwind auto-detects the consumer's own sources and never walks
node_modules, so that one directive is the only thing that puts thispackage's class strings in front of the compiler. Pointed one directory too
shallow, it puts nothing there.
Measured by compiling the published stylesheet exactly the way a consumer
does — a bare project,
@import "@robomous/ui-core/styles.css", the TailwindCLI:
h-8line-clamp-1py-20.2.0 ships the token declarations and almost no utilities. It surfaced as a
plain
SelectTriggerrendering 38px instead of 32 —h-8was nevergenerated — in VisionSet's browser suite, which is the first thing downstream
that actually compiles this CSS.
The gate
Nothing in this repository compiles CSS, so nothing here could catch it.
src/gates/design.test.tsnow resolves every@sourcein the stylesheet andfails unless one of them reaches
src/components. Shown failing against thebroken value before the fix went in.
That is a proxy for the real check. A gate that compiles the stylesheet and
asserts a component's utility lands in the output would be stronger, and is
worth doing separately — it needs a CSS toolchain this package does not
otherwise carry.
Test plan
pnpm format:check && pnpm lint && pnpm build && pnpm test— 76 tests@source "."and passes on@source ".."matches 0.1.1's shape