@react-router/node 8.2.0 → 8.3.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/CHANGELOG.md +17 -0
- package/dist/index.js +17 -7
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# `@react-router/node`
|
|
2
2
|
|
|
3
|
+
## v8.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bump `@remix-run/node-fetch-server` dependency ([#15447](https://github.com/remix-run/react-router/pull/15447))
|
|
8
|
+
- fix: Prevent client disconnects during streaming from crashing the Node process ([#15324](https://github.com/remix-run/react-router/pull/15324))
|
|
9
|
+
- Updated dependencies:
|
|
10
|
+
- [`react-router@8.3.1`](https://github.com/remix-run/react-router/releases/tag/react-router@8.3.1)
|
|
11
|
+
|
|
12
|
+
## v8.3.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Allow `typescript@7` to be used ([#15317](https://github.com/remix-run/react-router/pull/15317))
|
|
17
|
+
- Updated dependencies:
|
|
18
|
+
- [`react-router@8.3.0`](https://github.com/remix-run/react-router/releases/tag/react-router@8.3.0)
|
|
19
|
+
|
|
3
20
|
## v8.2.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/node v8.
|
|
2
|
+
* @react-router/node v8.3.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -123,9 +123,9 @@ async function writeReadableStreamToWritable(stream, writable) {
|
|
|
123
123
|
}
|
|
124
124
|
} catch (error) {
|
|
125
125
|
try {
|
|
126
|
-
reader.cancel(error).catch(() => {});
|
|
126
|
+
reader.cancel(error instanceof WritableClosedError ? void 0 : error).catch(() => {});
|
|
127
127
|
} catch {}
|
|
128
|
-
writable
|
|
128
|
+
destroyWritable(writable, error);
|
|
129
129
|
throw error;
|
|
130
130
|
} finally {
|
|
131
131
|
writableError.cleanup();
|
|
@@ -134,8 +134,16 @@ async function writeReadableStreamToWritable(stream, writable) {
|
|
|
134
134
|
} catch {}
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
var WritableClosedError = class extends Error {};
|
|
138
|
+
function destroyWritable(writable, error) {
|
|
139
|
+
if (error instanceof WritableClosedError || writable.destroyed) return;
|
|
140
|
+
writable.once("error", () => {});
|
|
141
|
+
writable.destroy(error);
|
|
142
|
+
}
|
|
137
143
|
function monitorWritableError(writable) {
|
|
144
|
+
let writableStartedDestroyed = writable.destroyed;
|
|
138
145
|
let settled = false;
|
|
146
|
+
let writableErrorEmitted = false;
|
|
139
147
|
let writableError;
|
|
140
148
|
let rejectWritableError;
|
|
141
149
|
let writableErrorPromise = new Promise((_, reject) => {
|
|
@@ -143,6 +151,7 @@ function monitorWritableError(writable) {
|
|
|
143
151
|
});
|
|
144
152
|
writableErrorPromise.catch(() => {});
|
|
145
153
|
function cleanup() {
|
|
154
|
+
if (!writableStartedDestroyed && writable.destroyed && writable.errored && !writableErrorEmitted) return;
|
|
146
155
|
writable.off("error", onError);
|
|
147
156
|
writable.off("close", onClose);
|
|
148
157
|
}
|
|
@@ -154,10 +163,11 @@ function monitorWritableError(writable) {
|
|
|
154
163
|
rejectWritableError(error);
|
|
155
164
|
}
|
|
156
165
|
function onError(error) {
|
|
166
|
+
writableErrorEmitted = true;
|
|
157
167
|
reject(error);
|
|
158
168
|
}
|
|
159
169
|
function onClose() {
|
|
160
|
-
reject(
|
|
170
|
+
reject(new WritableClosedError("Writable closed before stream finished"));
|
|
161
171
|
}
|
|
162
172
|
writable.once("error", onError);
|
|
163
173
|
writable.once("close", onClose);
|
|
@@ -168,7 +178,7 @@ function monitorWritableError(writable) {
|
|
|
168
178
|
},
|
|
169
179
|
throwIfClosed() {
|
|
170
180
|
if (writableError) throw writableError;
|
|
171
|
-
if (writable.destroyed || writable.writableEnded) throw new
|
|
181
|
+
if (writable.destroyed || writable.writableEnded) throw new WritableClosedError("Cannot write to a destroyed or ended writable stream");
|
|
172
182
|
}
|
|
173
183
|
};
|
|
174
184
|
}
|
|
@@ -206,7 +216,7 @@ async function writeAsyncIterableToWritable(iterable, writable) {
|
|
|
206
216
|
if (!completed) try {
|
|
207
217
|
Promise.resolve(iterator.return?.()).catch(() => {});
|
|
208
218
|
} catch {}
|
|
209
|
-
writable
|
|
219
|
+
destroyWritable(writable, error);
|
|
210
220
|
throw error;
|
|
211
221
|
} finally {
|
|
212
222
|
writableError.cleanup();
|
|
@@ -265,7 +275,7 @@ var StreamPump = class {
|
|
|
265
275
|
let available = (this.controller.desiredSize || 0) - bytes.byteLength;
|
|
266
276
|
this.controller.enqueue(bytes);
|
|
267
277
|
if (available <= 0) this.pause();
|
|
268
|
-
} catch
|
|
278
|
+
} catch {
|
|
269
279
|
this.controller.error(/* @__PURE__ */ new Error("Could not create Buffer, chunk must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object"));
|
|
270
280
|
this.cancel();
|
|
271
281
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.3.1",
|
|
5
5
|
"description": "Node.js platform abstractions for React Router",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/remix-run/react-router/issues"
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@remix-run/node-fetch-server": "^0.
|
|
41
|
+
"@remix-run/node-fetch-server": "^0.14.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^22.19.19",
|
|
45
45
|
"tsdown": "^0.22.0",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
47
|
"wireit": "0.14.12",
|
|
48
|
-
"react-router": "8.
|
|
48
|
+
"react-router": "8.3.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"typescript": "^5.1.0 || ^6.0.0",
|
|
52
|
-
"react-router": "8.
|
|
51
|
+
"typescript": "^5.1.0 || ^6.0.0 || ^7.0.0",
|
|
52
|
+
"react-router": "8.3.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"typescript": {
|