@remix-run/serve 1.6.4 → 1.6.5

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,8 @@
1
+ # `@remix-run/serve`
2
+
3
+ ## 1.6.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - `@remix-run/express@1.6.5`
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @remix-run/serve v1.6.4
3
+ * @remix-run/serve v1.6.5
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) {
@@ -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));
package/dist/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/serve v1.6.4
2
+ * @remix-run/serve v1.6.5
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function createApp(buildPath: string, mode?: string): import("express-serve-static-core").Express;
1
+ export declare function createApp(buildPath: string, mode?: string, publicPath?: string, assetsBuildDirectory?: string): import("express-serve-static-core").Express;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/serve v1.6.4
2
+ * @remix-run/serve v1.6.5
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -23,11 +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
29
  app.use(compression__default["default"]());
30
- app.use("/build", express__default["default"].static("public/build", {
30
+ app.use(publicPath, express__default["default"].static(assetsBuildDirectory, {
31
31
  immutable: true,
32
32
  maxAge: "1y"
33
33
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/serve",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Production application server for Remix",
5
5
  "bugs": {
6
6
  "url": "https://github.com/remix-run/remix/issues"
@@ -17,7 +17,7 @@
17
17
  "remix-serve": "dist/cli.js"
18
18
  },
19
19
  "dependencies": {
20
- "@remix-run/express": "1.6.4",
20
+ "@remix-run/express": "1.6.5",
21
21
  "compression": "^1.7.4",
22
22
  "express": "^4.17.1",
23
23
  "morgan": "^1.10.0"