@cedarjs/web-server 9.0.0-canary.1784 → 9.0.0-canary.3124
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/dist/bin.js +50 -65
- package/dist/cliConfig.d.ts +1 -1
- package/dist/cliConfig.d.ts.map +1 -1
- package/dist/cliConfig.js +3 -39
- package/dist/cliConfigHandler.d.ts +1 -1
- package/dist/cliConfigHandler.d.ts.map +1 -1
- package/dist/cliConfigHandler.js +4 -28
- package/dist/webServer.d.ts +1 -1
- package/dist/webServer.d.ts.map +1 -1
- package/dist/webServer.js +34 -59
- package/package.json +15 -11
- package/LICENSE +0 -21
package/dist/bin.js
CHANGED
|
@@ -1,79 +1,70 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
3
|
+
var __esm = (fn, res, err) => function __init() {
|
|
4
|
+
if (err) throw err[0];
|
|
5
|
+
try {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
} catch (e) {
|
|
8
|
+
throw err = [e], e;
|
|
17
9
|
}
|
|
18
|
-
return to;
|
|
19
10
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
11
|
|
|
29
12
|
// src/webServer.ts
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import ansis from "ansis";
|
|
16
|
+
import Fastify from "fastify";
|
|
17
|
+
import { redwoodFastifyWeb } from "@cedarjs/fastify-web";
|
|
18
|
+
import {
|
|
19
|
+
getConfig,
|
|
20
|
+
getPaths,
|
|
21
|
+
parsePort,
|
|
22
|
+
readEnvVar
|
|
23
|
+
} from "@cedarjs/project-config";
|
|
30
24
|
async function serveWeb(options = {}) {
|
|
31
25
|
const start = Date.now();
|
|
32
|
-
console.log(
|
|
33
|
-
const distIndexExists =
|
|
34
|
-
|
|
26
|
+
console.log(ansis.dim.italic("Starting Web Server..."));
|
|
27
|
+
const distIndexExists = fs.existsSync(
|
|
28
|
+
path.join(getPaths().web.dist, "index.html")
|
|
35
29
|
);
|
|
36
30
|
if (!distIndexExists) {
|
|
37
31
|
throw new Error(
|
|
38
32
|
"no built files to serve; run `yarn cedar build web` before serving the web side"
|
|
39
33
|
);
|
|
40
34
|
}
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
const webPort = readEnvVar("CEDAR_WEB_PORT", {
|
|
36
|
+
deprecatedAlias: "REDWOOD_WEB_PORT"
|
|
37
|
+
});
|
|
38
|
+
if (webPort) {
|
|
39
|
+
options.port ??= parsePort(webPort, "CEDAR_WEB_PORT");
|
|
43
40
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
options.host ??= (0, import_project_config.getConfig)().web.host;
|
|
47
|
-
options.host ??= process.env.NODE_ENV === "production" ? "0.0.0.0" : "::";
|
|
48
|
-
if (process.env.NODE_ENV === "production" && options.host !== "0.0.0.0") {
|
|
49
|
-
console.warn(
|
|
50
|
-
`Warning: host '${options.host}' may need to be '0.0.0.0' in production for containerized deployments`
|
|
51
|
-
);
|
|
41
|
+
if (process.env.PORT) {
|
|
42
|
+
options.port ??= parsePort(process.env.PORT, "PORT");
|
|
52
43
|
}
|
|
53
|
-
|
|
44
|
+
options.port ??= getConfig().web.port;
|
|
45
|
+
options.host ??= readEnvVar("CEDAR_WEB_HOST", {
|
|
46
|
+
deprecatedAlias: "REDWOOD_WEB_HOST"
|
|
47
|
+
});
|
|
48
|
+
options.host ??= process.env.HOST;
|
|
49
|
+
options.host ??= getConfig().web.host;
|
|
50
|
+
options.host ??= "::";
|
|
51
|
+
const fastify = Fastify({
|
|
54
52
|
requestTimeout: 15e3,
|
|
55
53
|
logger: {
|
|
56
54
|
level: process.env.LOG_LEVEL ?? (process.env.NODE_ENV === "development" ? "debug" : "warn")
|
|
57
55
|
}
|
|
58
56
|
});
|
|
59
|
-
fastify.register(
|
|
57
|
+
fastify.register(redwoodFastifyWeb, { redwood: options });
|
|
60
58
|
const address = await fastify.listen({
|
|
61
59
|
port: options.port,
|
|
62
60
|
host: options.host
|
|
63
61
|
});
|
|
64
|
-
console.log(
|
|
65
|
-
console.log(`Web server listening at ${
|
|
62
|
+
console.log(ansis.dim.italic("Took " + (Date.now() - start) + " ms"));
|
|
63
|
+
console.log(`Web server listening at ${ansis.green(address)}`);
|
|
66
64
|
}
|
|
67
|
-
var import_node_fs, import_node_path, import_ansis, import_fastify, import_fastify_web, import_project_config;
|
|
68
65
|
var init_webServer = __esm({
|
|
69
66
|
"src/webServer.ts"() {
|
|
70
67
|
"use strict";
|
|
71
|
-
import_node_fs = __toESM(require("node:fs"));
|
|
72
|
-
import_node_path = __toESM(require("node:path"));
|
|
73
|
-
import_ansis = __toESM(require("ansis"));
|
|
74
|
-
import_fastify = __toESM(require("fastify"));
|
|
75
|
-
import_fastify_web = require("@cedarjs/fastify-web");
|
|
76
|
-
import_project_config = require("@cedarjs/project-config");
|
|
77
68
|
}
|
|
78
69
|
});
|
|
79
70
|
|
|
@@ -94,16 +85,11 @@ var init_cliConfigHandler = __esm({
|
|
|
94
85
|
});
|
|
95
86
|
|
|
96
87
|
// src/bin.ts
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// package.json
|
|
104
|
-
var bin = {
|
|
105
|
-
"rw-web-server": "./dist/bin.js"
|
|
106
|
-
};
|
|
88
|
+
import path2 from "path";
|
|
89
|
+
import { config } from "dotenv-defaults";
|
|
90
|
+
import { hideBin } from "yargs/helpers";
|
|
91
|
+
import yargs from "yargs/yargs";
|
|
92
|
+
import { getPaths as getPaths2 } from "@cedarjs/project-config";
|
|
107
93
|
|
|
108
94
|
// src/cliConfig.ts
|
|
109
95
|
var description = "Start a server for serving the web side";
|
|
@@ -115,7 +101,7 @@ function builder(yargs2) {
|
|
|
115
101
|
alias: "p"
|
|
116
102
|
},
|
|
117
103
|
host: {
|
|
118
|
-
description: "The host to listen on
|
|
104
|
+
description: "The host to listen on",
|
|
119
105
|
type: "string"
|
|
120
106
|
},
|
|
121
107
|
apiProxyTarget: {
|
|
@@ -133,17 +119,16 @@ function builder(yargs2) {
|
|
|
133
119
|
|
|
134
120
|
// src/bin.ts
|
|
135
121
|
init_cliConfigHandler();
|
|
136
|
-
if (!process.env.
|
|
137
|
-
|
|
138
|
-
path:
|
|
139
|
-
defaults:
|
|
122
|
+
if (!process.env.CEDAR_ENV_FILES_LOADED) {
|
|
123
|
+
config({
|
|
124
|
+
path: path2.join(getPaths2().base, ".env"),
|
|
125
|
+
defaults: path2.join(getPaths2().base, ".env.defaults"),
|
|
140
126
|
multiline: true
|
|
141
127
|
});
|
|
142
|
-
process.env.
|
|
128
|
+
process.env.CEDAR_ENV_FILES_LOADED = "true";
|
|
143
129
|
}
|
|
144
130
|
process.env.NODE_ENV ??= "production";
|
|
145
|
-
|
|
146
|
-
(0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).scriptName(scriptName).alias("h", "help").alias("v", "version").strict().example(
|
|
131
|
+
yargs(hideBin(process.argv)).scriptName("cedar-web-server").alias("h", "help").alias("v", "version").strict().example(
|
|
147
132
|
"yarn $0 --api-url=/api --api-proxy-target=https://api.redwood.horse",
|
|
148
133
|
"Start the web server and proxy requests made to '/api' to 'https://api.redwood.horse'"
|
|
149
134
|
).example(
|
package/dist/cliConfig.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Argv } from 'yargs';
|
|
2
|
-
import type { ParsedOptions } from './types';
|
|
2
|
+
import type { ParsedOptions } from './types.js';
|
|
3
3
|
export declare const description = "Start a server for serving the web side";
|
|
4
4
|
export declare function builder(yargs: Argv<ParsedOptions>): void;
|
|
5
5
|
export declare function handler(options: ParsedOptions): Promise<void>;
|
package/dist/cliConfig.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cliConfig.d.ts","sourceRoot":"","sources":["../src/cliConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cliConfig.d.ts","sourceRoot":"","sources":["../src/cliConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,eAAO,MAAM,WAAW,4CAA4C,CAAA;AAEpE,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,QAwBjD;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,aAAa,iBAGnD"}
|
package/dist/cliConfig.js
CHANGED
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var cliConfig_exports = {};
|
|
30
|
-
__export(cliConfig_exports, {
|
|
31
|
-
builder: () => builder,
|
|
32
|
-
description: () => description,
|
|
33
|
-
handler: () => handler
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(cliConfig_exports);
|
|
36
1
|
const description = "Start a server for serving the web side";
|
|
37
2
|
function builder(yargs) {
|
|
38
3
|
yargs.options({
|
|
@@ -42,7 +7,7 @@ function builder(yargs) {
|
|
|
42
7
|
alias: "p"
|
|
43
8
|
},
|
|
44
9
|
host: {
|
|
45
|
-
description: "The host to listen on
|
|
10
|
+
description: "The host to listen on",
|
|
46
11
|
type: "string"
|
|
47
12
|
},
|
|
48
13
|
apiProxyTarget: {
|
|
@@ -61,9 +26,8 @@ async function handler(options) {
|
|
|
61
26
|
const { handler: handler2 } = await import("./cliConfigHandler.js");
|
|
62
27
|
await handler2(options);
|
|
63
28
|
}
|
|
64
|
-
|
|
65
|
-
0 && (module.exports = {
|
|
29
|
+
export {
|
|
66
30
|
builder,
|
|
67
31
|
description,
|
|
68
32
|
handler
|
|
69
|
-
}
|
|
33
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cliConfigHandler.d.ts","sourceRoot":"","sources":["../src/cliConfigHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cliConfigHandler.d.ts","sourceRoot":"","sources":["../src/cliConfigHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,wBAAsB,OAAO,CAAC,OAAO,EAAE,aAAa,iBAQnD"}
|
package/dist/cliConfigHandler.js
CHANGED
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var cliConfigHandler_exports = {};
|
|
20
|
-
__export(cliConfigHandler_exports, {
|
|
21
|
-
handler: () => handler
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(cliConfigHandler_exports);
|
|
24
|
-
var import_webServer = require("./webServer");
|
|
1
|
+
import { serveWeb } from "./webServer.js";
|
|
25
2
|
async function handler(options) {
|
|
26
3
|
try {
|
|
27
|
-
await
|
|
4
|
+
await serveWeb(options);
|
|
28
5
|
} catch (error) {
|
|
29
6
|
process.exitCode ||= 1;
|
|
30
7
|
console.error(`Error: ${error.message}`);
|
|
31
8
|
}
|
|
32
9
|
}
|
|
33
|
-
|
|
34
|
-
0 && (module.exports = {
|
|
10
|
+
export {
|
|
35
11
|
handler
|
|
36
|
-
}
|
|
12
|
+
};
|
package/dist/webServer.d.ts
CHANGED
package/dist/webServer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webServer.d.ts","sourceRoot":"","sources":["../src/webServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webServer.d.ts","sourceRoot":"","sources":["../src/webServer.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,wBAAsB,QAAQ,CAAC,OAAO,GAAE,aAAkB,iBA6DzD"}
|
package/dist/webServer.js
CHANGED
|
@@ -1,80 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var webServer_exports = {};
|
|
30
|
-
__export(webServer_exports, {
|
|
31
|
-
serveWeb: () => serveWeb
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(webServer_exports);
|
|
34
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
35
|
-
var import_node_path = __toESM(require("node:path"));
|
|
36
|
-
var import_ansis = __toESM(require("ansis"));
|
|
37
|
-
var import_fastify = __toESM(require("fastify"));
|
|
38
|
-
var import_fastify_web = require("@cedarjs/fastify-web");
|
|
39
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import ansis from "ansis";
|
|
4
|
+
import Fastify from "fastify";
|
|
5
|
+
import { redwoodFastifyWeb } from "@cedarjs/fastify-web";
|
|
6
|
+
import {
|
|
7
|
+
getConfig,
|
|
8
|
+
getPaths,
|
|
9
|
+
parsePort,
|
|
10
|
+
readEnvVar
|
|
11
|
+
} from "@cedarjs/project-config";
|
|
40
12
|
async function serveWeb(options = {}) {
|
|
41
13
|
const start = Date.now();
|
|
42
|
-
console.log(
|
|
43
|
-
const distIndexExists =
|
|
44
|
-
|
|
14
|
+
console.log(ansis.dim.italic("Starting Web Server..."));
|
|
15
|
+
const distIndexExists = fs.existsSync(
|
|
16
|
+
path.join(getPaths().web.dist, "index.html")
|
|
45
17
|
);
|
|
46
18
|
if (!distIndexExists) {
|
|
47
19
|
throw new Error(
|
|
48
20
|
"no built files to serve; run `yarn cedar build web` before serving the web side"
|
|
49
21
|
);
|
|
50
22
|
}
|
|
51
|
-
|
|
52
|
-
|
|
23
|
+
const webPort = readEnvVar("CEDAR_WEB_PORT", {
|
|
24
|
+
deprecatedAlias: "REDWOOD_WEB_PORT"
|
|
25
|
+
});
|
|
26
|
+
if (webPort) {
|
|
27
|
+
options.port ??= parsePort(webPort, "CEDAR_WEB_PORT");
|
|
53
28
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
options.host ??= (0, import_project_config.getConfig)().web.host;
|
|
57
|
-
options.host ??= process.env.NODE_ENV === "production" ? "0.0.0.0" : "::";
|
|
58
|
-
if (process.env.NODE_ENV === "production" && options.host !== "0.0.0.0") {
|
|
59
|
-
console.warn(
|
|
60
|
-
`Warning: host '${options.host}' may need to be '0.0.0.0' in production for containerized deployments`
|
|
61
|
-
);
|
|
29
|
+
if (process.env.PORT) {
|
|
30
|
+
options.port ??= parsePort(process.env.PORT, "PORT");
|
|
62
31
|
}
|
|
63
|
-
|
|
32
|
+
options.port ??= getConfig().web.port;
|
|
33
|
+
options.host ??= readEnvVar("CEDAR_WEB_HOST", {
|
|
34
|
+
deprecatedAlias: "REDWOOD_WEB_HOST"
|
|
35
|
+
});
|
|
36
|
+
options.host ??= process.env.HOST;
|
|
37
|
+
options.host ??= getConfig().web.host;
|
|
38
|
+
options.host ??= "::";
|
|
39
|
+
const fastify = Fastify({
|
|
64
40
|
requestTimeout: 15e3,
|
|
65
41
|
logger: {
|
|
66
42
|
level: process.env.LOG_LEVEL ?? (process.env.NODE_ENV === "development" ? "debug" : "warn")
|
|
67
43
|
}
|
|
68
44
|
});
|
|
69
|
-
fastify.register(
|
|
45
|
+
fastify.register(redwoodFastifyWeb, { redwood: options });
|
|
70
46
|
const address = await fastify.listen({
|
|
71
47
|
port: options.port,
|
|
72
48
|
host: options.host
|
|
73
49
|
});
|
|
74
|
-
console.log(
|
|
75
|
-
console.log(`Web server listening at ${
|
|
50
|
+
console.log(ansis.dim.italic("Took " + (Date.now() - start) + " ms"));
|
|
51
|
+
console.log(`Web server listening at ${ansis.green(address)}`);
|
|
76
52
|
}
|
|
77
|
-
|
|
78
|
-
0 && (module.exports = {
|
|
53
|
+
export {
|
|
79
54
|
serveWeb
|
|
80
|
-
}
|
|
55
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/web-server",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.3124",
|
|
4
4
|
"description": "CedarJS's server for the Web side",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,37 +8,41 @@
|
|
|
8
8
|
"directory": "packages/web-server"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
11
12
|
"main": "./dist/cliConfig.js",
|
|
12
13
|
"types": "./dist/cliConfig.d.ts",
|
|
13
14
|
"bin": {
|
|
15
|
+
"cedar-web-server": "./dist/bin.js",
|
|
14
16
|
"rw-web-server": "./dist/bin.js"
|
|
15
17
|
},
|
|
16
18
|
"files": [
|
|
17
19
|
"dist"
|
|
18
20
|
],
|
|
19
21
|
"scripts": {
|
|
20
|
-
"build": "
|
|
22
|
+
"build": "node ./build.mts",
|
|
21
23
|
"build:pack": "yarn pack -o cedarjs-web-server.tgz",
|
|
22
|
-
"build:types": "tsc --build --verbose",
|
|
24
|
+
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
23
25
|
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build && yarn fix:permissions\"",
|
|
24
26
|
"fix:permissions": "chmod +x dist/index.js; chmod +x dist/watch.js",
|
|
25
27
|
"prepublishOnly": "NODE_ENV=production yarn build"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@cedarjs/fastify-web": "9.0.0-canary.
|
|
29
|
-
"@cedarjs/project-config": "9.0.0-canary.
|
|
30
|
-
"ansis": "4.
|
|
30
|
+
"@cedarjs/fastify-web": "9.0.0-canary.3124",
|
|
31
|
+
"@cedarjs/project-config": "9.0.0-canary.3124",
|
|
32
|
+
"ansis": "4.3.1",
|
|
31
33
|
"dotenv-defaults": "5.0.2",
|
|
32
|
-
"fastify": "5.
|
|
33
|
-
"yargs": "17.7.
|
|
34
|
+
"fastify": "5.12.3",
|
|
35
|
+
"yargs": "17.7.3"
|
|
34
36
|
},
|
|
35
37
|
"devDependencies": {
|
|
36
|
-
"@cedarjs/framework-tools": "9.0.0-canary.
|
|
37
|
-
"tsx": "4.21.0",
|
|
38
|
+
"@cedarjs/framework-tools": "9.0.0-canary.3124",
|
|
38
39
|
"typescript": "5.9.3"
|
|
39
40
|
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=24"
|
|
43
|
+
},
|
|
40
44
|
"publishConfig": {
|
|
41
45
|
"access": "public"
|
|
42
46
|
},
|
|
43
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
|
|
44
48
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Cedar
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|