@remix-run/node 0.0.0-experimental-ea0e0959 → 0.0.0-experimental-7d1dda37
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/cookieSigning.js +1 -1
- package/errors.js +1 -1
- package/fetch.js +1 -1
- package/formData.js +2 -2
- package/globals.js +1 -1
- package/index.js +1 -1
- package/magicExports/esm/platform.js +1 -1
- package/magicExports/platform.js +1 -1
- package/package.json +2 -2
- package/parseMultipartFormData.d.ts +2 -2
- package/parseMultipartFormData.js +16 -7
- 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/cookieSigning.js
CHANGED
package/errors.js
CHANGED
package/fetch.js
CHANGED
package/formData.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v0.0.0-experimental-
|
|
2
|
+
* @remix-run/node v0.0.0-experimental-7d1dda37
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -50,7 +50,7 @@ class NodeFormData {
|
|
|
50
50
|
|
|
51
51
|
get(name) {
|
|
52
52
|
let arr = this._fields[name];
|
|
53
|
-
return arr
|
|
53
|
+
return (arr === null || arr === void 0 ? void 0 : arr.slice(-1)[0]) || null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
getAll(name) {
|
package/globals.js
CHANGED
package/index.js
CHANGED
package/magicExports/platform.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": "0.0.0-experimental-
|
|
4
|
+
"version": "0.0.0-experimental-7d1dda37",
|
|
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": "0.0.0-experimental-
|
|
15
|
+
"@remix-run/server-runtime": "0.0.0-experimental-7d1dda37",
|
|
16
16
|
"@types/busboy": "^0.3.1",
|
|
17
17
|
"@types/node-fetch": "^2.5.12",
|
|
18
18
|
"@web-std/file": "^3.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
2
|
+
import { Readable } from "stream";
|
|
3
3
|
import type { UploadHandler } from "./formData";
|
|
4
4
|
import { FormData as NodeFormData } from "./formData";
|
|
5
5
|
export declare function parseMultipartFormData(request: Request, uploadHandler: UploadHandler): Promise<FormData>;
|
|
6
|
-
export declare function internalParseFormData(contentType: string,
|
|
6
|
+
export declare function internalParseFormData(contentType: string, body: string | Buffer | Readable, abortController?: AbortController, uploadHandler?: UploadHandler): Promise<NodeFormData>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v0.0.0-experimental-
|
|
2
|
+
* @remix-run/node v0.0.0-experimental-7d1dda37
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
|
+
var stream = require('stream');
|
|
15
16
|
var Busboy = require('busboy');
|
|
16
17
|
var formData = require('./formData.js');
|
|
17
18
|
|
|
@@ -22,9 +23,17 @@ var Busboy__default = /*#__PURE__*/_interopDefaultLegacy(Busboy);
|
|
|
22
23
|
function parseMultipartFormData(request, uploadHandler) {
|
|
23
24
|
return request.formData(uploadHandler);
|
|
24
25
|
}
|
|
25
|
-
async function internalParseFormData(contentType,
|
|
26
|
+
async function internalParseFormData(contentType, body, abortController, uploadHandler) {
|
|
26
27
|
let formData$1 = new formData.FormData();
|
|
27
28
|
let fileWorkQueue = [];
|
|
29
|
+
let stream$1;
|
|
30
|
+
|
|
31
|
+
if (typeof body === "string" || Buffer.isBuffer(body)) {
|
|
32
|
+
stream$1 = stream.Readable.from(body.toString());
|
|
33
|
+
} else {
|
|
34
|
+
stream$1 = body;
|
|
35
|
+
}
|
|
36
|
+
|
|
28
37
|
await new Promise(async (resolve, reject) => {
|
|
29
38
|
let busboy = new Busboy__default["default"]({
|
|
30
39
|
highWaterMark: 2 * 1024 * 1024,
|
|
@@ -37,8 +46,8 @@ async function internalParseFormData(contentType, stream, abortController, uploa
|
|
|
37
46
|
function abort(error) {
|
|
38
47
|
if (aborted) return;
|
|
39
48
|
aborted = true;
|
|
40
|
-
stream.unpipe();
|
|
41
|
-
stream.removeAllListeners();
|
|
49
|
+
stream$1.unpipe();
|
|
50
|
+
stream$1.removeAllListeners();
|
|
42
51
|
busboy.removeAllListeners();
|
|
43
52
|
abortController === null || abortController === void 0 ? void 0 : abortController.abort();
|
|
44
53
|
reject(error || new Error("failed to parse form data"));
|
|
@@ -81,11 +90,11 @@ async function internalParseFormData(contentType, stream, abortController, uploa
|
|
|
81
90
|
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");
|
|
82
91
|
}
|
|
83
92
|
});
|
|
84
|
-
stream.on("error", abort);
|
|
85
|
-
stream.on("aborted", abort);
|
|
93
|
+
stream$1.on("error", abort);
|
|
94
|
+
stream$1.on("aborted", abort);
|
|
86
95
|
busboy.on("error", abort);
|
|
87
96
|
busboy.on("finish", resolve);
|
|
88
|
-
stream.pipe(busboy);
|
|
97
|
+
stream$1.pipe(busboy);
|
|
89
98
|
});
|
|
90
99
|
await Promise.all(fileWorkQueue);
|
|
91
100
|
return formData$1;
|
package/sessions/fileStorage.js
CHANGED
package/upload/meter.js
CHANGED