@react-router/express 0.0.0-experimental-4b431ca46 → 0.0.0-experimental-7c6c0664d
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 +0 -15
- package/README.md +3 -9
- package/dist/index.js +1 -1
- package/dist/server.js +22 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
# `@remix-run/express`
|
|
2
2
|
|
|
3
|
-
## 7.0.0-pre.0
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
|
|
8
|
-
- update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
|
|
9
|
-
- Add `exports` field to all packages ([#11675](https://github.com/remix-run/react-router/pull/11675))
|
|
10
|
-
- node package no longer re-exports from react-router ([#11702](https://github.com/remix-run/react-router/pull/11702))
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- Updated dependencies:
|
|
15
|
-
- `react-router@7.0.0-pre.0`
|
|
16
|
-
- `@react-router/node@7.0.0-pre.0`
|
|
17
|
-
|
|
18
3
|
## 2.9.0
|
|
19
4
|
|
|
20
5
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @react-router/express
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
To get started, open a new shell and run:
|
|
3
|
+
[Express](https://expressjs.com) server request handler for [React Router.](https://github.com/remix-run/react-router)
|
|
6
4
|
|
|
7
5
|
```sh
|
|
8
|
-
|
|
6
|
+
npm install @react-router/express
|
|
9
7
|
```
|
|
10
|
-
|
|
11
|
-
Then follow the prompts you see in your terminal.
|
|
12
|
-
|
|
13
|
-
For more information about Remix, [visit remix.run](https://remix.run)!
|
package/dist/index.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/express v0.0.0-experimental-
|
|
2
|
+
* @react-router/express v0.0.0-experimental-7c6c0664d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -16,6 +16,16 @@ var reactRouter = require('react-router');
|
|
|
16
16
|
var node = require('@react-router/node');
|
|
17
17
|
|
|
18
18
|
// IDK why this is needed when it's in the tsconfig..........
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A function that returns the value to use as `context` in route `loader` and
|
|
22
|
+
* `action` functions.
|
|
23
|
+
*
|
|
24
|
+
* You can think of this as an escape hatch that allows you to pass
|
|
25
|
+
* environment/platform-specific values through to your loader/action, such as
|
|
26
|
+
* values that are generated by Express middleware like `req.session`.
|
|
27
|
+
*/
|
|
28
|
+
|
|
19
29
|
/**
|
|
20
30
|
* Returns a request handler for Express that serves the response using Remix.
|
|
21
31
|
*/
|
|
@@ -64,14 +74,24 @@ function createRemixRequest(req, res) {
|
|
|
64
74
|
let resolvedHost = `${req.hostname}${port ? `:${port}` : ""}`;
|
|
65
75
|
// Use `req.originalUrl` so Remix is aware of the full path
|
|
66
76
|
let url = new URL(`${req.protocol}://${resolvedHost}${req.originalUrl}`);
|
|
77
|
+
|
|
67
78
|
// Abort action/loaders once we can no longer write a response
|
|
68
79
|
let controller = new AbortController();
|
|
69
|
-
res.on("close", () => controller.abort());
|
|
70
80
|
let init = {
|
|
71
81
|
method: req.method,
|
|
72
82
|
headers: createRemixHeaders(req.headers),
|
|
73
83
|
signal: controller.signal
|
|
74
84
|
};
|
|
85
|
+
|
|
86
|
+
// Abort action/loaders once we can no longer write a response iff we have
|
|
87
|
+
// not yet sent a response (i.e., `close` without `finish`)
|
|
88
|
+
// `finish` -> done rendering the response
|
|
89
|
+
// `close` -> response can no longer be written to
|
|
90
|
+
res.on("finish", () => controller = null);
|
|
91
|
+
res.on("close", () => {
|
|
92
|
+
var _controller;
|
|
93
|
+
return (_controller = controller) === null || _controller === void 0 ? void 0 : _controller.abort();
|
|
94
|
+
});
|
|
75
95
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
76
96
|
init.body = node.createReadableStreamFromReadable(req);
|
|
77
97
|
init.duplex = "half";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/express",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-7c6c0664d",
|
|
4
4
|
"description": "Express server request handler for React Router",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/remix-run/react-router/issues"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"./package.json": "./package.json"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@react-router/node": "0.0.0-experimental-
|
|
24
|
+
"@react-router/node": "0.0.0-experimental-7c6c0664d"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/express": "^4.17.9",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"express": "^4.17.1",
|
|
37
37
|
"typescript": "^5.1.0",
|
|
38
|
-
"react-router": "0.0.0-experimental-
|
|
38
|
+
"react-router": "0.0.0-experimental-7c6c0664d"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"typescript": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
46
|
+
"node": ">=20.0.0"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"dist/",
|