Skip to content

feat(solid): Solid 2.0 support — @astrojs/solid-js v8 - #17891

Merged
matthewp merged 14 commits into
withastro:mainfrom
ryansolid:solid-2
Nov 18, 2026
Merged

matthewp merged 14 commits into
withastro:mainfrom
ryansolid:solid-2

Conversation

@ryansolid

Copy link
Copy Markdown
Contributor

Changes

Rewrites @astrojs/solid-js for Solid 2.0 as a new major (v8), following the @astrojs/svelte precedent for major framework transitions: v8 supports Solid 2.0 only (solid-js@^2.0.0-rc.5 + @solidjs/web@^2.0.0-rc.5 — caret ranges, so 2.0 stable satisfies them when it ships); v7 remains for Solid 1.x.

Core (first commit)

  • Compiles through @solidjs/vite-plugin (replacing vite-plugin-solid), with a compiler option for the native (Oxc) or Babel backend.
  • Islands render through Solid 2.0's first-class async model (renderToStream, no Suspense wrapper): async islands settle fully on the server; Errored boundaries contain sync and async errors.
  • Threads an asset manifest into server renders so lazy() boundaries inside islands resolve module URLs, hydrate through serialized asset maps, and get their CSS inlined into island markup (deduped per page) — a live dev resolver in dev, the client build manifest in production (captured before the .vite cleanup for prerendering; persisted next to the server bundle for deployed SSR).
  • check() probe-renders through the stream renderer with per-component caching, rejects foreign framework vnodes explicitly, and is Proxy-safe (fixes the class of issues behind Solid component is rendered several times on the server #12354).
  • Drops the solid-devtools option (its 2.0 story is unsettled).
  • All Solid fixtures ported to 2.0; the previously-skipped solid-component suite is re-enabled with new lazy-CSS coverage.
  • astro add solid-js tsconfig preset now writes jsxImportSource: "@solidjs/web" (2.0 moves JSX types to renderer packages).

Server functions (experimental, second commit)

solid({ serverFunctions: true }) compiles "use server" functions in islands to typed RPC calls. The transport endpoint (default /_server) is injected as an Astro route, so requests flow through Astro's middleware pipeline — same auth guards and locals — in dev and production alike; getRequestEvent() inside a function exposes the request, Astro locals, and the API context. Island SSR runs inside a request-event scope, so direct in-process calls work during rendering. Requires an adapter (build fails with a clear error otherwise).

Server components (experimental, third commit)

serverFunctions: { components: true } enables "use server" functions returning components. They SSR inline in islands, are adopted at boot with zero endpoint requests, and later re-evaluations stream over the endpoint and morph in place, preserving client slot state and DOM identity.

Testing

  • e2e: solid-component, solid-circular, solid-recurse, nested-in-solid, plus a new solid-server-functions suite (endpoint round trip, middleware locals through the request event, t=0 server-component adoption + morph) — 26 tests.
  • unit: solid-component (13, includes 3 pre-existing assertion bug fixes), slots-solid, react-and-solid, astro-slots-nested.

Notes for review

  • Versioning: package.json is set to 8.0.0-beta.0 with a major changeset; happy to adjust to whatever release flow you prefer (Solid 2.0 itself is in RC).
  • examples/framework-solid is intentionally untouched: its component code is already 2.0-compatible, and its published-range package.json (create-astro templates install from the registry) should bump at release, adding @solidjs/web (2.0 compiled output imports it).
  • pnpm-workspace.yaml adds @solidjs/*/solid-js to minimumReleaseAgeExclude so freshly published RCs install past the age gate — needs a policy sign-off.
  • No existing Solid 2.0 issues/PRs found in the tracker; this is the first migration work filed.

Made with Cursor

ryansolid and others added 5 commits September 2, 2026 01:21
Rewrites the Solid adapter for Solid 2.0's new runtime split
(solid-js + @solidjs/web) and compiler (@solidjs/vite-plugin):

- renderToStream-based SSR with first-class async (no Suspense wrapper)
- asset manifest threaded into server renders so lazy() islands
  resolve, hydrate, and deliver their CSS (deduped per page)
- probe-based check() with caching, foreign-vnode rejection, and
  Proxy-safe source inspection
- client hydration updated to 2.0 signatures
- all Solid fixtures ported to 2.0 APIs; solid-component suite
  un-skipped with new lazy-CSS coverage

Co-authored-by: Cursor <[email protected]>
Adds a `serverFunctions` option to @astrojs/solid-js: "use server"
functions in islands compile to typed RPC calls dispatched through an
injected Astro route at the transport endpoint (default /_server), so
requests pass Astro's middleware pipeline in dev and production alike.
The route threads context.locals and the API context into the Solid
request event; island SSR runs inside provideRequestEvent so
getRequestEvent() and direct in-process calls work during rendering.
Normalizes bodyless POSTs (zero-argument calls) that Node-to-web
request conversion gives a non-null body stream.

Covered by a browser e2e fixture: endpoint round trip, middleware
locals via the request event, and SSR direct calls.

Co-authored-by: Cursor <[email protected]>
Wires the three app-side pieces for serverFunctions.components in the
Astro islands model: the frames render plugin + direct-call result
transform during island SSR (threaded through the manifest virtual so
disabled setups keep a frames-free graph), and installServerComponents()
injected at Astro's before-hydration stage. The endpoint response
transform already rides the handler virtual.

e2e covers t=0 inline SSR, zero-request document adoption at boot, and
endpoint-streamed morphs preserving client slot DOM identity.

Co-authored-by: Cursor <[email protected]>
Solid 2.0 moves JSX namespaces and jsx-runtime type entries into the
renderer packages; solid-js no longer exports one. `astro add solid-js`
now writes jsxImportSource: "@solidjs/web".

Co-authored-by: Cursor <[email protected]>
@changeset-bot

changeset-bot Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a6bb8ad

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

This PR includes changesets to release 3 packages
Name Type
@astrojs/solid-js Major
@astrojs/solid-js-renderer Minor
astro 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

@github-actions github-actions Bot added pkg: solid Related to Solid (scope) pkg: integration Related to any renderer integration (scope) pkg: astro Related to the core `astro` package (scope) labels Sep 2, 2026
@codspeed

codspeed Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 14.48%

3 warnings, 1 note

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚠️ 1 benchmark with a significant change ran in a different software environment

Its base and head results were measured with a different OS or toolchain, such as compiler, runtime or library versions, so the change might come from this difference rather than from the code. Open the benchmark to see what changed.

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

⚡ 1 improved benchmark
✅ 20 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ Build: full server site 3.8 s 3.3 s +14.48%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ryansolid:solid-2 (a6bb8ad) with main (c7a2f1d)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (49d7ab6) during the generation of this report, so c7a2f1d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@matthewp

matthewp commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

A few tests are failing. Happy to help if you're unsure about them, otherwise will leave to you to resolve.

Will talk with others on the team about how to ship this, whether it's a beta or stable.

ryansolid and others added 2 commits October 27, 2026 18:48
Also moves the Cloudflare Solid fixtures to Solid 2 (they still resolved
solid-js 1.x, which has no ./refresh export) and turns the empty Options
interface into a type alias for the no-empty-object-type lint rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWMf7eavBuREH2CFQrJ
oddcelot added a commit to oddcelot/bun-webcontainer that referenced this pull request Nov 3, 2026
@astrojs/solid-js 7.x needs solid-js 1.x, and the Solid 2 port
(withastro/astro#17891) is approved but not released. packages/astro-solid
holds its src/ unedited at the PR's head, under the upstream name, so
switching to npm later is a version bump plus deleting the directory.
scripts/vendor-astro-solid.ts re-copies it or, with --check, reports
whether the PR merged and v8 is on npm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bump solid-js, @solidjs/* and Solid 2 primitives off their rc/next tags onto
the stable releases (solid-js ^2.0.0, @solidjs/vite-plugin ^3.0.0) and set the
solid-js peer to ^2.0.0. Where the repo enforces minimumReleaseAge, the
2.0.0 packages are listed in minimumReleaseAgeExclude until they age past it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWL7JwK3aqy95RDD2WN
Solid 2.0's renderToStream onError also hears failures the render handled,
such as an <Errored> boundary rendering its fallback. The renderer treated
every call as a render failure, so a component whose Errored caught a sync
throw failed the page build, and the check() probe rejected it as not a
Solid component. Skip calls whose context.handling is not "failed".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWL7JwK3aqy95RDD2WN
Main moved the Solid renderer into packages/renderers/solid-js
(@astrojs/solid-js-renderer), with the integration re-exporting it. The
Solid 2 renderer (server.ts, client.ts, context.ts) now lives there, with
Solid 2 peers; the integration keeps @solidjs/vite-plugin, server
functions, server components and the client manifest handoff.

Also:
- keep @solidjs/vite-plugin's client-build-first hook from building the
  client ahead of Astro (it built Astro's placeholder input, e.g.
  virtual:astro:legacy-ssr-entry, and failed ssr-large-array)
- resolve manifest file candidates lazily so workerd renders (Invalid URL)
- port the renderer and vite-plugin-astro framework tests to Solid 2

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWL7JwK3aqy95RDD2WN
…rkaround

3.0.1 leaves the build order to the host when the client only has the
shared server input (solidjs/solid-vite-plugin#551), so the integration no
longer hides the client manifest flag from client-build-first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0117BoWL7JwK3aqy95RDD2WN
oddcelot added a commit to oddcelot/bun-webcontainer that referenced this pull request Nov 18, 2026
withastro/astro#17891 now targets Solid 2.0.0 and @solidjs/vite-plugin
3.0.1, and moved the renderer into @astrojs/solid-js-renderer, which the
integration re-exports. npm's renderer is Solid 1.x, so the PR's
packages/renderers/solid-js is vendored too, as a second private
workspace package; scripts/vendor-astro-solid.ts copies both.

Changelog: skip
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sets handle it

The package.json had the version hardcoded to 8.0.0-beta.0. Changesets
already has a 'major' bump changeset (.changeset/solid-2-adapter.md)
for @astrojs/solid-js, so the version will be correctly computed during
the release process. Restoring the version to 7.1.6 (matching main)
avoids a manual, out-of-band version bump.
…o Solid 2.0

The smoke tests and astro check CI jobs were failing because reverting
the manual @astrojs/solid-js version bump (back to 7.1.6, matching main)
caused pnpm to workspace-link the rewritten (Solid 2.0) integration into
examples/framework-solid and examples/framework-multiple, which were
still pinned to solid-js@^1.9.19 and the old JSX import source.

Update both examples to Solid 2.0 (solid-js@^2.0.0, @solidjs/web@^2.0.0,
jsxImportSource: '@solidjs/web'), matching every other fixture in the
repo that this PR already migrated. Verified both examples build and
pass astro check locally, along with the full example smoke build.
@github-actions github-actions Bot added the pkg: example Related to an example package (scope) label Nov 18, 2026
# Conflicts:
#	examples/framework-solid/package.json
@matthewp
matthewp merged commit 6fb274e into withastro:main Nov 18, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope) pkg: solid Related to Solid (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants