Skip to content

feat: add Start CSS crawl filtering - #316

Merged
birkskyum merged 1 commit into
solidjs:nextfrom
birkskyum:css-filter
Aug 19, 2026
Merged

feat: add Start CSS crawl filtering#316
birkskyum merged 1 commit into
solidjs:nextfrom
birkskyum:css-filter

Conversation

@birkskyum

Copy link
Copy Markdown
Member

Summary

  • add start.css.filter.include and start.css.filter.exclude
  • keep node_modules excluded by default
  • apply the filter to entry, external-host, and lazy-module development CSS collection
  • resolve relative filter patterns from the Vite root

This ports the CSS crawl option from SolidStart PR #2276. It lets applications opt selected dependency graphs into SSR CSS collection and avoid development FOUC.

Validation

  • pnpm build
  • pnpm check
  • node examples/turnkey/test/run.mjs dev (57/57)
  • node examples/turnkey/test/run.mjs css-filter (2/2)

@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1634ae5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@316

commit: 1634ae5

@birkskyum
birkskyum merged commit e607db7 into solidjs:next Aug 19, 2026
6 checks passed
ryansolid added a commit that referenced this pull request Aug 19, 2026
…FilterOptions = turnkey?.css?.filter` against the old local name while a6a13f2 renamed that local to `startOptions` — the rebase composed the two without a textual conflict, so tsc (TS2304) caught it in CI instead of the pre-merge local gate. One-line internal rename completion, no behavior or API change, so changeset-free like the commit it repairs. css-matrix suite green locally post-fix (82/82 + bridge 19/19).

Co-authored-by: Cursor <cursoragent@cursor.com>
ryansolid added a commit that referenced this pull request Aug 19, 2026
…'s stated use case — opting a node_modules dependency's graph into dev SSR CSS collection — could not work under the raw createFilter composition, twice over: the default /node_modules/ exclude was applied whenever the user set no exclude and createFilter's exclude-wins rule vetoed the included package, and a non-empty include turned the filter into a strict allowlist that rejected the app's own sources, pruning the crawl at the entry roots — an include-only config silently stripped ALL dev SSR CSS (live-repro'd in examples/start-ssr: include /some-ui-lib/ lost App.css from the streamed head while the page still rendered). The crawl walks the graph from the app's entries, so allowlist semantics are structurally wrong for this option; include now RESCUES files on top of the baseline (everything except exclude, which still defaults to /node_modules/ and still gets replaced — not extended — by a user exclude), composed from two createFilters so a file matching both patterns stays excluded, exactly createFilter's own conflict rule. Default and exclude-only behavior are byte-identical to before; empty-array includes are treated as absent (createFilter would read them as allow-all). Coverage the exclude side always had, now mirrored for include: the css-filter mode grew from 2 to 9 assertions across four dev-server sub-runs (exclude / include / conflict / default) against a temp node_modules package written by the harness — a real directory, not a symlink or file: dep, which Vite would realpath outside node_modules and dodge the default exclusion under test — whose JS imports its own CSS (the filter sees JS modules; CSS files bypass it), ssr.noExternal'd so the SSR env can transform the CSS import. Docs that both next.31 start options were missing: README options.start now documents css.filter (include/exclude semantics, dev-only scope) and #315's errorBoundary (generic 500 fallback, no leaked details, dev untouched, errorBoundary: false when middleware owns errors), and the option list gains the absent setup/errorBoundary/css entries; the StartOptions JSDoc for css.filter spells the same semantics. No new changeset — nothing has shipped (#316's changeset is queued unreleased in #313), so the existing start-css-filter changeset's wording is corrected to describe the fixed semantics instead. Full local gate green: start-ssr 349/349 + http-bridge 10/10, css-matrix 82/82 + bridge 19/19, build + tsc clean.

Co-authored-by: Cursor <cursoragent@cursor.com>
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