@solidjs/start 2.0.0 → 2.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @solidjs/start
2
2
 
3
+ ## 2.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e21fadf: fix potentially incomplete first chunk for chunk readers
8
+ - d78288f: Declare an explicit `Content-Type: text/plain; charset=utf-8` on seroval-stream server function responses (success and error paths) so intermediaries cannot content-sniff a type onto them
9
+
10
+ ## 2.0.1
11
+
12
+ ### Patch Changes
13
+
14
+ - fd5e2ae: Delegate `vite preview` to Nitro when its preview plugin is active, including for static builds that intentionally have no server entry.
15
+
3
16
  ## 2.0.0
4
17
 
5
18
  ### Highlights
@@ -100,6 +113,7 @@ SolidStart v2 requires Node.js 24 or newer and Vite 8. Most SolidStart v1 applic
100
113
  Route files are imported through an id carrying the picked exports in the query (`routes/api.ts?pick=GET`), which left the id ending in the export name. Plugins whose filter is anchored on the file extension (`/\.[cm]?[jt]sx?$/`, the default for `unplugin-auto-import`, `unplugin-macros` and others) silently skipped every route file. The id now ends with a `lang.<ext>` marker, the same convention Vue SFCs use for `?vue&type=script&lang.ts`. Chunk filenames are unchanged.
101
114
 
102
115
  - d8f1ea8: Apply the configured `nonce` to the two script tags that were still missing it, so a strict `script-src` CSP no longer needs `unsafe-inline`:
116
+
103
117
  - The client-side redirect that streaming mode emits after the shell has already flushed (`<script>window.location=...</script>`) now carries the nonce.
104
118
  - The SPA entry script tag now carries the nonce, matching the SSR entry script.
105
119
 
@@ -279,6 +293,7 @@ SolidStart v2 requires Node.js 24 or newer and Vite 8. Most SolidStart v1 applic
279
293
  - 8256190: Rework `@solidjs/start/env`
280
294
  - 6cbba24: Fix multiple Set-Cookie headers being lost on redirect responses
281
295
  - d4cc548: ## Bump Seroval
296
+
282
297
  - version `1.4.1`
283
298
 
284
299
  - dd40610: Handle base url in api routes
@@ -17,6 +17,10 @@ export function devServer(serverEntryPath) {
17
17
  {
18
18
  name: "solid-start-dev-server",
19
19
  configurePreviewServer(server) {
20
+ // Nitro's preview hook handles both server and static builds.
21
+ // Static builds have no server entry, so detect the active plugin instead.
22
+ if (server.config.plugins.some(plugin => plugin.name === "nitro:preview"))
23
+ return;
20
24
  const serverEntryUrl = pathToFileURL(resolvePreviewServerEntry(server.config.root)).href;
21
25
  return () => {
22
26
  server.middlewares.use(async (req, res) => {
@@ -122,6 +122,8 @@ export async function handleServerFunction(h3Event) {
122
122
  h3Event.res.headers.set("content-type", "text/javascript");
123
123
  return serializeToJSStream(instance, result);
124
124
  }
125
+ // explicit type keeps intermediaries (e.g. Go proxies) from sniffing one onto the stream
126
+ h3Event.res.headers.set("content-type", "text/plain; charset=utf-8");
125
127
  return serializeToJSONStream(result);
126
128
  }
127
129
  catch (x) {
@@ -167,6 +169,7 @@ export async function handleServerFunction(h3Event) {
167
169
  h3Event.res.headers.set("content-type", "text/javascript");
168
170
  return serializeToJSStream(instance, x);
169
171
  }
172
+ h3Event.res.headers.set("content-type", "text/plain; charset=utf-8");
170
173
  return serializeToJSONStream(x);
171
174
  }
172
175
  return x;
@@ -135,10 +135,14 @@ export class SerovalChunkReader {
135
135
  }
136
136
  }
137
137
  async next() {
138
- // Check if the buffer is empty
139
- if (this.buffer.length === 0) {
138
+ // Check if the buffer is empty or incomplete
139
+ if (this.buffer.length < 12) {
140
140
  // if we are already done...
141
141
  if (this.done) {
142
+ // incomplete stream
143
+ if (this.buffer.length !== 0) {
144
+ throw new Error("Malformed server function stream.");
145
+ }
142
146
  return {
143
147
  done: true,
144
148
  value: undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/start",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/solidjs/solid-start.git",