@solidjs/vite-plugin 3.0.0-next.39 → 3.0.0-next.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -237,4 +237,12 @@ export type ViteManifest = Record<string, {
237
237
  imports?: string[];
238
238
  }> & {
239
239
  _base?: string;
240
+ /**
241
+ * Manifest key of the client entry the document boots (the plugin's
242
+ * injected start-mode entry, or the single configured input). Absent when
243
+ * the plugin cannot tell the application entry apart from other configured
244
+ * inputs; its record is also serialized first so first-`isEntry` scans
245
+ * agree with it.
246
+ */
247
+ _entry?: string;
240
248
  };
@@ -119,6 +119,43 @@ export interface StartOptions {
119
119
  * @default undefined
120
120
  */
121
121
  setup?: string;
122
+ /**
123
+ * How the generated handler turns a page render into a response body.
124
+ *
125
+ * - `'stream'` (default): the document shell flushes as soon as it is
126
+ * ready, with `<Loading>` fallbacks in place; boundary content follows
127
+ * in later chunks and is swapped in by inline scripts. Best TTFB, but
128
+ * a client that never runs JavaScript (crawlers, `curl`, no-JS
129
+ * browsers) is left looking at the fallbacks (solidjs/solid#3280).
130
+ * - `'async'`: the handler awaits the render until every boundary has
131
+ * settled and sends one complete document. Nothing has flushed, so
132
+ * each resolved boundary is spliced in place of its placeholder — no
133
+ * fallback markup, no swap templates or scripts — while hydration data
134
+ * still serializes, so JavaScript clients hydrate exactly as before.
135
+ * The tradeoffs are inherent: time-to-first-byte waits for the slowest
136
+ * boundary, and the whole page buffers in memory before it is sent.
137
+ * `deferStream` is moot here (everything defers), and a `Location`
138
+ * header written mid-render becomes a real 3xx instead of the
139
+ * post-flush script fallback.
140
+ * - A module path (resolved relative to the Vite root, following the
141
+ * `middleware`/`setup` convention — a Vite config cannot serialize a
142
+ * closure into the generated handler): the module default-exports
143
+ * `(event) => 'stream' | 'async' | Promise<'stream' | 'async'>`, called
144
+ * per request inside the request scope after the middleware chain (so
145
+ * `event.locals` decoration is visible) — e.g. `'async'` for crawler
146
+ * user agents or a `?nojs` flag, `'stream'` for everyone else.
147
+ *
148
+ * Hosts driving the handler directly can override all of the above per
149
+ * call with `handleRequest(request, { renderMode })`; precedence is that
150
+ * runtime option, then the module function's result, then this static
151
+ * value. Applies to generated and authored entries alike (an authored
152
+ * `render()` returning a `renderToStream` result is awaited the same
153
+ * way). Server mode only — ignored in client mode, where the served
154
+ * shell has no boundaries to settle.
155
+ *
156
+ * @default 'stream'
157
+ */
158
+ renderMode?: 'stream' | 'async' | (string & {});
122
159
  /**
123
160
  * Typed, validated environment variables. A schema file — conventionally
124
161
  * `env.ts` (or `env.js`) at the project root, probed automatically —
@@ -213,4 +250,12 @@ export declare function startServe(options: StartOptions, internal?: {
213
250
  * declines HMR for that module's client compile (solidjs/solid#3151).
214
251
  */
215
252
  onDocumentResolved?: (documentPath: string | null) => void;
253
+ /**
254
+ * Reports the client entry this plugin adds to the client build's input
255
+ * (the virtual generated entry id, or the authored entry's absolute
256
+ * path) back to the main plugin, which stamps it as `_entry` on
257
+ * `virtual:solid-manifest` so the built handler and the runtime never
258
+ * have to guess the entry among other configured inputs (#353).
259
+ */
260
+ onClientEntryResolved?: (entryId: string) => void;
216
261
  }): Plugin[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/vite-plugin",
3
- "version": "3.0.0-next.39",
3
+ "version": "3.0.0-next.41",
4
4
  "description": "solid-js integration plugin for Vite",
5
5
  "type": "module",
6
6
  "engines": {
@@ -83,9 +83,9 @@
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@solidjs/start-devtools": "^1.0.0-next.2",
86
- "@solidjs/web": "^2.0.0-rc.0",
86
+ "@solidjs/web": "^2.0.0-rc.7",
87
87
  "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*",
88
- "solid-js": "^2.0.0-rc.0",
88
+ "solid-js": "^2.0.0-rc.7",
89
89
  "vite": "^8.0.0 || ^9.0.0"
90
90
  },
91
91
  "peerDependenciesMeta": {
@@ -49,6 +49,16 @@ declare module "virtual:solid-ssr-handler" {
49
49
  context?: Record<string, unknown>;
50
50
  /** Status/headers for the HTML response. */
51
51
  responseInit?: ResponseInit;
52
+ /**
53
+ * Per-call render mode, overriding `start.renderMode` (static value or
54
+ * per-request module alike). `'stream'` flushes the document shell
55
+ * with `<Loading>` fallbacks and streams boundary content behind it;
56
+ * `'async'` awaits the render until every boundary settled and sends
57
+ * one complete document — no fallbacks, no swap scripts, hydration
58
+ * data intact — for clients that never run JavaScript. A mid-render
59
+ * `Location` becomes a real 3xx under `'async'`.
60
+ */
61
+ renderMode?: 'stream' | 'async';
52
62
  /**
53
63
  * Extra fields spread into the request event at creation — the public
54
64
  * wrapper→event extension seam. Conventionally `nativeEvent` carries