Skip to content

Commit a7647e5

Browse files
authored
Merge branch 'main' into fix-onBeforeResponse
2 parents 68b74a5 + 9c1c936 commit a7647e5

10 files changed

Lines changed: 176 additions & 124 deletions

File tree

.changeset/fifty-flies-yell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/start": minor
3+
---
4+
5+
fix text/html missing when ssr is false

.changeset/fresh-eyes-bet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/vite-plugin-nitro-2": minor
3+
---
4+
5+
fix edge presets like netlify and cloudflare

.changeset/moody-hands-check.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/start": minor
3+
---
4+
5+
add `vite preview` support

.changeset/tricky-hounds-relate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/vite-plugin-nitro-2": minor
3+
---
4+
5+
needed to avoid weird issues like Cannot resolve "@tailwindcss/oxide-android-arm64/package.json"

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"editor.codeActionsOnSave": {
3-
"source.organizeImports": "explicit"
3+
// "source.organizeImports": "explicit"
44
},
5-
"typescript.tsdk": "node_modules/typescript/lib"
5+
"typescript.tsdk": "node_modules/typescript/lib",
6+
"editor.formatOnSave": true,
7+
"editor.defaultFormatter": "oxc.oxc-vscode"
68
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"devDependencies": {
3232
"@changesets/cli": "^2.29.8",
3333
"citty": "^0.1.5",
34-
"oxfmt": "^0.14.0",
34+
"oxfmt": "^0.28.0",
3535
"tinyglobby": "^0.2.2",
3636
"tippy.js": "^6.3.7",
3737
"typescript": "^5.7.0"

packages/start-nitro-v2-vite-plugin/src/index.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,21 @@ export function nitroV2Plugin(nitroConfig?: UserNitroConfig): PluginOption {
8484
},
8585
...nitroConfig,
8686
dev: false,
87+
routeRules: {
88+
"/_build/assets/**": {
89+
headers: {
90+
"cache-control": "public, immutable, max-age=31536000",
91+
},
92+
},
93+
},
8794
publicAssets: [
8895
{
8996
dir: client.config.build.outDir,
9097
maxAge: 31536000, // 1 year
9198
baseURL: "/",
9299
},
93100
],
101+
noExternals: false,
94102
renderer: virtualEntry,
95103
rollupConfig: {
96104
...nitroConfig?.rollupConfig,
@@ -116,14 +124,19 @@ export function nitroV2Plugin(nitroConfig?: UserNitroConfig): PluginOption {
116124
};
117125
},
118126
},
119-
nitroConfig?.preset === "netlify" && {
120-
name: "solid-start-nitro-netlify-fix",
127+
{
128+
name: "solid-start-nitro-edge-fix",
121129
enforce: "post",
122-
config() {
130+
async config() {
131+
await fsp.rm(".solid-start", { recursive: true, force: true });
123132
return {
124133
environments: {
125134
client: { build: { outDir: ".solid-start/client" } },
126-
ssr: { build: { outDir: ".solid-start/server" } },
135+
ssr: {
136+
build: nitroConfig?.preset?.toLowerCase().includes("static")
137+
? undefined
138+
: { outDir: ".solid-start/server" },
139+
},
127140
},
128141
};
129142
},

packages/start/src/config/dev-server.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ export function devServer(): Array<PluginOption> {
1111
return [
1212
{
1313
name: "solid-start-dev-server",
14+
configurePreviewServer(server) {
15+
return () => {
16+
server.middlewares.use(async (req, res) => {
17+
res.setHeader("content-encoding", "identity");
18+
const webReq = new NodeRequest({ req, res });
19+
const def: {
20+
default: { fetch: (req: Request) => Promise<Response> };
21+
} = await import(process.cwd() + "/dist/server/entry-server.js");
22+
sendNodeResponse(res, await def.default.fetch(webReq));
23+
});
24+
};
25+
},
1426
configureServer(viteDevServer) {
1527
(globalThis as any).VITE_DEV_SERVER = viteDevServer;
1628
return async () => {

packages/start/src/server/handler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export function createBaseHandler(
7979
return redirect(context.response.headers.get("Location")!, status);
8080
}
8181

82+
event.response.headers.set("content-type", "text/html");
83+
8284
return html;
8385
}
8486

pnpm-lock.yaml

Lines changed: 120 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)