Repository navigation
feat(solid): Solid 2.0 support — @astrojs/solid-js v8 - #17891
Conversation
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]>
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 detectedLatest commit: a6bb8ad The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
Merging this PR will improve performance by 14.48%3 warnings, 1 note
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes |
|
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. |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0117BoWMf7eavBuREH2CFQrJ
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
@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
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.
# Conflicts: # examples/framework-solid/package.json
Changes
Rewrites
@astrojs/solid-jsfor Solid 2.0 as a new major (v8), following the@astrojs/svelteprecedent 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)
@solidjs/vite-plugin(replacingvite-plugin-solid), with acompileroption for the native (Oxc) or Babel backend.renderToStream, no Suspense wrapper): async islands settle fully on the server;Erroredboundaries contain sync and async errors.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.vitecleanup 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).solid-devtoolsoption (its 2.0 story is unsettled).solid-componentsuite is re-enabled with new lazy-CSS coverage.astro add solid-jstsconfig preset now writesjsxImportSource: "@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 andlocals— in dev and production alike;getRequestEvent()inside a function exposes the request, Astrolocals, 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
solid-component,solid-circular,solid-recurse,nested-in-solid, plus a newsolid-server-functionssuite (endpoint round trip, middleware locals through the request event, t=0 server-component adoption + morph) — 26 tests.solid-component(13, includes 3 pre-existing assertion bug fixes),slots-solid,react-and-solid,astro-slots-nested.Notes for review
package.jsonis set to8.0.0-beta.0with amajorchangeset; happy to adjust to whatever release flow you prefer (Solid 2.0 itself is in RC).examples/framework-solidis intentionally untouched: its component code is already 2.0-compatible, and its published-rangepackage.json(create-astro templates install from the registry) should bump at release, adding@solidjs/web(2.0 compiled output imports it).pnpm-workspace.yamladds@solidjs/*/solid-jstominimumReleaseAgeExcludeso freshly published RCs install past the age gate — needs a policy sign-off.Made with Cursor