@catmint/cli 0.0.0-prealpha.1
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 +339 -0
- package/bin/catmint.js +2 -0
- package/dist/commands/build.d.ts +11 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +529 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/dev.d.ts +11 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +173 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/generate.d.ts +9 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +160 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/start.d.ts +8 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +443 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/cors-utils.d.ts +22 -0
- package/dist/cors-utils.d.ts.map +1 -0
- package/dist/cors-utils.js +32 -0
- package/dist/cors-utils.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/scan-utils.d.ts +20 -0
- package/dist/scan-utils.d.ts.map +1 -0
- package/dist/scan-utils.js +64 -0
- package/dist/scan-utils.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
// catmint start — Start production server
|
|
2
|
+
//
|
|
3
|
+
// RSC production pipeline:
|
|
4
|
+
// 1. Load RSC entry (dist/rsc/index.js) — exports render(url) → ReadableStream (flight)
|
|
5
|
+
// 2. Load SSR entry (dist/ssr/index.js) — exports renderToHtml(rscStream) → ReadableStream (HTML)
|
|
6
|
+
// 3. For page requests: RSC render → SSR render → pipe HTML to response
|
|
7
|
+
// 4. For API endpoints: SSR entry handles via handleEndpoint()
|
|
8
|
+
// 5. Client JS/CSS is bootstrapped via the RSC assets manifest (bootstrapScriptContent)
|
|
9
|
+
// which is embedded in the RSC+SSR build output automatically.
|
|
10
|
+
import { resolve, join, extname } from "node:path";
|
|
11
|
+
import { existsSync, readFileSync, statSync, createReadStream } from "node:fs";
|
|
12
|
+
import { createServer, } from "node:http";
|
|
13
|
+
import { networkInterfaces } from "node:os";
|
|
14
|
+
import { pathToFileURL } from "node:url";
|
|
15
|
+
import { errorPageHtml } from "@catmint/vite";
|
|
16
|
+
import { shouldAutoPreflight, buildPreflightHeaders } from "../cors-utils.js";
|
|
17
|
+
function parseFlags(args) {
|
|
18
|
+
const flags = {};
|
|
19
|
+
for (let i = 0; i < args.length; i++) {
|
|
20
|
+
const arg = args[i];
|
|
21
|
+
if (arg.startsWith("--")) {
|
|
22
|
+
const [key, val] = arg.slice(2).split("=");
|
|
23
|
+
flags[key] = val ?? args[++i] ?? true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return flags;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Common MIME types for static file serving.
|
|
30
|
+
*/
|
|
31
|
+
const MIME_TYPES = {
|
|
32
|
+
".html": "text/html; charset=utf-8",
|
|
33
|
+
".js": "application/javascript; charset=utf-8",
|
|
34
|
+
".mjs": "application/javascript; charset=utf-8",
|
|
35
|
+
".css": "text/css; charset=utf-8",
|
|
36
|
+
".json": "application/json; charset=utf-8",
|
|
37
|
+
".png": "image/png",
|
|
38
|
+
".jpg": "image/jpeg",
|
|
39
|
+
".jpeg": "image/jpeg",
|
|
40
|
+
".gif": "image/gif",
|
|
41
|
+
".svg": "image/svg+xml",
|
|
42
|
+
".ico": "image/x-icon",
|
|
43
|
+
".webp": "image/webp",
|
|
44
|
+
".avif": "image/avif",
|
|
45
|
+
".woff": "font/woff",
|
|
46
|
+
".woff2": "font/woff2",
|
|
47
|
+
".ttf": "font/ttf",
|
|
48
|
+
".eot": "application/vnd.ms-fontobject",
|
|
49
|
+
".otf": "font/otf",
|
|
50
|
+
".map": "application/json",
|
|
51
|
+
".txt": "text/plain; charset=utf-8",
|
|
52
|
+
".xml": "application/xml; charset=utf-8",
|
|
53
|
+
".wasm": "application/wasm",
|
|
54
|
+
".mp4": "video/mp4",
|
|
55
|
+
".webm": "video/webm",
|
|
56
|
+
".mp3": "audio/mpeg",
|
|
57
|
+
".ogg": "audio/ogg",
|
|
58
|
+
".pdf": "application/pdf",
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Try to serve a static file from the given directory.
|
|
62
|
+
* Returns true if the file was found and served.
|
|
63
|
+
*/
|
|
64
|
+
function tryServeStatic(req, res, urlPath, baseDir, cacheImmutable) {
|
|
65
|
+
// Prevent directory traversal
|
|
66
|
+
const safePath = urlPath.replace(/\.\./g, "").replace(/\/+/g, "/");
|
|
67
|
+
const filePath = join(baseDir, safePath);
|
|
68
|
+
// Security: ensure the resolved path is within the base directory
|
|
69
|
+
if (!filePath.startsWith(baseDir)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (!existsSync(filePath))
|
|
73
|
+
return false;
|
|
74
|
+
const fileStat = statSync(filePath);
|
|
75
|
+
if (!fileStat.isFile())
|
|
76
|
+
return false;
|
|
77
|
+
const ext = extname(filePath);
|
|
78
|
+
const contentType = MIME_TYPES[ext] ?? "application/octet-stream";
|
|
79
|
+
res.setHeader("Content-Type", contentType);
|
|
80
|
+
res.setHeader("Content-Length", fileStat.size);
|
|
81
|
+
if (cacheImmutable) {
|
|
82
|
+
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
|
83
|
+
}
|
|
84
|
+
res.statusCode = 200;
|
|
85
|
+
createReadStream(filePath).pipe(res);
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get the local network address for display.
|
|
90
|
+
*/
|
|
91
|
+
function getNetworkAddress() {
|
|
92
|
+
const interfaces = networkInterfaces();
|
|
93
|
+
for (const name of Object.keys(interfaces)) {
|
|
94
|
+
const addrs = interfaces[name];
|
|
95
|
+
if (!addrs)
|
|
96
|
+
continue;
|
|
97
|
+
for (const addr of addrs) {
|
|
98
|
+
if (addr.family === "IPv4" && !addr.internal) {
|
|
99
|
+
return addr.address;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Pipe a Web ReadableStream to a Node.js ServerResponse.
|
|
107
|
+
*/
|
|
108
|
+
async function pipeWebStreamToResponse(webStream, res) {
|
|
109
|
+
const reader = webStream.getReader();
|
|
110
|
+
try {
|
|
111
|
+
while (true) {
|
|
112
|
+
const { done, value } = await reader.read();
|
|
113
|
+
if (done)
|
|
114
|
+
break;
|
|
115
|
+
// Write chunk, handling backpressure
|
|
116
|
+
if (!res.write(value)) {
|
|
117
|
+
await new Promise((resolve) => res.once("drain", resolve));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
reader.releaseLock();
|
|
123
|
+
res.end();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Start the Catmint production server.
|
|
128
|
+
*
|
|
129
|
+
* Loads the RSC and SSR build entries and serves pages using the
|
|
130
|
+
* RSC flight protocol → SSR HTML rendering pipeline.
|
|
131
|
+
*/
|
|
132
|
+
export async function start(args) {
|
|
133
|
+
const flags = parseFlags(args);
|
|
134
|
+
const rootDir = process.cwd();
|
|
135
|
+
// Read port/host from manifest config first, then CLI flags override
|
|
136
|
+
let port = 3000;
|
|
137
|
+
let host = "0.0.0.0";
|
|
138
|
+
// We'll read these from the manifest after loading it, but CLI flags take precedence
|
|
139
|
+
const portFlag = typeof flags.port === "string" ? parseInt(flags.port, 10) : undefined;
|
|
140
|
+
const hostFlag = typeof flags.host === "string" ? flags.host : undefined;
|
|
141
|
+
const distDir = resolve(rootDir, "dist");
|
|
142
|
+
const manifestPath = join(distDir, "app_manifest.json");
|
|
143
|
+
// 1. Check that dist/ exists and contains app_manifest.json
|
|
144
|
+
if (!existsSync(distDir)) {
|
|
145
|
+
console.error(' Error: "dist/" directory not found. Run "catmint build" first.');
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
if (!existsSync(manifestPath)) {
|
|
149
|
+
console.error(' Error: "dist/app_manifest.json" not found. Run "catmint build" first.');
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
// 2. Read app_manifest.json
|
|
153
|
+
let manifest;
|
|
154
|
+
try {
|
|
155
|
+
manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
console.error(" Error: Failed to parse app_manifest.json:", err);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
// Apply port/host from manifest config, then override with CLI flags
|
|
162
|
+
if (manifest.config?.server?.port) {
|
|
163
|
+
port = manifest.config.server.port;
|
|
164
|
+
}
|
|
165
|
+
if (manifest.config?.server?.host) {
|
|
166
|
+
host = manifest.config.server.host;
|
|
167
|
+
}
|
|
168
|
+
if (portFlag !== undefined) {
|
|
169
|
+
port = portFlag;
|
|
170
|
+
}
|
|
171
|
+
if (hostFlag !== undefined) {
|
|
172
|
+
host = hostFlag;
|
|
173
|
+
}
|
|
174
|
+
const clientDir = join(distDir, "client");
|
|
175
|
+
const rscDir = join(distDir, "rsc");
|
|
176
|
+
const ssrDir = join(distDir, "ssr");
|
|
177
|
+
const staticDir = join(distDir, "static");
|
|
178
|
+
// 3. Load RSC entry — renders pages to RSC flight streams
|
|
179
|
+
let rscEntry;
|
|
180
|
+
const rscEntryPath = join(rscDir, "index.js");
|
|
181
|
+
if (existsSync(rscEntryPath)) {
|
|
182
|
+
try {
|
|
183
|
+
rscEntry = await import(pathToFileURL(rscEntryPath).href);
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
console.warn(" Warning: Failed to load RSC entry:", err);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// 4. Load SSR entry — converts RSC flight streams to HTML + handles endpoints
|
|
190
|
+
let ssrEntry;
|
|
191
|
+
const ssrEntryPath = join(ssrDir, "index.js");
|
|
192
|
+
if (existsSync(ssrEntryPath)) {
|
|
193
|
+
try {
|
|
194
|
+
ssrEntry = await import(pathToFileURL(ssrEntryPath).href);
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
console.warn(" Warning: Failed to load SSR entry:", err);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// Check we have both entries for RSC rendering
|
|
201
|
+
const hasRscPipeline = !!(rscEntry && ssrEntry);
|
|
202
|
+
if (!hasRscPipeline) {
|
|
203
|
+
console.warn(" Warning: RSC pipeline not available. Pages will return 404.");
|
|
204
|
+
if (!rscEntry)
|
|
205
|
+
console.warn(" Missing: dist/rsc/index.js");
|
|
206
|
+
if (!ssrEntry)
|
|
207
|
+
console.warn(" Missing: dist/ssr/index.js");
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Try to render a user-defined status page via the RSC → SSR pipeline.
|
|
211
|
+
* Returns the HTML string if a status page was found and rendered,
|
|
212
|
+
* or null to signal fallback to the built-in error page.
|
|
213
|
+
*/
|
|
214
|
+
async function tryRenderStatusPage(statusCode, pathname, data) {
|
|
215
|
+
if (!hasRscPipeline || !rscEntry?.renderStatusPage)
|
|
216
|
+
return null;
|
|
217
|
+
try {
|
|
218
|
+
const result = await rscEntry.renderStatusPage(statusCode, pathname, data);
|
|
219
|
+
if (!result)
|
|
220
|
+
return null;
|
|
221
|
+
const htmlStream = await ssrEntry.renderToHtml(result.stream, result.headConfig);
|
|
222
|
+
// Read the full HTML stream into a string
|
|
223
|
+
const reader = htmlStream.getReader();
|
|
224
|
+
const decoder = new TextDecoder();
|
|
225
|
+
let html = "";
|
|
226
|
+
while (true) {
|
|
227
|
+
const { done, value } = await reader.read();
|
|
228
|
+
if (done)
|
|
229
|
+
break;
|
|
230
|
+
html += decoder.decode(value, { stream: true });
|
|
231
|
+
}
|
|
232
|
+
return html;
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
console.error(` Failed to render status page for ${statusCode}:`, err);
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Send an error response for a page request. Tries to render a user-defined
|
|
241
|
+
* status page first, falling back to the built-in error page HTML.
|
|
242
|
+
*/
|
|
243
|
+
async function sendStatusPage(res, statusCode, pathname, data) {
|
|
244
|
+
const html = await tryRenderStatusPage(statusCode, pathname, data);
|
|
245
|
+
res.statusCode = statusCode;
|
|
246
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
247
|
+
res.end(html ?? errorPageHtml(statusCode));
|
|
248
|
+
}
|
|
249
|
+
// 5. Create HTTP server
|
|
250
|
+
const server = createServer(async (req, res) => {
|
|
251
|
+
const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
|
|
252
|
+
const urlPath = url.pathname;
|
|
253
|
+
// Client assets (dist/client/) have hashed filenames and never conflict
|
|
254
|
+
// with app routes — serve them first for optimal performance.
|
|
255
|
+
if (tryServeStatic(req, res, urlPath, clientDir, true)) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
// Server function RPC handling (/__catmint/fn/<basePath>/<hash>)
|
|
259
|
+
const SERVER_FN_PREFIX = "/__catmint/fn/";
|
|
260
|
+
if (urlPath.startsWith(SERVER_FN_PREFIX) && ssrEntry?.handleServerFn) {
|
|
261
|
+
try {
|
|
262
|
+
// Read request body
|
|
263
|
+
const chunks = [];
|
|
264
|
+
await new Promise((resolve, reject) => {
|
|
265
|
+
req.on("data", (chunk) => chunks.push(chunk));
|
|
266
|
+
req.on("end", () => resolve());
|
|
267
|
+
req.on("error", reject);
|
|
268
|
+
});
|
|
269
|
+
const buf = Buffer.concat(chunks);
|
|
270
|
+
let body;
|
|
271
|
+
try {
|
|
272
|
+
body =
|
|
273
|
+
buf.length > 0 ? JSON.parse(buf.toString("utf-8")) : undefined;
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
res.statusCode = 400;
|
|
277
|
+
res.setHeader("Content-Type", "application/json");
|
|
278
|
+
res.end(JSON.stringify({ error: "Invalid JSON body" }));
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const result = await ssrEntry.handleServerFn(urlPath, body);
|
|
282
|
+
if (result) {
|
|
283
|
+
res.statusCode = 200;
|
|
284
|
+
res.setHeader("Content-Type", "application/json");
|
|
285
|
+
res.end(JSON.stringify(result.result));
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
// No matching server function
|
|
289
|
+
res.statusCode = 404;
|
|
290
|
+
res.setHeader("Content-Type", "application/json");
|
|
291
|
+
res.end(JSON.stringify({ error: "Server function not found" }));
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
catch (err) {
|
|
295
|
+
console.error(" Server function error:", err);
|
|
296
|
+
if (!res.headersSent) {
|
|
297
|
+
res.statusCode = 500;
|
|
298
|
+
res.setHeader("Content-Type", "application/json");
|
|
299
|
+
res.end(JSON.stringify({
|
|
300
|
+
error: err instanceof Error ? err.message : "Server function error",
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// API endpoint handling (any HTTP method)
|
|
307
|
+
if (ssrEntry) {
|
|
308
|
+
try {
|
|
309
|
+
const method = (req.method ?? "GET").toUpperCase();
|
|
310
|
+
const protocol = "http";
|
|
311
|
+
const hostHeader = req.headers.host ?? "localhost";
|
|
312
|
+
const fullUrl = `${protocol}://${hostHeader}${req.url ?? "/"}`;
|
|
313
|
+
const requestInit = {
|
|
314
|
+
method,
|
|
315
|
+
headers: Object.entries(req.headers).reduce((acc, [key, val]) => {
|
|
316
|
+
if (val)
|
|
317
|
+
acc[key] = Array.isArray(val) ? val.join(", ") : val;
|
|
318
|
+
return acc;
|
|
319
|
+
}, {}),
|
|
320
|
+
};
|
|
321
|
+
// Attach body for methods that have one
|
|
322
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
323
|
+
const chunks = [];
|
|
324
|
+
await new Promise((resolve, reject) => {
|
|
325
|
+
req.on("data", (chunk) => chunks.push(chunk));
|
|
326
|
+
req.on("end", () => resolve());
|
|
327
|
+
req.on("error", reject);
|
|
328
|
+
});
|
|
329
|
+
const buf = Buffer.concat(chunks);
|
|
330
|
+
requestInit.body = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
331
|
+
}
|
|
332
|
+
const webRequest = new Request(fullUrl, requestInit);
|
|
333
|
+
const result = await ssrEntry.handleEndpoint(urlPath, method, webRequest);
|
|
334
|
+
if (result) {
|
|
335
|
+
res.statusCode = result.response.status;
|
|
336
|
+
// Copy response headers
|
|
337
|
+
result.response.headers.forEach((value, key) => {
|
|
338
|
+
res.setHeader(key, value);
|
|
339
|
+
});
|
|
340
|
+
// Stream the response body
|
|
341
|
+
if (result.response.body) {
|
|
342
|
+
await pipeWebStreamToResponse(result.response.body, res);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
res.end();
|
|
346
|
+
}
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
// Endpoint exists but method not supported → 405 or auto-preflight
|
|
350
|
+
if (ssrEntry.hasEndpoint(urlPath)) {
|
|
351
|
+
const ep = manifest.endpoints.find((e) => e.path === urlPath);
|
|
352
|
+
const allowedMethods = ep?.methods ?? ["GET"];
|
|
353
|
+
// CORS auto-preflight: when OPTIONS is requested but no
|
|
354
|
+
// OPTIONS handler is exported, generate a sensible preflight
|
|
355
|
+
// response (PRD §26.3). Safe by default — no Allow-Origin.
|
|
356
|
+
if (shouldAutoPreflight(method, allowedMethods)) {
|
|
357
|
+
const headers = buildPreflightHeaders(allowedMethods);
|
|
358
|
+
res.statusCode = 204;
|
|
359
|
+
res.setHeader("Allow", headers.allow);
|
|
360
|
+
res.setHeader("Access-Control-Allow-Methods", headers.accessControlAllowMethods);
|
|
361
|
+
res.setHeader("Access-Control-Allow-Headers", headers.accessControlAllowHeaders);
|
|
362
|
+
res.setHeader("Access-Control-Max-Age", headers.accessControlMaxAge);
|
|
363
|
+
res.end();
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
res.statusCode = 405;
|
|
367
|
+
res.setHeader("Content-Type", "text/plain");
|
|
368
|
+
res.setHeader("Allow", allowedMethods.join(", "));
|
|
369
|
+
res.end(`Method ${method} not allowed`);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
catch (err) {
|
|
374
|
+
console.error(" Endpoint error:", err);
|
|
375
|
+
if (!res.headersSent) {
|
|
376
|
+
await sendStatusPage(res, 500, urlPath);
|
|
377
|
+
}
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// RSC → SSR: render the page using the two-phase pipeline
|
|
382
|
+
// 1. RSC entry renders the page to a flight stream
|
|
383
|
+
// 2. SSR entry converts flight stream to HTML with embedded RSC payload
|
|
384
|
+
// (the RSC payload is embedded as <script> tags for client hydration)
|
|
385
|
+
// 3. Client JS bootstrapping is handled by the RSC assets manifest
|
|
386
|
+
// (bootstrapScriptContent is injected during the build)
|
|
387
|
+
if (hasRscPipeline && req.method === "GET") {
|
|
388
|
+
try {
|
|
389
|
+
const result = await rscEntry.render(urlPath);
|
|
390
|
+
if (result) {
|
|
391
|
+
const htmlStream = await ssrEntry.renderToHtml(result.stream, result.headConfig);
|
|
392
|
+
res.statusCode = 200;
|
|
393
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
394
|
+
await pipeWebStreamToResponse(htmlStream, res);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (err) {
|
|
399
|
+
console.error(" RSC render error:", err);
|
|
400
|
+
if (!res.headersSent) {
|
|
401
|
+
await sendStatusPage(res, 500, urlPath);
|
|
402
|
+
}
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
// Static assets from dist/static/ (copies of app/public/).
|
|
407
|
+
// Served after route checks per PRD §12: routes take precedence
|
|
408
|
+
// over static files.
|
|
409
|
+
if (tryServeStatic(req, res, urlPath, staticDir, true)) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
// 404
|
|
413
|
+
await sendStatusPage(res, 404, urlPath);
|
|
414
|
+
});
|
|
415
|
+
// 6. Start listening
|
|
416
|
+
server.listen(port, host, () => {
|
|
417
|
+
console.log();
|
|
418
|
+
console.log(" catmint production server");
|
|
419
|
+
console.log();
|
|
420
|
+
console.log(` Build ID: ${manifest.buildId}`);
|
|
421
|
+
console.log(` Routes: ${manifest.routes.length} pages, ${manifest.endpoints.length} endpoints`);
|
|
422
|
+
if (hasRscPipeline) {
|
|
423
|
+
console.log(` Mode: RSC`);
|
|
424
|
+
}
|
|
425
|
+
console.log();
|
|
426
|
+
console.log(` Local: http://${host === "0.0.0.0" ? "localhost" : host}:${port}`);
|
|
427
|
+
const networkAddr = getNetworkAddress();
|
|
428
|
+
if (networkAddr) {
|
|
429
|
+
console.log(` Network: http://${networkAddr}:${port}`);
|
|
430
|
+
}
|
|
431
|
+
console.log();
|
|
432
|
+
});
|
|
433
|
+
// Graceful shutdown
|
|
434
|
+
const shutdown = () => {
|
|
435
|
+
console.log("\n Shutting down...");
|
|
436
|
+
server.close(() => {
|
|
437
|
+
process.exit(0);
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
process.on("SIGINT", shutdown);
|
|
441
|
+
process.on("SIGTERM", shutdown);
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,2BAA2B;AAC3B,wFAAwF;AACxF,kGAAkG;AAClG,wEAAwE;AACxE,+DAA+D;AAC/D,wFAAw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
/**
|
|
2
|
+
* Build the auto-preflight response headers for an endpoint that doesn't
|
|
3
|
+
* export an explicit OPTIONS handler (PRD §26.3).
|
|
4
|
+
*
|
|
5
|
+
* @param exportedMethods - The HTTP methods exported by the endpoint (e.g., ["GET", "POST"])
|
|
6
|
+
* @returns Headers object with Allow, Access-Control-Allow-Methods, etc.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildPreflightHeaders(exportedMethods: string[]): {
|
|
9
|
+
allow: string;
|
|
10
|
+
accessControlAllowMethods: string;
|
|
11
|
+
accessControlAllowHeaders: string;
|
|
12
|
+
accessControlMaxAge: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Check if an OPTIONS request should trigger auto-preflight.
|
|
16
|
+
*
|
|
17
|
+
* @param method - The HTTP method from the request
|
|
18
|
+
* @param exportedMethods - The methods exported by the endpoint
|
|
19
|
+
* @returns true if auto-preflight should be generated
|
|
20
|
+
*/
|
|
21
|
+
export declare function shouldAutoPreflight(method: string, exportedMethods: string[]): boolean;
|
|
22
|
+
//# sourceMappingURL=cors-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors-utils.d.ts","sourceRoot":"","sources":["../src/cors-utils.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAaA;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAET"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @catmint/cli/cors-utils — CORS auto-preflight response builder
|
|
2
|
+
/**
|
|
3
|
+
* Build the auto-preflight response headers for an endpoint that doesn't
|
|
4
|
+
* export an explicit OPTIONS handler (PRD §26.3).
|
|
5
|
+
*
|
|
6
|
+
* @param exportedMethods - The HTTP methods exported by the endpoint (e.g., ["GET", "POST"])
|
|
7
|
+
* @returns Headers object with Allow, Access-Control-Allow-Methods, etc.
|
|
8
|
+
*/
|
|
9
|
+
export function buildPreflightHeaders(exportedMethods) {
|
|
10
|
+
const filtered = exportedMethods
|
|
11
|
+
.filter((m) => m !== "default" && m !== "ANY")
|
|
12
|
+
.concat("OPTIONS");
|
|
13
|
+
const unique = [...new Set(filtered)];
|
|
14
|
+
const allowValue = unique.join(", ");
|
|
15
|
+
return {
|
|
16
|
+
allow: allowValue,
|
|
17
|
+
accessControlAllowMethods: allowValue,
|
|
18
|
+
accessControlAllowHeaders: "Content-Type, Authorization",
|
|
19
|
+
accessControlMaxAge: "86400",
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Check if an OPTIONS request should trigger auto-preflight.
|
|
24
|
+
*
|
|
25
|
+
* @param method - The HTTP method from the request
|
|
26
|
+
* @param exportedMethods - The methods exported by the endpoint
|
|
27
|
+
* @returns true if auto-preflight should be generated
|
|
28
|
+
*/
|
|
29
|
+
export function shouldAutoPreflight(method, exportedMethods) {
|
|
30
|
+
return method === "OPTIONS" && !exportedMethods.includes("OPTIONS");
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=cors-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors-utils.js","sourceRoot":"","sources":["../src/cors-utils.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,eAAyB;IAM7D,MAAM,QAAQ,GAAG,eAAe;SAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,KAAK,CAAC;SAC7C,MAAM,CAAC,SAAS,CAAC,CAAC;IACrB,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO;QACL,KAAK,EAAE,UAAU;QACjB,yBAAyB,EAAE,UAAU;QACrC,yBAAyB,EAAE,6BAA6B;QACxD,mBAAmB,EAAE,OAAO;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAc,EACd,eAAyB;IAEzB,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACtE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Main CLI entry point.
|
|
4
|
+
*
|
|
5
|
+
* Commands:
|
|
6
|
+
* - `catmint dev` — Start development server with HMR
|
|
7
|
+
* - `catmint build` — Production build
|
|
8
|
+
* - `catmint start` — Start production server
|
|
9
|
+
* - `catmint generate` — Regenerate route types and manifests
|
|
10
|
+
*/
|
|
11
|
+
declare function main(): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA;;;;;;;;GAQG;AACH,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BnC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// @catmint/cli — Dev/build/start CLI for Catmint framework
|
|
4
|
+
/**
|
|
5
|
+
* Main CLI entry point.
|
|
6
|
+
*
|
|
7
|
+
* Commands:
|
|
8
|
+
* - `catmint dev` — Start development server with HMR
|
|
9
|
+
* - `catmint build` — Production build
|
|
10
|
+
* - `catmint start` — Start production server
|
|
11
|
+
* - `catmint generate` — Regenerate route types and manifests
|
|
12
|
+
*/
|
|
13
|
+
async function main() {
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
const command = args[0];
|
|
16
|
+
switch (command) {
|
|
17
|
+
case "dev": {
|
|
18
|
+
const { dev } = await import("./commands/dev.js");
|
|
19
|
+
await dev(args.slice(1));
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case "build": {
|
|
23
|
+
const { build } = await import("./commands/build.js");
|
|
24
|
+
await build(args.slice(1));
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case "start": {
|
|
28
|
+
const { start } = await import("./commands/start.js");
|
|
29
|
+
await start(args.slice(1));
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case "generate": {
|
|
33
|
+
const { generate } = await import("./commands/generate.js");
|
|
34
|
+
await generate(args.slice(1));
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
default:
|
|
38
|
+
console.error(`Unknown command: ${command}`);
|
|
39
|
+
console.error("Usage: catmint <dev|build|start|generate>");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
main().catch((err) => {
|
|
44
|
+
console.error(err);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,2DAA2D;AAE3D;;;;;;;;GAQG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,KAAK,CAAC,CAAC,C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boundary component files (.server.tsx, .client.tsx).
|
|
3
|
+
* Returns an array of { name, source, boundary, filePath } entries.
|
|
4
|
+
*/
|
|
5
|
+
export declare function scanComponentFiles(dir: string, rootDir: string): Array<{
|
|
6
|
+
name: string;
|
|
7
|
+
source: string;
|
|
8
|
+
boundary: "client" | "server";
|
|
9
|
+
filePath: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Scan the public directory for static assets.
|
|
13
|
+
* Returns an array of { path, source, file } entries.
|
|
14
|
+
*/
|
|
15
|
+
export declare function scanStaticAssets(publicDir: string, rootDir: string, prefix?: string): Array<{
|
|
16
|
+
path: string;
|
|
17
|
+
source: string;
|
|
18
|
+
file: string;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=scan-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-utils.d.ts","sourceRoot":"","sources":["../src/scan-utils.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,KAAK,CAAC;IACP,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CA2BD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAY,GACnB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBvD"}
|