Skip to content

Point @source at the components again - #5

Merged
YaelAnaya merged 1 commit into
mainfrom
fix-source-scope
Sep 7, 2026
Merged

YaelAnaya merged 1 commit into
mainfrom
fix-source-scope

Conversation

@YaelAnaya

@YaelAnaya YaelAnaya commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

The bug

@source resolves relative to the stylesheet. Moving styles.css into
src/theme/ moved the target with it: @source "." stopped meaning src/,
which holds components/, and started meaning src/theme/, which holds no
component 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 this
package'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 Tailwind
CLI:

Version CSS emitted h-8 line-clamp-1 py-2
0.1.1 103,857 B 5 2 1
0.2.0 22,248 B 0 0 0
this branch 104,911 B 5 2 1

0.2.0 ships the token declarations and almost no utilities. It surfaced as a
plain SelectTrigger rendering 38px instead of 32 — h-8 was never
generated — 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.ts now resolves every @source in the stylesheet and
fails unless one of them reaches src/components. Shown failing against the
broken 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
  • The new gate fails on @source "." and passes on @source ".."
  • Packed and compiled as a consumer: the utilities are back, byte count
    matches 0.1.1's shape
  • 0.2.0 wants deprecating on npm once 0.2.1 is out

`@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.
@YaelAnaya
YaelAnaya merged commit dd00ce6 into main Sep 7, 2026
1 check passed
@YaelAnaya
YaelAnaya deleted the fix-source-scope branch September 7, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant