@solidjs/vite-plugin 3.0.0-next.38 → 3.0.0-next.40
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.
- package/README.md +67 -2
- package/dist/cjs/index.cjs +392 -51
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +393 -52
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/server-functions/index.d.ts +11 -0
- package/dist/types/src/ssr/index.d.ts +37 -0
- package/package.json +3 -3
- package/virtual-solid-manifest.d.ts +10 -0
|
@@ -5,7 +5,7 @@ import { type StartOptions } from './ssr/index.js';
|
|
|
5
5
|
export { devStylePatch } from './dev-manifest.js';
|
|
6
6
|
export { serverFunctions };
|
|
7
7
|
export type { ServerFunctionsOptions };
|
|
8
|
-
export type { ServerFunctionsFilter } from './server-functions/index.js';
|
|
8
|
+
export type { PersistedServerFunctionManifest, ServerFunctionsFilter, } from './server-functions/index.js';
|
|
9
9
|
export type { StartOptions };
|
|
10
10
|
import type { FilterPattern, Plugin } from 'vite';
|
|
11
11
|
/** Possible options for the extensions property */
|
|
@@ -135,6 +135,17 @@ export interface ServerFunctionsOptions {
|
|
|
135
135
|
*/
|
|
136
136
|
components?: boolean | 'external';
|
|
137
137
|
}
|
|
138
|
+
/** The persisted manifest's on-disk shape (the array form is the pre-`functions` legacy). */
|
|
139
|
+
export interface PersistedServerFunctionManifest {
|
|
140
|
+
/** Modules containing server functions, root-relative. */
|
|
141
|
+
modules: string[];
|
|
142
|
+
/** Every server function the client build emitted a reference to. */
|
|
143
|
+
functions: Array<{
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
module: string;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
138
149
|
/**
|
|
139
150
|
* The second parameter is internal wiring for the main plugin's
|
|
140
151
|
* `serverFunctions` option: the built-in dev middleware is only installed
|
|
@@ -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 —
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/vite-plugin",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.40",
|
|
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.
|
|
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.
|
|
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
|