@react-router/serve 0.0.0-experimental-c0856287f

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 ADDED
@@ -0,0 +1,506 @@
1
+ # `@remix-run/serve`
2
+
3
+ ## 2.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Put `undici` fetch polyfill behind a new `installGlobals({ nativeFetch: true })` parameter ([#9198](https://github.com/remix-run/remix/pull/9198))
8
+ - `remix-serve` will default to using `undici` for the fetch polyfill if `future.unstable_singleFetch` is enabled because the single fetch implementation relies on the `undici` polyfill
9
+ - Any users opting into Single Fetch and managing their own polyfill will need to pass the flag to `installGlobals` on their own to avoid runtime errors with Single Fetch
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies:
14
+ - `@remix-run/node@2.9.0`
15
+ - `@remix-run/express@2.9.0`
16
+
17
+ ## 2.8.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies:
22
+ - `@remix-run/express@2.8.1`
23
+ - `@remix-run/node@2.8.1`
24
+
25
+ ## 2.8.0
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies:
30
+ - `@remix-run/express@2.8.0`
31
+ - `@remix-run/node@2.8.0`
32
+
33
+ ## 2.7.2
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies:
38
+ - `@remix-run/express@2.7.2`
39
+ - `@remix-run/node@2.7.2`
40
+
41
+ ## 2.7.1
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies:
46
+ - `@remix-run/express@2.7.1`
47
+ - `@remix-run/node@2.7.1`
48
+
49
+ ## 2.7.0
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies:
54
+ - `@remix-run/express@2.7.0`
55
+ - `@remix-run/node@2.7.0`
56
+
57
+ ## 2.6.0
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies:
62
+ - `@remix-run/node@2.6.0`
63
+ - `@remix-run/express@2.6.0`
64
+
65
+ ## 2.5.1
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies:
70
+ - `@remix-run/express@2.5.1`
71
+ - `@remix-run/node@2.5.1`
72
+
73
+ ## 2.5.0
74
+
75
+ ### Patch Changes
76
+
77
+ - Don't try to load sourcemaps if they don't exist on disk ([#8446](https://github.com/remix-run/remix/pull/8446))
78
+ - Updated dependencies:
79
+ - `@remix-run/node@2.5.0`
80
+ - `@remix-run/express@2.5.0`
81
+
82
+ ## 2.4.1
83
+
84
+ ### Patch Changes
85
+
86
+ - Use node `fileURLToPath` to convert source map URL to path ([#8321](https://github.com/remix-run/remix/pull/8321))
87
+ - Updated dependencies:
88
+ - `@remix-run/node@2.4.1`
89
+ - `@remix-run/express@2.4.1`
90
+
91
+ ## 2.4.0
92
+
93
+ ### Patch Changes
94
+
95
+ - Fix source map loading when file has `?t=timestamp` suffix (rebuilds) ([#8174](https://github.com/remix-run/remix/pull/8174))
96
+ - Updated dependencies:
97
+ - `@remix-run/node@2.4.0`
98
+ - `@remix-run/express@2.4.0`
99
+
100
+ ## 2.3.1
101
+
102
+ ### Patch Changes
103
+
104
+ - Updated dependencies:
105
+ - `@remix-run/express@2.3.1`
106
+ - `@remix-run/node@2.3.1`
107
+
108
+ ## 2.3.0
109
+
110
+ ### Patch Changes
111
+
112
+ - Updated dependencies:
113
+ - `@remix-run/express@2.3.0`
114
+ - `@remix-run/node@2.3.0`
115
+
116
+ ## 2.2.0
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies:
121
+ - `@remix-run/express@2.2.0`
122
+ - `@remix-run/node@2.2.0`
123
+
124
+ ## 2.1.0
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies:
129
+ - `@remix-run/express@2.1.0`
130
+ - `@remix-run/node@2.1.0`
131
+
132
+ ## 2.0.1
133
+
134
+ ### Patch Changes
135
+
136
+ - Fix HMR for CJS projects using `remix-serve` and manual mode (`remix dev --manual`) ([#7487](https://github.com/remix-run/remix/pull/7487))
137
+ - By explicitly busting the `require` cache, `remix-serve` now correctly re-imports new server changes in CJS
138
+ - ESM projects were already working correctly and are not affected by this.
139
+ - Fix error caused by partially written server build ([#7470](https://github.com/remix-run/remix/pull/7470))
140
+ - Previously, it was possible to trigger a reimport of the app server code before the new server build had completely been written. Reimporting the partially written server build caused issues related to `build.assets` being undefined and crashing when reading `build.assets.version`
141
+ - Updated dependencies:
142
+ - `@remix-run/node@2.0.1`
143
+ - `@remix-run/express@2.0.1`
144
+
145
+ ## 2.0.0
146
+
147
+ ### Major Changes
148
+
149
+ - `remix-serve` now picks an open port if 3000 is taken ([#7278](https://github.com/remix-run/remix/pull/7278))
150
+
151
+ - If `PORT` env var is set, `remix-serve` will use that port
152
+ - Otherwise, `remix-serve` picks an open port (3000 unless that is already taken)
153
+
154
+ - Integrate manual mode in `remix-serve` ([#7231](https://github.com/remix-run/remix/pull/7231))
155
+
156
+ - Remove undocumented `createApp` Node API ([#7229](https://github.com/remix-run/remix/pull/7229))
157
+
158
+ - `remix-serve` is a CLI, not a library
159
+
160
+ - Require Node >=18.0.0 ([#6939](https://github.com/remix-run/remix/pull/6939))
161
+
162
+ - Promote the `future.v2_dev` flag in `remix.config.js` to a root level `dev` config ([#7002](https://github.com/remix-run/remix/pull/7002))
163
+
164
+ - Default to `serverModuleFormat: "esm"` and update `remix-serve` to use dynamic import to support ESM and CJS build outputs ([#6949](https://github.com/remix-run/remix/pull/6949))
165
+
166
+ - Preserve dynamic imports in `remix-serve` for external bundle ([#7173](https://github.com/remix-run/remix/pull/7173))
167
+
168
+ - For preparation of using Node's built in fetch implementation, installing the fetch globals is now a responsibility of the app server ([#7009](https://github.com/remix-run/remix/pull/7009))
169
+
170
+ - If you are using `remix-serve`, nothing is required
171
+ - If you are using your own app server, you will need to install the globals yourself
172
+
173
+ ```js filename=server.js
174
+ import { installGlobals } from "@remix-run/node";
175
+
176
+ installGlobals();
177
+ ```
178
+
179
+ - `source-map-support` is now a responsibility of the app server ([#7009](https://github.com/remix-run/remix/pull/7009))
180
+
181
+ - If you are using `remix-serve`, nothing is required
182
+ - If you are using your own app server, you will need to install [`source-map-support`](https://www.npmjs.com/package/source-map-support) yourself.
183
+
184
+ ```sh
185
+ npm i source-map-support
186
+ ```
187
+
188
+ ```js filename=server.js
189
+ import sourceMapSupport from "source-map-support";
190
+ sourceMapSupport.install();
191
+ ```
192
+
193
+ ### Patch Changes
194
+
195
+ - Update `remix-serve` usage error message to support ESM projects ([#7400](https://github.com/remix-run/remix/pull/7400))
196
+ - Updated dependencies:
197
+ - `@remix-run/node@2.0.0`
198
+ - `@remix-run/express@2.0.0`
199
+
200
+ ## 1.19.3
201
+
202
+ ### Patch Changes
203
+
204
+ - Updated dependencies:
205
+ - `@remix-run/express@1.19.3`
206
+ - `@remix-run/node@1.19.3`
207
+
208
+ ## 1.19.2
209
+
210
+ ### Patch Changes
211
+
212
+ - Install `source-map-support` ([#7039](https://github.com/remix-run/remix/pull/7039))
213
+ - Updated dependencies:
214
+ - `@remix-run/node@1.19.2`
215
+ - `@remix-run/express@1.19.2`
216
+
217
+ ## 1.19.1
218
+
219
+ ### Patch Changes
220
+
221
+ - Updated dependencies:
222
+ - `@remix-run/express@1.19.1`
223
+ - `@remix-run/node@1.19.1`
224
+
225
+ ## 1.19.0
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies:
230
+ - `@remix-run/node@1.19.0`
231
+ - `@remix-run/express@1.19.0`
232
+
233
+ ## 1.18.1
234
+
235
+ ### Patch Changes
236
+
237
+ - Updated dependencies:
238
+ - `@remix-run/node@1.18.1`
239
+ - `@remix-run/express@1.18.1`
240
+
241
+ ## 1.18.0
242
+
243
+ ### Minor Changes
244
+
245
+ - stabilize v2 dev server ([#6615](https://github.com/remix-run/remix/pull/6615))
246
+
247
+ ### Patch Changes
248
+
249
+ - fix(types): better tuple serialization types ([#6616](https://github.com/remix-run/remix/pull/6616))
250
+ - Updated dependencies:
251
+ - `@remix-run/node@1.18.0`
252
+ - `@remix-run/express@1.18.0`
253
+
254
+ ## 1.17.1
255
+
256
+ ### Patch Changes
257
+
258
+ - Updated dependencies:
259
+ - `@remix-run/express@1.17.1`
260
+ - `@remix-run/node@1.17.1`
261
+
262
+ ## 1.17.0
263
+
264
+ ### Patch Changes
265
+
266
+ - Add `HeadersArgs` type to be consistent with loaders/actions/meta and allows for using a `function` declaration in addition to an arrow function expression ([#6247](https://github.com/remix-run/remix/pull/6247))
267
+
268
+ ```tsx
269
+ import type { HeadersArgs } from "@remix-run/node"; // or cloudflare/deno
270
+
271
+ export function headers({ loaderHeaders }: HeadersArgs) {
272
+ return {
273
+ "x-my-custom-thing": loaderHeaders.get("x-my-custom-thing") || "fallback",
274
+ };
275
+ }
276
+ ```
277
+
278
+ - Updated dependencies:
279
+ - `@remix-run/node@1.17.0`
280
+ - `@remix-run/express@1.17.0`
281
+
282
+ ## 1.16.1
283
+
284
+ ### Patch Changes
285
+
286
+ - Updated dependencies:
287
+ - `@remix-run/node@1.16.1`
288
+ - `@remix-run/express@1.16.1`
289
+
290
+ ## 1.16.0
291
+
292
+ ### Patch Changes
293
+
294
+ - add `@remix-run/node/install` side-effect to allow `node --require @remix-run/node/install` ([#6132](https://github.com/remix-run/remix/pull/6132))
295
+ - Updated dependencies:
296
+ - `@remix-run/express@1.16.0`
297
+ - `@remix-run/node@1.16.0`
298
+
299
+ ## 1.15.0
300
+
301
+ ### Patch Changes
302
+
303
+ - Updated dependencies:
304
+ - `@remix-run/express@1.15.0`
305
+
306
+ ## 1.14.3
307
+
308
+ ### Patch Changes
309
+
310
+ - Updated dependencies:
311
+ - `@remix-run/express@1.14.3`
312
+
313
+ ## 1.14.2
314
+
315
+ ### Patch Changes
316
+
317
+ - Updated dependencies:
318
+ - `@remix-run/express@1.14.2`
319
+
320
+ ## 1.14.1
321
+
322
+ ### Patch Changes
323
+
324
+ - Updated dependencies:
325
+ - `@remix-run/express@1.14.1`
326
+
327
+ ## 1.14.0
328
+
329
+ ### Patch Changes
330
+
331
+ - Allow configurable `NODE_ENV` with `remix-serve` ([#5540](https://github.com/remix-run/remix/pull/5540))
332
+ - Sync `FutureConfig` interface between packages ([#5398](https://github.com/remix-run/remix/pull/5398))
333
+ - Updated dependencies:
334
+ - `@remix-run/express@1.14.0`
335
+
336
+ ## 1.13.0
337
+
338
+ ### Patch Changes
339
+
340
+ - Updated dependencies:
341
+ - `@remix-run/express@1.13.0`
342
+
343
+ ## 1.12.0
344
+
345
+ ### Minor Changes
346
+
347
+ - Added a new development server available in the Remix config under the `unstable_dev` flag. [See the release notes](https://github.com/remix-run/remix/releases/tag/remix%401.12.0) for a full description. ([#5133](https://github.com/remix-run/remix/pull/5133))
348
+
349
+ ### Patch Changes
350
+
351
+ - Updated dependencies:
352
+ - `@remix-run/express@1.12.0`
353
+
354
+ ## 1.11.1
355
+
356
+ ### Patch Changes
357
+
358
+ - Updated dependencies:
359
+ - `@remix-run/express@1.11.1`
360
+
361
+ ## 1.11.0
362
+
363
+ ### Patch Changes
364
+
365
+ - Introduces the `defer()` API from `@remix-run/router` with support for server-rendering and HTTP streaming. This utility allows you to defer values returned from `loader` functions by returning promises instead of resolved values. This has been refered to as _"sending a promise over the wire"_. ([#4920](https://github.com/remix-run/remix/pull/4920))
366
+
367
+ Informational Resources:
368
+
369
+ - <https://gist.github.com/jacob-ebey/9bde9546c1aafaa6bc8c242054b1be26>
370
+ - <https://github.com/remix-run/remix/blob/main/decisions/0004-streaming-apis.md>
371
+
372
+ Documentation Resources (better docs specific to Remix are in the works):
373
+
374
+ - <https://reactrouter.com/en/main/utils/defer>
375
+ - <https://reactrouter.com/en/main/components/await>
376
+ - <https://reactrouter.com/en/main/hooks/use-async-value>
377
+ - <https://reactrouter.com/en/main/hooks/use-async-error>
378
+
379
+ - Updated dependencies:
380
+ - `@remix-run/express@1.11.0`
381
+
382
+ ## 1.10.1
383
+
384
+ ### Patch Changes
385
+
386
+ - Updated dependencies:
387
+ - `@remix-run/express@1.10.1`
388
+
389
+ ## 1.10.0
390
+
391
+ ### Patch Changes
392
+
393
+ - Updated dependencies:
394
+ - `@remix-run/express@1.10.0`
395
+
396
+ ## 1.9.0
397
+
398
+ ### Patch Changes
399
+
400
+ - Fix `TypedResponse` so that Typescript correctly shows errors for incompatible types in `loader` and `action` functions. ([#4734](https://github.com/remix-run/remix/pull/4734))
401
+ - Updated dependencies:
402
+ - `@remix-run/express@1.9.0`
403
+
404
+ ## 1.8.2
405
+
406
+ ### Patch Changes
407
+
408
+ - Updated dependencies:
409
+ - `@remix-run/express@1.8.2`
410
+
411
+ ## 1.8.1
412
+
413
+ ### Patch Changes
414
+
415
+ - Updated dependencies:
416
+ - `@remix-run/express@1.8.1`
417
+
418
+ ## 1.8.0
419
+
420
+ ### Patch Changes
421
+
422
+ - Updated dependencies:
423
+ - `@remix-run/express@1.8.0`
424
+
425
+ ## 1.7.6
426
+
427
+ ### Patch Changes
428
+
429
+ - Updated dependencies:
430
+ - `@remix-run/express@1.7.6`
431
+
432
+ ## 1.7.5
433
+
434
+ ### Patch Changes
435
+
436
+ - Updated dependencies:
437
+ - `@remix-run/express@1.7.5`
438
+
439
+ ## 1.7.4
440
+
441
+ ### Patch Changes
442
+
443
+ - Updated dependencies:
444
+ - `@remix-run/express@1.7.4`
445
+
446
+ ## 1.7.3
447
+
448
+ ### Patch Changes
449
+
450
+ - Updated dependencies:
451
+ - `@remix-run/express@1.7.3`
452
+
453
+ ## 1.7.2
454
+
455
+ ### Patch Changes
456
+
457
+ - Updated dependencies:
458
+ - `@remix-run/express@1.7.2`
459
+
460
+ ## 1.7.1
461
+
462
+ ### Patch Changes
463
+
464
+ - Updated dependencies:
465
+ - `@remix-run/express@1.7.1`
466
+
467
+ ## 1.7.0
468
+
469
+ ### Minor Changes
470
+
471
+ - We've added a new type: `SerializeFrom`. This is used to infer the ([#4013](https://github.com/remix-run/remix/pull/4013))
472
+ JSON-serialized return type of loaders and actions.
473
+ - `MetaFunction` type can now infer `data` and `parentsData` types from route loaders ([#4022](https://github.com/remix-run/remix/pull/4022))
474
+
475
+ ### Patch Changes
476
+
477
+ - Updated dependencies:
478
+ - `@remix-run/express@1.7.0`
479
+
480
+ ## 1.6.8
481
+
482
+ ### Patch Changes
483
+
484
+ - Updated dependencies:
485
+ - `@remix-run/express@1.6.8`
486
+
487
+ ## 1.6.7
488
+
489
+ ### Patch Changes
490
+
491
+ - Updated dependencies:
492
+ - `@remix-run/express@1.6.7`
493
+
494
+ ## 1.6.6
495
+
496
+ ### Patch Changes
497
+
498
+ - Updated dependencies:
499
+ - `@remix-run/express@1.6.6`
500
+
501
+ ## 1.6.5
502
+
503
+ ### Patch Changes
504
+
505
+ - Updated dependencies
506
+ - `@remix-run/express@1.6.5`
package/LICENSE.md ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) React Training LLC 2015-2019
4
+ Copyright (c) Remix Software Inc. 2020-2021
5
+ Copyright (c) Shopify Inc. 2022-2023
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # Welcome to Remix!
2
+
3
+ [Remix](https://remix.run) is a web framework that helps you build better websites with React.
4
+
5
+ To get started, open a new shell and run:
6
+
7
+ ```sh
8
+ npx create-remix@latest
9
+ ```
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/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ import "@react-router/node/install";
package/dist/cli.js ADDED
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @react-router/serve v0.0.0-experimental-c0856287f
4
+ *
5
+ * Copyright (c) Remix Software Inc.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE.md file in the root directory of this source tree.
9
+ *
10
+ * @license MIT
11
+ */
12
+ 'use strict';
13
+
14
+ require('@react-router/node/install');
15
+ var fs = require('node:fs');
16
+ var os = require('node:os');
17
+ var path = require('node:path');
18
+ var url = require('node:url');
19
+ var node = require('@react-router/node');
20
+ var express$1 = require('@react-router/express');
21
+ var compression = require('compression');
22
+ var express = require('express');
23
+ var morgan = require('morgan');
24
+ var sourceMapSupport = require('source-map-support');
25
+ var getPort = require('get-port');
26
+
27
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
28
+
29
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
30
+ var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
31
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
32
+ var url__default = /*#__PURE__*/_interopDefaultLegacy(url);
33
+ var compression__default = /*#__PURE__*/_interopDefaultLegacy(compression);
34
+ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
35
+ var morgan__default = /*#__PURE__*/_interopDefaultLegacy(morgan);
36
+ var sourceMapSupport__default = /*#__PURE__*/_interopDefaultLegacy(sourceMapSupport);
37
+ var getPort__default = /*#__PURE__*/_interopDefaultLegacy(getPort);
38
+
39
+ process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
40
+ sourceMapSupport__default["default"].install({
41
+ retrieveSourceMap: function (source) {
42
+ let match = source.startsWith("file://");
43
+ if (match) {
44
+ let filePath = url__default["default"].fileURLToPath(source);
45
+ let sourceMapPath = `${filePath}.map`;
46
+ if (fs__default["default"].existsSync(sourceMapPath)) {
47
+ return {
48
+ url: source,
49
+ map: fs__default["default"].readFileSync(sourceMapPath, "utf8")
50
+ };
51
+ }
52
+ }
53
+ return null;
54
+ }
55
+ });
56
+ node.installGlobals();
57
+ run();
58
+ function parseNumber(raw) {
59
+ if (raw === undefined) return undefined;
60
+ let maybe = Number(raw);
61
+ if (Number.isNaN(maybe)) return undefined;
62
+ return maybe;
63
+ }
64
+ async function run() {
65
+ let port = parseNumber(process.env.PORT) ?? (await getPort__default["default"]({
66
+ port: 3000
67
+ }));
68
+ let buildPathArg = process.argv[2];
69
+ if (!buildPathArg) {
70
+ console.error(`
71
+ Usage: react-router-serve <server-build-path> - e.g. react-router-serve build/server/index.js`);
72
+ process.exit(1);
73
+ }
74
+ let buildPath = path__default["default"].resolve(buildPathArg);
75
+ let build = await import(url__default["default"].pathToFileURL(buildPath).href);
76
+ let onListen = () => {
77
+ var _Object$values$flat$f;
78
+ let address = process.env.HOST || ((_Object$values$flat$f = Object.values(os__default["default"].networkInterfaces()).flat().find(ip => String(ip === null || ip === void 0 ? void 0 : ip.family).includes("4") && !(ip !== null && ip !== void 0 && ip.internal))) === null || _Object$values$flat$f === void 0 ? void 0 : _Object$values$flat$f.address);
79
+ if (!address) {
80
+ console.log(`[react-router-serve] http://localhost:${port}`);
81
+ } else {
82
+ console.log(`[react-router-serve] http://localhost:${port} (http://${address}:${port})`);
83
+ }
84
+ };
85
+ let app = express__default["default"]();
86
+ app.disable("x-powered-by");
87
+ app.use(compression__default["default"]());
88
+ app.use(build.publicPath, express__default["default"].static(build.assetsBuildDirectory, {
89
+ immutable: true,
90
+ maxAge: "1y"
91
+ }));
92
+ app.use(express__default["default"].static("public", {
93
+ maxAge: "1h"
94
+ }));
95
+ app.use(morgan__default["default"]("tiny"));
96
+ app.all("*", express$1.createRequestHandler({
97
+ build,
98
+ mode: process.env.NODE_ENV
99
+ }));
100
+ let server = process.env.HOST ? app.listen(port, process.env.HOST, onListen) : app.listen(port, onListen);
101
+ ["SIGTERM", "SIGINT"].forEach(signal => {
102
+ process.once(signal, () => server === null || server === void 0 ? void 0 : server.close(console.error));
103
+ });
104
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@react-router/serve",
3
+ "version": "0.0.0-experimental-c0856287f",
4
+ "description": "Production application server for React Router",
5
+ "bugs": {
6
+ "url": "https://github.com/remix-run/react-router/issues"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/remix-run/react-router",
11
+ "directory": "packages/remix-serve"
12
+ },
13
+ "license": "MIT",
14
+ "bin": {
15
+ "react-router-serve": "dist/cli.js"
16
+ },
17
+ "dependencies": {
18
+ "compression": "^1.7.4",
19
+ "express": "^4.17.1",
20
+ "get-port": "5.1.1",
21
+ "morgan": "^1.10.0",
22
+ "source-map-support": "^0.5.21",
23
+ "@react-router/express": "0.0.0-experimental-c0856287f",
24
+ "@react-router/node": "0.0.0-experimental-c0856287f"
25
+ },
26
+ "devDependencies": {
27
+ "@types/compression": "^1.7.0",
28
+ "@types/express": "^4.17.9",
29
+ "@types/morgan": "^1.9.2",
30
+ "@types/source-map-support": "^0.5.6"
31
+ },
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "files": [
36
+ "dist/",
37
+ "CHANGELOG.md",
38
+ "LICENSE.md",
39
+ "README.md"
40
+ ],
41
+ "scripts": {
42
+ "tsc": "tsc"
43
+ }
44
+ }