@remix-run/node 1.3.3 → 1.3.5-pre.1

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/crypto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/fetch.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/globals.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
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.3",
4
+ "version": "1.3.5-pre.1",
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.3",
15
+ "@remix-run/server-runtime": "1.3.5-pre.1",
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.3
2
+ * @remix-run/node v1.3.5-pre.1
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.toString());
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
- let busboy = new Busboy__default["default"]({
45
- highWaterMark: 2 * 1024 * 1024,
46
- headers: {
47
- "content-type": contentType
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
- function abort(error) {
53
- if (aborted) return;
54
- aborted = true;
55
- stream$1.unpipe();
56
- stream$1.removeAllListeners();
57
- busboy.removeAllListeners();
58
- abortController === null || abortController === void 0 ? void 0 : abortController.abort();
59
- reject(error || new Error("failed to parse form data"));
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
- busboy.on("field", (name, value) => {
63
- formData$1.append(name, value);
64
- });
65
- busboy.on("file", (name, filestream, filename, encoding, mimetype) => {
66
- if (uploadHandler) {
67
- fileWorkQueue.push((async () => {
68
- try {
69
- let value = await uploadHandler({
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
- if (typeof value !== "undefined") {
78
- formData$1.append(name, value);
87
+ throw error;
88
+ } finally {
89
+ filestream.resume();
79
90
  }
80
- } catch (error) {
81
- // Emit error to busboy to bail early if possible
82
- busboy.emit("error", error); // It's possible that the handler is doing stuff and fails
83
- // *after* busboy has finished. Rethrow the error for surfacing
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
- if (!uploadHandler) {
96
- 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");
97
- }
98
- });
99
- stream$1.on("error", abort);
100
- stream$1.on("aborted", abort);
101
- busboy.on("error", abort);
102
- busboy.on("finish", resolve);
103
- stream$1.pipe(busboy);
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;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/upload/meter.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.3.3
2
+ * @remix-run/node v1.3.5-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *