@remix-run/node 1.3.4-pre.0 → 1.3.5-pre.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/base64.js +1 -1
- package/crypto.js +1 -1
- package/fetch.js +2 -2
- package/formData.js +1 -1
- package/globals.js +1 -1
- package/implementations.js +1 -1
- package/index.js +1 -1
- package/magicExports/esm/remix.js +1 -1
- package/magicExports/remix.js +1 -1
- package/package.json +2 -2
- package/parseMultipartFormData.js +60 -56
- package/sessions/fileStorage.js +1 -1
- package/upload/fileUploadHandler.js +1 -1
- package/upload/memoryUploadHandler.js +1 -1
- package/upload/meter.js +1 -1
package/base64.js
CHANGED
package/crypto.js
CHANGED
package/fetch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v1.3.
|
|
2
|
+
* @remix-run/node v1.3.5-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -96,7 +96,7 @@ class NodeRequest extends nodeFetch.Request {
|
|
|
96
96
|
async formData(uploadHandler) {
|
|
97
97
|
let contentType = this.headers.get("Content-Type");
|
|
98
98
|
|
|
99
|
-
if (contentType) {
|
|
99
|
+
if (contentType && (/application\/x-www-form-urlencoded/.test(contentType) || /multipart\/form-data/.test(contentType))) {
|
|
100
100
|
return await parseMultipartFormData.internalParseFormData(contentType, this.body, this.abortController, uploadHandler);
|
|
101
101
|
}
|
|
102
102
|
|
package/formData.js
CHANGED
package/globals.js
CHANGED
package/implementations.js
CHANGED
package/index.js
CHANGED
package/magicExports/remix.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix-run/node",
|
|
3
3
|
"description": "Node.js platform abstractions for Remix",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.5-pre.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"url": "https://github.com/remix-run/remix/issues"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@remix-run/server-runtime": "1.3.
|
|
15
|
+
"@remix-run/server-runtime": "1.3.5-pre.2",
|
|
16
16
|
"@types/busboy": "^0.3.1",
|
|
17
17
|
"@types/node-fetch": "^2.5.12",
|
|
18
18
|
"@web-std/file": "^3.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v1.3.
|
|
2
|
+
* @remix-run/node v1.3.5-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -35,72 +35,76 @@ async function internalParseFormData(contentType, body, abortController, uploadH
|
|
|
35
35
|
let stream$1;
|
|
36
36
|
|
|
37
37
|
if (typeof body === "string" || Buffer.isBuffer(body)) {
|
|
38
|
-
stream$1 = stream.Readable.from(body
|
|
38
|
+
stream$1 = stream.Readable.from(body);
|
|
39
39
|
} else {
|
|
40
40
|
stream$1 = body;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
await new Promise(async (resolve, reject) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
try {
|
|
45
|
+
let busboy = new Busboy__default["default"]({
|
|
46
|
+
highWaterMark: 2 * 1024 * 1024,
|
|
47
|
+
headers: {
|
|
48
|
+
"content-type": contentType
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
let aborted = false;
|
|
52
|
+
|
|
53
|
+
function abort(error) {
|
|
54
|
+
if (aborted) return;
|
|
55
|
+
aborted = true;
|
|
56
|
+
stream$1.unpipe();
|
|
57
|
+
stream$1.removeAllListeners();
|
|
58
|
+
busboy.removeAllListeners();
|
|
59
|
+
abortController === null || abortController === void 0 ? void 0 : abortController.abort();
|
|
60
|
+
reject(error || new Error("failed to parse form data"));
|
|
48
61
|
}
|
|
49
|
-
});
|
|
50
|
-
let aborted = false;
|
|
51
62
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
busboy.on("field", (name, value) => {
|
|
64
|
+
formData$1.append(name, value);
|
|
65
|
+
});
|
|
66
|
+
busboy.on("file", (name, filestream, filename, encoding, mimetype) => {
|
|
67
|
+
if (uploadHandler) {
|
|
68
|
+
fileWorkQueue.push((async () => {
|
|
69
|
+
try {
|
|
70
|
+
let value = await uploadHandler({
|
|
71
|
+
name,
|
|
72
|
+
stream: filestream,
|
|
73
|
+
filename,
|
|
74
|
+
encoding,
|
|
75
|
+
mimetype
|
|
76
|
+
});
|
|
61
77
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
name,
|
|
71
|
-
stream: filestream,
|
|
72
|
-
filename,
|
|
73
|
-
encoding,
|
|
74
|
-
mimetype
|
|
75
|
-
});
|
|
78
|
+
if (typeof value !== "undefined") {
|
|
79
|
+
formData$1.append(name, value);
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
// Emit error to busboy to bail early if possible
|
|
83
|
+
busboy.emit("error", error); // It's possible that the handler is doing stuff and fails
|
|
84
|
+
// *after* busboy has finished. Rethrow the error for surfacing
|
|
85
|
+
// in the Promise.all(fileWorkQueue) below.
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
throw error;
|
|
88
|
+
} finally {
|
|
89
|
+
filestream.resume();
|
|
79
90
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// in the Promise.all(fileWorkQueue) below.
|
|
85
|
-
|
|
86
|
-
throw error;
|
|
87
|
-
} finally {
|
|
88
|
-
filestream.resume();
|
|
89
|
-
}
|
|
90
|
-
})());
|
|
91
|
-
} else {
|
|
92
|
-
filestream.resume();
|
|
93
|
-
}
|
|
91
|
+
})());
|
|
92
|
+
} else {
|
|
93
|
+
filestream.resume();
|
|
94
|
+
}
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
if (!uploadHandler) {
|
|
97
|
+
console.warn(`Tried to parse multipart file upload for field "${name}" but no uploadHandler was provided.` + " Read more here: https://remix.run/api/remix#parseMultipartFormData-node");
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
stream$1.on("error", abort);
|
|
101
|
+
stream$1.on("aborted", abort);
|
|
102
|
+
busboy.on("error", abort);
|
|
103
|
+
busboy.on("finish", resolve);
|
|
104
|
+
stream$1.pipe(busboy);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
reject(err);
|
|
107
|
+
}
|
|
104
108
|
});
|
|
105
109
|
await Promise.all(fileWorkQueue);
|
|
106
110
|
return formData$1;
|
package/sessions/fileStorage.js
CHANGED
package/upload/meter.js
CHANGED