@solidjs/start 1.0.3 → 1.0.5

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.
@@ -96,15 +96,19 @@ async function handleServerFunction(h3Event) {
96
96
  }
97
97
  if (h3Event.method === "POST") {
98
98
  const contentType = request.headers.get("content-type");
99
- const h3EventBody = h3Event.node.req;
100
- const isH3EventBodyStreamLocked = h3EventBody instanceof ReadableStream && h3EventBody.locked;
99
+ const h3Request = h3Event.node.req;
100
+ // This should never be the case in "proper" Nitro presets since node.req has to be IncomingMessage,
101
+ // But the new azure-functions preset for some reason uses a ReadableStream in node.req (#1521)
102
+ const isReadableStream = h3Request instanceof ReadableStream;
103
+ const isH3EventBodyStreamLocked = isReadableStream && h3Request.locked;
104
+ const requestBody = isReadableStream ? h3Request : h3Request.body;
101
105
  if (contentType?.startsWith("multipart/form-data") ||
102
106
  contentType?.startsWith("application/x-www-form-urlencoded")) {
103
107
  // workaround for https://github.com/unjs/nitro/issues/1721
104
108
  // (issue only in edge runtimes)
105
109
  parsed.push(await (isH3EventBodyStreamLocked
106
110
  ? request
107
- : new Request(request, { ...request, body: h3EventBody })).formData());
111
+ : new Request(request, { ...request, body: requestBody })).formData());
108
112
  // what should work when #1721 is fixed
109
113
  // parsed.push(await request.formData);
110
114
  }
@@ -113,7 +117,7 @@ async function handleServerFunction(h3Event) {
113
117
  // (issue only in edge runtimes)
114
118
  const tmpReq = isH3EventBodyStreamLocked
115
119
  ? request
116
- : new Request(request, { ...request, body: h3EventBody });
120
+ : new Request(request, { ...request, body: requestBody });
117
121
  // what should work when #1721 is fixed
118
122
  // just use request.json() here
119
123
  parsed = fromJSON(await tmpReq.json(), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/start",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
@@ -56,13 +56,13 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "solid-js": "^1.8.18",
59
- "vinxi": "^0.3.14",
59
+ "vinxi": "^0.4.0",
60
60
  "typescript": "^5.4.2"
61
61
  },
62
62
  "dependencies": {
63
- "@vinxi/plugin-directives": "^0.3.1",
64
- "@vinxi/server-components": "^0.3.3",
65
- "@vinxi/server-functions": "^0.3.3",
63
+ "@vinxi/plugin-directives": "^0.4.1",
64
+ "@vinxi/server-components": "^0.4.1",
65
+ "@vinxi/server-functions": "^0.4.1",
66
66
  "defu": "^6.1.2",
67
67
  "error-stack-parser": "^2.1.4",
68
68
  "glob": "^10.3.10",