@react-router/serve 0.0.0-experimental-ce4015162 → 0.0.0-experimental-8cee090e4
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 +10 -0
- package/dist/cli.js +17 -6
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# `@react-router/serve`
|
|
2
2
|
|
|
3
|
+
## v7.16.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Normalize `assetsBuildDirectory` path separators in `react-router-serve` so Windows-built server artifacts can serve `/assets/*` correctly when run on Linux. ([#14982](https://github.com/remix-run/react-router/pull/14982))
|
|
8
|
+
- Updated dependencies:
|
|
9
|
+
- [`react-router@7.16.0`](https://github.com/remix-run/react-router/releases/tag/react-router@7.16.0)
|
|
10
|
+
- [`@react-router/express@7.16.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/express@7.16.0)
|
|
11
|
+
- [`@react-router/node@7.16.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/node@7.16.0)
|
|
12
|
+
|
|
3
13
|
## v7.15.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @react-router/serve v0.0.0-experimental-
|
|
3
|
+
* @react-router/serve v0.0.0-experimental-8cee090e4
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -42,6 +42,15 @@ function parseNumber(raw) {
|
|
|
42
42
|
if (Number.isNaN(maybe)) return void 0;
|
|
43
43
|
return maybe;
|
|
44
44
|
}
|
|
45
|
+
function getExpressPath(publicPath) {
|
|
46
|
+
let pathname;
|
|
47
|
+
try {
|
|
48
|
+
pathname = new URL(publicPath).pathname;
|
|
49
|
+
} catch {
|
|
50
|
+
pathname = publicPath;
|
|
51
|
+
}
|
|
52
|
+
return pathname.startsWith("/") ? pathname : `/${pathname}`;
|
|
53
|
+
}
|
|
45
54
|
async function run() {
|
|
46
55
|
let port = parseNumber(process.env.PORT) ?? await getPort({ port: 3e3 });
|
|
47
56
|
let buildPathArg = process.argv[2];
|
|
@@ -66,7 +75,8 @@ async function run() {
|
|
|
66
75
|
assetsBuildDirectory: path.resolve(path.dirname(buildPath), config.assetsBuildDirectory)
|
|
67
76
|
};
|
|
68
77
|
} else build = buildModule;
|
|
69
|
-
let onListen = () => {
|
|
78
|
+
let onListen = (error) => {
|
|
79
|
+
if (error) throw error;
|
|
70
80
|
let address = process.env.HOST || Object.values(os.networkInterfaces()).flat().find((ip) => String(ip?.family).includes("4") && !ip?.internal)?.address;
|
|
71
81
|
if (!address) console.log(`[react-router-serve] http://localhost:${port}`);
|
|
72
82
|
else console.log(`[react-router-serve] http://localhost:${port} (http://${address}:${port})`);
|
|
@@ -74,15 +84,16 @@ async function run() {
|
|
|
74
84
|
let app = express();
|
|
75
85
|
app.disable("x-powered-by");
|
|
76
86
|
if (!isRSCBuild) app.use(compression());
|
|
77
|
-
|
|
87
|
+
let expressPublicPath = getExpressPath(build.publicPath);
|
|
88
|
+
app.use(path.posix.join(expressPublicPath, "assets"), express.static(path.join(build.assetsBuildDirectory, "assets"), {
|
|
78
89
|
immutable: true,
|
|
79
90
|
maxAge: "1y"
|
|
80
91
|
}));
|
|
81
|
-
app.use(
|
|
92
|
+
app.use(expressPublicPath, express.static(build.assetsBuildDirectory));
|
|
82
93
|
app.use(express.static("public", { maxAge: "1h" }));
|
|
83
94
|
app.use(morgan("tiny"));
|
|
84
|
-
if (build.fetch) app.all("*", createRequestListener(build.fetch));
|
|
85
|
-
else app.all("*", createRequestHandler({
|
|
95
|
+
if (build.fetch) app.all("/{*splat}", createRequestListener(build.fetch));
|
|
96
|
+
else app.all("/{*splat}", createRequestHandler({
|
|
86
97
|
build: buildModule,
|
|
87
98
|
mode: process.env.NODE_ENV
|
|
88
99
|
}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/serve",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-experimental-
|
|
4
|
+
"version": "0.0.0-experimental-8cee090e4",
|
|
5
5
|
"description": "Production application server for React Router",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/remix-run/react-router/issues"
|
|
@@ -34,27 +34,27 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@remix-run/node-fetch-server": "^0.13.
|
|
37
|
+
"@remix-run/node-fetch-server": "^0.13.3",
|
|
38
38
|
"compression": "^1.8.1",
|
|
39
|
-
"express": "^
|
|
39
|
+
"express": "^5.2.1",
|
|
40
40
|
"get-port": "7.2.0",
|
|
41
41
|
"morgan": "^1.10.1",
|
|
42
42
|
"source-map-support": "^0.5.21",
|
|
43
|
-
"@react-router/node": "0.0.0-experimental-
|
|
44
|
-
"@react-router/express": "0.0.0-experimental-
|
|
43
|
+
"@react-router/node": "0.0.0-experimental-8cee090e4",
|
|
44
|
+
"@react-router/express": "0.0.0-experimental-8cee090e4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"react-router": "0.0.0-experimental-
|
|
47
|
+
"react-router": "0.0.0-experimental-8cee090e4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/compression": "^1.8.1",
|
|
51
|
-
"@types/express": "^
|
|
51
|
+
"@types/express": "^5.0.6",
|
|
52
52
|
"@types/morgan": "^1.9.10",
|
|
53
|
-
"@types/node": "^22.19.
|
|
53
|
+
"@types/node": "^22.19.19",
|
|
54
54
|
"@types/source-map-support": "^0.5.6",
|
|
55
|
-
"tsdown": "^0.
|
|
55
|
+
"tsdown": "^0.22.0",
|
|
56
56
|
"typescript": "^6.0.3",
|
|
57
|
-
"wireit": "0.14.
|
|
57
|
+
"wireit": "0.14.12"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=22.12.0"
|