@squadbase/vantage 0.6.2-dev1.3e69e88 → 0.6.2-dev1.9d91dda
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/{build-JB4VOMUI.js → build-TVKFIVFQ.js} +7 -7
- package/dist/{build-JB4VOMUI.js.map → build-TVKFIVFQ.js.map} +1 -1
- package/dist/{check-ZJYK6RLG.js → check-3KHZXZMQ.js} +5 -5
- package/dist/{check-ZJYK6RLG.js.map → check-3KHZXZMQ.js.map} +1 -1
- package/dist/{chunk-KLEIVDUV.js → chunk-CEXAQQ5W.js} +150 -11
- package/dist/chunk-CEXAQQ5W.js.map +1 -0
- package/dist/{chunk-JGRMRXXZ.js → chunk-JKLLFVEU.js} +3 -3
- package/dist/{chunk-JGRMRXXZ.js.map → chunk-JKLLFVEU.js.map} +1 -1
- package/dist/{chunk-EP6JHXSR.js → chunk-LMUACBMA.js} +3 -3
- package/dist/{chunk-EP6JHXSR.js.map → chunk-LMUACBMA.js.map} +1 -1
- package/dist/{chunk-MP3QSOXL.js → chunk-NKFBFDRZ.js} +13 -4
- package/dist/chunk-NKFBFDRZ.js.map +1 -0
- package/dist/{chunk-BCE22JSM.js → chunk-P7W4LR3Z.js} +32 -13
- package/dist/chunk-P7W4LR3Z.js.map +1 -0
- package/dist/{chunk-T3FLAGI6.js → chunk-VA776YE5.js} +3 -3
- package/dist/{chunk-T3FLAGI6.js.map → chunk-VA776YE5.js.map} +1 -1
- package/dist/cli.js +6 -6
- package/dist/components/index.js +1 -1
- package/dist/{dev-FCEC3UKQ.js → dev-GDKATCC7.js} +7 -7
- package/dist/{dev-FCEC3UKQ.js.map → dev-GDKATCC7.js.map} +1 -1
- package/dist/{doctor-WHZXPERA.js → doctor-WQXPXP6K.js} +5 -5
- package/dist/{doctor-WHZXPERA.js.map → doctor-WQXPXP6K.js.map} +1 -1
- package/dist/{routes-GTFO5PUF.js → routes-MWBWWOJ2.js} +4 -4
- package/dist/{routes-GTFO5PUF.js.map → routes-MWBWWOJ2.js.map} +1 -1
- package/dist/table/index.js +2 -2
- package/dist/table/index.js.map +1 -1
- package/dist/{upgrade-AL4KZZR4.js → upgrade-HCANX4GQ.js} +4 -4
- package/dist/{upgrade-AL4KZZR4.js.map → upgrade-HCANX4GQ.js.map} +1 -1
- package/dist/vite/index.js +3 -3
- package/package.json +1 -1
- package/skills/vantage-design/SKILL.md +3 -1
- package/skills/vantage-design/references/format.md +1 -1
- package/skills/vantage-slide/SKILL.md +17 -0
- package/templates/agents/api.md +29 -0
- package/templates/agents/slide.md +13 -1
- package/theme.css +7 -1
- package/dist/chunk-BCE22JSM.js.map +0 -1
- package/dist/chunk-KLEIVDUV.js.map +0 -1
- package/dist/chunk-MP3QSOXL.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { runDiagnostics } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import { vantagePlugin } from './chunk-
|
|
4
|
-
import { generateArtifacts } from './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
import { runDiagnostics } from './chunk-P7W4LR3Z.js';
|
|
2
|
+
import './chunk-JKLLFVEU.js';
|
|
3
|
+
import { vantagePlugin } from './chunk-VA776YE5.js';
|
|
4
|
+
import { generateArtifacts } from './chunk-LMUACBMA.js';
|
|
5
|
+
import './chunk-CEXAQQ5W.js';
|
|
6
6
|
import { scanProject, timedAsync } from './chunk-ZVANIULZ.js';
|
|
7
7
|
import './chunk-46QI6GFC.js';
|
|
8
8
|
import './chunk-B7LLBNLV.js';
|
|
@@ -104,5 +104,5 @@ function writeDeployManifest(root, model) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export { build };
|
|
107
|
-
//# sourceMappingURL=build-
|
|
108
|
-
//# sourceMappingURL=build-
|
|
107
|
+
//# sourceMappingURL=build-TVKFIVFQ.js.map
|
|
108
|
+
//# sourceMappingURL=build-TVKFIVFQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
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A,EAAM,uBAAuB,CAAA,EAAG,IAAA,CAAK,SAAA,CAAU,QAAA,EAAU,IAAA,EAAM,CAAC,CAAA,GAAI,IAAI,CAAA;AACrG","file":"build-TVKFIVFQ.js","sourcesContent":["import fs from \"node:fs\"\nimport path from \"node:path\"\nimport { build as viteBuild, loadEnv } from \"vite\"\nimport { MANIFEST_SCHEMA_VERSION, VANTAGE_DIR } from \"../core/constants\"\nimport { runDiagnostics } from \"../core/diagnostics\"\nimport { generateArtifacts } from \"../core/generate\"\nimport { timedAsync } from \"../core/profile\"\nimport { scanProject } from \"../core/scan\"\nimport type { RouteModel } from \"../core/types\"\nimport { vantagePlugin } from \"../vite/index\"\nimport { applyApiBaseUrlFlag, log, printDiagnostics, type ParsedArgs } from \"./util\"\n\nconst SERVER_ENTRY = `// AUTO-GENERATED by @squadbase/vantage.\nimport path from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport { startNodeServer } from \"@squadbase/vantage/server/node\"\nimport { apiRoutes } from \"./server-routes.gen\"\n\nconst clientDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"../client\")\nstartNodeServer({ apiRoutes, clientDir })\n`\n\n/** `vantage build` — build client and (optionally) server into dist/. */\nexport async function build(root: string, args: ParsedArgs): Promise<number> {\n const model = scanProject(root)\n const errors = runDiagnostics(root, model).filter((d) => d.severity === \"error\")\n if (errors.length) {\n printDiagnostics(errors)\n log.error(\"Fix the errors above before building.\")\n return 1\n }\n\n const mode = \"production\"\n // `--api-base-url` feeds the client's PUBLIC_API_BASE_URL. Setting it on\n // process.env (before loadEnv/Vite read env) makes the flag win over any .env\n // value and keeps the single env-prefix mechanism — no Vite `define`.\n applyApiBaseUrlFlag(args)\n const env = { ...process.env, ...loadEnv(mode, root, \"\") }\n const quiet = Boolean(args.flags.json)\n\n // Write .vantage/ up front instead of letting the plugin do it at\n // configResolved: the server bundle reads server-routes.gen.ts, so once the\n // artifacts exist the two builds no longer depend on each other and can run\n // at the same time (they write to dist/client and dist/server respectively).\n generateArtifacts({ root, model })\n\n if (!quiet) log.step(model.hasServer ? \"Building client and server…\" : \"Building client…\")\n\n const clientBuild = timedAsync(\"build:client\", async () => {\n await viteBuild({\n configFile: false,\n root,\n mode,\n plugins: [vantagePlugin({ root, env, model, artifactsWritten: true })],\n logLevel: quiet ? \"silent\" : args.flags.verbose ? \"info\" : \"warn\",\n })\n // The HTML input lives in .vantage/, so Vite emits it to dist/client/.vantage/.\n // Hoist it to dist/client/index.html (asset URLs are already root-absolute).\n relocateClientHtml(root)\n })\n\n const serverBuild = model.hasServer\n ? timedAsync(\"build:server\", () => buildServer(root))\n : Promise.resolve()\n\n await Promise.all([clientBuild, serverBuild])\n\n writeDeployManifest(root, model)\n if (!quiet) log.ok(`Build complete → ${path.relative(process.cwd(), path.join(root, \"dist\")) || \"dist\"}/`)\n\n if (args.flags.json) {\n process.stdout.write(\n JSON.stringify({\n ok: true,\n mode: model.hasServer ? \"fullstack\" : \"spa\",\n output: \"dist\",\n pages: model.pages.length,\n apis: model.apis.length,\n }) + \"\\n\",\n )\n }\n return 0\n}\n\nfunction relocateClientHtml(root: string): void {\n const clientDir = path.join(root, \"dist\", \"client\")\n const nested = path.join(clientDir, VANTAGE_DIR, \"index.html\")\n const target = path.join(clientDir, \"index.html\")\n if (fs.existsSync(nested)) {\n fs.mkdirSync(clientDir, { recursive: true })\n fs.renameSync(nested, target)\n fs.rmSync(path.join(clientDir, VANTAGE_DIR), { recursive: true, force: true })\n }\n}\n\nasync function buildServer(root: string): Promise<void> {\n // Loaded here, not at module scope: an SPA project never builds a server and\n // should not pay for esbuild's binary being brought up.\n const { build: esbuildBuild } = await import(\"esbuild\")\n const vantageDir = path.join(root, VANTAGE_DIR)\n const entry = path.join(vantageDir, \"server-entry.ts\")\n fs.writeFileSync(entry, SERVER_ENTRY)\n await esbuildBuild({\n entryPoints: [entry],\n outfile: path.join(root, \"dist\", \"server\", \"index.mjs\"),\n bundle: true,\n platform: \"node\",\n format: \"esm\",\n target: \"node20\",\n logLevel: \"warning\",\n banner: { js: \"// @squadbase/vantage server bundle\" },\n })\n}\n\nfunction writeDeployManifest(root: string, model: RouteModel): void {\n const dist = path.join(root, \"dist\")\n fs.mkdirSync(dist, { recursive: true })\n const manifest = {\n schemaVersion: MANIFEST_SCHEMA_VERSION,\n mode: model.hasServer ? \"fullstack\" : \"spa\",\n client: \"./client\",\n ...(model.hasServer ? { server: \"./server/index.mjs\" } : {}),\n spaFallback: \"./client/index.html\",\n runtime: \"node\",\n }\n fs.writeFileSync(path.join(dist, \"vantage-manifest.json\"), JSON.stringify(manifest, null, 2) + \"\\n\")\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { runDiagnostics } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { runDiagnostics } from './chunk-P7W4LR3Z.js';
|
|
2
|
+
import './chunk-JKLLFVEU.js';
|
|
3
|
+
import './chunk-CEXAQQ5W.js';
|
|
4
4
|
import { scanProject } from './chunk-ZVANIULZ.js';
|
|
5
5
|
import { printJson, log, printDiagnostics } from './chunk-QI3XQKHS.js';
|
|
6
6
|
import './chunk-C2CX6GLX.js';
|
|
@@ -34,5 +34,5 @@ async function check(root, args) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export { check };
|
|
37
|
-
//# sourceMappingURL=check-
|
|
38
|
-
//# sourceMappingURL=check-
|
|
37
|
+
//# sourceMappingURL=check-3KHZXZMQ.js.map
|
|
38
|
+
//# sourceMappingURL=check-3KHZXZMQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/check.ts"],"names":[],"mappings":";;;;;;;;;;AAKA,eAAsB,KAAA,CAAM,MAAc,IAAA,EAAmC;AAC3E,EAAA,MAAM,KAAA,GAAQ,YAAY,IAAI,CAAA;AAC9B,EAAA,MAAM,KAAA,GAAQ,cAAA,CAAe,IAAA,EAAM,KAAK,CAAA;AACxC,EAAA,MAAM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A,MAAM,SAAS,KAAA,CAAM,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,OAAO,CAAA;AACzD,EAAA,MAAM,WAAW,KAAA,CAAM,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,SAAS,CAAA;AAE7D,EAAA,IAAI,IAAA,CAAK,MAAM,IAAA,EAAM;AACnB,IAAA,SAAA,CAAU;AAAA,MACR,EAAA,EAAI,OAAO,MAAA,KAAW,CAAA;AAAA,MACtB,YAAY,MAAA,CAAO,MAAA;AAAA,MACnB,cAAc,QAAA,CAAS,MAAA;AAAA,MACvB,WAAA,EAAa;AAAA,KACd,CAAA;AACD,IAAA,OAAO,MAAA,CAAO,SAAS,CAAA,GAAI,CAAA;AAAA,EAC7B;AAEA,EAAA,IAAI,KAAA,CAAM,WAAW,CAAA,EAAG;AACtB,IAAA,GAAA,CAAI,GAAG,oBAAoB,CAAA;AAC3B,IAAA,OAAO,CAAA;AAAA,EACT;AACA,EAAA,gBAAA,CAAiB,KAAK,CAAA;AACtB,EAAA,OAAA,CAAQ,IAAI,EAAE,CAAA;AACd,EAAA,IAAI,MAAA,CAAO,MAAA,EAAQ,GAAA,CAAI,KAAA,CAAM,CAAA,EAAG,OAAO,MAAM,CAAA,WAAA,EAAc,QAAA,CAAS,MAAM,CAAA,YAAA,CAAc,CAAA;AAAA,OACnF,GAAA,CAAI,IAAA,CAAK,CAAA,EAAG,QAAA,CAAS,MAAM,CAAA,YAAA,CAAc,CAAA;AAC9C,EAAA,OAAO,MAAA,CAAO,SAAS,CAAA,GAAI,CAAA;AAC7B","file":"check-3KHZXZMQ.js","sourcesContent":["import { runDiagnostics } from \"../core/diagnostics\"\nimport { scanProject } from \"../core/scan\"\nimport { log, printDiagnostics, printJson, type ParsedArgs } from \"./util\"\n\n/** `vantage check` — static verification of the project. */\nexport async function check(root: string, args: ParsedArgs): Promise<number> {\n const model = scanProject(root)\n const diags = runDiagnostics(root, model)\n const errors = diags.filter((d) => d.severity === \"error\")\n const warnings = diags.filter((d) => d.severity === \"warning\")\n\n if (args.flags.json) {\n printJson({\n ok: errors.length === 0,\n errorCount: errors.length,\n warningCount: warnings.length,\n diagnostics: diags,\n })\n return errors.length ? 1 : 0\n }\n\n if (diags.length === 0) {\n log.ok(\"No problems found.\")\n return 0\n }\n printDiagnostics(diags)\n console.log(\"\")\n if (errors.length) log.error(`${errors.length} error(s), ${warnings.length} warning(s).`)\n else log.warn(`${warnings.length} warning(s).`)\n return errors.length ? 1 : 0\n}\n"]}
|
|
@@ -4,6 +4,119 @@ import fs from 'fs';
|
|
|
4
4
|
|
|
5
5
|
// @squadbase/vantage — generated build. Do not edit.
|
|
6
6
|
|
|
7
|
+
// src/core/placeholder.ts
|
|
8
|
+
var PLACEHOLDER_HOME_PAGE = `import { definePage } from "@squadbase/vantage"
|
|
9
|
+
import {
|
|
10
|
+
DashboardCardPreset,
|
|
11
|
+
EChart,
|
|
12
|
+
PageShell,
|
|
13
|
+
PageShellContent,
|
|
14
|
+
PageShellDescription,
|
|
15
|
+
PageShellHeader,
|
|
16
|
+
PageShellHeading,
|
|
17
|
+
PageShellTitle,
|
|
18
|
+
Placeholder,
|
|
19
|
+
Sparkline,
|
|
20
|
+
type EChartsOption,
|
|
21
|
+
} from "@squadbase/vantage/components"
|
|
22
|
+
|
|
23
|
+
export const page = definePage({
|
|
24
|
+
title: "Dashboard",
|
|
25
|
+
description: "Sample data \u2014 replace with your own to get started.",
|
|
26
|
+
navLabel: "Home",
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const METRICS = [
|
|
30
|
+
{ label: "Metric 1", value: "1,234", trend: [3, 4, 3, 5, 6, 5, 7] },
|
|
31
|
+
{ label: "Metric 2", value: "5,678", trend: [6, 5, 6, 4, 5, 6, 6] },
|
|
32
|
+
{ label: "Metric 3", value: "90.1%", trend: [2, 3, 5, 4, 6, 7, 8] },
|
|
33
|
+
{ label: "Metric 4", value: "$12.3k", trend: [5, 6, 4, 6, 5, 7, 6] },
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
// Sample charts. \`EChart\` paints series with \`--chart-1..5\` and the sparklines
|
|
37
|
+
// use \`--primary\` (both from \`styles.css\`), so a theme change shows up here.
|
|
38
|
+
const BAR_OPTION: EChartsOption = {
|
|
39
|
+
legend: { top: 0 },
|
|
40
|
+
grid: { top: 36, right: 8, bottom: 24, left: 36 },
|
|
41
|
+
xAxis: { type: "category", data: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] },
|
|
42
|
+
yAxis: { type: "value" },
|
|
43
|
+
series: [
|
|
44
|
+
{ name: "Series A", type: "bar", data: [12, 18, 15, 22, 26, 24] },
|
|
45
|
+
{ name: "Series B", type: "bar", data: [8, 11, 13, 12, 16, 19] },
|
|
46
|
+
{ name: "Series C", type: "bar", data: [5, 7, 6, 9, 8, 11] },
|
|
47
|
+
],
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const PIE_OPTION: EChartsOption = {
|
|
51
|
+
legend: { bottom: 0 },
|
|
52
|
+
series: [
|
|
53
|
+
{
|
|
54
|
+
type: "pie",
|
|
55
|
+
radius: ["45%", "70%"],
|
|
56
|
+
center: ["50%", "45%"],
|
|
57
|
+
label: { show: false },
|
|
58
|
+
data: [
|
|
59
|
+
{ name: "Category A", value: 35 },
|
|
60
|
+
{ name: "Category B", value: 25 },
|
|
61
|
+
{ name: "Category C", value: 18 },
|
|
62
|
+
{ name: "Category D", value: 12 },
|
|
63
|
+
{ name: "Category E", value: 10 },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const CHARTS = [
|
|
70
|
+
{ title: "Chart 1", option: BAR_OPTION },
|
|
71
|
+
{ title: "Chart 2", option: PIE_OPTION },
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
export default function HomePage() {
|
|
75
|
+
return (
|
|
76
|
+
<PageShell>
|
|
77
|
+
<PageShellHeader>
|
|
78
|
+
<PageShellHeading>
|
|
79
|
+
<PageShellTitle>Dashboard</PageShellTitle>
|
|
80
|
+
<PageShellDescription>
|
|
81
|
+
Sample data \u2014 replace with your own to get started.
|
|
82
|
+
</PageShellDescription>
|
|
83
|
+
</PageShellHeading>
|
|
84
|
+
</PageShellHeader>
|
|
85
|
+
|
|
86
|
+
<PageShellContent>
|
|
87
|
+
<section className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4">
|
|
88
|
+
{METRICS.map((metric) => (
|
|
89
|
+
<DashboardCardPreset key={metric.label} title={metric.label}>
|
|
90
|
+
<Placeholder className="text-2xl font-bold">{metric.value}</Placeholder>
|
|
91
|
+
<Sparkline
|
|
92
|
+
className="mt-2"
|
|
93
|
+
data={metric.trend.map((value) => ({ value }))}
|
|
94
|
+
color="text-primary"
|
|
95
|
+
area
|
|
96
|
+
/>
|
|
97
|
+
</DashboardCardPreset>
|
|
98
|
+
))}
|
|
99
|
+
</section>
|
|
100
|
+
|
|
101
|
+
<section className="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
|
102
|
+
{CHARTS.map((chart) => (
|
|
103
|
+
<DashboardCardPreset key={chart.title} title={chart.title}>
|
|
104
|
+
<EChart option={chart.option} height={256} ariaLabel={chart.title} />
|
|
105
|
+
</DashboardCardPreset>
|
|
106
|
+
))}
|
|
107
|
+
</section>
|
|
108
|
+
</PageShellContent>
|
|
109
|
+
</PageShell>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
function isPlaceholderHomePage(content) {
|
|
114
|
+
if (/\bplaceholder\s*:\s*true\b/.test(content)) return true;
|
|
115
|
+
return content.trim() === PLACEHOLDER_HOME_PAGE.trim();
|
|
116
|
+
}
|
|
117
|
+
function isHomePagePath(file) {
|
|
118
|
+
return file === "index.tsx" || file === "src/index.tsx";
|
|
119
|
+
}
|
|
7
120
|
function humanize(stem) {
|
|
8
121
|
return stem.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[-_\s]+/).filter(Boolean).map((word) => word === word.toUpperCase() ? word : word[0].toUpperCase() + word.slice(1)).join(" ");
|
|
9
122
|
}
|
|
@@ -80,6 +193,7 @@ function parsePageMeta(src) {
|
|
|
80
193
|
if (title) meta.title = title;
|
|
81
194
|
if (description) meta.description = description;
|
|
82
195
|
if (navLabel) meta.navLabel = navLabel;
|
|
196
|
+
if (/\bplaceholder\s*:\s*true\b/.test(args)) meta.placeholder = true;
|
|
83
197
|
return meta;
|
|
84
198
|
}
|
|
85
199
|
function extractPageMeta(absFile) {
|
|
@@ -98,6 +212,11 @@ function extractPageMeta(absFile) {
|
|
|
98
212
|
return {};
|
|
99
213
|
}
|
|
100
214
|
const meta = parsePageMeta(src);
|
|
215
|
+
const fileName = absFile.split(/[/\\]/).pop() ?? "";
|
|
216
|
+
const relPath = absFile.includes("/src/") ? `src/${fileName}` : fileName;
|
|
217
|
+
if (isHomePagePath(relPath) && isPlaceholderHomePage(src)) {
|
|
218
|
+
meta.placeholder = true;
|
|
219
|
+
}
|
|
101
220
|
metaCache.set(absFile, { mtimeMs: stat.mtimeMs, size: stat.size, meta });
|
|
102
221
|
return meta;
|
|
103
222
|
}
|
|
@@ -137,29 +256,49 @@ function buildRouteTree(model) {
|
|
|
137
256
|
const index = remaining.length === 0;
|
|
138
257
|
const path2 = index ? "/" : remaining.map(segToRouter).join("/");
|
|
139
258
|
const meta = page.kind === "file" ? filePageMeta(page) : extractPageMeta(page.absFile);
|
|
140
|
-
|
|
259
|
+
const builtPage = {
|
|
141
260
|
file: page.file,
|
|
142
261
|
routePath: page.routePath,
|
|
143
262
|
parentLayoutId: owner ? owner.id : null,
|
|
144
263
|
path: path2,
|
|
145
264
|
index,
|
|
146
|
-
|
|
147
|
-
...meta.description ? { description: meta.description } : {},
|
|
148
|
-
...meta.navLabel ? { navLabel: meta.navLabel } : {},
|
|
149
|
-
kind: page.kind,
|
|
150
|
-
...page.fileExt ? { fileExt: page.fileExt } : {},
|
|
151
|
-
...page.variant ? { variant: page.variant } : {}
|
|
265
|
+
kind: page.kind
|
|
152
266
|
};
|
|
267
|
+
if (meta.title) builtPage.title = meta.title;
|
|
268
|
+
if (meta.description) builtPage.description = meta.description;
|
|
269
|
+
if (meta.navLabel) builtPage.navLabel = meta.navLabel;
|
|
270
|
+
if (page.fileExt) builtPage.fileExt = page.fileExt;
|
|
271
|
+
if (page.variant) builtPage.variant = page.variant;
|
|
272
|
+
if (meta.placeholder) builtPage.placeholder = meta.placeholder;
|
|
273
|
+
return builtPage;
|
|
153
274
|
});
|
|
275
|
+
const byRoutePath = /* @__PURE__ */ new Map();
|
|
276
|
+
for (const page of pages) {
|
|
277
|
+
const group = byRoutePath.get(page.routePath) ?? { placeholder: [], nonPlaceholder: [] };
|
|
278
|
+
if (page.placeholder) {
|
|
279
|
+
group.placeholder.push(page);
|
|
280
|
+
} else {
|
|
281
|
+
group.nonPlaceholder.push(page);
|
|
282
|
+
}
|
|
283
|
+
byRoutePath.set(page.routePath, group);
|
|
284
|
+
}
|
|
285
|
+
const filteredPages = [];
|
|
286
|
+
for (const group of byRoutePath.values()) {
|
|
287
|
+
if (group.nonPlaceholder.length > 0) {
|
|
288
|
+
filteredPages.push(...group.nonPlaceholder);
|
|
289
|
+
} else {
|
|
290
|
+
filteredPages.push(...group.placeholder);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
154
293
|
return {
|
|
155
294
|
rootLayout: rootLayoutRoute ? rootLayoutRoute.file : null,
|
|
156
295
|
notFound: model.notFound,
|
|
157
296
|
error: model.error,
|
|
158
297
|
layouts: built,
|
|
159
|
-
pages
|
|
298
|
+
pages: filteredPages
|
|
160
299
|
};
|
|
161
300
|
}
|
|
162
301
|
|
|
163
|
-
export { buildRouteTree, extractPageMeta, filePageKind, filePageMeta, filePageModuleName };
|
|
164
|
-
//# sourceMappingURL=chunk-
|
|
165
|
-
//# sourceMappingURL=chunk-
|
|
302
|
+
export { buildRouteTree, extractPageMeta, filePageKind, filePageMeta, filePageModuleName, isHomePagePath, isPlaceholderHomePage };
|
|
303
|
+
//# sourceMappingURL=chunk-CEXAQQ5W.js.map
|
|
304
|
+
//# sourceMappingURL=chunk-CEXAQQ5W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/placeholder.ts","../src/core/file-page.ts","../src/core/route-tree.ts"],"names":["depth","path"],"mappings":";;;;;;;AAeA,IAAM,qBAAA,GAAwB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAiHvB,SAAS,sBAAsB,OAAA,EAA0B;AAE9D,EAAA,IAAI,4BAAA,CAA6B,IAAA,CAAK,OAAO,CAAA,EAAG,OAAO,IAAA;AAGvD,EAAA,OAAO,OAAA,CAAQ,IAAA,EAAK,KAAM,qBAAA,CAAsB,IAAA,EAAK;AACvD;AAKO,SAAS,eAAe,IAAA,EAAuB;AACpD,EAAA,OAAO,IAAA,KAAS,eAAe,IAAA,KAAS,eAAA;AAC1C;AC1GO,SAAS,SAAS,IAAA,EAAsB;AAC7C,EAAA,OAAO,IAAA,CACJ,OAAA,CAAQ,oBAAA,EAAs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A;AAAA,IACT,KAAA,EAAO;AAAA,GACT;AACF","file":"chunk-CEXAQQ5W.js","sourcesContent":["/**\n * Detect whether a file is an untouched template placeholder.\n *\n * When a Vantage project is initialized from the template, it includes\n * a placeholder home page at `src/index.tsx` (or `index.tsx` at the root).\n * If that file remains completely untouched and a new artifact (e.g. a slide)\n * wants to claim route `/`, we allow it by treating the placeholder as yieldable\n * instead of reporting ROUTE_CONFLICT.\n */\n\n/**\n * Expected content of the template placeholder `src/index.tsx`.\n * This is the exact content from @squadbase/vantage-template 0.1.1.\n * When the template is updated, this constant must be updated as well.\n */\nconst PLACEHOLDER_HOME_PAGE = `import { definePage } from \"@squadbase/vantage\"\nimport {\n DashboardCardPreset,\n EChart,\n PageShell,\n PageShellContent,\n PageShellDescription,\n PageShellHeader,\n PageShellHeading,\n PageShellTitle,\n Placeholder,\n Sparkline,\n type EChartsOption,\n} from \"@squadbase/vantage/components\"\n\nexport const page = definePage({\n title: \"Dashboard\",\n description: \"Sample data — replace with your own to get started.\",\n navLabel: \"Home\",\n})\n\nconst METRICS = [\n { label: \"Metric 1\", value: \"1,234\", trend: [3, 4, 3, 5, 6, 5, 7] },\n { label: \"Metric 2\", value: \"5,678\", trend: [6, 5, 6, 4, 5, 6, 6] },\n { label: \"Metric 3\", value: \"90.1%\", trend: [2, 3, 5, 4, 6, 7, 8] },\n { label: \"Metric 4\", value: \"$12.3k\", trend: [5, 6, 4, 6, 5, 7, 6] },\n]\n\n// Sample charts. \\`EChart\\` paints series with \\`--chart-1..5\\` and the sparklines\n// use \\`--primary\\` (both from \\`styles.css\\`), so a theme change shows up here.\nconst BAR_OPTION: EChartsOption = {\n legend: { top: 0 },\n grid: { top: 36, right: 8, bottom: 24, left: 36 },\n xAxis: { type: \"category\", data: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"] },\n yAxis: { type: \"value\" },\n series: [\n { name: \"Series A\", type: \"bar\", data: [12, 18, 15, 22, 26, 24] },\n { name: \"Series B\", type: \"bar\", data: [8, 11, 13, 12, 16, 19] },\n { name: \"Series C\", type: \"bar\", data: [5, 7, 6, 9, 8, 11] },\n ],\n}\n\nconst PIE_OPTION: EChartsOption = {\n legend: { bottom: 0 },\n series: [\n {\n type: \"pie\",\n radius: [\"45%\", \"70%\"],\n center: [\"50%\", \"45%\"],\n label: { show: false },\n data: [\n { name: \"Category A\", value: 35 },\n { name: \"Category B\", value: 25 },\n { name: \"Category C\", value: 18 },\n { name: \"Category D\", value: 12 },\n { name: \"Category E\", value: 10 },\n ],\n },\n ],\n}\n\nconst CHARTS = [\n { title: \"Chart 1\", option: BAR_OPTION },\n { title: \"Chart 2\", option: PIE_OPTION },\n]\n\nexport default function HomePage() {\n return (\n <PageShell>\n <PageShellHeader>\n <PageShellHeading>\n <PageShellTitle>Dashboard</PageShellTitle>\n <PageShellDescription>\n Sample data — replace with your own to get started.\n </PageShellDescription>\n </PageShellHeading>\n </PageShellHeader>\n\n <PageShellContent>\n <section className=\"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4\">\n {METRICS.map((metric) => (\n <DashboardCardPreset key={metric.label} title={metric.label}>\n <Placeholder className=\"text-2xl font-bold\">{metric.value}</Placeholder>\n <Sparkline\n className=\"mt-2\"\n data={metric.trend.map((value) => ({ value }))}\n color=\"text-primary\"\n area\n />\n </DashboardCardPreset>\n ))}\n </section>\n\n <section className=\"grid grid-cols-1 gap-4 lg:grid-cols-2\">\n {CHARTS.map((chart) => (\n <DashboardCardPreset key={chart.title} title={chart.title}>\n <EChart option={chart.option} height={256} ariaLabel={chart.title} />\n </DashboardCardPreset>\n ))}\n </section>\n </PageShellContent>\n </PageShell>\n )\n}\n`\n\n/**\n * Check if a file content matches the template placeholder home page.\n * Returns true if the file is the exact untouched placeholder.\n * \n * This is a fallback for projects created from the older template (0.1.1-dev1.2be5c44)\n * before the explicit `placeholder: true` marker was added.\n */\nexport function isPlaceholderHomePage(content: string): boolean {\n // First check for explicit placeholder marker\n if (/\\bplaceholder\\s*:\\s*true\\b/.test(content)) return true\n \n // Fallback: exact content match for older templates\n return content.trim() === PLACEHOLDER_HOME_PAGE.trim()\n}\n\n/**\n * Check if a file path is the home page (index.tsx at root or in src/).\n */\nexport function isHomePagePath(file: string): boolean {\n return file === \"index.tsx\" || file === \"src/index.tsx\"\n}\n","/**\n * Everything the rest of the framework needs to know about a data-file page:\n * its title, the token the viewer switches on, and the name of the wrapper\n * module generated for it. One source of truth, the same way\n * `route-spec.ts`'s `detectApiMethods` is the one source for API methods —\n * `route-tree.ts` (metadata) and `generate.ts` (codegen) both read from here.\n */\nimport path from \"node:path\"\nimport { createHash } from \"node:crypto\"\n\n/** The parts of a file page each helper below needs. */\ninterface FileNamed {\n /** Project-relative POSIX path. */\n file: string\n}\ninterface FileTyped {\n /** The data-file extension, e.g. `\".csv\"`. */\n fileExt?: string\n}\n/** Metadata also needs the page-root-relative directory, which the URL uses. */\ntype FileMetaInput = FileNamed & FileTyped & { dir: string }\n\n/** The same shape `definePage` metadata takes, so callers can spread either. */\ninterface PageMeta {\n title?: string\n description?: string\n navLabel?: string\n placeholder?: boolean\n}\n\n/**\n * Turn a file stem into a title: `monthly_report-2024` -> \"Monthly Report\n * 2024\", `salesByRegion` -> \"Sales By Region\". All-caps tokens are left alone\n * (`KPI` stays `KPI`) because they are almost always acronyms.\n */\nexport function humanize(stem: string): string {\n return stem\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((word) => (word === word.toUpperCase() ? word : word[0]!.toUpperCase() + word.slice(1)))\n .join(\" \")\n}\n\n/**\n * Title for a data-file page, derived from its name — a spreadsheet cannot\n * carry a `definePage`. `index.csv` borrows its directory's name (its own name\n * is not in the URL either); a root-level `index.csv` gets no title at all,\n * exactly like a root `index.tsx` without `definePage`.\n */\nexport function filePageMeta(page: FileMetaInput): PageMeta {\n const base = path.posix.basename(page.file)\n let stem = page.fileExt ? base.slice(0, -page.fileExt.length) : base\n if (stem.toLowerCase() === \"index\") stem = page.dir.split(\"/\").filter(Boolean).pop() ?? \"\"\n if (stem === \"\") return {}\n return { title: humanize(stem) }\n}\n\n/** The token handed to the client viewer: `\".xlsx\"` -> `\"xlsx\"`. */\nexport function filePageKind(page: FileTyped): string {\n return (page.fileExt ?? \"\").slice(1)\n}\n\n/**\n * Name of the wrapper module generated for a data-file page. Derived from the\n * source path so it is stable across runs (`writeIfChanged` stays a no-op) and\n * readable in a stack trace; the hash suffix keeps `a/b.csv` and `a-b.csv` from\n * colliding once slugified.\n */\nexport function filePageModuleName(page: FileNamed): string {\n const slug = page.file\n .replace(/[^A-Za-z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\")\n .toLowerCase()\n const hash = createHash(\"sha256\").update(page.file).digest(\"hex\").slice(0, 8)\n return `${slug}-${hash}.tsx`\n}\n","import fs from \"node:fs\"\nimport type { FilePageExt, PageVariant } from \"./constants\"\nimport { filePageMeta } from \"./file-page\"\nimport { isHomePagePath, isPlaceholderHomePage } from \"./placeholder\"\nimport type { PageKind, RouteModel, Segment } from \"./types\"\n\n/** A layout route (path-bearing) in the built tree. */\nexport interface BuiltLayout {\n id: string\n dir: string\n parentId: string | null\n /** Router path relative to its parent (TanStack `$param` form). */\n path: string\n file: string\n}\n\n/** A page route in the built tree. */\nexport interface BuiltPage {\n file: string\n routePath: string\n parentLayoutId: string | null\n /** Router path relative to parent, or \"/\" for an index route. */\n path: string\n index: boolean\n title?: string\n description?: string\n navLabel?: string\n kind: PageKind\n fileExt?: FilePageExt\n variant?: PageVariant\n placeholder?: boolean\n}\n\n/** The structured route tree emitted for the client runtime. */\nexport interface BuiltTree {\n rootLayout: string | null\n notFound: string | null\n error: string | null\n layouts: BuiltLayout[]\n pages: BuiltPage[]\n}\n\nfunction segToRouter(s: Segment): string {\n if (s.kind === \"static\") return s.value\n if (s.kind === \"param\") return `$${s.name}`\n return \"$\"\n}\n\n/** Convert a relative directory string (may contain `[param]`) to a router path. */\nfunction dirToRouterPath(relDir: string): string {\n return relDir\n .split(\"/\")\n .filter(Boolean)\n .map((token) => {\n const catchall = token.match(/^\\[\\.\\.\\.(.+)\\]$/)\n if (catchall) return \"$\"\n const param = token.match(/^\\[(.+)\\]$/)\n if (param) return `$${param[1]}`\n return token\n })\n .join(\"/\")\n}\n\nfunction isAncestorDir(ancestor: string, dir: string): boolean {\n if (ancestor === \"\") return true\n return dir === ancestor || dir.startsWith(ancestor + \"/\")\n}\n\nfunction isStrictAncestorDir(ancestor: string, dir: string): boolean {\n return dir.startsWith(ancestor + \"/\")\n}\n\nfunction depth(dir: string): number {\n return dir === \"\" ? 0 : dir.split(\"/\").length\n}\n\n/**\n * Extract the argument object body of the first `definePage({ ... })` call\n * using balanced-brace scanning, so nested objects/functions (e.g.\n * `validateSearch: (s) => ({ ... })`) don't truncate the match. Returns null\n * when there is no definePage call — the caller then emits no metadata rather\n * than falling back to the whole file (which would match unrelated `title:`\n * keys in chart/option configs).\n */\nfunction extractDefinePageArgs(src: string): string | null {\n const call = src.match(/\\bdefinePage\\s*\\(/)\n if (!call) return null\n let i = (call.index ?? 0) + call[0].length\n while (i < src.length && /\\s/.test(src[i]!)) i++\n if (src[i] !== \"{\") return null\n const start = i\n let depth = 0\n for (; i < src.length; i++) {\n const c = src[i]\n if (c === \"{\") depth++\n else if (c === \"}\" && --depth === 0) return src.slice(start + 1, i)\n }\n return null\n}\n\n/**\n * Match `key: \"...\"` allowing the value's own quote character to differ and\n * handling escapes, so values containing an apostrophe/quote are not truncated.\n */\nfunction matchStringField(scope: string, key: string): string | undefined {\n const re = new RegExp(\n `\\\\b${key}\\\\s*:\\\\s*(?:\"((?:\\\\\\\\.|[^\"\\\\\\\\])*)\"|'((?:\\\\\\\\.|[^'\\\\\\\\])*)'|\\`((?:\\\\\\\\.|[^\\`\\\\\\\\])*)\\`)`,\n )\n const m = scope.match(re)\n if (!m) return undefined\n return (m[1] ?? m[2] ?? m[3] ?? \"\").replace(/\\\\(.)/g, \"$1\")\n}\n\ninterface PageMeta {\n title?: string\n description?: string\n navLabel?: string\n placeholder?: boolean\n}\n\n/**\n * Cache keyed on mtime+size. A long-lived dev server regenerates the route tree\n * on every structural change, and re-reading + re-parsing every page module for\n * metadata that almost never changes is pure waste. `statSync` is an order of\n * magnitude cheaper than the read plus the brace scan it feeds.\n */\nconst metaCache = new Map<string, { mtimeMs: number; size: number; meta: PageMeta }>()\n\nfunction parsePageMeta(src: string): PageMeta {\n const args = extractDefinePageArgs(src)\n if (args == null) return {}\n const meta: PageMeta = {}\n const title = matchStringField(args, \"title\")\n const description = matchStringField(args, \"description\")\n const navLabel = matchStringField(args, \"navLabel\")\n if (title) meta.title = title\n if (description) meta.description = description\n if (navLabel) meta.navLabel = navLabel\n // Check for placeholder: true (boolean literal)\n if (/\\bplaceholder\\s*:\\s*true\\b/.test(args)) meta.placeholder = true\n return meta\n}\n\n/** Best-effort static extraction of definePage title/description/navLabel. */\nexport function extractPageMeta(absFile: string): PageMeta {\n let stat: fs.Stats\n try {\n stat = fs.statSync(absFile)\n } catch {\n return {}\n }\n const hit = metaCache.get(absFile)\n if (hit && hit.mtimeMs === stat.mtimeMs && hit.size === stat.size) return hit.meta\n\n let src: string\n try {\n src = fs.readFileSync(absFile, \"utf8\")\n } catch {\n return {}\n }\n const meta = parsePageMeta(src)\n \n // Check for placeholder using the robust detection from placeholder.ts\n // This includes both explicit marker and fallback exact match\n const fileName = absFile.split(/[/\\\\]/).pop() ?? \"\"\n const relPath = absFile.includes(\"/src/\") ? `src/${fileName}` : fileName\n if (isHomePagePath(relPath) && isPlaceholderHomePage(src)) {\n meta.placeholder = true\n }\n \n metaCache.set(absFile, { mtimeMs: stat.mtimeMs, size: stat.size, meta })\n return meta\n}\n\n/**\n * Build the structured route tree from a scan. Layouts become path-bearing\n * routes; pages attach to the deepest layout that owns their directory.\n */\nexport function buildRouteTree(model: RouteModel): BuiltTree {\n const rootLayoutRoute = model.layouts.find((l) => l.dir === \"\") ?? null\n const nestedLayouts = model.layouts\n .filter((l) => l.dir !== \"\")\n .sort((a, b) => depth(a.dir) - depth(b.dir))\n\n const built: BuiltLayout[] = []\n const dirToId = new Map<string, string>()\n\n nestedLayouts.forEach((layout, i) => {\n const id = `L${i}`\n // Parent = deepest other layout that is a strict ancestor of this dir.\n let parent: { id: string; dir: string } | null = null\n for (const cand of built) {\n if (isStrictAncestorDir(cand.dir, layout.dir)) {\n if (!parent || depth(cand.dir) > depth(parent.dir)) parent = { id: cand.id, dir: cand.dir }\n }\n }\n const parentDir = parent ? parent.dir : \"\"\n const relDir = parentDir === \"\" ? layout.dir : layout.dir.slice(parentDir.length + 1)\n built.push({\n id,\n dir: layout.dir,\n parentId: parent ? parent.id : null,\n path: dirToRouterPath(relDir),\n file: layout.file,\n })\n dirToId.set(layout.dir, id)\n })\n\n const pages: BuiltPage[] = model.pages.map((page) => {\n // Owner = deepest layout whose dir is an ancestor-or-equal of the page dir.\n let owner: BuiltLayout | null = null\n for (const l of built) {\n if (isAncestorDir(l.dir, page.dir)) {\n if (!owner || depth(l.dir) > depth(owner.dir)) owner = l\n }\n }\n const ownerSegCount = owner ? depth(owner.dir) : 0\n const remaining = page.segments.slice(ownerSegCount)\n const index = remaining.length === 0\n const path = index ? \"/\" : remaining.map(segToRouter).join(\"/\")\n // `extractPageMeta` reads the file as UTF-8 and runs regexes over it, so a\n // data file must never reach it — a few MB of spreadsheet binary would be\n // decoded and scanned for a `definePage` that cannot exist there.\n const meta = page.kind === \"file\" ? filePageMeta(page) : extractPageMeta(page.absFile)\n const builtPage: BuiltPage = {\n file: page.file,\n routePath: page.routePath,\n parentLayoutId: owner ? owner.id : null,\n path,\n index,\n kind: page.kind,\n }\n if (meta.title) builtPage.title = meta.title\n if (meta.description) builtPage.description = meta.description\n if (meta.navLabel) builtPage.navLabel = meta.navLabel\n if (page.fileExt) builtPage.fileExt = page.fileExt\n if (page.variant) builtPage.variant = page.variant\n if (meta.placeholder) builtPage.placeholder = meta.placeholder\n return builtPage\n })\n\n // Filter out placeholder pages when there's another page at the same route.\n // This allows new artifacts (e.g. index.slide.tsx) to claim \"/\" when the\n // template's placeholder home page is untouched.\n const byRoutePath = new Map<string, { placeholder: BuiltPage[]; nonPlaceholder: BuiltPage[] }>()\n for (const page of pages) {\n const group = byRoutePath.get(page.routePath) ?? { placeholder: [], nonPlaceholder: [] }\n if (page.placeholder) {\n group.placeholder.push(page)\n } else {\n group.nonPlaceholder.push(page)\n }\n byRoutePath.set(page.routePath, group)\n }\n\n const filteredPages: BuiltPage[] = []\n for (const group of byRoutePath.values()) {\n // If there are non-placeholder pages, use only those\n if (group.nonPlaceholder.length > 0) {\n filteredPages.push(...group.nonPlaceholder)\n } else {\n // Otherwise, use the placeholder(s)\n filteredPages.push(...group.placeholder)\n }\n }\n\n return {\n rootLayout: rootLayoutRoute ? rootLayoutRoute.file : null,\n notFound: model.notFound,\n error: model.error,\n layouts: built,\n pages: filteredPages,\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { filePageMeta, extractPageMeta } from './chunk-
|
|
1
|
+
import { filePageMeta, extractPageMeta } from './chunk-CEXAQQ5W.js';
|
|
2
2
|
import { API_METHODS } from './chunk-C2CX6GLX.js';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
|
|
@@ -237,5 +237,5 @@ function extractApiSpec(api) {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
export { detectApiMethods, extractApiSpec, extractPageSpec, maskSource, stripComments };
|
|
240
|
-
//# sourceMappingURL=chunk-
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
240
|
+
//# sourceMappingURL=chunk-JKLLFVEU.js.map
|
|
241
|
+
//# sourceMappingURL=chunk-JKLLFVEU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/source.ts","../src/core/route-spec.ts"],"names":[],"mappings":";;;;;;;AAWO,SAAS,cAAc,GAAA,EAAqB;AACjD,EAAA,OAAO,IAAI,OAAA,CAAQ,mBAA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D,EAAA,MAAM,MAAA,GAAS,QAAA,CAAS,GAAA,CAAI,QAAQ,CAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,cAAc,EAAA,CAAG,YAAA,CAAa,GAAA,CAAI,OAAA,EAAS,MAAM,CAAC,CAAA;AAAA,EAC1D,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,MAAA,EAAQ,OAAA,EAAS,EAAC,EAAE;AAAA,EAC/B;AACA,EAAA,MAAM,OAAA,GAAU,cAAc,GAAG,CAAA;AACjC,EAAA,MAAM,OAAA,GAAU,WAAA,CAAY,MAAA,CAAO,CAAC,CAAA,KAAM,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,GAAA,CAAI,CAAC,MAAA,KAAW;AACxE,IAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,GAAA,CAAI,MAAM,CAAA;AACjC,IAAA,MAAM,IAAA,GAAO,YAAY,MAAM,CAAA;AAC/B,IAAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,KAAA,EAAO,aAAa,MAAM,CAAA;AAAA,MAC1B,GAAI,IAAA,GAAO,EAAE,IAAA,KAAS,EAAC;AAAA,MACvB,SAAA,EAAW,iBAAiB,MAAM,CAAA;AAAA,MAClC,MAAA,EAAQ,cAAc,MAAM;AAAA,KAC9B;AAAA,EACF,CAAC,CAAA;AACD,EAAA,OAAO,EAAE,QAAQ,OAAA,EAAQ;AAC3B","file":"chunk-JGRMRXXZ.js","sourcesContent":["/**\n * Low-level source scanning helpers shared by the static analyzers\n * (`diagnostics.ts`, `route-spec.ts`). Everything here is text-only — user code\n * is never imported or executed.\n */\n\n/**\n * Strip block and line comments so commented-out code doesn't produce false\n * positives (or hide real issues). Naive but adequate for presence checks:\n * URLs (`http://`) are preserved via the `[^:]` guard before `//`.\n */\nexport function stripComments(src: string): string {\n return src.replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\").replace(/(^|[^:\"'`\\\\])\\/\\/[^\\n]*/g, \"$1\")\n}\n\nconst OPENERS: Record<string, string> = { \"(\": \")\", \"[\": \"]\", \"{\": \"}\" }\n\n/**\n * Read a balanced bracketed region starting at `openIndex` (which must hold\n * `(`, `[` or `{`), returning the raw text *between* the brackets. Quote- and\n * nesting-aware so brackets inside string literals don't unbalance the scan.\n * Returns null when the region is never closed.\n */\nexport function readBracketBody(src: string, openIndex: number): string | null {\n const open = src[openIndex]\n if (!open || !OPENERS[open]) return null\n let depth = 0\n let quote: string | null = null\n for (let i = openIndex; i < src.length; i++) {\n const c = src[i]!\n if (quote) {\n if (c === \"\\\\\") i++\n else if (c === quote) quote = null\n continue\n }\n if (c === '\"' || c === \"'\" || c === \"`\") {\n quote = c\n continue\n }\n if (OPENERS[c]) depth++\n else if (c === \")\" || c === \"]\" || c === \"}\") {\n if (--depth === 0) return src.slice(openIndex + 1, i)\n }\n }\n return null\n}\n\n/**\n * Split an argument list or object body on top-level commas, ignoring commas\n * nested inside brackets or string literals. Empty parts are dropped.\n */\nexport function splitTopLevel(body: string): string[] {\n const parts: string[] = []\n let depth = 0\n let quote: string | null = null\n let start = 0\n for (let i = 0; i < body.length; i++) {\n const c = body[i]!\n if (quote) {\n if (c === \"\\\\\") i++\n else if (c === quote) quote = null\n continue\n }\n if (c === '\"' || c === \"'\" || c === \"`\") {\n quote = c\n continue\n }\n if (OPENERS[c]) depth++\n else if (c === \")\" || c === \"]\" || c === \"}\") depth--\n else if (c === \",\" && depth === 0) {\n parts.push(body.slice(start, i))\n start = i + 1\n }\n }\n parts.push(body.slice(start))\n return parts.map((p) => p.trim()).filter(Boolean)\n}\n\n/**\n * Lex a module just far enough to tell code, comments and string literals\n * apart, *without* moving anything: comments come back blanked to spaces\n * (newlines kept) so offsets and line numbers still match the raw file, and\n * `inString[i]` is 1 where offset `i` sits inside a `'…'`, `\"…\"` or `` `…` ``\n * literal (template `${…}` bodies count as string — close enough for literal\n * scans). `'`/`\"` literals end at a newline, so an apostrophe in JSX text\n * cannot swallow more than the rest of its own line.\n */\nexport function maskSource(src: string): { code: string; inString: Uint8Array } {\n const out = src.split(\"\")\n const inString = new Uint8Array(src.length)\n let i = 0\n while (i < src.length) {\n const c = src[i]!\n const next = src[i + 1]\n if (c === \"/\" && next === \"/\" && src[i - 1] !== \":\") {\n while (i < src.length && src[i] !== \"\\n\") out[i++] = \" \"\n continue\n }\n if (c === \"/\" && next === \"*\") {\n const end = src.indexOf(\"*/\", i + 2)\n const stop = end === -1 ? src.length : end + 2\n for (; i < stop; i++) if (src[i] !== \"\\n\") out[i] = \" \"\n continue\n }\n if (c === '\"' || c === \"'\" || c === \"`\") {\n i++\n while (i < src.length) {\n const d = src[i]!\n if (d === \"\\\\\") {\n inString[i] = 1\n inString[i + 1] = 1\n i += 2\n continue\n }\n if (d === c) break\n if (d === \"\\n\" && c !== \"`\") break\n inString[i++] = 1\n }\n i++\n continue\n }\n i++\n }\n return { code: out.join(\"\"), inString }\n}\n","import fs from \"node:fs\"\nimport { API_METHODS, type ApiMethod } from \"./constants\"\nimport { filePageMeta } from \"./file-page\"\nimport { extractPageMeta } from \"./route-tree\"\nimport { readBracketBody, splitTopLevel, stripComments } from \"./source\"\nimport type { ApiRoute, PageRoute, Segment } from \"./types\"\n\n/**\n * Best-effort *static* specs for the routes `vantage routes --detail` prints:\n * what a page takes in its path, and what an API route accepts and answers\n * with. Like `diagnostics.ts` this only reads text — user modules are never\n * imported or executed — so every field is a hint derived from the source, not\n * a guarantee. Callers pass sources through {@link stripComments} first.\n */\n\n/** A dynamic segment of a route path. */\nexport interface RouteParam {\n name: string\n kind: \"param\" | \"catchall\"\n}\n\n/** Static spec of a page route. */\nexport interface PageSpec {\n params: RouteParam[]\n title?: string\n description?: string\n navLabel?: string\n}\n\n/** The request body an API handler reads, when detectable. */\nexport interface ApiBodySpec {\n format: \"json\" | \"formData\" | \"text\" | \"binary\"\n /** Top-level keys, when the handler destructures them. */\n keys?: string[]\n}\n\n/** A response an API handler returns. */\nexport interface ApiResponseSpec {\n status: number\n /** Response content type, omitted when it can't be derived. */\n contentType?: string\n /** Top-level keys, when the payload is an object literal. */\n keys?: string[]\n}\n\n/** An `HttpError` an API handler throws. */\nexport interface ApiErrorSpec {\n status: number\n message?: string\n}\n\n/** Static spec of one HTTP method handler. */\nexport interface ApiMethodSpec {\n method: ApiMethod\n /** Query string keys read via `searchParams`. */\n query: string[]\n body?: ApiBodySpec\n responses: ApiResponseSpec[]\n errors: ApiErrorSpec[]\n}\n\n/** Static spec of an API route module. */\nexport interface ApiSpec {\n params: RouteParam[]\n methods: ApiMethodSpec[]\n}\n\n/**\n * HTTP method handlers a module exports (direct declaration or export list).\n * `src` must be comment-stripped. Shared with the `INVALID_API_EXPORT`\n * diagnostic so both agree on what counts as a handler.\n */\nexport function detectApiMethods(src: string): ApiMethod[] {\n return API_METHODS.filter(\n (m) =>\n new RegExp(`export\\\\s+(async\\\\s+)?(function|const|let|var)\\\\s+${m}\\\\b`).test(src) ||\n new RegExp(`export\\\\s*\\\\{[^}]*\\\\b${m}\\\\b[^}]*\\\\}`).test(src),\n )\n}\n\n/**\n * Slice the module into one source region per handler: from a handler's export\n * declaration to the next one (or EOF). Coarse on purpose — matching a function\n * body would have to cope with arrow bodies, overloads and trailing helpers —\n * and good enough because handlers are written one after another. A method\n * exported only through an export list gets the whole module as its region.\n */\nfunction methodRegions(src: string): Map<ApiMethod, string> {\n const re = new RegExp(\n `export\\\\s+(?:async\\\\s+)?(?:function|const|let|var)\\\\s+(${API_METHODS.join(\"|\")})\\\\b`,\n \"g\",\n )\n const decls: { method: ApiMethod; index: number }[] = []\n let m: RegExpExecArray | null\n while ((m = re.exec(src))) decls.push({ method: m[1] as ApiMethod, index: m.index })\n\n const regions = new Map<ApiMethod, string>()\n decls.forEach((d, i) => {\n regions.set(d.method, src.slice(d.index, decls[i + 1]?.index ?? src.length))\n })\n for (const method of detectApiMethods(src)) {\n if (!regions.has(method)) regions.set(method, src)\n }\n return regions\n}\n\n/** Top-level keys of an object literal expression, `…` standing in for spreads. */\nfunction objectKeys(expr: string): string[] | undefined {\n const trimmed = expr.trim()\n if (!trimmed.startsWith(\"{\")) return undefined\n const body = readBracketBody(trimmed, 0)\n if (body == null) return undefined\n const keys: string[] = []\n for (const part of splitTopLevel(body)) {\n if (part.startsWith(\"...\")) {\n keys.push(\"…\")\n continue\n }\n const name = part.match(/^[\"'`]?([A-Za-z0-9_$]+)/)\n if (name) keys.push(name[1]!)\n }\n return keys.length ? keys : undefined\n}\n\n/** Read `status: 201` out of a `ResponseInit` literal. */\nfunction initStatus(init: string | undefined): number | undefined {\n const m = init?.match(/\\bstatus\\s*:\\s*(\\d{3})\\b/)\n return m ? Number(m[1]) : undefined\n}\n\n/** Read a content-type header out of a `ResponseInit` literal. */\nfunction initContentType(init: string | undefined): string | undefined {\n const m = init?.match(/[\"']?content-type[\"']?\\s*:\\s*[\"']([^\"';]+)/i)\n return m ? m[1]!.trim() : undefined\n}\n\n/** Every `Response.json(…)` / `json(…)` / `new Response(…)` in a handler region. */\nfunction extractResponses(region: string): ApiResponseSpec[] {\n const re = /\\bnew\\s+Response\\s*\\(|\\bResponse\\s*\\.\\s*json\\s*\\(|(?<![.\\w$])json\\s*\\(/g\n const out: ApiResponseSpec[] = []\n const seen = new Set<string>()\n let m: RegExpExecArray | null\n while ((m = re.exec(region))) {\n const isJson = !m[0].startsWith(\"new\")\n const args = readBracketBody(region, m.index + m[0].length - 1)\n if (args == null) continue\n const [payload, init] = splitTopLevel(args)\n const contentType = isJson\n ? \"application/json\"\n : (initContentType(init) ??\n (payload?.startsWith(\"JSON.stringify\") ? \"application/json\" : undefined))\n const keys = isJson && payload ? objectKeys(payload) : undefined\n const spec: ApiResponseSpec = {\n status: initStatus(init) ?? 200,\n ...(contentType ? { contentType } : {}),\n ...(keys ? { keys } : {}),\n }\n const key = JSON.stringify(spec)\n if (seen.has(key)) continue\n seen.add(key)\n out.push(spec)\n }\n return out\n}\n\n/** Every `new HttpError(status, \"message\")` in a handler region. */\nfunction extractErrors(region: string): ApiErrorSpec[] {\n const re = /\\bHttpError\\s*\\(\\s*(\\d{3})\\s*(?:,\\s*(?:([\"'`])((?:\\\\.|(?!\\2)[\\s\\S])*)\\2))?/g\n const out: ApiErrorSpec[] = []\n const seen = new Set<string>()\n let m: RegExpExecArray | null\n while ((m = re.exec(region))) {\n const message = m[3]?.replace(/\\\\(.)/g, \"$1\")\n const spec: ApiErrorSpec = { status: Number(m[1]), ...(message ? { message } : {}) }\n const key = JSON.stringify(spec)\n if (seen.has(key)) continue\n seen.add(key)\n out.push(spec)\n }\n return out\n}\n\n/** Query keys read through `searchParams.get/getAll/has(\"x\")`. */\nfunction extractQuery(region: string): string[] {\n const re = /searchParams\\s*\\.\\s*(?:get|getAll|has)\\s*\\(\\s*[\"'`]([^\"'`]+)[\"'`]/g\n const out = new Set<string>()\n let m: RegExpExecArray | null\n while ((m = re.exec(region))) out.add(m[1]!)\n return [...out]\n}\n\n/** The request body a handler reads, plus destructured keys when present. */\nfunction extractBody(region: string): ApiBodySpec | undefined {\n const read = region.match(/\\b(?:request|req)\\s*\\.\\s*(json|formData|text|arrayBuffer|blob)\\s*\\(/)\n if (!read) return undefined\n const method = read[1]!\n const format: ApiBodySpec[\"format\"] =\n method === \"json\" || method === \"formData\" || method === \"text\" ? method : \"binary\"\n\n const destructured = region.match(\n /(?:const|let|var)\\s*(\\{[\\s\\S]*?\\})\\s*=\\s*(?:await\\s+)?[\\w.]*\\.json\\s*\\(/,\n )\n const keys = format === \"json\" && destructured ? objectKeys(destructured[1]!) : undefined\n return { format, ...(keys ? { keys } : {}) }\n}\n\nfunction toParams(segments: Segment[]): RouteParam[] {\n const out: RouteParam[] = []\n for (const s of segments) {\n if (s.kind === \"static\") continue\n out.push({ name: s.name, kind: s.kind })\n }\n return out\n}\n\n/** Static spec of a page: its path params and its `definePage` metadata. */\nexport function extractPageSpec(page: PageRoute): PageSpec {\n // A data file has no `definePage` to read, and reading it as UTF-8 would\n // decode megabytes of spreadsheet binary; its title is derived from the name.\n const meta = page.kind === \"file\" ? filePageMeta(page) : extractPageMeta(page.absFile)\n return { params: toParams(page.segments), ...meta }\n}\n\n/** Static spec of an API route: path params and a per-method request/response sketch. */\nexport function extractApiSpec(api: ApiRoute): ApiSpec {\n const params = toParams(api.segments)\n let src: string\n try {\n src = stripComments(fs.readFileSync(api.absFile, \"utf8\"))\n } catch {\n return { params, methods: [] }\n }\n const regions = methodRegions(src)\n const methods = API_METHODS.filter((m) => regions.has(m)).map((method) => {\n const region = regions.get(method)!\n const body = extractBody(region)\n return {\n method,\n query: extractQuery(region),\n ...(body ? { body } : {}),\n responses: extractResponses(region),\n errors: extractErrors(region),\n }\n })\n return { params, methods }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/source.ts","../src/core/route-spec.ts"],"names":[],"mappings":";;;;;;;AAWO,SAAS,cAAc,GAAA,EAAqB;AACjD,EAAA,OAAO,IAAI,OAAA,CAAQ,mBAAA,EAAqB,EAAE,CAAA,CAAE,OAAA,CAAQ,4BAA4B,IAAI,CAAA;AACtF;AAEA,IAAM,UAAkC,EAAE,GAAA,EAAK,KAAK,GAAA,EAAK,GAAA,EAAK,KAAK,GAAA,EAAI;AAQhE,SAAS,eAAA,CAAgB,KAAa,SAAA,EAAkC;AAC7E,EAAA,MAAM,IAAA,GAAO,IAAI,SAAS,CAAA;AAC1B,EAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,OAAA,CAAQ,IAAI,GAAG,OAAO,IAAA;AACpC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,IAAI,KAAA,GAAuB,IAAA;AAC3B,EAAA,KAAA,IAAS,CAAA,GAAI,SAAA,EAAW,CAAA,GAAI,GAAA,CAAI,QAAQ,CAAA,EAAA,EAAK;AAC3C,IAAA,MAAM,CAAA,GAAI,IAAI,CAAC,CAAA;AACf,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,IAAI,MAAM,IAAA,EAAM,CAAA,EAAA;A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AAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,KAAA,EAAO,aAAa,MAAM,CAAA;AAAA,MAC1B,GAAI,IAAA,GAAO,EAAE,IAAA,KAAS,EAAC;AAAA,MACvB,SAAA,EAAW,iBAAiB,MAAM,CAAA;AAAA,MAClC,MAAA,EAAQ,cAAc,MAAM;AAAA,KAC9B;AAAA,EACF,CAAC,CAAA;AACD,EAAA,OAAO,EAAE,QAAQ,OAAA,EAAQ;AAC3B","file":"chunk-JKLLFVEU.js","sourcesContent":["/**\n * Low-level source scanning helpers shared by the static analyzers\n * (`diagnostics.ts`, `route-spec.ts`). Everything here is text-only — user code\n * is never imported or executed.\n */\n\n/**\n * Strip block and line comments so commented-out code doesn't produce false\n * positives (or hide real issues). Naive but adequate for presence checks:\n * URLs (`http://`) are preserved via the `[^:]` guard before `//`.\n */\nexport function stripComments(src: string): string {\n return src.replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\").replace(/(^|[^:\"'`\\\\])\\/\\/[^\\n]*/g, \"$1\")\n}\n\nconst OPENERS: Record<string, string> = { \"(\": \")\", \"[\": \"]\", \"{\": \"}\" }\n\n/**\n * Read a balanced bracketed region starting at `openIndex` (which must hold\n * `(`, `[` or `{`), returning the raw text *between* the brackets. Quote- and\n * nesting-aware so brackets inside string literals don't unbalance the scan.\n * Returns null when the region is never closed.\n */\nexport function readBracketBody(src: string, openIndex: number): string | null {\n const open = src[openIndex]\n if (!open || !OPENERS[open]) return null\n let depth = 0\n let quote: string | null = null\n for (let i = openIndex; i < src.length; i++) {\n const c = src[i]!\n if (quote) {\n if (c === \"\\\\\") i++\n else if (c === quote) quote = null\n continue\n }\n if (c === '\"' || c === \"'\" || c === \"`\") {\n quote = c\n continue\n }\n if (OPENERS[c]) depth++\n else if (c === \")\" || c === \"]\" || c === \"}\") {\n if (--depth === 0) return src.slice(openIndex + 1, i)\n }\n }\n return null\n}\n\n/**\n * Split an argument list or object body on top-level commas, ignoring commas\n * nested inside brackets or string literals. Empty parts are dropped.\n */\nexport function splitTopLevel(body: string): string[] {\n const parts: string[] = []\n let depth = 0\n let quote: string | null = null\n let start = 0\n for (let i = 0; i < body.length; i++) {\n const c = body[i]!\n if (quote) {\n if (c === \"\\\\\") i++\n else if (c === quote) quote = null\n continue\n }\n if (c === '\"' || c === \"'\" || c === \"`\") {\n quote = c\n continue\n }\n if (OPENERS[c]) depth++\n else if (c === \")\" || c === \"]\" || c === \"}\") depth--\n else if (c === \",\" && depth === 0) {\n parts.push(body.slice(start, i))\n start = i + 1\n }\n }\n parts.push(body.slice(start))\n return parts.map((p) => p.trim()).filter(Boolean)\n}\n\n/**\n * Lex a module just far enough to tell code, comments and string literals\n * apart, *without* moving anything: comments come back blanked to spaces\n * (newlines kept) so offsets and line numbers still match the raw file, and\n * `inString[i]` is 1 where offset `i` sits inside a `'…'`, `\"…\"` or `` `…` ``\n * literal (template `${…}` bodies count as string — close enough for literal\n * scans). `'`/`\"` literals end at a newline, so an apostrophe in JSX text\n * cannot swallow more than the rest of its own line.\n */\nexport function maskSource(src: string): { code: string; inString: Uint8Array } {\n const out = src.split(\"\")\n const inString = new Uint8Array(src.length)\n let i = 0\n while (i < src.length) {\n const c = src[i]!\n const next = src[i + 1]\n if (c === \"/\" && next === \"/\" && src[i - 1] !== \":\") {\n while (i < src.length && src[i] !== \"\\n\") out[i++] = \" \"\n continue\n }\n if (c === \"/\" && next === \"*\") {\n const end = src.indexOf(\"*/\", i + 2)\n const stop = end === -1 ? src.length : end + 2\n for (; i < stop; i++) if (src[i] !== \"\\n\") out[i] = \" \"\n continue\n }\n if (c === '\"' || c === \"'\" || c === \"`\") {\n i++\n while (i < src.length) {\n const d = src[i]!\n if (d === \"\\\\\") {\n inString[i] = 1\n inString[i + 1] = 1\n i += 2\n continue\n }\n if (d === c) break\n if (d === \"\\n\" && c !== \"`\") break\n inString[i++] = 1\n }\n i++\n continue\n }\n i++\n }\n return { code: out.join(\"\"), inString }\n}\n","import fs from \"node:fs\"\nimport { API_METHODS, type ApiMethod } from \"./constants\"\nimport { filePageMeta } from \"./file-page\"\nimport { extractPageMeta } from \"./route-tree\"\nimport { readBracketBody, splitTopLevel, stripComments } from \"./source\"\nimport type { ApiRoute, PageRoute, Segment } from \"./types\"\n\n/**\n * Best-effort *static* specs for the routes `vantage routes --detail` prints:\n * what a page takes in its path, and what an API route accepts and answers\n * with. Like `diagnostics.ts` this only reads text — user modules are never\n * imported or executed — so every field is a hint derived from the source, not\n * a guarantee. Callers pass sources through {@link stripComments} first.\n */\n\n/** A dynamic segment of a route path. */\nexport interface RouteParam {\n name: string\n kind: \"param\" | \"catchall\"\n}\n\n/** Static spec of a page route. */\nexport interface PageSpec {\n params: RouteParam[]\n title?: string\n description?: string\n navLabel?: string\n}\n\n/** The request body an API handler reads, when detectable. */\nexport interface ApiBodySpec {\n format: \"json\" | \"formData\" | \"text\" | \"binary\"\n /** Top-level keys, when the handler destructures them. */\n keys?: string[]\n}\n\n/** A response an API handler returns. */\nexport interface ApiResponseSpec {\n status: number\n /** Response content type, omitted when it can't be derived. */\n contentType?: string\n /** Top-level keys, when the payload is an object literal. */\n keys?: string[]\n}\n\n/** An `HttpError` an API handler throws. */\nexport interface ApiErrorSpec {\n status: number\n message?: string\n}\n\n/** Static spec of one HTTP method handler. */\nexport interface ApiMethodSpec {\n method: ApiMethod\n /** Query string keys read via `searchParams`. */\n query: string[]\n body?: ApiBodySpec\n responses: ApiResponseSpec[]\n errors: ApiErrorSpec[]\n}\n\n/** Static spec of an API route module. */\nexport interface ApiSpec {\n params: RouteParam[]\n methods: ApiMethodSpec[]\n}\n\n/**\n * HTTP method handlers a module exports (direct declaration or export list).\n * `src` must be comment-stripped. Shared with the `INVALID_API_EXPORT`\n * diagnostic so both agree on what counts as a handler.\n */\nexport function detectApiMethods(src: string): ApiMethod[] {\n return API_METHODS.filter(\n (m) =>\n new RegExp(`export\\\\s+(async\\\\s+)?(function|const|let|var)\\\\s+${m}\\\\b`).test(src) ||\n new RegExp(`export\\\\s*\\\\{[^}]*\\\\b${m}\\\\b[^}]*\\\\}`).test(src),\n )\n}\n\n/**\n * Slice the module into one source region per handler: from a handler's export\n * declaration to the next one (or EOF). Coarse on purpose — matching a function\n * body would have to cope with arrow bodies, overloads and trailing helpers —\n * and good enough because handlers are written one after another. A method\n * exported only through an export list gets the whole module as its region.\n */\nfunction methodRegions(src: string): Map<ApiMethod, string> {\n const re = new RegExp(\n `export\\\\s+(?:async\\\\s+)?(?:function|const|let|var)\\\\s+(${API_METHODS.join(\"|\")})\\\\b`,\n \"g\",\n )\n const decls: { method: ApiMethod; index: number }[] = []\n let m: RegExpExecArray | null\n while ((m = re.exec(src))) decls.push({ method: m[1] as ApiMethod, index: m.index })\n\n const regions = new Map<ApiMethod, string>()\n decls.forEach((d, i) => {\n regions.set(d.method, src.slice(d.index, decls[i + 1]?.index ?? src.length))\n })\n for (const method of detectApiMethods(src)) {\n if (!regions.has(method)) regions.set(method, src)\n }\n return regions\n}\n\n/** Top-level keys of an object literal expression, `…` standing in for spreads. */\nfunction objectKeys(expr: string): string[] | undefined {\n const trimmed = expr.trim()\n if (!trimmed.startsWith(\"{\")) return undefined\n const body = readBracketBody(trimmed, 0)\n if (body == null) return undefined\n const keys: string[] = []\n for (const part of splitTopLevel(body)) {\n if (part.startsWith(\"...\")) {\n keys.push(\"…\")\n continue\n }\n const name = part.match(/^[\"'`]?([A-Za-z0-9_$]+)/)\n if (name) keys.push(name[1]!)\n }\n return keys.length ? keys : undefined\n}\n\n/** Read `status: 201` out of a `ResponseInit` literal. */\nfunction initStatus(init: string | undefined): number | undefined {\n const m = init?.match(/\\bstatus\\s*:\\s*(\\d{3})\\b/)\n return m ? Number(m[1]) : undefined\n}\n\n/** Read a content-type header out of a `ResponseInit` literal. */\nfunction initContentType(init: string | undefined): string | undefined {\n const m = init?.match(/[\"']?content-type[\"']?\\s*:\\s*[\"']([^\"';]+)/i)\n return m ? m[1]!.trim() : undefined\n}\n\n/** Every `Response.json(…)` / `json(…)` / `new Response(…)` in a handler region. */\nfunction extractResponses(region: string): ApiResponseSpec[] {\n const re = /\\bnew\\s+Response\\s*\\(|\\bResponse\\s*\\.\\s*json\\s*\\(|(?<![.\\w$])json\\s*\\(/g\n const out: ApiResponseSpec[] = []\n const seen = new Set<string>()\n let m: RegExpExecArray | null\n while ((m = re.exec(region))) {\n const isJson = !m[0].startsWith(\"new\")\n const args = readBracketBody(region, m.index + m[0].length - 1)\n if (args == null) continue\n const [payload, init] = splitTopLevel(args)\n const contentType = isJson\n ? \"application/json\"\n : (initContentType(init) ??\n (payload?.startsWith(\"JSON.stringify\") ? \"application/json\" : undefined))\n const keys = isJson && payload ? objectKeys(payload) : undefined\n const spec: ApiResponseSpec = {\n status: initStatus(init) ?? 200,\n ...(contentType ? { contentType } : {}),\n ...(keys ? { keys } : {}),\n }\n const key = JSON.stringify(spec)\n if (seen.has(key)) continue\n seen.add(key)\n out.push(spec)\n }\n return out\n}\n\n/** Every `new HttpError(status, \"message\")` in a handler region. */\nfunction extractErrors(region: string): ApiErrorSpec[] {\n const re = /\\bHttpError\\s*\\(\\s*(\\d{3})\\s*(?:,\\s*(?:([\"'`])((?:\\\\.|(?!\\2)[\\s\\S])*)\\2))?/g\n const out: ApiErrorSpec[] = []\n const seen = new Set<string>()\n let m: RegExpExecArray | null\n while ((m = re.exec(region))) {\n const message = m[3]?.replace(/\\\\(.)/g, \"$1\")\n const spec: ApiErrorSpec = { status: Number(m[1]), ...(message ? { message } : {}) }\n const key = JSON.stringify(spec)\n if (seen.has(key)) continue\n seen.add(key)\n out.push(spec)\n }\n return out\n}\n\n/** Query keys read through `searchParams.get/getAll/has(\"x\")`. */\nfunction extractQuery(region: string): string[] {\n const re = /searchParams\\s*\\.\\s*(?:get|getAll|has)\\s*\\(\\s*[\"'`]([^\"'`]+)[\"'`]/g\n const out = new Set<string>()\n let m: RegExpExecArray | null\n while ((m = re.exec(region))) out.add(m[1]!)\n return [...out]\n}\n\n/** The request body a handler reads, plus destructured keys when present. */\nfunction extractBody(region: string): ApiBodySpec | undefined {\n const read = region.match(/\\b(?:request|req)\\s*\\.\\s*(json|formData|text|arrayBuffer|blob)\\s*\\(/)\n if (!read) return undefined\n const method = read[1]!\n const format: ApiBodySpec[\"format\"] =\n method === \"json\" || method === \"formData\" || method === \"text\" ? method : \"binary\"\n\n const destructured = region.match(\n /(?:const|let|var)\\s*(\\{[\\s\\S]*?\\})\\s*=\\s*(?:await\\s+)?[\\w.]*\\.json\\s*\\(/,\n )\n const keys = format === \"json\" && destructured ? objectKeys(destructured[1]!) : undefined\n return { format, ...(keys ? { keys } : {}) }\n}\n\nfunction toParams(segments: Segment[]): RouteParam[] {\n const out: RouteParam[] = []\n for (const s of segments) {\n if (s.kind === \"static\") continue\n out.push({ name: s.name, kind: s.kind })\n }\n return out\n}\n\n/** Static spec of a page: its path params and its `definePage` metadata. */\nexport function extractPageSpec(page: PageRoute): PageSpec {\n // A data file has no `definePage` to read, and reading it as UTF-8 would\n // decode megabytes of spreadsheet binary; its title is derived from the name.\n const meta = page.kind === \"file\" ? filePageMeta(page) : extractPageMeta(page.absFile)\n return { params: toParams(page.segments), ...meta }\n}\n\n/** Static spec of an API route: path params and a per-method request/response sketch. */\nexport function extractApiSpec(api: ApiRoute): ApiSpec {\n const params = toParams(api.segments)\n let src: string\n try {\n src = stripComments(fs.readFileSync(api.absFile, \"utf8\"))\n } catch {\n return { params, methods: [] }\n }\n const regions = methodRegions(src)\n const methods = API_METHODS.filter((m) => regions.has(m)).map((method) => {\n const region = regions.get(method)!\n const body = extractBody(region)\n return {\n method,\n query: extractQuery(region),\n ...(body ? { body } : {}),\n responses: extractResponses(region),\n errors: extractErrors(region),\n }\n })\n return { params, methods }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildRouteTree, filePageModuleName, filePageKind } from './chunk-
|
|
1
|
+
import { buildRouteTree, filePageModuleName, filePageKind } from './chunk-CEXAQQ5W.js';
|
|
2
2
|
import { timed } from './chunk-ZVANIULZ.js';
|
|
3
3
|
import { VANTAGE_DIR, MANIFEST_SCHEMA_VERSION } from './chunk-C2CX6GLX.js';
|
|
4
4
|
import fs from 'fs';
|
|
@@ -247,5 +247,5 @@ function generateArtifacts({ root, model }) {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
export { generateArtifacts };
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
251
|
-
//# sourceMappingURL=chunk-
|
|
250
|
+
//# sourceMappingURL=chunk-LMUACBMA.js.map
|
|
251
|
+
//# sourceMappingURL=chunk-LMUACBMA.js.map
|