@solidjs/vite-plugin 3.0.0-next.30 → 3.0.0-next.32
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 +77 -10
- package/dist/cjs/index.cjs +269 -119
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +269 -119
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/src/dev-manifest.d.ts +4 -3
- package/dist/types/src/devtools/index.d.ts +3 -0
- package/dist/types/src/environment.d.ts +5 -1
- package/dist/types/src/ssr/index.d.ts +42 -1
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -27,13 +27,13 @@ Join [solid discord](https://discord.com/invite/solidjs) and check the [troubles
|
|
|
27
27
|
|
|
28
28
|
## Requirements
|
|
29
29
|
|
|
30
|
-
This module is 100% ESM compatible and requires
|
|
30
|
+
This module is 100% ESM compatible and requires Node.js `^20.19.0 || >=22.12.0`.
|
|
31
31
|
|
|
32
|
-
You can check your current version
|
|
32
|
+
You can check your current Node.js version by running `node -v`. Use a version
|
|
33
|
+
manager such as [Volta](https://volta.sh/) or [nvm](https://github.com/nvm-sh/nvm)
|
|
34
|
+
to update it.
|
|
33
35
|
|
|
34
|
-
Supported Vite versions: **Vite
|
|
35
|
-
dropped; if you are on an older Vite, stay on an earlier release of this
|
|
36
|
-
plugin (2.x) or upgrade Vite.
|
|
36
|
+
Supported Vite versions: **Vite 8 and 9**.
|
|
37
37
|
|
|
38
38
|
## Quickstart
|
|
39
39
|
|
|
@@ -179,7 +179,37 @@ same server functions.
|
|
|
179
179
|
The object form carries the options (`start: true` is pure sugar for
|
|
180
180
|
`start: {}` — both mean the identical start mode with defaults, and
|
|
181
181
|
`false`/absent means off): `app`, `document`, `entryServer`, `entryClient`,
|
|
182
|
-
`middleware`, `env`, `
|
|
182
|
+
`middleware`, `setup`, `env`, `devtools`, `errorBoundary`, `css`, `external`,
|
|
183
|
+
all documented below.
|
|
184
|
+
|
|
185
|
+
Install `@solidjs/start-devtools` as a development dependency to add the
|
|
186
|
+
development toolbar with runtime errors and server function calls:
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
pnpm add -D @solidjs/start-devtools@next
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Start mode detects the package automatically. Set `start: { devtools: true }`
|
|
193
|
+
to require it or `start: { devtools: false }` to disable automatic integration.
|
|
194
|
+
The package is an optional peer and the toolbar is not included in production
|
|
195
|
+
builds.
|
|
196
|
+
|
|
197
|
+
Generated entries wrap the app automatically. With custom server and client
|
|
198
|
+
entries, place the development boundary around the app in the shared document
|
|
199
|
+
or root:
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
import { DevToolbar } from "@solidjs/start-devtools";
|
|
203
|
+
|
|
204
|
+
<body>
|
|
205
|
+
<DevToolbar>
|
|
206
|
+
<App />
|
|
207
|
+
</DevToolbar>
|
|
208
|
+
</body>;
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The package becomes a children-only passthrough in production, so no toolbar
|
|
212
|
+
code is included in either production bundle.
|
|
183
213
|
|
|
184
214
|
```tsx
|
|
185
215
|
// src/App.tsx — the entire app: a plain content component
|
|
@@ -200,7 +230,7 @@ With `ssr: true` — **SSR start mode**:
|
|
|
200
230
|
classic `vite build` + `vite build --ssr` two-step, work too.)
|
|
201
231
|
- **Build ordering**: server builds read the client manifest, so with `ssr`
|
|
202
232
|
enabled the plugin also orders builder-mode (environments API) app builds
|
|
203
|
-
client-first via a `buildApp` hook
|
|
233
|
+
client-first via a `buildApp` hook. That covers composed
|
|
204
234
|
setups whose own orchestrator builds server environments before the
|
|
205
235
|
client — e.g. @cloudflare/vite-plugin — with no hand-written ordering
|
|
206
236
|
plugin; setups without another orchestrator keep Vite's stock
|
|
@@ -429,6 +459,43 @@ client values, the leak scan — follows
|
|
|
429
459
|
design-correct prior art, reimplemented on this plugin's machinery with
|
|
430
460
|
Standard Schema as the only contract (and runtime-read server values).
|
|
431
461
|
|
|
462
|
+
**`errorBoundary`** — in a production build, generated entries wrap the app
|
|
463
|
+
in a default error boundary (and the document in an outer one): a render
|
|
464
|
+
error streams a generic `500 | Internal Server Error` fallback — no stack
|
|
465
|
+
or error details reach the HTML; the error itself goes to `console.error`
|
|
466
|
+
— and an error caught before the shell flushes commits a real 500 status
|
|
467
|
+
through the response-head lifecycle. Development is unaffected (Vite's
|
|
468
|
+
error overlay owns dev errors), as are authored entries — the boundary is
|
|
469
|
+
generated-entry codegen. Disable it with `start: { errorBoundary: false }`
|
|
470
|
+
when application middleware owns error handling (an error middleware only
|
|
471
|
+
sees the throw when no boundary catches it first). Default: `true`.
|
|
472
|
+
|
|
473
|
+
**`css.filter`** — include/exclude patterns
|
|
474
|
+
([picomatch](https://github.com/micromatch/picomatch) globs or regexes;
|
|
475
|
+
relative globs resolve against the Vite root) for the module graphs the dev
|
|
476
|
+
server crawls when collecting the CSS it inlines into `<head>` (the no-FOUC
|
|
477
|
+
guarantee). By default the crawl covers the app's own sources and skips
|
|
478
|
+
`node_modules`. `exclude` prunes matching graphs — providing one replaces
|
|
479
|
+
the default `node_modules` exclusion — and `include` opts matching files in
|
|
480
|
+
on top of that baseline, which is how a dependency's CSS gets
|
|
481
|
+
server-inlined in dev:
|
|
482
|
+
|
|
483
|
+
```ts
|
|
484
|
+
solid({
|
|
485
|
+
start: {
|
|
486
|
+
css: { filter: { include: /node_modules\/some-ui-lib/ } },
|
|
487
|
+
},
|
|
488
|
+
ssr: true,
|
|
489
|
+
});
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
CSS files themselves and virtual modules always pass — the filter decides
|
|
493
|
+
which module graphs are traversed, not which stylesheets are kept — and a
|
|
494
|
+
file matching both patterns stays excluded (Vite `createFilter`'s
|
|
495
|
+
conflict rule). Development only: excluding a graph does not remove its
|
|
496
|
+
CSS from the production build, where CSS always comes from the built
|
|
497
|
+
assets.
|
|
498
|
+
|
|
432
499
|
**Entry resolution** (all paths relative to the Vite root):
|
|
433
500
|
|
|
434
501
|
1. Explicit `start.entryServer` / `start.entryClient` options.
|
|
@@ -529,7 +596,7 @@ the plugin strips its script from the served shell — nothing hydrates, so
|
|
|
529
596
|
a shared `Document` costs nothing — and the built-in shell omits it.)
|
|
530
597
|
|
|
531
598
|
Start-mode serving is opt-in via `start`, so bare `ssr: true` setups keep the
|
|
532
|
-
transform-only behavior. See `examples/
|
|
599
|
+
transform-only behavior. See `examples/start-ssr` for a complete SSR app
|
|
533
600
|
(including a one-file production server and server functions),
|
|
534
601
|
`examples/start-client` for client mode (whose test flips the same app
|
|
535
602
|
between the modes), and `examples/ssr` for the manual `ssr: true` wiring.
|
|
@@ -590,7 +657,7 @@ plugin's own runtime configuration.
|
|
|
590
657
|
Meta-frameworks that need to control plugin ordering and dispatch requests
|
|
591
658
|
through their own server should use the standalone `serverFunctions()`
|
|
592
659
|
export instead, which never installs the dev middleware. See
|
|
593
|
-
`examples/
|
|
660
|
+
`examples/start-ssr` for a complete app.
|
|
594
661
|
|
|
595
662
|
**Server components (experimental):** `serverFunctions: { components: true }`
|
|
596
663
|
lets a `"use server"` function return a component. Server components ride
|
|
@@ -605,7 +672,7 @@ SSR'd document and are adopted
|
|
|
605
672
|
at boot with zero endpoint requests. With authored entries, the app-side
|
|
606
673
|
pieces (the render plugin, the bootstrap script, and the client's
|
|
607
674
|
`installServerComponents()` call, all from `@solidjs/web/frames`) live in
|
|
608
|
-
your entry files instead. See `examples/
|
|
675
|
+
your entry files instead. See `examples/start-ssr` for a complete page.
|
|
609
676
|
|
|
610
677
|
#### options.compiler
|
|
611
678
|
|