@solidjs/start 2.0.1 → 2.0.3

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.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 91fc972: Prefix production entry scripts, stylesheets, modulepreloads, and serialized manifest paths with Vite's configured base URL.
8
+
9
+ ## 2.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - e21fadf: fix potentially incomplete first chunk for chunk readers
14
+ - 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
15
+
3
16
  ## 2.0.1
4
17
 
5
18
  ### Patch Changes
@@ -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,
@@ -10,7 +10,7 @@ export function getSsrProdManifest() {
10
10
  const viteManifestEntry = clientViteManifest[id /*import.meta.env.START_CLIENT_ENTRY*/];
11
11
  if (!viteManifestEntry)
12
12
  throw new Error(`No entry found in vite manifest for '${id}'`);
13
- return join("/", viteManifestEntry.file);
13
+ return join(import.meta.env.BASE_URL, viteManifestEntry.file);
14
14
  },
15
15
  async getAssets(id) {
16
16
  if (id.startsWith("./"))
@@ -24,7 +24,7 @@ export function getSsrProdManifest() {
24
24
  .map(id => id);
25
25
  for (const entryKey of entryKeys) {
26
26
  json[entryKey] = {
27
- output: join("/", viteManifest[entryKey].file),
27
+ output: join(import.meta.env.BASE_URL, viteManifest[entryKey].file),
28
28
  assets: await this.getAssets(entryKey),
29
29
  };
30
30
  }
@@ -41,7 +41,7 @@ function createHtmlTagsForAssets(assets) {
41
41
  .map(asset => ({
42
42
  tag: "link",
43
43
  attrs: {
44
- href: "/" + asset,
44
+ href: join(import.meta.env.BASE_URL, asset),
45
45
  key: asset,
46
46
  ...(asset.endsWith(".css") ? { rel: "stylesheet" } : { rel: "modulepreload" }),
47
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/start",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/solidjs/solid-start.git",