Skip to content

fix: rc.10 follow-ups — live server-function address in dev, event-stream preview passthrough, attribution/perf-tracks pre-bundling - #374

Merged
ryansolid merged 1 commit into
nextfrom
rc10-followups
Sep 27, 2026
Merged

ryansolid merged 1 commit into
nextfrom
rc10-followups

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Four follow-ups found by the rc.9 → rc.10 audit of the plugin against Solid 2.0.0-rc.10. No plugin option added, removed or renamed.

1. live/ server-function address in the dev middleware

What. The dev middleware's id parser strips a leading live/ segment the way it strips data/, mirroring the runtime's parseServerFunctionAddress (one kind segment at most; an id is exactly one segment, so live/, live/a/b and data/live/<id> stay misses).

Why. rc.10 added a third address shape, <endpoint>/live/<id>, for a live loop's connection (answered as text/event-stream). The parser only knew data/, so live/<id> kept its slash → functionId = null → the on-demand SSR import was skipped → a live function whose module nothing had imported server-side yet came back 404 Unknown server function (reproduced before the fix; 200 event-stream after).

Where. src/server-functions/index.ts:649 (the strip), comments at src/server-functions/index.ts:611, :639 and src/ssr/index.ts:1324 now enumerate all three shapes.

2. Preview compression vs event streams

What. vite preview's handler middleware sets content-encoding: identity for text/event-stream responses and for everything under the server-function mount, in addition to text/html.

Why. @polka/compression sizes a response on its first write and, at ≥1KiB, pipes the rest through zlib, which holds small writes until its buffer fills — a live event stream's events would sit undelivered while the connection stays open; the streaming codec's chunks likewise arrive in bursts. Rule chosen and documented in the code: content type for text/html and text/event-stream (SSE from an app middleware route is a stream too), plus the server-function mount, because the runtime's other streamed shape — the codec stream — is text/plain, too generic to key on, and keying on the mount keeps a future answer shape from silently regressing to buffered. The mount reaches the start plugin through startServe's existing internal wiring (serverFunctionsEndpoint; startServe is not part of the package's exports), normalized by a shared normalizeServerFunctionsEndpoint (same logic the server-functions plugin already used inline).

Where. src/ssr/index.ts:1824–1885 (mount + rule), src/ssr/index.ts:630 (internal field), src/index.ts:2143 (threading), src/server-functions/index.ts:182 (normalizer, used at :382).

3. optimizeDeps.include: solid-js/attribution, @solidjs/web/performance-tracks

What. Both subpaths join optimizeDeps.include under serve — the same gate the refresh runtime and the frames/server-functions entries already use; not gated on the dev/observe posture (the surrounding entries aren't, and the subpaths exist in every posture).

Why. A consumer the scanner never crawls (a linked package, a solid-condition package vitefu excluded) importing one mid-session triggers late discovery → re-optimize → a second @solidjs/signals core beside the one solid-js was bundled with. Verified both subpaths exist in packages/solid/package.json / packages/web/package.json on origin/next and at tag solid-js@2.0.0-rc.10 (./attribution since rc.8, ./performance-tracks since rc.10; peer range is ^2.0.0-rc.10).

Where. src/index.ts:1382–1394.

4. Stale strings

  • README.md:124 and src/index.ts:265 no longer say the dev option "injects solid-js/dev" (no such entry); it resolves the development export condition.
  • examples/start-ssr/vite.config.ts:35, examples/start-ssr/test/run.mjs:4420, :4453: componentNames → sourceNames.

Tests

  • examples/start-ssr/test/run.mjs:1001–1051 (dev mode): cold dispatch at /_server/live/<id> for incrementCounter in src/frames/data.tsx — a module App.tsx never imports and the bare cold dispatch didn't load — expects 200 text/event-stream with a data: event; plus the three grammar misses. Fails on origin/next (404), passes here.
  • examples/start-ssr/test/run.mjs:3376–3468 (preview mode): greet at the live address (201 event-stream, first chunk >1KiB) and getServerMessage at the data address (text/plain) come back without gzip/br, while the hashed client asset still compresses. With the old text/html-only rule both come back gzip (verified).
  • examples/start-ssr/test/components-warning.mjs:120–140: the two entries present under serve, absent under build.

Results (all local, macOS):

suite result
pnpm build (rollup + tsc --emitDeclarationOnly) ok
pnpm check 100/100
root pnpm test (vite-8 Cypress) ok
examples/start-ssr pnpm test (run.mjs all modes + http-bridge + components-warning) 607/607, 10/10, 11/11
examples/start-client 65/65
examples/start-env 47/47
examples/ssr 12/12 + 8/8 boundary
examples/css-matrix 87/87 + 19/19 bridge
examples/vite-8 vitest (browser) 1/1

Prettier: the touched files carry pre-existing drift on lines this PR doesn't touch; every line this PR adds or changes is prettier-clean.

Public API changes: none

startServe's internal parameter gained serverFunctionsEndpoint, and normalizeServerFunctionsEndpoint is a new module-level export of src/server-functions/index.ts; neither is reachable from the package's export map (. re-exports serverFunctions and types only).

…sthrough, attribution/perf-tracks pre-bundling

Four findings from the rc.9 → rc.10 audit.

The server-function dev middleware now reads the id out of the runtime's
third address shape, `<endpoint>/live/<id>` (a `live` loop's connection,
@solidjs/web 2.0.0-rc.10), the way it already did for `data/<id>` —
mirroring `parseServerFunctionAddress`: one kind segment at most, an id is
exactly one segment. Before, `live/<id>` kept its slash, the id parsed to
null, the on-demand SSR import was skipped, and a live function whose
module nothing had loaded server-side yet 404'd (`Unknown server
function`). The comments enumerating the two old shapes follow.

`vite preview` passes `text/event-stream` responses and everything under
the server-function mount through @polka/compression as
`content-encoding: identity`, as it already did for `text/html`. The
middleware sizes a response on its first write and, at ≥1KiB, pipes the
rest through zlib, which holds small writes — a live event stream's events
(and the streaming codec's chunks) would sit undelivered while the
connection stays open. The mount reaches the start plugin through its
internal wiring (`serverFunctionsEndpoint`), normalized by the shared
`normalizeServerFunctionsEndpoint`.

Under `serve`, `solid-js/attribution` and `@solidjs/web/performance-tracks`
join `optimizeDeps.include`, so a consumer the scanner never crawls (a
linked package, a `solid`-condition package vitefu excluded) importing one
mid-session no longer triggers a late discovery → re-optimize → a second
@solidjs/signals core. Both subpaths exist across the peer range.

Stale strings: the `dev` option docs no longer name a `solid-js/dev` entry
(it is the `development` export condition); `componentNames` → `sourceNames`
in the start-ssr example's config comment and observe-mode labels.

Tests: start-ssr dev mode dispatches a live address cold (module imported
on demand, event-stream answer) and asserts the address grammar's misses;
preview mode asserts live and data-address answers big enough to trip the
threshold come back uncompressed while static assets still compress;
components-warning asserts the two new include entries under serve and
their absence under build.

Co-authored-by: Claude via Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Sep 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e40e2c4

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 Sep 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: e40e2c4

@ryansolid
ryansolid merged commit 9a42be9 into next Sep 27, 2026
6 checks passed
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