@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,529 @@
|
|
|
1
|
+
// catmint build — Production build
|
|
2
|
+
import { resolve, join, relative } from "node:path";
|
|
3
|
+
import { existsSync, readdirSync, statSync, readFileSync } from "node:fs";
|
|
4
|
+
import { mkdir, cp, writeFile } from "node:fs/promises";
|
|
5
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
6
|
+
import { createRequire } from "node:module";
|
|
7
|
+
import { createBuilder } from "vite";
|
|
8
|
+
import { loadConfig } from "catmint/config";
|
|
9
|
+
import { scanRoutes } from "catmint/routing";
|
|
10
|
+
import { loadEnv } from "catmint/env";
|
|
11
|
+
import catmintVite, { buildEntriesPlugin, scanStatusPages, } from "@catmint/vite";
|
|
12
|
+
import { scanComponentFiles, scanStaticAssets } from "../scan-utils.js";
|
|
13
|
+
function parseFlags(args) {
|
|
14
|
+
const flags = {};
|
|
15
|
+
for (let i = 0; i < args.length; i++) {
|
|
16
|
+
const arg = args[i];
|
|
17
|
+
if (arg.startsWith("--")) {
|
|
18
|
+
const [key, val] = arg.slice(2).split("=");
|
|
19
|
+
flags[key] = val ?? args[++i] ?? true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return flags;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate a content-based build ID from the output directory.
|
|
26
|
+
*/
|
|
27
|
+
function generateBuildId(dir) {
|
|
28
|
+
const hash = createHash("sha256");
|
|
29
|
+
function walkDir(d) {
|
|
30
|
+
if (!existsSync(d))
|
|
31
|
+
return;
|
|
32
|
+
const entries = readdirSync(d);
|
|
33
|
+
for (const entry of entries.sort()) {
|
|
34
|
+
const fullPath = join(d, entry);
|
|
35
|
+
const s = statSync(fullPath);
|
|
36
|
+
if (s.isDirectory()) {
|
|
37
|
+
walkDir(fullPath);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
hash.update(entry);
|
|
41
|
+
hash.update(readFileSync(fullPath));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
walkDir(dir);
|
|
46
|
+
return hash.digest("hex").slice(0, 16);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Copy a directory recursively.
|
|
50
|
+
*/
|
|
51
|
+
async function copyDir(src, dest) {
|
|
52
|
+
if (!existsSync(src))
|
|
53
|
+
return;
|
|
54
|
+
await mkdir(dest, { recursive: true });
|
|
55
|
+
await cp(src, dest, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Format bytes into human-readable size.
|
|
59
|
+
*/
|
|
60
|
+
function formatSize(bytes) {
|
|
61
|
+
if (bytes < 1024)
|
|
62
|
+
return `${bytes} B`;
|
|
63
|
+
if (bytes < 1024 * 1024)
|
|
64
|
+
return `${(bytes / 1024).toFixed(1)} kB`;
|
|
65
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Calculate the total size of a directory.
|
|
69
|
+
*/
|
|
70
|
+
function dirSize(dir) {
|
|
71
|
+
if (!existsSync(dir))
|
|
72
|
+
return 0;
|
|
73
|
+
let total = 0;
|
|
74
|
+
const entries = readdirSync(dir);
|
|
75
|
+
for (const entry of entries) {
|
|
76
|
+
const fullPath = join(dir, entry);
|
|
77
|
+
const s = statSync(fullPath);
|
|
78
|
+
if (s.isDirectory()) {
|
|
79
|
+
total += dirSize(fullPath);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
total += s.size;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return total;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Recursively scan a directory for `.fn.ts` files.
|
|
89
|
+
*/
|
|
90
|
+
function scanServerFnFiles(dir) {
|
|
91
|
+
const results = [];
|
|
92
|
+
if (!existsSync(dir))
|
|
93
|
+
return results;
|
|
94
|
+
const entries = readdirSync(dir);
|
|
95
|
+
for (const entry of entries) {
|
|
96
|
+
const fullPath = join(dir, entry);
|
|
97
|
+
const s = statSync(fullPath);
|
|
98
|
+
if (s.isDirectory()) {
|
|
99
|
+
results.push(...scanServerFnFiles(fullPath));
|
|
100
|
+
}
|
|
101
|
+
else if (/\.fn\.(ts|tsx)$/.test(entry)) {
|
|
102
|
+
results.push(fullPath);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return results;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Extract exported names from a `.fn.ts` file using regex.
|
|
109
|
+
* Handles: export const, export function, export default, export { ... }
|
|
110
|
+
*/
|
|
111
|
+
function extractExports(filePath) {
|
|
112
|
+
const code = readFileSync(filePath, "utf-8");
|
|
113
|
+
const exports = [];
|
|
114
|
+
// export const foo = ...
|
|
115
|
+
for (const match of code.matchAll(/export\s+const\s+(\w+)\s*=/g)) {
|
|
116
|
+
exports.push(match[1]);
|
|
117
|
+
}
|
|
118
|
+
// export let foo = ...
|
|
119
|
+
for (const match of code.matchAll(/export\s+let\s+(\w+)\s*=/g)) {
|
|
120
|
+
exports.push(match[1]);
|
|
121
|
+
}
|
|
122
|
+
// export function foo(...)
|
|
123
|
+
for (const match of code.matchAll(/export\s+function\s+(\w+)\s*\(/g)) {
|
|
124
|
+
exports.push(match[1]);
|
|
125
|
+
}
|
|
126
|
+
// export async function foo(...)
|
|
127
|
+
for (const match of code.matchAll(/export\s+async\s+function\s+(\w+)\s*\(/g)) {
|
|
128
|
+
exports.push(match[1]);
|
|
129
|
+
}
|
|
130
|
+
// export default
|
|
131
|
+
if (/export\s+default\s/.test(code)) {
|
|
132
|
+
exports.push("default");
|
|
133
|
+
}
|
|
134
|
+
return [...new Set(exports)];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Compute a deterministic hash (same algorithm as @catmint/vite/utils).
|
|
138
|
+
*/
|
|
139
|
+
function deterministicHash(input) {
|
|
140
|
+
return createHash("sha256").update(input).digest("hex").slice(0, 8);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Normalize path separators to forward slashes.
|
|
144
|
+
*/
|
|
145
|
+
function toPosixPath(p) {
|
|
146
|
+
return p.split(/[\\/]/).join("/");
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Extract `cachedRoute()` options from a page source file using SWC AST analysis.
|
|
150
|
+
*
|
|
151
|
+
* Parses the file with SWC and walks the AST to find the default export.
|
|
152
|
+
* If it's a `cachedRoute(handler, options)` call, extracts the options object
|
|
153
|
+
* (revalidate, tag, staleWhileRevalidate) from the second argument.
|
|
154
|
+
*
|
|
155
|
+
* This approach is robust against code examples in string literals, JSX content,
|
|
156
|
+
* and unusual formatting — unlike regex-based extraction.
|
|
157
|
+
*
|
|
158
|
+
* Returns null if the file doesn't use cachedRoute as its default export.
|
|
159
|
+
*/
|
|
160
|
+
function extractCacheOptions(filePath) {
|
|
161
|
+
if (!existsSync(filePath))
|
|
162
|
+
return null;
|
|
163
|
+
// Only analyze TypeScript/JavaScript page files, not MDX documentation
|
|
164
|
+
if (!/\.(tsx?|jsx?)$/.test(filePath))
|
|
165
|
+
return null;
|
|
166
|
+
const code = readFileSync(filePath, "utf-8");
|
|
167
|
+
// Quick bail-out: if the file doesn't mention cachedRoute at all, skip parsing
|
|
168
|
+
if (!code.includes("cachedRoute"))
|
|
169
|
+
return null;
|
|
170
|
+
let ast;
|
|
171
|
+
try {
|
|
172
|
+
// Lazy-import SWC (already a dependency via catmint/config)
|
|
173
|
+
// Use createRequire for ESM compatibility since this module uses ESM imports
|
|
174
|
+
const esmRequire = createRequire(import.meta.url);
|
|
175
|
+
const { parseSync } = esmRequire("@swc/core");
|
|
176
|
+
ast = parseSync(code, {
|
|
177
|
+
syntax: "typescript",
|
|
178
|
+
tsx: true,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
// If SWC parsing fails (e.g., syntax error), bail out gracefully
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
// Find the default export statement
|
|
186
|
+
for (const node of ast.body) {
|
|
187
|
+
// Handle: export default cachedRoute(...)
|
|
188
|
+
if (node.type === "ExportDefaultExpression" &&
|
|
189
|
+
node.expression?.type === "CallExpression" &&
|
|
190
|
+
node.expression.callee?.type === "Identifier" &&
|
|
191
|
+
node.expression.callee.value === "cachedRoute") {
|
|
192
|
+
return extractOptionsFromCallArgs(node.expression.arguments);
|
|
193
|
+
}
|
|
194
|
+
// Handle: export default cachedRoute(...) where the expression is wrapped
|
|
195
|
+
// e.g., export default expression (already covers most cases above)
|
|
196
|
+
if (node.type === "ExportDefaultDeclaration" &&
|
|
197
|
+
node.decl?.type === "CallExpression" &&
|
|
198
|
+
node.decl.callee?.type === "Identifier" &&
|
|
199
|
+
node.decl.callee.value === "cachedRoute") {
|
|
200
|
+
return extractOptionsFromCallArgs(node.decl.arguments);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Extract cache options from the arguments array of a cachedRoute() call AST node.
|
|
207
|
+
*
|
|
208
|
+
* cachedRoute(handler, { tag: [...], revalidate: N, staleWhileRevalidate: bool })
|
|
209
|
+
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
210
|
+
* This is args[1] — an ObjectExpression
|
|
211
|
+
*/
|
|
212
|
+
function extractOptionsFromCallArgs(args) {
|
|
213
|
+
if (!args || args.length < 2) {
|
|
214
|
+
// cachedRoute(handler) without options — mark as cached with empty options
|
|
215
|
+
return args?.length === 1 ? {} : null;
|
|
216
|
+
}
|
|
217
|
+
const optionsArg = args[1]?.expression;
|
|
218
|
+
if (!optionsArg || optionsArg.type !== "ObjectExpression") {
|
|
219
|
+
return {};
|
|
220
|
+
}
|
|
221
|
+
const result = {};
|
|
222
|
+
for (const prop of optionsArg.properties) {
|
|
223
|
+
if (prop.type !== "KeyValueProperty")
|
|
224
|
+
continue;
|
|
225
|
+
const key = prop.key?.type === "Identifier"
|
|
226
|
+
? prop.key.value
|
|
227
|
+
: prop.key?.type === "StringLiteral"
|
|
228
|
+
? prop.key.value
|
|
229
|
+
: null;
|
|
230
|
+
if (key === "revalidate" && prop.value?.type === "NumericLiteral") {
|
|
231
|
+
result.revalidate = prop.value.value;
|
|
232
|
+
}
|
|
233
|
+
if (key === "tag" && prop.value?.type === "ArrayExpression") {
|
|
234
|
+
const tags = [];
|
|
235
|
+
for (const elem of prop.value.elements) {
|
|
236
|
+
const expr = elem?.expression ?? elem;
|
|
237
|
+
if (expr?.type === "StringLiteral") {
|
|
238
|
+
tags.push(expr.value);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (tags.length > 0) {
|
|
242
|
+
result.tags = tags;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (key === "staleWhileRevalidate" &&
|
|
246
|
+
prop.value?.type === "BooleanLiteral") {
|
|
247
|
+
result.staleWhileRevalidate = prop.value.value;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Run the Catmint production build.
|
|
254
|
+
*
|
|
255
|
+
* Produces:
|
|
256
|
+
* - Server bundle
|
|
257
|
+
* - Client bundle
|
|
258
|
+
* - Static assets
|
|
259
|
+
* - app_manifest.json
|
|
260
|
+
*/
|
|
261
|
+
export async function build(args) {
|
|
262
|
+
const startTime = performance.now();
|
|
263
|
+
const flags = parseFlags(args);
|
|
264
|
+
const rootDir = process.cwd();
|
|
265
|
+
// Load config
|
|
266
|
+
const config = await loadConfig(rootDir);
|
|
267
|
+
// Load env files (production mode: .env, .env.production, .env.production.local, NOT .env.local)
|
|
268
|
+
loadEnv(rootDir, "production");
|
|
269
|
+
// Override config from flags
|
|
270
|
+
const outDir = typeof flags.outDir === "string"
|
|
271
|
+
? resolve(rootDir, flags.outDir)
|
|
272
|
+
: resolve(rootDir, config.build.outDir);
|
|
273
|
+
const sourcemap = flags.sourcemap === true || flags.sourcemap === "true"
|
|
274
|
+
? true
|
|
275
|
+
: config.build.sourcemap;
|
|
276
|
+
const mode = typeof flags.mode === "string" ? flags.mode : "production";
|
|
277
|
+
const clientOutDir = join(outDir, "client");
|
|
278
|
+
// RSC build outputs to dist/rsc (RSC entry) and dist/ssr (SSR entry)
|
|
279
|
+
// For adapter compatibility, serverOutDir points to dist/ssr since that's
|
|
280
|
+
// where the SSR entry (which adapters need to serve pages) lives.
|
|
281
|
+
const serverOutDir = join(outDir, "ssr");
|
|
282
|
+
const rscOutDir = join(outDir, "rsc");
|
|
283
|
+
const staticOutDir = join(outDir, "static");
|
|
284
|
+
console.log();
|
|
285
|
+
console.log(" catmint build");
|
|
286
|
+
console.log();
|
|
287
|
+
// Scan routes
|
|
288
|
+
const appDir = resolve(rootDir, "app");
|
|
289
|
+
let routes = [];
|
|
290
|
+
try {
|
|
291
|
+
routes = await scanRoutes(appDir);
|
|
292
|
+
}
|
|
293
|
+
catch (err) {
|
|
294
|
+
console.error(" Failed to scan routes:", err);
|
|
295
|
+
process.exit(1);
|
|
296
|
+
}
|
|
297
|
+
// Merge user's vite.plugins with catmintVite() instead of overwriting
|
|
298
|
+
const { plugins: userPlugins, ...viteRest } = config.vite;
|
|
299
|
+
const pageRoutes = routes.filter((r) => r.type === "page");
|
|
300
|
+
const endpointRoutes = routes
|
|
301
|
+
.filter((r) => r.type === "endpoint")
|
|
302
|
+
.map((r) => ({
|
|
303
|
+
pattern: r.pattern,
|
|
304
|
+
filePath: r.filePath,
|
|
305
|
+
methods: r.methods ?? [],
|
|
306
|
+
}));
|
|
307
|
+
// Scan for server function files (.fn.ts)
|
|
308
|
+
const serverFnFilePaths = scanServerFnFiles(appDir);
|
|
309
|
+
const serverFnFiles = serverFnFilePaths.map((fp) => ({
|
|
310
|
+
filePath: fp,
|
|
311
|
+
exports: extractExports(fp),
|
|
312
|
+
}));
|
|
313
|
+
// Scan for status page files (404.tsx, 500.tsx, etc.)
|
|
314
|
+
const statusPages = scanStatusPages(appDir);
|
|
315
|
+
if (statusPages.length > 0) {
|
|
316
|
+
console.log(` Status pages: ${statusPages.map((sp) => `${sp.statusCode} (${sp.urlPrefix})`).join(", ")}`);
|
|
317
|
+
}
|
|
318
|
+
const buildEntries = buildEntriesPlugin({
|
|
319
|
+
routes: pageRoutes,
|
|
320
|
+
endpoints: endpointRoutes,
|
|
321
|
+
appDir,
|
|
322
|
+
serverFnFiles,
|
|
323
|
+
statusPages,
|
|
324
|
+
softNavigation: config.navigation.soft,
|
|
325
|
+
i18n: config.i18n,
|
|
326
|
+
});
|
|
327
|
+
// RSC build: uses createBuilder() + builder.buildApp() which triggers the
|
|
328
|
+
// RSC plugin's 5-step build pipeline:
|
|
329
|
+
// 1. Scan RSC (discover "use client" boundaries)
|
|
330
|
+
// 2. Scan SSR (discover "use server" boundaries)
|
|
331
|
+
// 3. Build RSC (real build with client reference proxies)
|
|
332
|
+
// 4. Build Client (client bundles + client reference chunks)
|
|
333
|
+
// 5. Build SSR (server-side rendering bundles)
|
|
334
|
+
//
|
|
335
|
+
// The RSC plugin handles all the complexity of reference tracking,
|
|
336
|
+
// client component grouping, and assets manifest generation.
|
|
337
|
+
const mergedPlugins = [
|
|
338
|
+
...(Array.isArray(userPlugins) ? userPlugins : []),
|
|
339
|
+
catmintVite({
|
|
340
|
+
mdx: {
|
|
341
|
+
remarkPlugins: config.mdx.remarkPlugins,
|
|
342
|
+
rehypePlugins: config.mdx.rehypePlugins,
|
|
343
|
+
},
|
|
344
|
+
softNavigation: config.navigation.soft,
|
|
345
|
+
i18n: config.i18n,
|
|
346
|
+
}), // RSC enabled by default
|
|
347
|
+
buildEntries,
|
|
348
|
+
];
|
|
349
|
+
console.log(" Building with RSC pipeline...");
|
|
350
|
+
console.log(" (5-step: scan RSC → scan SSR → build RSC → build client → build SSR)");
|
|
351
|
+
console.log();
|
|
352
|
+
const builder = await createBuilder({
|
|
353
|
+
root: rootDir,
|
|
354
|
+
mode,
|
|
355
|
+
build: {
|
|
356
|
+
sourcemap,
|
|
357
|
+
emptyOutDir: true,
|
|
358
|
+
},
|
|
359
|
+
// Configure per-environment entry points and output directories
|
|
360
|
+
environments: {
|
|
361
|
+
rsc: {
|
|
362
|
+
build: {
|
|
363
|
+
outDir: join(outDir, "rsc"),
|
|
364
|
+
rollupOptions: {
|
|
365
|
+
input: { index: "virtual:catmint/rsc-entry" },
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
ssr: {
|
|
370
|
+
build: {
|
|
371
|
+
outDir: join(outDir, "ssr"),
|
|
372
|
+
rollupOptions: {
|
|
373
|
+
input: { index: "virtual:catmint/ssr-rsc-entry" },
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
client: {
|
|
378
|
+
build: {
|
|
379
|
+
outDir: clientOutDir,
|
|
380
|
+
rollupOptions: {
|
|
381
|
+
input: { index: "virtual:catmint/client-rsc-entry" },
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
plugins: mergedPlugins,
|
|
387
|
+
...viteRest,
|
|
388
|
+
});
|
|
389
|
+
// Run the 5-step build pipeline
|
|
390
|
+
await builder.buildApp();
|
|
391
|
+
// 3. Copy public assets to dist/static/
|
|
392
|
+
console.log(" Copying static assets...");
|
|
393
|
+
const publicDir = resolve(appDir, "public");
|
|
394
|
+
await copyDir(publicDir, staticOutDir);
|
|
395
|
+
// 4. Generate app_manifest.json
|
|
396
|
+
console.log(" Generating app manifest...");
|
|
397
|
+
const buildId = generateBuildId(outDir);
|
|
398
|
+
// Generate a bypass token for on-demand ISR (used by Vercel Prerender Functions)
|
|
399
|
+
const bypassToken = randomUUID();
|
|
400
|
+
// Extract cache options from page source files
|
|
401
|
+
const cacheRules = [];
|
|
402
|
+
const pageRoutesWithCache = routes
|
|
403
|
+
.filter((r) => r.type === "page")
|
|
404
|
+
.map((route) => {
|
|
405
|
+
const cacheOptions = extractCacheOptions(route.filePath);
|
|
406
|
+
const routeEntry = {
|
|
407
|
+
path: route.pattern,
|
|
408
|
+
type: "page",
|
|
409
|
+
source: relative(rootDir, route.filePath),
|
|
410
|
+
};
|
|
411
|
+
if (cacheOptions) {
|
|
412
|
+
routeEntry.cache = {
|
|
413
|
+
revalidate: cacheOptions.revalidate,
|
|
414
|
+
tags: cacheOptions.tags,
|
|
415
|
+
staleWhileRevalidate: cacheOptions.staleWhileRevalidate,
|
|
416
|
+
};
|
|
417
|
+
cacheRules.push({
|
|
418
|
+
path: route.pattern,
|
|
419
|
+
revalidate: cacheOptions.revalidate,
|
|
420
|
+
tags: cacheOptions.tags,
|
|
421
|
+
staleWhileRevalidate: cacheOptions.staleWhileRevalidate,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return routeEntry;
|
|
425
|
+
});
|
|
426
|
+
const manifest = {
|
|
427
|
+
version: 1,
|
|
428
|
+
framework: "catmint",
|
|
429
|
+
frameworkVersion: "0.1.0",
|
|
430
|
+
mode: config.mode,
|
|
431
|
+
buildId,
|
|
432
|
+
buildTimestamp: new Date().toISOString(),
|
|
433
|
+
config: {
|
|
434
|
+
mode: config.mode,
|
|
435
|
+
server: { port: config.server.port, host: config.server.host },
|
|
436
|
+
build: { target: config.build.target, sourcemap: config.build.sourcemap },
|
|
437
|
+
},
|
|
438
|
+
routes: pageRoutesWithCache,
|
|
439
|
+
endpoints: routes
|
|
440
|
+
.filter((r) => r.type === "endpoint")
|
|
441
|
+
.map((route) => ({
|
|
442
|
+
path: route.pattern,
|
|
443
|
+
type: "endpoint",
|
|
444
|
+
source: relative(rootDir, route.filePath),
|
|
445
|
+
methods: route.methods ?? [],
|
|
446
|
+
})),
|
|
447
|
+
serverFunctions: serverFnFiles.flatMap((file) => {
|
|
448
|
+
const relPath = toPosixPath(relative(rootDir, file.filePath));
|
|
449
|
+
return file.exports.map((name) => {
|
|
450
|
+
const hash = deterministicHash(`${relPath}:${name}`);
|
|
451
|
+
const basePath = relPath.replace(/\.(fn\.ts|fn\.tsx?)$/, "");
|
|
452
|
+
return {
|
|
453
|
+
name,
|
|
454
|
+
source: relPath,
|
|
455
|
+
hash,
|
|
456
|
+
path: `/__catmint/fn/${basePath}/${hash}`,
|
|
457
|
+
method: "POST",
|
|
458
|
+
};
|
|
459
|
+
});
|
|
460
|
+
}),
|
|
461
|
+
components: scanComponentFiles(appDir, rootDir).map((c) => ({
|
|
462
|
+
name: c.name,
|
|
463
|
+
source: c.source,
|
|
464
|
+
boundary: c.boundary,
|
|
465
|
+
chunk: deterministicHash(c.source),
|
|
466
|
+
})),
|
|
467
|
+
staticAssets: scanStaticAssets(resolve(rootDir, "public"), rootDir),
|
|
468
|
+
statusPages: statusPages.map((sp) => ({
|
|
469
|
+
statusCode: sp.statusCode,
|
|
470
|
+
urlPrefix: sp.urlPrefix,
|
|
471
|
+
})),
|
|
472
|
+
cache: {
|
|
473
|
+
rules: cacheRules,
|
|
474
|
+
invalidation: {
|
|
475
|
+
endpoint: "/__catmint/invalidate",
|
|
476
|
+
supportedStrategies: ["tag", "path"],
|
|
477
|
+
bypassToken,
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
output: {
|
|
481
|
+
server: relative(rootDir, serverOutDir),
|
|
482
|
+
client: relative(rootDir, clientOutDir),
|
|
483
|
+
static: relative(rootDir, staticOutDir),
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
await mkdir(outDir, { recursive: true });
|
|
487
|
+
await writeFile(join(outDir, "app_manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
|
|
488
|
+
// 5. Run adapter if configured
|
|
489
|
+
if (config.adapter) {
|
|
490
|
+
console.log(` Running adapter: ${config.adapter.name}...`);
|
|
491
|
+
const adapterContext = {
|
|
492
|
+
manifest,
|
|
493
|
+
serverDir: serverOutDir,
|
|
494
|
+
clientDir: clientOutDir,
|
|
495
|
+
staticDir: staticOutDir,
|
|
496
|
+
async writeFile(path, content) {
|
|
497
|
+
const fullPath = resolve(outDir, path);
|
|
498
|
+
await mkdir(resolve(fullPath, ".."), { recursive: true });
|
|
499
|
+
await writeFile(fullPath, content);
|
|
500
|
+
},
|
|
501
|
+
async copyDir(src, dest) {
|
|
502
|
+
await copyDir(src, dest);
|
|
503
|
+
},
|
|
504
|
+
log: (message) => console.log(` [${config.adapter.name}] ${message}`),
|
|
505
|
+
};
|
|
506
|
+
await config.adapter.adapt(adapterContext);
|
|
507
|
+
}
|
|
508
|
+
// 6. Display build summary
|
|
509
|
+
const elapsed = ((performance.now() - startTime) / 1000).toFixed(2);
|
|
510
|
+
const clientSize = dirSize(clientOutDir);
|
|
511
|
+
const serverSize = dirSize(serverOutDir);
|
|
512
|
+
const rscSize = dirSize(rscOutDir);
|
|
513
|
+
const staticSize = dirSize(staticOutDir);
|
|
514
|
+
const pageCount = routes.filter((r) => r.type === "page").length;
|
|
515
|
+
const endpointCount = routes.filter((r) => r.type === "endpoint").length;
|
|
516
|
+
console.log();
|
|
517
|
+
console.log(" Build complete!");
|
|
518
|
+
console.log();
|
|
519
|
+
console.log(` Output: ${relative(rootDir, outDir)}/`);
|
|
520
|
+
console.log(` Client: ${formatSize(clientSize)}`);
|
|
521
|
+
console.log(` SSR: ${formatSize(serverSize)}`);
|
|
522
|
+
console.log(` RSC: ${formatSize(rscSize)}`);
|
|
523
|
+
console.log(` Static: ${formatSize(staticSize)}`);
|
|
524
|
+
console.log(` Routes: ${pageCount} pages, ${endpointCount} endpoints`);
|
|
525
|
+
console.log(` Build ID: ${buildId}`);
|
|
526
|
+
console.log(` Time: ${elapsed}s`);
|
|
527
|
+
console.log();
|
|
528
|
+
}
|
|
529
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAM5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAi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CAAC,GAAG,CAAC,iBAAiB,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,iBAAiB,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,iBAAiB,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,iBAAiB,SAAS,WAAW,aAAa,YAAY,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,iBAAiB,OAAO,GAAG,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Start the Catmint development server.
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Built on Vite for fast HMR
|
|
6
|
+
* - Watches `app/` directory for route changes
|
|
7
|
+
* - Regenerates route types automatically
|
|
8
|
+
* - Proxies server function calls to the dev server
|
|
9
|
+
*/
|
|
10
|
+
export declare function dev(args: string[]): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAuFA;;;;;;;;GAQG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsGvD"}
|