@remix-run/serve 0.0.0-experimental-d28d77b8 → 0.0.0-experimental-6f3ef540b

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.
File without changes
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @remix-run/serve v0.0.0-experimental-d28d77b8
3
+ * @remix-run/serve v0.0.0-experimental-6f3ef540b
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
6
6
  *
@@ -21,12 +21,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
21
21
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
22
22
  var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
23
23
 
24
- let port = Number.parseInt(process.env.PORT || "3000", 10);
25
-
26
- if (Number.isNaN(port)) {
27
- port = 3000;
28
- }
29
-
24
+ let port = process.env.PORT ? Number(process.env.PORT) : 3000;
25
+ if (Number.isNaN(port)) port = 3000;
30
26
  let buildPathArg = process.argv[2];
31
27
 
32
28
  if (!buildPathArg) {
@@ -40,7 +36,7 @@ let buildPath = path__default["default"].resolve(process.cwd(), buildPathArg);
40
36
  let onListen = () => {
41
37
  var _Object$values$flat$f;
42
38
 
43
- let address = process.env.HOST || ((_Object$values$flat$f = Object.values(os__default["default"].networkInterfaces()).flat().find(ip => (ip === null || ip === void 0 ? void 0 : ip.family) === "IPv4" && !ip.internal)) === null || _Object$values$flat$f === void 0 ? void 0 : _Object$values$flat$f.address);
39
+ 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);
44
40
 
45
41
  if (!address) {
46
42
  console.log(`Remix App Server started at http://localhost:${port}`);
@@ -49,7 +45,9 @@ let onListen = () => {
49
45
  }
50
46
  };
51
47
 
52
- let app = index.createApp(buildPath);
48
+ let build = require(buildPath);
49
+
50
+ let app = index.createApp(buildPath, process.env.NODE_ENV, build.publicPath, build.assetsBuildDirectory);
53
51
  let server = process.env.HOST ? app.listen(port, process.env.HOST, onListen) : app.listen(port, onListen);
54
52
  ["SIGTERM", "SIGINT"].forEach(signal => {
55
53
  process.once(signal, () => server === null || server === void 0 ? void 0 : server.close(console.error));
File without changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/serve v0.0.0-experimental-d28d77b8
2
+ * @remix-run/serve v0.0.0-experimental-6f3ef540b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -0,0 +1 @@
1
+ export declare function createApp(buildPath: string, mode?: string, publicPath?: string, assetsBuildDirectory?: string): import("express-serve-static-core").Express;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/serve v0.0.0-experimental-d28d77b8
2
+ * @remix-run/serve v0.0.0-experimental-6f3ef540b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -23,13 +23,11 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
23
23
  var compression__default = /*#__PURE__*/_interopDefaultLegacy(compression);
24
24
  var morgan__default = /*#__PURE__*/_interopDefaultLegacy(morgan);
25
25
 
26
- function createApp(buildPath, mode = "production") {
26
+ function createApp(buildPath, mode = "production", publicPath = "/build/", assetsBuildDirectory = "public/build/") {
27
27
  let app = express__default["default"]();
28
28
  app.disable("x-powered-by");
29
- app.use(compression__default["default"]({
30
- filter: express$1.createCompressionFilter()
31
- }));
32
- app.use("/build", express__default["default"].static("public/build", {
29
+ app.use(compression__default["default"]());
30
+ app.use(publicPath, express__default["default"].static(assetsBuildDirectory, {
33
31
  immutable: true,
34
32
  maxAge: "1y"
35
33
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/serve",
3
- "version": "0.0.0-experimental-d28d77b8",
3
+ "version": "0.0.0-experimental-6f3ef540b",
4
4
  "description": "Production application server for Remix",
5
5
  "bugs": {
6
6
  "url": "https://github.com/remix-run/remix/issues"
@@ -11,11 +11,13 @@
11
11
  "directory": "packages/remix-serve"
12
12
  },
13
13
  "license": "MIT",
14
+ "main": "dist/index.js",
15
+ "typings": "dist/index.d.ts",
14
16
  "bin": {
15
- "remix-serve": "cli.js"
17
+ "remix-serve": "dist/cli.js"
16
18
  },
17
19
  "dependencies": {
18
- "@remix-run/express": "0.0.0-experimental-d28d77b8",
20
+ "@remix-run/express": "0.0.0-experimental-6f3ef540b",
19
21
  "compression": "^1.7.4",
20
22
  "express": "^4.17.1",
21
23
  "morgan": "^1.10.0"
@@ -27,5 +29,11 @@
27
29
  },
28
30
  "engines": {
29
31
  "node": ">=14"
30
- }
32
+ },
33
+ "files": [
34
+ "dist/",
35
+ "CHANGELOG.md",
36
+ "LICENSE.md",
37
+ "README.md"
38
+ ]
31
39
  }
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function createApp(buildPath: string, mode?: string): import("express-serve-static-core").Express;