@remix-run/serve 0.0.0-experimental-ab9dac4f

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/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2021 Remix Software Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 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/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/cli.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @remix-run/serve v0.0.0-experimental-ab9dac4f
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
+ var path = require('path');
15
+ var index = require('./index');
16
+
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
+
19
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
20
+
21
+ process.env.NODE_ENV = "production";
22
+ let port = process.env.PORT || 3000;
23
+ let buildPathArg = process.argv[2];
24
+
25
+ if (!buildPathArg) {
26
+ console.error(`
27
+ Usage: remix-serve <build-dir>`);
28
+ process.exit(1);
29
+ }
30
+
31
+ let buildPath = path__default["default"].resolve(process.cwd(), buildPathArg);
32
+ index.createApp(buildPath).listen(port, () => {
33
+ console.log(`Remix App Server started at http://localhost:${port}`);
34
+ });
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function createApp(buildPath: string, mode?: string): import("express-serve-static-core").Express;
package/index.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @remix-run/serve v0.0.0-experimental-ab9dac4f
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, '__esModule', { value: true });
14
+
15
+ var express = require('express');
16
+ var compression = require('compression');
17
+ var morgan = require('morgan');
18
+ var express$1 = require('@remix-run/express');
19
+
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
+
22
+ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
23
+ var compression__default = /*#__PURE__*/_interopDefaultLegacy(compression);
24
+ var morgan__default = /*#__PURE__*/_interopDefaultLegacy(morgan);
25
+
26
+ function createApp(buildPath, mode = "production") {
27
+ let app = express__default["default"]();
28
+ app.use(compression__default["default"]());
29
+ app.use(express__default["default"].static("public", {
30
+ immutable: true,
31
+ maxAge: "1y"
32
+ }));
33
+ app.use(morgan__default["default"]("tiny"));
34
+ app.all("*", mode === "production" ? express$1.createRequestHandler({
35
+ build: require(buildPath),
36
+ mode
37
+ }) : (req, res, next) => {
38
+ // require cache is purged in @remix-run/dev where the file watcher is
39
+ let build = require(buildPath);
40
+
41
+ return express$1.createRequestHandler({
42
+ build,
43
+ mode
44
+ })(req, res, next);
45
+ });
46
+ return app;
47
+ }
48
+
49
+ exports.createApp = createApp;
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@remix-run/serve",
3
+ "description": "Production application server for Remix",
4
+ "version": "0.0.0-experimental-ab9dac4f",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/remix-run/remix",
9
+ "directory": "packages/remix-serve"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/remix-run/remix/issues"
13
+ },
14
+ "bin": {
15
+ "remix-serve": "cli.js"
16
+ },
17
+ "dependencies": {
18
+ "@remix-run/express": "0.0.0-experimental-ab9dac4f",
19
+ "compression": "^1.7.4",
20
+ "express": "^4.17.1",
21
+ "morgan": "^1.10.0"
22
+ },
23
+ "devDependencies": {
24
+ "@types/compression": "^1.7.0",
25
+ "@types/express": "^4.17.9",
26
+ "@types/morgan": "^1.9.2"
27
+ }
28
+ }