Skip to content

Commit 791ae3e

Browse files
authored
feat: require Vite 8 or newer (#320)
* feat: require Vite 8 or newer * test: keep Vite coverage in a matrix
1 parent 6d7ed43 commit 791ae3e

41 files changed

Lines changed: 83 additions & 1313 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/vite-8-minimum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@solidjs/vite-plugin': patch
3+
---
4+
5+
Require Vite 8 or newer and remove the Vite 6 and 7 compatibility paths.

.github/workflows/vitest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
example: [vite-6, vite-7, vite-8]
15+
example: [vite-8]
1616

1717
runs-on: ubuntu-22.04
1818
steps:

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Join [solid discord](https://discord.com/invite/solidjs) and check the [troubles
2727

2828
## Requirements
2929

30-
This module is 100% ESM compatible and requires NodeJS `14.18.0` or later.
30+
This module is 100% ESM compatible and requires Node.js `^20.19.0 || >=22.12.0`.
3131

32-
You can check your current version of NodeJS by typing `node -v` in your terminal. If your version is below that one version I'd encourage you to either do an update globally or use a NodeJS version management tool such as [Volta](https://volta.sh/) or [nvm](https://github.com/nvm-sh/nvm).
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.
3335

34-
Supported Vite versions: **Vite 6, 7 and 8**. Support for Vite 3–5 was
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**.
3737

3838
## Quickstart
3939

@@ -230,7 +230,7 @@ With `ssr: true` — **SSR start mode**:
230230
classic `vite build` + `vite build --ssr` two-step, work too.)
231231
- **Build ordering**: server builds read the client manifest, so with `ssr`
232232
enabled the plugin also orders builder-mode (environments API) app builds
233-
client-first via a `buildApp` hook (Vite 7.1+). That covers composed
233+
client-first via a `buildApp` hook. That covers composed
234234
setups whose own orchestrator builds server environments before the
235235
client — e.g. @cloudflare/vite-plugin — with no hand-written ordering
236236
plugin; setups without another orchestrator keep Vite's stock

examples/css-matrix/server.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async function start() {
5959

6060
let render;
6161
if (!isProduction) {
62-
({ render } = await vite.ssrLoadModule('/src/entry-server.tsx'));
62+
({ render } = await vite.environments.ssr.runner.import('/src/entry-server.tsx'));
6363
} else {
6464
({ render } = await import('./dist/server/entry-server.js'));
6565
}
@@ -86,7 +86,6 @@ async function start() {
8686
},
8787
});
8888
} catch (e) {
89-
if (!isProduction) vite.ssrFixStacktrace(e);
9089
console.error(e);
9190
res.statusCode = 500;
9291
res.end(e.message);

examples/css-matrix/test/bridge.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ try {
7171
const loadManifestModule = async () => {
7272
const node = ssrEnv.moduleGraph.getModuleById('\0virtual:solid-manifest');
7373
if (node) ssrEnv.moduleGraph.invalidateModule(node);
74-
return (await server.ssrLoadModule('virtual:solid-manifest')).default;
74+
return (await ssrEnv.runner.import('virtual:solid-manifest')).default;
7575
};
7676

7777
// ---- Protocol over plain HTTP ------------------------------------------

examples/ssr/server.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async function start() {
5858

5959
let render;
6060
if (!isProduction) {
61-
({ render } = await vite.ssrLoadModule('/src/entry-server.tsx'));
61+
({ render } = await vite.environments.ssr.runner.import('/src/entry-server.tsx'));
6262
} else {
6363
({ render } = await import('./dist/server/entry-server.js'));
6464
}
@@ -90,7 +90,6 @@ async function start() {
9090
},
9191
});
9292
} catch (e) {
93-
if (!isProduction) vite.ssrFixStacktrace(e);
9493
console.error(e);
9594
res.statusCode = 500;
9695
res.end(e.message);

examples/start-env/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import solidPlugin from '@solidjs/vite-plugin';
2020
// server key (config-time error — boot validation is synchronous so the
2121
// server chunk carries no top-level await).
2222
export default defineConfig({
23+
future: {
24+
removePluginHookHandleHotUpdate: 'warn',
25+
removePluginHookSsrArgument: 'warn',
26+
removeSsrLoadModule: 'warn',
27+
},
2328
plugins: [
2429
solidPlugin({
2530
start: {

examples/start-ssr/test/host-dispatch.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ try {
2626
const match = /createServerReference\w*\("([^"]*-getServerMessage)"/.exec(transformed?.code || '');
2727
if (!match) throw new Error('could not extract function id from transformed module');
2828

29-
await server.ssrLoadModule('virtual:solid-server-function-manifest');
30-
const handler = await server.ssrLoadModule('virtual:solid-server-function-handler');
29+
const runner = server.environments.ssr.runner;
30+
await runner.import('virtual:solid-server-function-manifest');
31+
const handler = await runner.import('virtual:solid-server-function-handler');
3132
const response = await handler.handleServerFunctionRequest(
3233
new Request(
3334
`http://localhost${handler.endpoint}?id=${encodeURIComponent(match[1])}&args=${encodeURIComponent('["host"]')}`,

examples/start-ssr/test/http-bridge.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ try {
193193
);
194194

195195
// ---- Abort propagation ----------------------------------------------------
196-
// The middleware runs in-process (ssrLoadModule), so the probe global it
197-
// records on is this very globalThis.
196+
// The middleware shares this process, including the probe global.
198197
const probe = () => globalThis.__solidBridgeProbe ?? { aborts: 0, cancels: 0 };
199198
{
200199
const abortsBefore = probe().aborts;

examples/start-ssr/test/run.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
// - `serverFunctions.devMiddleware: false` keeps compilation on while the
4141
// middleware no longer intercepts `/_server` (a dev POST 404s), and a
4242
// host emulation (test/host-dispatch.mjs) proves the manifest + handler
43-
// virtual modules still dispatch through `ssrLoadModule`,
43+
// virtual modules still dispatch through the SSR module runner,
4444
// - builder-order: with an adversarial `builder.buildApp` that builds the
4545
// ssr environment first (mimicking e.g. @cloudflare/vite-plugin), the
4646
// plugin's client-build-first hook still gets the client manifest baked
@@ -1791,7 +1791,7 @@ async function runConfigureMode() {
17911791
// 404. Then test/host-dispatch.mjs emulates the host that owns dispatch
17921792
// instead (a metaframework or an environment plugin like
17931793
// @cloudflare/vite-plugin): manifest + handler virtual modules loaded
1794-
// through `ssrLoadModule`, request dispatched like production.
1794+
// through the SSR module runner, request dispatched like production.
17951795
async function runNoMiddlewareMode() {
17961796
const mode = 'no-middleware';
17971797
console.log(`\n=== ${mode.toUpperCase()} ===`);
@@ -2721,7 +2721,9 @@ async function runMiddlewareMode() {
27212721
// middleware route reading getRequestEvent()) carries exactly those
27222722
// fields — createRequestEvent(request, options.event) spreads them
27232723
// over the event defaults.
2724-
const handlerModule = await probe.ssrLoadModule('virtual:solid-ssr-handler');
2724+
const handlerModule = await probe.environments.ssr.runner.import(
2725+
'virtual:solid-ssr-handler',
2726+
);
27252727
const seamResponse = await handlerModule.handleRequest(
27262728
new Request('http://localhost/api/native', { headers: { accept: 'application/json' } }),
27272729
{ event: { nativeEvent: { socket: { remoteAddress: '203.0.113.7' } } } },
@@ -3193,7 +3195,7 @@ async function runExternalMode() {
31933195
server = await createServer({ root: exampleDir, server: { middlewareMode: true } });
31943196
const clientModule = await server.environments.client.transformRequest('/src/api.ts');
31953197
const functionId = extractFunctionId(clientModule?.code || '', 'getServerMessage');
3196-
const handler = await server.ssrLoadModule('virtual:solid-ssr-handler');
3198+
const handler = await server.environments.ssr.runner.import('virtual:solid-ssr-handler');
31973199
const response = await handler.handleRequest(new Request('http://localhost/'));
31983200
const html = await response.text();
31993201
record(

0 commit comments

Comments
 (0)