@cedarjs/cli 5.0.0-canary.2493 → 5.0.0-canary.2496
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/commands/serve.js +8 -6
- package/package.json +12 -12
package/dist/commands/serve.js
CHANGED
|
@@ -107,10 +107,9 @@ const builder = async (yargs) => {
|
|
|
107
107
|
const { serveStatic } = await import("srvx/static");
|
|
108
108
|
const apiUrl = getConfig().web.apiUrl;
|
|
109
109
|
const webDist = getPaths().web.dist;
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
);
|
|
110
|
+
const prerenderIndexPath = path.join(webDist, "200.html");
|
|
111
|
+
const fallbackIndexPath = fs.existsSync(prerenderIndexPath) ? prerenderIndexPath : path.join(webDist, "index.html");
|
|
112
|
+
const spaHtml = fs.readFileSync(fallbackIndexPath, "utf-8");
|
|
114
113
|
const webServer = serveSrvx({
|
|
115
114
|
// Dummy fetch handler. All requests are handled by middleware
|
|
116
115
|
fetch: async () => new Response("Not Found", { status: 404 }),
|
|
@@ -127,12 +126,15 @@ const builder = async (yargs) => {
|
|
|
127
126
|
return fetch(targetUrl, {
|
|
128
127
|
method: req.method,
|
|
129
128
|
headers: req.headers,
|
|
130
|
-
body: req.body
|
|
129
|
+
body: req.body,
|
|
130
|
+
// @ts-expect-error - `duplex` is required when forwarding a
|
|
131
|
+
// request body via fetch (Node 18+).
|
|
132
|
+
duplex: "half"
|
|
131
133
|
});
|
|
132
134
|
},
|
|
133
135
|
() => {
|
|
134
136
|
const headers = { "Content-Type": "text/html" };
|
|
135
|
-
return new Response(
|
|
137
|
+
return new Response(spaHtml, { headers });
|
|
136
138
|
}
|
|
137
139
|
],
|
|
138
140
|
port: webPort,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2496",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/parser": "7.29.3",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
|
-
"@cedarjs/api-server": "5.0.0-canary.
|
|
37
|
-
"@cedarjs/cli-helpers": "5.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "5.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "5.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "5.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "5.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "5.0.0-canary.
|
|
45
|
-
"@cedarjs/vite": "5.0.0-canary.
|
|
46
|
-
"@cedarjs/web-server": "5.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "5.0.0-canary.2496",
|
|
37
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2496",
|
|
38
|
+
"@cedarjs/fastify-web": "5.0.0-canary.2496",
|
|
39
|
+
"@cedarjs/internal": "5.0.0-canary.2496",
|
|
40
|
+
"@cedarjs/prerender": "5.0.0-canary.2496",
|
|
41
|
+
"@cedarjs/project-config": "5.0.0-canary.2496",
|
|
42
|
+
"@cedarjs/structure": "5.0.0-canary.2496",
|
|
43
|
+
"@cedarjs/telemetry": "5.0.0-canary.2496",
|
|
44
|
+
"@cedarjs/utils": "5.0.0-canary.2496",
|
|
45
|
+
"@cedarjs/vite": "5.0.0-canary.2496",
|
|
46
|
+
"@cedarjs/web-server": "5.0.0-canary.2496",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
48
48
|
"@opentelemetry/api": "1.9.1",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|