@squadbase/vantage 0.6.2-dev1.d7c0911 → 0.6.2-dev1.e30f2cc
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-X5NVCQKT.js → build-A23M4GCH.js} +7 -7
- package/dist/{build-X5NVCQKT.js.map → build-A23M4GCH.js.map} +1 -1
- package/dist/{check-ZBIH422T.js → check-FBHT6W6J.js} +5 -5
- package/dist/{check-ZBIH422T.js.map → check-FBHT6W6J.js.map} +1 -1
- package/dist/chunk-2IAPIOPS.js +152 -0
- package/dist/chunk-2IAPIOPS.js.map +1 -0
- package/dist/chunk-57GHR5LN.js +163 -0
- package/dist/chunk-57GHR5LN.js.map +1 -0
- package/dist/{chunk-7DZGJQ3P.js → chunk-5C2SEDPH.js} +21 -4
- package/dist/chunk-5C2SEDPH.js.map +1 -0
- package/dist/chunk-6OTTGAPO.js +44 -0
- package/dist/chunk-6OTTGAPO.js.map +1 -0
- package/dist/{chunk-XPQSTZUU.js → chunk-7S52M2SL.js} +4 -3
- package/dist/chunk-7S52M2SL.js.map +1 -0
- package/dist/{chunk-V3LF7BE7.js → chunk-ANZLVSEP.js} +4 -5
- package/dist/chunk-ANZLVSEP.js.map +1 -0
- package/dist/{chunk-XQUSGIDG.js → chunk-CKWPK4RO.js} +10 -3
- package/dist/chunk-CKWPK4RO.js.map +1 -0
- package/dist/chunk-JXFCSF3K.js +673 -0
- package/dist/chunk-JXFCSF3K.js.map +1 -0
- package/dist/{chunk-WRSX2MDK.js → chunk-QOXXOFGL.js} +115 -930
- package/dist/chunk-QOXXOFGL.js.map +1 -0
- package/dist/{chunk-CEXAQQ5W.js → chunk-S5MDTHH7.js} +180 -18
- package/dist/chunk-S5MDTHH7.js.map +1 -0
- package/dist/{chunk-2ICNHUG6.js → chunk-SDJTTMLK.js} +64 -7
- package/dist/chunk-SDJTTMLK.js.map +1 -0
- package/dist/{chunk-WAMZWZJB.js → chunk-SHZM3EXB.js} +19 -8
- package/dist/chunk-SHZM3EXB.js.map +1 -0
- package/dist/{chunk-JKLLFVEU.js → chunk-UWSQUHX6.js} +4 -99
- package/dist/chunk-UWSQUHX6.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +8 -2
- package/dist/client/index.js.map +1 -1
- package/dist/components/index.d.ts +13 -249
- package/dist/components/index.js +5 -2
- package/dist/delta-text-CvwBGJ95.d.ts +15 -0
- package/dist/{dev-4XEDTELV.js → dev-H4I2JL63.js} +7 -7
- package/dist/{dev-4XEDTELV.js.map → dev-H4I2JL63.js.map} +1 -1
- package/dist/doc/index.d.ts +215 -2
- package/dist/doc/index.js +307 -3
- package/dist/doc/index.js.map +1 -1
- package/dist/{doctor-5E2VEZPK.js → doctor-B2O3GJDU.js} +5 -5
- package/dist/{doctor-5E2VEZPK.js.map → doctor-B2O3GJDU.js.map} +1 -1
- package/dist/format-U0cQl069.d.ts +243 -0
- package/dist/query/index.js +2 -2
- package/dist/{routes-3SGAFDMC.js → routes-PVKNT777.js} +4 -4
- package/dist/{routes-3SGAFDMC.js.map → routes-PVKNT777.js.map} +1 -1
- package/dist/slide/index.d.ts +272 -1
- package/dist/slide/index.js +974 -4
- package/dist/slide/index.js.map +1 -1
- package/dist/table/index.js +8 -5
- package/dist/table/index.js.map +1 -1
- package/dist/ui/index.d.ts +4 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/index.js.map +1 -1
- package/dist/{upgrade-JHXZBGQS.js → upgrade-6DT7ADRP.js} +4 -4
- package/dist/{upgrade-JHXZBGQS.js.map → upgrade-6DT7ADRP.js.map} +1 -1
- package/dist/vite/index.js +3 -3
- package/docs/en/changelog.md +2 -0
- package/docs/en/components.md +13 -2
- package/docs/en/doc/delta-text.md +40 -0
- package/docs/en/doc/doc-action-items.md +49 -0
- package/docs/en/doc/doc-callout.md +38 -0
- package/docs/en/doc/doc-data-table.md +60 -0
- package/docs/en/doc/doc-executive-summary.md +64 -0
- package/docs/en/doc/doc-figure.md +56 -0
- package/docs/en/doc/doc-key-findings.md +61 -0
- package/docs/en/doc/doc-kpi-scorecard.md +80 -0
- package/docs/en/doc/doc-notes-and-sources.md +43 -0
- package/docs/en/doc/doc-report-header.md +46 -0
- package/docs/en/pages-and-metadata.md +15 -0
- package/docs/en/parts/area-chart.md +99 -0
- package/docs/en/parts/bar-chart.md +91 -0
- package/docs/en/parts/bar-list.md +50 -0
- package/docs/en/parts/category-bar.md +37 -0
- package/docs/en/parts/chart-frame.md +39 -0
- package/docs/en/parts/delta.md +4 -3
- package/docs/en/parts/donut-chart.md +72 -0
- package/docs/en/parts/funnel-steps.md +2 -1
- package/docs/en/parts/heatmap.md +53 -0
- package/docs/en/parts/kpi-card.md +2 -1
- package/docs/en/parts/legend.md +35 -0
- package/docs/en/parts/line-chart.md +94 -0
- package/docs/en/parts/progress-circle.md +33 -0
- package/docs/en/parts/sample-data.md +39 -0
- package/docs/en/parts/scatter-chart.md +56 -0
- package/docs/en/parts/tracker.md +36 -0
- package/docs/en/parts/updated-at.md +30 -0
- package/docs/en/parts/waterfall-chart.md +56 -0
- package/docs/en/slide/slide-chart-full.md +48 -0
- package/docs/en/slide/slide-chart-insight.md +52 -0
- package/docs/en/slide/slide-columns.md +46 -0
- package/docs/en/slide/slide-comparison.md +68 -0
- package/docs/en/slide/slide-cover.md +39 -0
- package/docs/en/slide/slide-exec-summary.md +47 -0
- package/docs/en/slide/slide-heading.md +38 -0
- package/docs/en/slide/slide-kpi-grid.md +55 -0
- package/docs/en/slide/slide-kpi-hero.md +58 -0
- package/docs/en/slide/slide-next-actions.md +49 -0
- package/docs/en/slide/slide-scorecard-table.md +54 -0
- package/docs/en/slide/slide-section.md +44 -0
- package/docs/en/slide/slide-source-line.md +34 -0
- package/docs/en/ui/alert-dialog.md +42 -0
- package/docs/en/ui/avatar.md +31 -0
- package/docs/en/ui/combobox.md +74 -0
- package/docs/en/ui/drawer.md +41 -0
- package/docs/en/ui/empty.md +1 -1
- package/docs/en/ui/error-state.md +4 -3
- package/docs/en/ui/field.md +42 -0
- package/docs/en/ui/hover-card.md +21 -0
- package/docs/en/ui/kbd.md +17 -0
- package/docs/en/ui/loading.md +1 -1
- package/docs/en/ui/pagination.md +36 -0
- package/docs/en/ui/radio-group.md +21 -0
- package/docs/en/ui/toast.md +44 -0
- package/docs/en/ui/toggle-group.md +4 -3
- package/docs/index.json +857 -77
- package/docs/ja/changelog.md +2 -0
- package/docs/ja/components.md +12 -1
- package/docs/ja/doc/delta-text.md +40 -0
- package/docs/ja/doc/doc-action-items.md +49 -0
- package/docs/ja/doc/doc-callout.md +38 -0
- package/docs/ja/doc/doc-data-table.md +60 -0
- package/docs/ja/doc/doc-executive-summary.md +64 -0
- package/docs/ja/doc/doc-figure.md +56 -0
- package/docs/ja/doc/doc-key-findings.md +61 -0
- package/docs/ja/doc/doc-kpi-scorecard.md +80 -0
- package/docs/ja/doc/doc-notes-and-sources.md +43 -0
- package/docs/ja/doc/doc-report-header.md +46 -0
- package/docs/ja/page-types/slide.md +1 -0
- package/docs/ja/pages-and-metadata.md +15 -0
- package/docs/ja/parts/area-chart.md +49 -25
- package/docs/ja/parts/bar-chart.md +50 -24
- package/docs/ja/parts/bar-list.md +31 -8
- package/docs/ja/parts/chart-frame.md +36 -0
- package/docs/ja/parts/delta.md +5 -4
- package/docs/ja/parts/donut-chart.md +45 -26
- package/docs/ja/parts/funnel-steps.md +27 -8
- package/docs/ja/parts/heatmap.md +45 -0
- package/docs/ja/parts/kpi-card.md +2 -1
- package/docs/ja/parts/legend.md +36 -0
- package/docs/ja/parts/line-chart.md +48 -22
- package/docs/ja/parts/sample-data.md +61 -0
- package/docs/ja/parts/scatter-chart.md +69 -0
- package/docs/ja/parts/updated-at.md +27 -0
- package/docs/ja/parts/waterfall-chart.md +61 -0
- package/docs/ja/slide/slide-chart-full.md +48 -0
- package/docs/ja/slide/slide-chart-insight.md +52 -0
- package/docs/ja/slide/slide-columns.md +46 -0
- package/docs/ja/slide/slide-comparison.md +68 -0
- package/docs/ja/slide/slide-cover.md +39 -0
- package/docs/ja/slide/slide-exec-summary.md +47 -0
- package/docs/ja/slide/slide-heading.md +38 -0
- package/docs/ja/slide/slide-kpi-grid.md +55 -0
- package/docs/ja/slide/slide-kpi-hero.md +58 -0
- package/docs/ja/slide/slide-next-actions.md +49 -0
- package/docs/ja/slide/slide-scorecard-table.md +54 -0
- package/docs/ja/slide/slide-section.md +44 -0
- package/docs/ja/slide/slide-source-line.md +34 -0
- package/docs/ja/ui/empty.md +1 -1
- package/docs/ja/ui/error-state.md +4 -3
- package/docs/ja/ui/loading.md +1 -1
- package/docs/ja/ui/toggle-group.md +4 -3
- package/package.json +26 -25
- package/registry/ui/accordion.tsx +1 -1
- package/registry/ui/alert-dialog.tsx +1 -1
- package/registry/ui/alert.tsx +1 -1
- package/registry/ui/app-shell.tsx +1 -1
- package/registry/ui/area-chart.tsx +89 -27
- package/registry/ui/attention-list.tsx +303 -0
- package/registry/ui/avatar.tsx +1 -1
- package/registry/ui/badge.tsx +1 -1
- package/registry/ui/bar-chart.tsx +89 -27
- package/registry/ui/bar-list.tsx +88 -25
- package/registry/ui/box-plot-chart.tsx +3906 -0
- package/registry/ui/breadcrumb.tsx +1 -1
- package/registry/ui/button.tsx +1 -1
- package/registry/ui/calendar.tsx +1 -1
- package/registry/ui/card.tsx +1 -1
- package/registry/ui/category-bar.tsx +55 -20
- package/registry/ui/chart-frame.tsx +57 -22
- package/registry/ui/checkbox.tsx +1 -1
- package/registry/ui/collapsible.tsx +1 -1
- package/registry/ui/combobox.tsx +1 -1
- package/registry/ui/command.tsx +1 -1
- package/registry/ui/dashboard-card.tsx +5 -5
- package/registry/ui/data-table.tsx +1 -1
- package/registry/ui/date-range-picker.tsx +1 -1
- package/registry/ui/delta.tsx +12 -9
- package/registry/ui/dialog.tsx +1 -1
- package/registry/ui/donut-chart.tsx +90 -27
- package/registry/ui/drawer.tsx +1 -1
- package/registry/ui/dropdown-menu.tsx +1 -1
- package/registry/ui/echart.tsx +195 -45
- package/registry/ui/field.tsx +1 -1
- package/registry/ui/filter-bar.tsx +1 -1
- package/registry/ui/funnel-steps.tsx +34 -6
- package/registry/ui/heatmap.tsx +56 -22
- package/registry/ui/histogram-chart.tsx +3986 -0
- package/registry/ui/hover-card.tsx +1 -1
- package/registry/ui/input-group.tsx +1 -1
- package/registry/ui/input.tsx +1 -1
- package/registry/ui/kbd.tsx +1 -1
- package/registry/ui/kpi-card.tsx +42 -15
- package/registry/ui/label.tsx +1 -1
- package/registry/ui/legend.tsx +88 -25
- package/registry/ui/line-chart.tsx +89 -27
- package/registry/ui/metric-value.tsx +1 -1
- package/registry/ui/multi-select.tsx +1 -1
- package/registry/ui/page-shell.tsx +11 -11
- package/registry/ui/pagination.tsx +1 -1
- package/registry/ui/paired-chart.tsx +3827 -0
- package/registry/ui/placeholder.tsx +1 -1
- package/registry/ui/popover.tsx +1 -1
- package/registry/ui/progress-circle.tsx +1 -1
- package/registry/ui/progress.tsx +1 -1
- package/registry/ui/radio-group.tsx +1 -1
- package/registry/ui/sample-data.tsx +2 -2
- package/registry/ui/scatter-chart.tsx +89 -27
- package/registry/ui/scroll-area.tsx +1 -1
- package/registry/ui/searchable-select.tsx +1 -1
- package/registry/ui/section-header.tsx +3 -3
- package/registry/ui/segmented-control.tsx +1 -1
- package/registry/ui/select.tsx +1 -1
- package/registry/ui/separator.tsx +1 -1
- package/registry/ui/sheet.tsx +1 -1
- package/registry/ui/sidebar.tsx +1 -1
- package/registry/ui/skeleton.tsx +1 -1
- package/registry/ui/slider.tsx +2 -2
- package/registry/ui/sparkline.tsx +1 -1
- package/registry/ui/spinner.tsx +1 -1
- package/registry/ui/states.tsx +1 -1
- package/registry/ui/status-badge.tsx +9 -9
- package/registry/ui/switch.tsx +1 -1
- package/registry/ui/table.tsx +1 -1
- package/registry/ui/tabs.tsx +1 -1
- package/registry/ui/textarea.tsx +1 -1
- package/registry/ui/toast.tsx +1 -1
- package/registry/ui/toggle-group.tsx +1 -1
- package/registry/ui/toggle.tsx +1 -1
- package/registry/ui/tooltip.tsx +7 -3
- package/registry/ui/tracker.tsx +10 -4
- package/registry/ui/trend-indicator.tsx +3 -3
- package/registry/ui/updated-at.tsx +1 -1
- package/registry/ui/waterfall-chart.tsx +89 -27
- package/skills/vantage-design/SKILL.md +34 -24
- package/skills/vantage-design/references/extract.md +16 -14
- package/skills/vantage-design/references/format.md +6 -5
- package/skills/vantage-design/references/presets.md +60 -110
- package/skills/vantage-pitfalls/SKILL.md +5 -0
- package/skills/vantage-slide/SKILL.md +54 -36
- package/templates/AGENTS.md +4 -2
- package/templates/agents/doc.md +48 -0
- package/templates/agents/page.md +32 -1
- package/templates/agents/slide.md +70 -2
- package/theme.css +32 -24
- package/dist/chunk-2ICNHUG6.js.map +0 -1
- package/dist/chunk-7DZGJQ3P.js.map +0 -1
- package/dist/chunk-CEXAQQ5W.js.map +0 -1
- package/dist/chunk-JKLLFVEU.js.map +0 -1
- package/dist/chunk-V3LF7BE7.js.map +0 -1
- package/dist/chunk-WAMZWZJB.js.map +0 -1
- package/dist/chunk-WRSX2MDK.js.map +0 -1
- package/dist/chunk-XPQSTZUU.js.map +0 -1
- package/dist/chunk-XQUSGIDG.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/api-change.ts","../src/core/generate.ts"],"names":["require"],"mappings":";;;;;;;;;;AAMO,IAAM,gBAAA,GAAmB;ACMhC,IAAM,GAAA,GAAM,oBAAA;AAGZ,IAAM,cAAA,GAAiB,YAAA;AAOvB,IAAM,WAAA,GAAc,gBAAA;AAOpB,IAAM,eAAA,uBAAsB,GAAA,EAA2B;AAEvD,SAAS,kBAAkB,IAAA,EAA6B;AACtD,EAAA,MAAM,GAAA,GAAM,eAAA,CAAgB,GAAA,CAAI,IAAI,CAAA;AACpC,EAAA,IAAI,GAAA,KAAQ,QAAW,OAAO,GAAA;AAC9B,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI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Y,sBAAsB,CAAA,EAAG,kBAAA,CAAmB,KAAK,CAAC,CAAA;AAAA,IACzF;AAEA,IAAA,OAAO,UAAA;AAAA,EACT,CAAC,CAAA;AACH","file":"chunk-SHZM3EXB.js","sourcesContent":["/**\n * Custom HMR event the dev server sends when a `server/api` module is added,\n * changed or removed. Payload: `{ paths: string[] }` (project-relative). The\n * client entry listens and refetches the API queries; a client without the\n * listener ignores it.\n */\nexport const API_CHANGE_EVENT = \"vantage:api-change\"\n","import fs from \"node:fs\"\nimport path from \"node:path\"\nimport { createRequire } from \"node:module\"\nimport { API_CHANGE_EVENT } from \"./api-change\"\nimport { MANIFEST_SCHEMA_VERSION, VANTAGE_DIR } from \"./constants\"\nimport { filePageKind, filePageModuleName } from \"./file-page\"\nimport { timed } from \"./profile\"\nimport { buildRouteTree, extractAppLang } from \"./route-tree\"\nimport type { BuiltPage, BuiltTree } from \"./route-tree\"\nimport { routeSortKey } from \"./scan\"\nimport type { PageRoute, RouteModel, Segment } from \"./types\"\n\nconst PKG = \"@squadbase/vantage\"\n\n/** Subdirectory of `.vantage/` holding one wrapper module per data-file page. */\nconst FILE_PAGES_DIR = \"file-pages\"\n\n/**\n * Vite inlines an asset under 4 KB as a base64 data URL, which would bury a\n * small `.csv` inside a JS chunk and leave the download link pointing at it.\n * `?no-inline` is checked before the size limit, so it always wins.\n */\nconst ASSET_QUERY = \"?url&no-inline\"\n\n/**\n * Resolve the absolute directory of the installed @squadbase/vantage package.\n * Memoized per root: module resolution is comparatively expensive and the answer\n * cannot change while the process lives.\n */\nconst vantageDirCache = new Map<string, string | null>()\n\nfunction resolveVantageDir(root: string): string | null {\n const hit = vantageDirCache.get(root)\n if (hit !== undefined) return hit\n let dir: string | null\n try {\n const require = createRequire(path.join(root, \"noop.js\"))\n dir = path.dirname(require.resolve(`${PKG}/package.json`))\n } catch {\n dir = null\n }\n vantageDirCache.set(root, dir)\n return dir\n}\n\n/** POSIX import specifier from `.vantage/` to a project-relative file. */\nfunction importFromVantage(relFile: string): string {\n return `../${relFile}`\n}\n\n/**\n * POSIX import specifier from `.vantage/file-pages/` to a project-relative\n * file — one level deeper than `importFromVantage`. Do not mix the two up. The\n * \".vantage/ sits exactly one level below the project root\" invariant still\n * holds for the directory itself; this is a second, explicit depth used only\n * by the generated wrappers.\n */\nfunction importFromFilePages(relFile: string): string {\n return `../../${relFile}`\n}\n\nfunction ensureDir(dir: string): void {\n fs.mkdirSync(dir, { recursive: true })\n}\n\nfunction writeIfChanged(file: string, content: string): void {\n try {\n if (fs.existsSync(file) && fs.readFileSync(file, \"utf8\") === content) return\n } catch {\n /* fall through to write */\n }\n fs.writeFileSync(file, content)\n}\n\nfunction serializeSegments(segments: Segment[]): string {\n return (\n \"[\" +\n segments\n .map((s) => {\n if (s.kind === \"static\") return `{ kind: \"static\", value: ${JSON.stringify(s.value)} }`\n if (s.kind === \"param\") return `{ kind: \"param\", name: ${JSON.stringify(s.name)} }`\n return `{ kind: \"catchall\", name: ${JSON.stringify(s.name)} }`\n })\n .join(\", \") +\n \"]\"\n )\n}\n\nconst BANNER =\n \"// AUTO-GENERATED by @squadbase/vantage. Do not edit — regenerated on every run.\\n\"\n\nfunction renderRouteTree(tree: BuiltTree): string {\n const lines: string[] = []\n lines.push(BANNER)\n lines.push(`import type { ClientManifest } from \"${PKG}/client\"`)\n lines.push(\"\")\n lines.push(\"export const manifest: ClientManifest = {\")\n lines.push(\n ` rootLayout: ${tree.rootLayout ? `() => import(${JSON.stringify(importFromVantage(tree.rootLayout))})` : \"null\"},`,\n )\n lines.push(\n ` notFound: ${tree.notFound ? `() => import(${JSON.stringify(importFromVantage(tree.notFound))})` : \"null\"},`,\n )\n lines.push(\n ` error: ${tree.error ? `() => import(${JSON.stringify(importFromVantage(tree.error))})` : \"null\"},`,\n )\n lines.push(\" layouts: [\")\n for (const l of tree.layouts) {\n lines.push(\n ` { id: ${JSON.stringify(l.id)}, parentId: ${JSON.stringify(l.parentId)}, path: ${JSON.stringify(\n l.path,\n )}, load: () => import(${JSON.stringify(importFromVantage(l.file))}) },`,\n )\n }\n lines.push(\" ],\")\n lines.push(\" pages: [\")\n for (const p of tree.pages) {\n const extra: string[] = []\n if (p.title) extra.push(`title: ${JSON.stringify(p.title)}`)\n if (p.description) extra.push(`description: ${JSON.stringify(p.description)}`)\n if (p.navLabel) extra.push(`navLabel: ${JSON.stringify(p.navLabel)}`)\n if (p.kind !== \"module\") extra.push(`kind: ${JSON.stringify(p.kind)}`)\n if (p.variant) extra.push(`variant: ${JSON.stringify(p.variant)}`)\n // A data file is not a module, so the manifest loads the wrapper generated\n // for it instead. Everything else about the entry is unchanged, which is\n // why the client manifest shape stays the same.\n const specifier =\n p.kind === \"file\"\n ? `./${FILE_PAGES_DIR}/${filePageModuleName(p)}`\n : importFromVantage(p.file)\n lines.push(\n ` { parentLayoutId: ${JSON.stringify(p.parentLayoutId)}, path: ${JSON.stringify(\n p.path,\n )}, index: ${p.index}, routePath: ${JSON.stringify(p.routePath)}${\n extra.length ? \", \" + extra.join(\", \") : \"\"\n }, load: () => import(${JSON.stringify(specifier)}) },`,\n )\n }\n lines.push(\" ],\")\n lines.push(\"}\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\nfunction renderServerRoutes(model: RouteModel): string {\n const lines: string[] = []\n lines.push(BANNER)\n lines.push(`import type { ProdApiRoute } from \"${PKG}/server/node\"`)\n model.apis.forEach((a, i) => {\n lines.push(`import * as m${i} from ${JSON.stringify(importFromVantage(a.file))}`)\n })\n lines.push(\"\")\n lines.push(\"export const apiRoutes: ProdApiRoute[] = [\")\n model.apis.forEach((a, i) => {\n lines.push(\n ` { routePath: ${JSON.stringify(a.routePath)}, segments: ${serializeSegments(\n a.segments,\n )}, module: m${i} },`,\n )\n })\n lines.push(\"]\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\nexport function renderIndexHtml(lang = \"en\"): string {\n return `<!doctype html>\n<html lang=\"${lang}\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Vantage</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/.vantage/client-entry.tsx\"></script>\n </body>\n</html>\n`\n}\n\nfunction renderClientEntry(draft: boolean): string {\n if (!draft) {\n return `${BANNER}import { bootstrap } from \"${PKG}/client\"\nimport { manifest } from \"./route-tree.gen\"\nimport \"./runtime.css\"\n\nconst app = bootstrap(manifest)\n\n// @ts-ignore -- HMR types are not part of the generated env\nif (import.meta.hot) {\n // @ts-ignore -- HMR types are not part of the generated env\n import.meta.hot.on(\"${API_CHANGE_EVENT}\", () => app.refreshApi())\n}\n`\n }\n // Draft preview: the route tree is an HMR boundary, so a provisional page can\n // join it without a reload. `import.meta.hot` is not in the generated env\n // types (an app that pulls in vite/client would see a duplicate declaration\n // if it were), hence the ignores.\n return `${BANNER}import { bootstrap } from \"${PKG}/client\"\nimport type { ClientManifest } from \"${PKG}/client\"\nimport { manifest } from \"./route-tree.gen\"\nimport \"./runtime.css\"\n\n// @ts-ignore -- HMR types are not part of the generated env\nconst hot = import.meta.hot\nconst app = bootstrap(manifest, { hot })\n\n// @ts-ignore -- HMR types are not part of the generated env\nif (import.meta.hot) {\n // @ts-ignore -- HMR types are not part of the generated env\n import.meta.hot.on(\"${API_CHANGE_EVENT}\", () => app.refreshApi())\n // @ts-ignore -- HMR types are not part of the generated env\n import.meta.hot.accept(\"./route-tree.gen\", (mod: { manifest: ClientManifest } | undefined) => {\n if (mod) app.update(mod.manifest)\n })\n}\n`\n}\n\nfunction renderRuntimeCss(root: string, pageDir: string): string {\n const parts: string[] = []\n parts.push('@import \"tailwindcss\";')\n parts.push(`@import \"${PKG}/theme.css\";`)\n // The global stylesheet lives next to the pages: styles.css at the project\n // root, or src/styles.css once src/ exists (`SRC_DIR_SPLIT` catches a leftover\n // root-level one instead of importing both).\n const stylesRel = pageDir === \"\" ? \"styles.css\" : `${pageDir}/styles.css`\n if (fs.existsSync(path.join(root, stylesRel))) {\n parts.push(`@import \"../${stylesRel}\";`)\n }\n // Tailwind auto-detects the Vite project root; the packaged components live\n // in node_modules, which Tailwind skips by default, so register them here.\n // The whole of dist/ has to be scanned, not just dist/ui and dist/components:\n // tsup hoists code shared between entries into top-level dist/chunk-*.js, and\n // that is where most of the component class strings end up.\n const vantageDir = resolveVantageDir(root)\n if (vantageDir) {\n parts.push(`@source ${JSON.stringify(path.join(vantageDir, \"dist\"))};`)\n }\n return parts.join(\"\\n\") + \"\\n\"\n}\n\nfunction renderEnvTypes(): string {\n return `${BANNER}\ninterface ImportMetaEnv {\n readonly MODE: string\n readonly DEV: boolean\n readonly PROD: boolean\n readonly SSR: boolean\n readonly BASE_URL: string\n readonly [key: \\`PUBLIC_\\${string}\\`]: string | undefined\n}\n\ninterface ImportMeta {\n readonly env: ImportMetaEnv\n}\n\ndeclare module \"*.css\" {\n const content: string\n export default content\n}\n\n// Generated data-file pages import their source with Vite's asset query. The\n// app's tsconfig includes .vantage/**/*.tsx, so the wrappers are type-checked\n// alongside the app and need this declaration to resolve.\ndeclare module \"*?url&no-inline\" {\n const src: string\n export default src\n}\n`\n}\n\nfunction renderInternalManifest(model: RouteModel): string {\n return (\n JSON.stringify(\n {\n schemaVersion: MANIFEST_SCHEMA_VERSION,\n pageDir: model.pageDir,\n pages: model.pages.map((p) => ({ file: p.file, route: p.routePath })),\n apis: model.apis.map((a) => ({ file: a.file, route: a.routePath })),\n hasServer: model.hasServer,\n },\n null,\n 2,\n ) + \"\\n\"\n )\n}\n\n/**\n * The wrapper module standing in for one data-file page. Thin on purpose: the\n * asset import is what puts the file through Vite's pipeline (hashed in the\n * build, a stable URL in dev), and everything else lives in the viewer.\n */\nfunction renderFilePageWrapper(page: BuiltPage): string {\n const fileName = path.posix.basename(page.file)\n const props = [\n `kind=${JSON.stringify(filePageKind(page))}`,\n \"src={src}\",\n `fileName={${JSON.stringify(fileName)}}`,\n ...(page.title ? [`title={${JSON.stringify(page.title)}}`] : []),\n ]\n return `${BANNER}import { FilePageView } from \"${PKG}/table\"\nimport src from ${JSON.stringify(importFromFilePages(page.file) + ASSET_QUERY)}\n\n// ${page.file} -> ${page.routePath}\nexport default function FilePage() {\n return <FilePageView ${props.join(\" \")} />\n}\n`\n}\n\n/**\n * One wrapper module per data-file page. `writeIfChanged` never deletes, so\n * orphans are pruned explicitly: a renamed `.csv` would otherwise leave behind\n * a wrapper importing a file that no longer exists — invisible to the build\n * (rollup only follows the manifest) but a hard error in the app's own `tsc`.\n */\nfunction writeFilePages(vantageDir: string, tree: { pages: BuiltPage[] }): void {\n const dir = path.join(vantageDir, FILE_PAGES_DIR)\n const filePages = tree.pages.filter((p) => p.kind === \"file\")\n if (filePages.length === 0) {\n fs.rmSync(dir, { recursive: true, force: true })\n return\n }\n ensureDir(dir)\n const keep = new Set<string>()\n for (const page of filePages) {\n const name = filePageModuleName(page)\n keep.add(name)\n writeIfChanged(path.join(dir, name), renderFilePageWrapper(page))\n }\n for (const entry of fs.readdirSync(dir)) {\n if (!keep.has(entry)) fs.rmSync(path.join(dir, entry), { force: true })\n }\n}\n\n/** Options controlling artifact generation. */\nexport interface GenerateOptions {\n root: string\n model: RouteModel\n}\n\n/**\n * What the draft preview layers over a plain scan. Held per project root rather\n * than passed in, because the dev watcher regenerates on its own and must keep\n * producing the same tree while a draft is open.\n */\nexport interface DraftArtifacts {\n /** The client entry accepts route-tree updates instead of reloading. */\n hmr: boolean\n /** Pages with no file on disk yet, merged into the route tree. */\n pages: PageRoute[]\n}\n\nconst draftArtifacts = new Map<string, DraftArtifacts>()\n\n/** Set (or, with `null`, clear) the draft layer for `root`. */\nexport function setDraftArtifacts(root: string, draft: DraftArtifacts | null): void {\n if (draft) draftArtifacts.set(root, draft)\n else draftArtifacts.delete(root)\n}\n\n/**\n * Write the client entry this root's dev server serves, if the file on disk is\n * something else. A `vantage build` run in the same project (a deploy's prebuild\n * next to a dev server with draft preview) writes the production entry, which has\n * no HMR hooks; the draft layer puts its own back (see `vite/draft/plugin.ts`).\n * Only the entry: a route tree with provisional pages must not reach a build.\n * True when it had to be rewritten.\n */\nexport function restoreClientEntry(root: string): boolean {\n const file = path.join(root, VANTAGE_DIR, \"client-entry.tsx\")\n const content = renderClientEntry(Boolean(draftArtifacts.get(root)?.hmr))\n try {\n if (fs.readFileSync(file, \"utf8\") === content) return false\n } catch {\n /* fall through to write */\n }\n fs.writeFileSync(file, content)\n return true\n}\n\n/**\n * The model the route tree is built from: the scan plus the drafted pages. A\n * page the scan already found wins over its draft, so the tree is the same\n * before and after the file lands.\n */\nfunction withDraftPages(model: RouteModel, draft: DraftArtifacts | undefined): RouteModel {\n if (!draft || draft.pages.length === 0) return model\n const known = new Set(model.pages.map((p) => p.file))\n const extra = draft.pages.filter((p) => !known.has(p.file))\n if (extra.length === 0) return model\n return {\n ...model,\n pages: [...model.pages, ...extra].sort((a, b) => routeSortKey(a).localeCompare(routeSortKey(b))),\n }\n}\n\n/**\n * Regenerate the `.vantage/` directory from a route model. Idempotent and\n * content-stable so it does not thrash file watchers.\n */\nexport function generateArtifacts({ root, model }: GenerateOptions): string {\n return timed(\"generate\", () => {\n const vantageDir = path.join(root, VANTAGE_DIR)\n ensureDir(vantageDir)\n ensureDir(path.join(vantageDir, \"types\"))\n\n // Everything in .vantage is generated and git/agent/search invisible.\n writeIfChanged(path.join(vantageDir, \".gitignore\"), \"*\\n\")\n writeIfChanged(path.join(vantageDir, \"index.html\"), renderIndexHtml(extractAppLang(model)))\n const draft = draftArtifacts.get(root)\n writeIfChanged(path.join(vantageDir, \"client-entry.tsx\"), renderClientEntry(Boolean(draft?.hmr)))\n // Built once and shared: `renderRouteTree` and `writeFilePages` need the\n // same tree, and building it twice re-reads every page module for metadata.\n const tree = buildRouteTree(withDraftPages(model, draft))\n writeIfChanged(path.join(vantageDir, \"route-tree.gen.ts\"), renderRouteTree(tree))\n writeIfChanged(path.join(vantageDir, \"runtime.css\"), renderRuntimeCss(root, model.pageDir))\n writeIfChanged(path.join(vantageDir, \"types\", \"env.d.ts\"), renderEnvTypes())\n writeIfChanged(path.join(vantageDir, \"manifest.json\"), renderInternalManifest(model))\n\n writeFilePages(vantageDir, tree)\n\n if (model.hasServer) {\n writeIfChanged(path.join(vantageDir, \"server-routes.gen.ts\"), renderServerRoutes(model))\n }\n\n return vantageDir\n })\n}\n"]}
|
|
@@ -1,103 +1,8 @@
|
|
|
1
|
-
import { filePageMeta, extractPageMeta } from './chunk-
|
|
1
|
+
import { filePageMeta, extractPageMeta, stripComments, readBracketBody, splitTopLevel } from './chunk-S5MDTHH7.js';
|
|
2
2
|
import { API_METHODS } from './chunk-C2CX6GLX.js';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
|
|
5
5
|
// @squadbase/vantage — generated build. Do not edit.
|
|
6
|
-
|
|
7
|
-
// src/core/source.ts
|
|
8
|
-
function stripComments(src) {
|
|
9
|
-
return src.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:"'`\\])\/\/[^\n]*/g, "$1");
|
|
10
|
-
}
|
|
11
|
-
var OPENERS = { "(": ")", "[": "]", "{": "}" };
|
|
12
|
-
function readBracketBody(src, openIndex) {
|
|
13
|
-
const open = src[openIndex];
|
|
14
|
-
if (!open || !OPENERS[open]) return null;
|
|
15
|
-
let depth = 0;
|
|
16
|
-
let quote = null;
|
|
17
|
-
for (let i = openIndex; i < src.length; i++) {
|
|
18
|
-
const c = src[i];
|
|
19
|
-
if (quote) {
|
|
20
|
-
if (c === "\\") i++;
|
|
21
|
-
else if (c === quote) quote = null;
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
if (c === '"' || c === "'" || c === "`") {
|
|
25
|
-
quote = c;
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (OPENERS[c]) depth++;
|
|
29
|
-
else if (c === ")" || c === "]" || c === "}") {
|
|
30
|
-
if (--depth === 0) return src.slice(openIndex + 1, i);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
function splitTopLevel(body) {
|
|
36
|
-
const parts = [];
|
|
37
|
-
let depth = 0;
|
|
38
|
-
let quote = null;
|
|
39
|
-
let start = 0;
|
|
40
|
-
for (let i = 0; i < body.length; i++) {
|
|
41
|
-
const c = body[i];
|
|
42
|
-
if (quote) {
|
|
43
|
-
if (c === "\\") i++;
|
|
44
|
-
else if (c === quote) quote = null;
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
if (c === '"' || c === "'" || c === "`") {
|
|
48
|
-
quote = c;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (OPENERS[c]) depth++;
|
|
52
|
-
else if (c === ")" || c === "]" || c === "}") depth--;
|
|
53
|
-
else if (c === "," && depth === 0) {
|
|
54
|
-
parts.push(body.slice(start, i));
|
|
55
|
-
start = i + 1;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
parts.push(body.slice(start));
|
|
59
|
-
return parts.map((p) => p.trim()).filter(Boolean);
|
|
60
|
-
}
|
|
61
|
-
function maskSource(src) {
|
|
62
|
-
const out = src.split("");
|
|
63
|
-
const inString = new Uint8Array(src.length);
|
|
64
|
-
let i = 0;
|
|
65
|
-
while (i < src.length) {
|
|
66
|
-
const c = src[i];
|
|
67
|
-
const next = src[i + 1];
|
|
68
|
-
if (c === "/" && next === "/" && src[i - 1] !== ":") {
|
|
69
|
-
while (i < src.length && src[i] !== "\n") out[i++] = " ";
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
if (c === "/" && next === "*") {
|
|
73
|
-
const end = src.indexOf("*/", i + 2);
|
|
74
|
-
const stop = end === -1 ? src.length : end + 2;
|
|
75
|
-
for (; i < stop; i++) if (src[i] !== "\n") out[i] = " ";
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (c === '"' || c === "'" || c === "`") {
|
|
79
|
-
i++;
|
|
80
|
-
while (i < src.length) {
|
|
81
|
-
const d = src[i];
|
|
82
|
-
if (d === "\\") {
|
|
83
|
-
inString[i] = 1;
|
|
84
|
-
inString[i + 1] = 1;
|
|
85
|
-
i += 2;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (d === c) break;
|
|
89
|
-
if (d === "\n" && c !== "`") break;
|
|
90
|
-
inString[i++] = 1;
|
|
91
|
-
}
|
|
92
|
-
i++;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
i++;
|
|
96
|
-
}
|
|
97
|
-
return { code: out.join(""), inString };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// src/core/route-spec.ts
|
|
101
6
|
function detectApiMethods(src) {
|
|
102
7
|
return API_METHODS.filter(
|
|
103
8
|
(m) => new RegExp(`export\\s+(async\\s+)?(function|const|let|var)\\s+${m}\\b`).test(src) || new RegExp(`export\\s*\\{[^}]*\\b${m}\\b[^}]*\\}`).test(src)
|
|
@@ -236,6 +141,6 @@ function extractApiSpec(api) {
|
|
|
236
141
|
return { params, methods };
|
|
237
142
|
}
|
|
238
143
|
|
|
239
|
-
export { detectApiMethods, extractApiSpec, extractPageSpec
|
|
240
|
-
//# sourceMappingURL=chunk-
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
export { detectApiMethods, extractApiSpec, extractPageSpec };
|
|
145
|
+
//# sourceMappingURL=chunk-UWSQUHX6.js.map
|
|
146
|
+
//# sourceMappingURL=chunk-UWSQUHX6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/route-spec.ts"],"names":[],"mappings":";;;;;AAwEO,SAAS,iBAAiB,GAAA,EAA0B;AACzD,EAAA,OAAO,WAAA,CAAY,MAAA;AAAA,IACjB,CAAC,CAAA,KACC,IAAI,OAAO,CAAA,kDAAA,EAAqD,CAAC,KAAK,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA,IAChF,IAAI,MAAA,CAAO,CAAA,qBAAA,EAAwB,CAAC,CAAA,WAAA,CAAa,CAAA,CAAE,KAAK,GAAG;AAAA,G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,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-UWSQUHX6.js","sourcesContent":["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"]}
|
package/dist/cli.js
CHANGED
|
@@ -50,16 +50,16 @@ ${pc.bold("Options")}
|
|
|
50
50
|
-h, --help Print this help
|
|
51
51
|
`;
|
|
52
52
|
var COMMANDS = {
|
|
53
|
-
dev: () => import('./dev-
|
|
54
|
-
build: () => import('./build-
|
|
53
|
+
dev: () => import('./dev-H4I2JL63.js').then((m) => m.dev),
|
|
54
|
+
build: () => import('./build-A23M4GCH.js').then((m) => m.build),
|
|
55
55
|
preview: () => import('./preview-T6CLSQVX.js').then((m) => m.preview),
|
|
56
|
-
check: () => import('./check-
|
|
57
|
-
routes: () => import('./routes-
|
|
56
|
+
check: () => import('./check-FBHT6W6J.js').then((m) => m.check),
|
|
57
|
+
routes: () => import('./routes-PVKNT777.js').then((m) => m.routes),
|
|
58
58
|
add: () => import('./add-4GHF2TX2.js').then((m) => m.add),
|
|
59
59
|
docs: () => import('./docs-JVP4RPKT.js').then((m) => m.docs),
|
|
60
60
|
search: () => import('./search-5LC4XPB5.js').then((m) => m.search),
|
|
61
|
-
doctor: () => import('./doctor-
|
|
62
|
-
upgrade: () => import('./upgrade-
|
|
61
|
+
doctor: () => import('./doctor-B2O3GJDU.js').then((m) => m.doctor),
|
|
62
|
+
upgrade: () => import('./upgrade-6DT7ADRP.js').then((m) => m.upgrade)
|
|
63
63
|
};
|
|
64
64
|
var NO_ROOT_POSITIONAL = /* @__PURE__ */ new Set(["add", "docs", "search"]);
|
|
65
65
|
async function main() {
|
package/dist/client/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ interface BootstrapOptions {
|
|
|
20
20
|
interface BootstrapHandle {
|
|
21
21
|
/** The route tree changed (a page appeared or went away): draw from the new manifest. */
|
|
22
22
|
update(manifest: ClientManifest): void;
|
|
23
|
+
/** A `server/api` module changed (dev): refetch the API queries, errored ones included. */
|
|
24
|
+
refreshApi(): void;
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* Client entrypoint. The generated `.vantage/client-entry.tsx` calls this with
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setRoutes } from '../chunk-6S4BAIGV.js';
|
|
2
|
-
import { createQueryClient, setDraftActive, isDraftSettling, SETTLING_MS } from '../chunk-
|
|
2
|
+
import { createQueryClient, refreshApiQueries, API_REFRESH_DEBOUNCE_MS, setDraftActive, isDraftSettling, SETTLING_MS } from '../chunk-CKWPK4RO.js';
|
|
3
3
|
import { StrictMode, Component, createRef, useSyncExternalStore } from 'react';
|
|
4
4
|
import { createRoot } from 'react-dom/client';
|
|
5
5
|
import { RouterProvider, createRootRoute, createRoute, createRouter, Outlet, lazyRouteComponent } from '@tanstack/react-router';
|
|
@@ -283,6 +283,11 @@ function bootstrap(manifest, options = {}) {
|
|
|
283
283
|
setRoutes(manifest);
|
|
284
284
|
const holder = createRouterHolder(buildRouter(manifest, { draft: Boolean(hot) }).router);
|
|
285
285
|
const queryClient = createQueryClient();
|
|
286
|
+
let refreshTimer;
|
|
287
|
+
const refreshApi = () => {
|
|
288
|
+
clearTimeout(refreshTimer);
|
|
289
|
+
refreshTimer = setTimeout(() => void refreshApiQueries(queryClient), API_REFRESH_DEBOUNCE_MS);
|
|
290
|
+
};
|
|
286
291
|
const defaultTitle = document.title;
|
|
287
292
|
const updateTitle = () => {
|
|
288
293
|
try {
|
|
@@ -303,7 +308,7 @@ function bootstrap(manifest, options = {}) {
|
|
|
303
308
|
/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(AppErrorBoundary, { children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(RouterProvider, { router: holder.get() }) }) }) })
|
|
304
309
|
);
|
|
305
310
|
updateTitle();
|
|
306
|
-
return { update: () => location.reload() };
|
|
311
|
+
return { update: () => location.reload(), refreshApi };
|
|
307
312
|
}
|
|
308
313
|
let currentManifest = manifest;
|
|
309
314
|
let pendingRoute = null;
|
|
@@ -335,6 +340,7 @@ function bootstrap(manifest, options = {}) {
|
|
|
335
340
|
);
|
|
336
341
|
updateTitle();
|
|
337
342
|
return {
|
|
343
|
+
refreshApi,
|
|
338
344
|
update(next) {
|
|
339
345
|
currentManifest = next;
|
|
340
346
|
setRoutes(next);
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/states.tsx","../../src/client/error-boundary.tsx","../../src/client/build-router.tsx","../../src/client/draft.tsx","../../src/client/self-heal.ts","../../src/client/bootstrap.tsx","../../src/client/draft-skeleton.tsx"],"names":["jsx","Component"],"mappings":";;;;;;;;;AAIO,SAAS,cAAA,GAA4B;AAC1C,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,+CAAA,EAAgD,IAAA,EAAK,QAAA,EAAS,WAAA,EAAU,QAAA,EACrF,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wEAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,WAAU,gFAAA,EAAiF,CAAA;AAAA,IAAE;AAAA,GAAA,EAErG,CAAA,EACF,CAAA;AAEJ;AAEO,SAAS,YAAA,CAAa,EAAE,KAAA,EAAM,EAAkC;AACrE,EAAA,MAAM,UAAU,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AACrE,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAU,uBAAA,EAAwB,MAAK,OAAA,EAC1C,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4EAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,wDAAA,EAAyD,QAAA,EAAA,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Y,cAAc,WAAW,CAAA;AAErE,MAAA,IAAI,YAAA,KAAiB,IAAA,IAAQ,QAAA,CAAS,YAAY,CAAA,EAAG;AACnD,QAAA,MAAM,KAAA,GAAQ,YAAA;AACd,QAAA,YAAA,GAAe,IAAA;AACf,QAAA,KAAK,KAAK,KAAK,CAAA;AAAA,MACjB,WAAW,WAAA,KAAgB,IAAA,IAAQ,CAAC,QAAA,CAAS,WAAW,CAAA,EAAG;AAEzD,QAAA,IAAI,QAAA,CAAS,QAAA,KAAa,WAAA,EAAa,KAAK,OAAO,GAAA,EAAI,CAAE,QAAA,CAAS,EAAE,EAAA,EAAI,GAAA,EAAK,CAAA,CAAE,MAAM,MAAM;AAAA,QAAC,CAAC,CAAA;AAC7F,QAAA,WAAA,GAAc,IAAA;AAAA,MAChB;AAAA,IACF;AAAA,GACF;AACF;AC1LO,SAAS,aAAA,GAA2B;AACzC,EAAA,uBACEA,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,uBAAA,EAAqB,IAAA;AAAA,MACrB,aAAA,EAAY,MAAA;AAAA,MACZ,SAAA,EAAU,mCAAA;AAAA,MACV,KAAA,EAAO,EAAE,SAAA,EAAW,MAAA,EAAQ,OAAO,MAAA;AAAO;AAAA,GAC5C;AAEJ","file":"index.js","sourcesContent":["import type { ReactNode } from \"react\"\n\n/** Minimal internal states used as router-level defaults. */\n\nexport function DefaultPending(): ReactNode {\n return (\n <div className=\"flex min-h-[40vh] items-center justify-center\" role=\"status\" aria-live=\"polite\">\n <div className=\"flex items-center gap-3 text-sm text-[var(--muted-foreground,#71717a)]\">\n <span className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\" />\n Loading…\n </div>\n </div>\n )\n}\n\nexport function DefaultError({ error }: { error: unknown }): ReactNode {\n const message = error instanceof Error ? error.message : String(error)\n return (\n <div className=\"mx-auto max-w-2xl p-6\" role=\"alert\">\n <div className=\"rounded-lg border border-[var(--border,#e4e4e7)] bg-[var(--card,#fff)] p-6\">\n <h2 className=\"text-lg font-semibold text-[var(--foreground,#09090b)]\">Something went wrong</h2>\n <p className=\"mt-2 text-sm text-[var(--muted-foreground,#71717a)]\">{message}</p>\n </div>\n </div>\n )\n}\n\nexport function DefaultNotFound(): ReactNode {\n return (\n <div className=\"mx-auto max-w-2xl p-6 text-center\">\n <p className=\"text-5xl font-bold text-[var(--muted-foreground,#a1a1aa)]\">404</p>\n <h2 className=\"mt-3 text-lg font-semibold text-[var(--foreground,#09090b)]\">Page not found</h2>\n <p className=\"mt-1 text-sm text-[var(--muted-foreground,#71717a)]\">\n The page you are looking for does not exist.\n </p>\n </div>\n )\n}\n","import { Component, type ErrorInfo, type ReactNode } from \"react\"\nimport { DefaultError } from \"./states\"\n\ninterface Props {\n children: ReactNode\n fallback?: (error: unknown) => ReactNode\n}\n\ninterface State {\n error: unknown\n}\n\n/**\n * Top-level error boundary that wraps the entire application (outside the\n * router). Route-level errors are handled by the router's errorComponent; this\n * catches catastrophic render failures in the provider tree.\n */\nexport class AppErrorBoundary extends Component<Props, State> {\n state: State = { error: null }\n\n static getDerivedStateFromError(error: unknown): State {\n return { error }\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo): void {\n // Forwarded to the terminal in dev via the console bridge.\n console.error(\"[vantage] Unhandled application error:\", error, info.componentStack)\n }\n\n render(): ReactNode {\n if (this.state.error != null) {\n return this.props.fallback\n ? this.props.fallback(this.state.error)\n : <DefaultError error={this.state.error} />\n }\n return this.props.children\n }\n}\n","import {\n createRootRoute,\n createRoute,\n createRouter,\n lazyRouteComponent,\n Outlet,\n} from \"@tanstack/react-router\"\nimport { isDraftSettling } from \"./draft-state\"\nimport type { ClientManifest, Loader } from \"./manifest\"\nimport { DefaultError, DefaultNotFound, DefaultPending } from \"./states\"\n\n// The programmatic route tree fights TanStack's file-route generics, which are\n// designed for codegen. Internal assembly is intentionally untyped; the public\n// surface (pages, definePage) stays fully typed.\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype AnyRoute = any\n\nfunction RootPassthrough() {\n return <Outlet />\n}\n\nfunction lazyComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\nfunction lazyErrorComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\n/**\n * While a draft is showing, a failing route must not draw the error page: the\n * error goes up to the draft boundary, which keeps the previous screen. With no\n * draft active this renders the wrapped component untouched.\n */\nfunction draftGuarded(Inner: AnyRoute): AnyRoute {\n return function DraftGuardedError(props: { error: unknown }) {\n if (isDraftSettling()) throw props.error\n return <Inner {...props} />\n }\n}\n\nexport interface BuildRouterOptions {\n /** Route the draft preview's failures to the draft boundary (see `draftGuarded`). */\n draft?: boolean\n}\n\nexport interface BuiltRouter {\n router: AnyRoute\n /** routeId -> page meta, for the title manager. */\n meta: Map<string, { title?: string; description?: string; routePath: string }>\n}\n\n/** Assemble a TanStack Router instance from the generated manifest. */\nexport function buildRouter(manifest: ClientManifest, options: BuildRouterOptions = {}): BuiltRouter {\n const guard = options.draft ? draftGuarded : (c: AnyRoute) => c\n const rootRoute = createRootRoute({\n component: manifest.rootLayout ? lazyComponent(manifest.rootLayout) : RootPassthrough,\n errorComponent: guard(manifest.error ? lazyErrorComponent(manifest.error) : DefaultError),\n notFoundComponent: manifest.notFound ? lazyComponent(manifest.notFound) : DefaultNotFound,\n })\n\n const layoutById = new Map<string, AnyRoute>()\n const childrenByParent = new Map<string, AnyRoute[]>()\n const meta = new Map<string, { title?: string; description?: string; routePath: string }>()\n\n const pushChild = (parentKey: string, route: AnyRoute) => {\n const list = childrenByParent.get(parentKey) ?? []\n list.push(route)\n childrenByParent.set(parentKey, list)\n }\n\n // 1. Create layout routes (parents referenced lazily via getParentRoute).\n for (const layout of manifest.layouts) {\n const parentKey = layout.parentId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n layout.parentId ? layoutById.get(layout.parentId)! : rootRoute,\n path: layout.path,\n component: lazyComponent(layout.load),\n } as AnyRoute)\n layoutById.set(layout.id, route)\n pushChild(parentKey, route)\n }\n\n // 2. Create page routes.\n for (const page of manifest.pages) {\n const parentKey = page.parentLayoutId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n page.parentLayoutId ? layoutById.get(page.parentLayoutId)! : rootRoute,\n path: page.path,\n component: lazyComponent(page.load),\n staticData: { title: page.title, description: page.description, routePath: page.routePath },\n } as AnyRoute)\n pushChild(parentKey, route)\n // route.id is finalized after createRouter; index by routePath-derived key\n // is unreliable, so the title manager reads staticData off matches instead.\n }\n\n // 3. Attach children — deepest layouts first so nested trees are built before\n // their parent references them.\n const layoutsDeepFirst = [...manifest.layouts].sort(\n (a, b) => layoutDepth(b, manifest) - layoutDepth(a, manifest),\n )\n for (const layout of layoutsDeepFirst) {\n const route = layoutById.get(layout.id)!\n route.addChildren(childrenByParent.get(layout.id) ?? [])\n }\n rootRoute.addChildren(childrenByParent.get(\"__root__\") ?? [])\n\n const router = createRouter({\n routeTree: rootRoute,\n defaultPendingComponent: DefaultPending,\n defaultErrorComponent: guard(DefaultError),\n defaultNotFoundComponent: DefaultNotFound,\n defaultPreload: \"intent\",\n scrollRestoration: true,\n // The router's own outermost boundary would catch the error a guarded error\n // component rethrows and draw its stock error page; let it reach the draft\n // boundary around the router instead.\n ...(options.draft ? { disableGlobalCatchBoundary: true } : {}),\n } as AnyRoute)\n\n return { router, meta }\n}\n\nfunction layoutDepth(layout: { id: string; parentId: string | null }, manifest: ClientManifest): number {\n let depth = 0\n let current: string | null = layout.parentId\n const byId = new Map(manifest.layouts.map((l) => [l.id, l]))\n while (current) {\n depth++\n current = byId.get(current)?.parentId ?? null\n }\n return depth\n}\n","import { Component, createRef, type ReactNode } from \"react\"\nimport { isDraftActive, isDraftSettling, SETTLING_MS, setDraftActive } from \"./draft-state\"\n\n/** The slice of Vite's HMR context the draft layer uses. */\nexport interface DraftHot {\n on(event: string, cb: (data: any) => void): void // eslint-disable-line @typescript-eslint/no-explicit-any\n send(event: string, data?: unknown): void\n}\n\nconst resetListeners = new Set<() => void>()\n\n/** The files the server last said it holds a draft of (project-relative), to tell which one a failure came from. */\nlet draftFiles: string[] = []\n\n/**\n * How long a screen held after a draft failed waits for the version the server\n * falls back to. The update normally follows within a frame or two; if none\n * comes (nothing on disk to go back to) the children are drawn again after this.\n * Not before `isDraftSettling` is over: a final version that really throws would\n * be taken for the draft's failure once more and held with nobody left to reset it.\n */\nexport const DRAFT_END_RESET_MS = SETTLING_MS + 100\n\n/** Ask every draft boundary to draw its children again. */\nexport function resetDraftBoundaries(): void {\n for (const reset of resetListeners) reset()\n}\n\n/**\n * Wire the server's draft events to the client:\n * vantage:draft-state → `window.__VANTAGE_DRAFT__`, and back to live content a moment after it ends\n * vantage:draft-page → `onPage` (the router lives in bootstrap)\n * vantage:draft-page-closed → `onPageClosed` (a new page that was never written)\n * vite:afterUpdate → a newer version arrived, so try drawing again\n */\nexport function connectDraft(\n hot: DraftHot,\n handlers: { onPage(route: string): void; onPageClosed?(route: string): void },\n): void {\n hot.on(\"vantage:draft-state\", (data: { active?: boolean; files?: unknown } | undefined) => {\n const active = data?.active === true\n // Kept when the draft ends: a failure reported a moment later still names its file.\n if (active && Array.isArray(data?.files)) draftFiles = data.files.filter((f): f is string => typeof f === \"string\")\n setDraftActive(active)\n // Not at once: the server announces the end before it sends the version it\n // fell back to, and drawing the failing one again here would show the error page.\n if (!active) setTimeout(resetDraftBoundaries, DRAFT_END_RESET_MS)\n })\n hot.on(\"vantage:draft-page\", (data: { route?: string } | undefined) => {\n if (typeof data?.route === \"string\" && data.route !== \"\") handlers.onPage(data.route)\n })\n hot.on(\"vantage:draft-page-closed\", (data: { route?: string } | undefined) => {\n if (typeof data?.route === \"string\" && data.route !== \"\") handlers.onPageClosed?.(data.route)\n })\n hot.on(\"vite:afterUpdate\", () => resetDraftBoundaries())\n // The server only announces a change, so a page that loads while a draft is showing has to ask.\n hot.send(\"vantage:draft-sync\")\n}\n\n/**\n * The draft file a failure came from: the one named first in the stack (the\n * module that threw, then the components that rendered it). Browser stacks name\n * modules by their dev-server URL, so a project-relative path is looked for as a\n * `/path` followed by nothing that could extend it.\n */\nexport function draftFileInStack(stack: string | undefined, files: readonly string[]): string | undefined {\n if (!stack) return undefined\n let best: { file: string; at: number } | undefined\n for (const file of files) {\n const needle = `/${file}`\n for (let at = stack.indexOf(needle); at !== -1; at = stack.indexOf(needle, at + 1)) {\n if (/[\\w./-]/.test(stack.charAt(at + needle.length))) continue\n if (best === undefined || at < best.at) best = { file, at }\n break\n }\n }\n return best?.file\n}\n\n/**\n * Tell the server the draft threw while rendering, so it can fall back to the\n * version before. `file` is the draft the failure came from when the stack names\n * one; without it the server steps back the draft it applied last.\n */\nexport function reportDraftRenderError(hot: DraftHot, error: unknown, componentStack?: string): void {\n const message = error instanceof Error ? error.message : String(error)\n const stack = [error instanceof Error ? error.stack : undefined, componentStack].filter(Boolean).join(\"\\n\")\n const file = draftFileInStack(stack, draftFiles)\n hot.send(\"vantage:draft-render-error\", file === undefined ? { message } : { file, message })\n}\n\n/**\n * Tell the surrounding editor a draft page is on screen. A no-op outside an\n * iframe: there is nobody to tell.\n */\nexport function announceDraftPage(route: string, parent: Window = window.parent): void {\n if (parent === window) return\n parent.postMessage({ source: \"vantage\", type: \"vantage:draft-page-opened\", path: route }, \"*\")\n}\n\n/** Tell the surrounding editor a draft page it was told about is gone. */\nexport function announceDraftPageClosed(route: string, parent: Window = window.parent): void {\n if (parent === window) return\n parent.postMessage({ source: \"vantage\", type: \"vantage:draft-page-closed\", path: route }, \"*\")\n}\n\n/** A copy of what is on screen, canvases included (cloning a canvas leaves it blank). */\nfunction freeze(host: HTMLElement): Node {\n const copy = host.cloneNode(true) as HTMLElement\n const from = host.querySelectorAll(\"canvas\")\n const to = copy.querySelectorAll(\"canvas\")\n from.forEach((canvas, i) => {\n try {\n to[i]?.getContext(\"2d\")?.drawImage(canvas, 0, 0)\n } catch {\n /* a canvas that cannot be read stays blank */\n }\n })\n return copy\n}\n\ninterface Props {\n children: ReactNode\n onError?: (error: unknown, componentStack?: string) => void\n}\n\ninterface State {\n hasError: boolean\n error: unknown\n /** The failure happened while a draft was showing (the draft may end before the screen is redrawn). */\n draft: boolean\n generation: number\n}\n\n/**\n * Keeps the previous screen up when a draft throws while rendering.\n *\n * Wraps the router. While a draft is showing, the error components rethrow\n * (see `build-router`) instead of drawing the error page, and that lands here:\n * the DOM as it was just before the failure is copied and kept, the server is\n * told (`onError`), and it falls back to the version before. The next HMR\n * update — or the draft ending — draws the children again. Without an active\n * draft nothing is caught: the error goes on to `AppErrorBoundary` as before.\n */\nexport class DraftFreezeBoundary extends Component<Props, State> {\n state: State = { hasError: false, error: null, draft: false, generation: 0 }\n private host = createRef<HTMLDivElement>()\n private frozen = createRef<HTMLDivElement>()\n\n static getDerivedStateFromError(error: unknown): Partial<State> {\n return { hasError: true, error, draft: isDraftSettling() }\n }\n\n componentDidMount(): void {\n resetListeners.add(this.reset)\n }\n\n componentWillUnmount(): void {\n resetListeners.delete(this.reset)\n }\n\n // Runs before the commit touches the DOM, so the screen is still the last good one.\n getSnapshotBeforeUpdate(_props: Props, prev: State): Node | null {\n if (!prev.hasError && this.state.hasError && this.host.current) return freeze(this.host.current)\n return null\n }\n\n componentDidUpdate(_props: Props, _prev: State, snapshot: Node | null): void {\n if (snapshot && this.frozen.current) this.frozen.current.replaceChildren(...Array.from(snapshot.childNodes))\n }\n\n componentDidCatch(error: unknown, info?: { componentStack?: string | null }): void {\n if (isDraftSettling()) this.props.onError?.(error, info?.componentStack ?? undefined)\n }\n\n private reset = (): void => {\n if (this.state.hasError) {\n this.setState((s) => ({ hasError: false, error: null, draft: false, generation: s.generation + 1 }))\n }\n }\n\n render(): ReactNode {\n if (this.state.hasError) {\n // Not a draft's failure: leave it to the boundary above.\n if (!this.state.draft) throw this.state.error\n return <div ref={this.frozen} data-vantage-draft-frozen style={{ display: \"contents\" }} />\n }\n return (\n <div key={this.state.generation} ref={this.host} style={{ display: \"contents\" }}>\n {this.props.children}\n </div>\n )\n }\n}\n","/**\n * Stale-chunk self-healing.\n *\n * A published app is served build-by-build: its HTML references content-hashed\n * JS chunks that belong to one build. When the app is re-published, an\n * already-open tab can end up requesting a chunk hash that the newly-served\n * build no longer has (the routing pin that keeps a session on one build is\n * short-lived by design), which fails the dynamic import. Vite emits\n * `vite:preloadError` for exactly that case.\n *\n * We reload once to pick up the new build. A short sessionStorage cooldown keeps\n * a genuinely-unreachable chunk (offline, or a build that was garbage-collected)\n * from turning into an infinite reload loop — after the first failed reload the\n * error is allowed to surface to the error boundary instead.\n */\nconst RELOAD_COOLDOWN_MS = 10_000\nconst RELOAD_STAMP_KEY = \"__vantage_chunk_reload_at\"\n\n// Messages browsers use when a dynamic import / module preload fails to load.\nconst DYNAMIC_IMPORT_FAILURE = /Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i\n\nfunction reloadOnceForStaleChunk(): void {\n let last = 0\n try {\n last = Number(window.sessionStorage.getItem(RELOAD_STAMP_KEY) ?? \"0\")\n } catch {\n // sessionStorage can throw in private/embedded contexts — treat as \"no prior reload\".\n }\n if (Number.isFinite(last) && Date.now() - last < RELOAD_COOLDOWN_MS) {\n // Already reloaded very recently; the chunk is still unreachable, so stop\n // reloading and let the error surface rather than looping.\n return\n }\n try {\n window.sessionStorage.setItem(RELOAD_STAMP_KEY, String(Date.now()))\n } catch {\n // best-effort — a failed write just means we can't dedupe, not a reason to skip healing.\n }\n window.location.reload()\n}\n\n/**\n * Register global listeners that reload the page when a chunk from a\n * now-replaced build fails to load. Safe to call once at bootstrap; a no-op\n * outside the browser.\n */\nexport function registerChunkErrorSelfHeal(): void {\n if (typeof window === \"undefined\") return\n\n // Vite's canonical signal for a failed dynamic-import preload. Calling\n // preventDefault() stops Vite from re-throwing; we reload instead.\n window.addEventListener(\"vite:preloadError\", (event) => {\n event.preventDefault()\n reloadOnceForStaleChunk()\n })\n\n // Belt-and-suspenders: a dynamic import that fails without a modulepreload\n // surfaces as an unhandled rejection. Only act on the specific stale-module\n // messages so unrelated rejections are left alone.\n window.addEventListener(\"unhandledrejection\", (event) => {\n const reason = event.reason\n const message = reason instanceof Error ? reason.message : String(reason ?? \"\")\n if (DYNAMIC_IMPORT_FAILURE.test(message)) {\n reloadOnceForStaleChunk()\n }\n })\n}\n","import { StrictMode, useSyncExternalStore } from \"react\"\nimport { createRoot } from \"react-dom/client\"\nimport { RouterProvider } from \"@tanstack/react-router\"\nimport { QueryClientProvider } from \"@tanstack/react-query\"\nimport { createQueryClient } from \"../query/client\"\nimport { setRoutes } from \"../router/registry\"\nimport { AppErrorBoundary } from \"./error-boundary\"\nimport { buildRouter } from \"./build-router\"\nimport {\n announceDraftPage,\n announceDraftPageClosed,\n connectDraft,\n DraftFreezeBoundary,\n reportDraftRenderError,\n type DraftHot,\n} from \"./draft\"\nimport { registerChunkErrorSelfHeal } from \"./self-heal\"\nimport type { ClientManifest } from \"./manifest\"\n\nexport interface BootstrapOptions {\n /**\n * The HMR context of the generated entry, passed only when the draft preview\n * is on. Its presence is what switches the draft behaviour on; without it the\n * client is exactly what it was.\n */\n hot?: DraftHot\n}\n\nexport interface BootstrapHandle {\n /** The route tree changed (a page appeared or went away): draw from the new manifest. */\n update(manifest: ClientManifest): void\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyRouter = any\n\n/** The current router, swappable without remounting the providers above it. */\nfunction createRouterHolder(initial: AnyRouter) {\n let current = initial\n const listeners = new Set<() => void>()\n return {\n get: (): AnyRouter => current,\n set(next: AnyRouter) {\n current = next\n for (const l of listeners) l()\n },\n subscribe(l: () => void) {\n listeners.add(l)\n return () => {\n listeners.delete(l)\n }\n },\n }\n}\n\ntype RouterHolder = ReturnType<typeof createRouterHolder>\n\nfunction SwappableRouter({ holder }: { holder: RouterHolder }) {\n const router = useSyncExternalStore(holder.subscribe, holder.get)\n return <RouterProvider router={router} />\n}\n\n/**\n * Client entrypoint. The generated `.vantage/client-entry.tsx` calls this with\n * the route manifest. Owns React root creation and the provider tree:\n *\n * <AppErrorBoundary>\n * <QueryClientProvider>\n * <RouterProvider />\n *\n * With the draft preview on (`options.hot`) the router sits in a swappable\n * holder inside a `DraftFreezeBoundary`, so a new route tree can replace it and\n * a failing draft can keep the previous screen.\n */\nexport function bootstrap(manifest: ClientManifest, options: BootstrapOptions = {}): BootstrapHandle {\n const { hot } = options\n // Recover from stale chunks after a re-publish: reload once when a dynamic\n // import fails because the served build changed under an open tab.\n registerChunkErrorSelfHeal()\n\n // Publish the route list before the first render so `useRoutes()` is\n // populated for the very first page, not one paint late.\n setRoutes(manifest)\n\n const holder = createRouterHolder(buildRouter(manifest, { draft: Boolean(hot) }).router)\n const queryClient = createQueryClient()\n\n // The document's initial title is the fallback for pages without a definePage\n // title, so navigating away from a titled page doesn't leave a stale title.\n const defaultTitle = document.title\n\n const updateTitle = () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const matches: any[] = holder.get().state?.matches ?? []\n const leaf = matches[matches.length - 1]\n const title = leaf?.staticData?.title\n document.title = typeof title === \"string\" && title.length > 0 ? title : defaultTitle\n } catch {\n /* title updates are best-effort */\n }\n }\n let unsubscribeTitle: (() => void) | undefined = holder.get().subscribe?.(\"onResolved\", updateTitle)\n\n const el = document.getElementById(\"root\")\n if (!el) {\n throw new Error('[vantage] Root element \"#root\" was not found in the document.')\n }\n\n if (!hot) {\n createRoot(el).render(\n <StrictMode>\n <AppErrorBoundary>\n <QueryClientProvider client={queryClient}>\n <RouterProvider router={holder.get()} />\n </QueryClientProvider>\n </AppErrorBoundary>\n </StrictMode>,\n )\n updateTitle()\n // Only the draft preview swaps route trees; anyone else gets a plain reload.\n return { update: () => location.reload() }\n }\n\n let currentManifest = manifest\n /** A draft page announced before the route tree that holds it arrived. */\n let pendingRoute: string | null = null\n /** The draft page last opened, so its removal can move the screen off it. */\n let openedRoute: string | null = null\n\n const hasRoute = (route: string) => currentManifest.pages.some((p) => p.routePath === route)\n // A route with parameters has no single URL to move to.\n const navigable = (route: string) => !/[:*]/.test(route)\n\n const open = async (route: string): Promise<void> => {\n openedRoute = route\n try {\n await holder.get().navigate({ to: route })\n } catch {\n /* the screen stays where it was */\n }\n announceDraftPage(route)\n }\n\n connectDraft(hot, {\n onPage(route) {\n // Nothing to open for a route with parameters (the server does not announce one either).\n if (!navigable(route)) return\n if (hasRoute(route)) void open(route)\n else pendingRoute = route\n },\n onPageClosed(route) {\n if (!navigable(route)) return\n if (pendingRoute === route) pendingRoute = null\n announceDraftPageClosed(route)\n },\n })\n\n createRoot(el).render(\n <StrictMode>\n <AppErrorBoundary>\n <QueryClientProvider client={queryClient}>\n <DraftFreezeBoundary onError={(error, componentStack) => reportDraftRenderError(hot, error, componentStack)}>\n <SwappableRouter holder={holder} />\n </DraftFreezeBoundary>\n </QueryClientProvider>\n </AppErrorBoundary>\n </StrictMode>,\n )\n updateTitle()\n\n return {\n update(next) {\n currentManifest = next\n setRoutes(next)\n unsubscribeTitle?.()\n holder.set(buildRouter(next, { draft: true }).router)\n // A router that replaces a running one is not started by the provider: without\n // this the page it opens on stays blank until something navigates.\n void holder.get().load?.()\n unsubscribeTitle = holder.get().subscribe?.(\"onResolved\", updateTitle)\n\n if (pendingRoute !== null && hasRoute(pendingRoute)) {\n const route = pendingRoute\n pendingRoute = null\n void open(route)\n } else if (openedRoute !== null && !hasRoute(openedRoute)) {\n // The draft page was dropped: don't leave the screen on a dead route.\n if (location.pathname === openedRoute) void holder.get().navigate({ to: \"/\" }).catch(() => {})\n openedRoute = null\n }\n },\n }\n}\n","import type { ReactNode } from \"react\"\n\n/**\n * A frame with nothing in it, drawn where a part has not been written yet. Same\n * look as the placeholder the draft layer declares for a missing component, so\n * the two read as one thing on screen.\n */\nexport function DraftSkeleton(): ReactNode {\n return (\n <div\n data-vantage-skeleton\n aria-hidden=\"true\"\n className=\"animate-pulse rounded-md bg-muted\"\n style={{ minHeight: \"4rem\", width: \"100%\" }}\n />\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/client/states.tsx","../../src/client/error-boundary.tsx","../../src/client/build-router.tsx","../../src/client/draft.tsx","../../src/client/self-heal.ts","../../src/client/bootstrap.tsx","../../src/client/draft-skeleton.tsx"],"names":["jsx","Component"],"mappings":";;;;;;;;;AAIO,SAAS,cAAA,GAA4B;AAC1C,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,+CAAA,EAAgD,IAAA,EAAK,QAAA,EAAS,WAAA,EAAU,QAAA,EACrF,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wEAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,WAAU,gFAAA,EAAiF,CAAA;AAAA,IAAE;AAAA,GAAA,EAErG,CAAA,EACF,CAAA;AAEJ;AAEO,SAAS,YAAA,CAAa,EAAE,KAAA,EAAM,EAAkC;AACrE,EAAA,MAAM,UAAU,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AACrE,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAU,uBAAA,EAAwB,MAAK,OAAA,EAC1C,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4EAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,wDAAA,EAAyD,QAAA,EAAA,sBAAA,EAAoB,CAAA;AAAA,oBAC3F,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,qDAAA,EAAuD,QAAA,EAAA,OAAA,EAAQ;AAAA,GAAA,EAC9E,CAAA,EACF,CAAA;AAEJ;AAEO,SAAS,eAAA,GAA6B;AAC3C,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mCAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,S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;AACnD,QAAA,MAAM,KAAA,GAAQ,YAAA;AACd,QAAA,YAAA,GAAe,IAAA;AACf,QAAA,KAAK,KAAK,KAAK,CAAA;AAAA,MACjB,WAAW,WAAA,KAAgB,IAAA,IAAQ,CAAC,QAAA,CAAS,WAAW,CAAA,EAAG;AAEzD,QAAA,IAAI,QAAA,CAAS,QAAA,KAAa,WAAA,EAAa,KAAK,OAAO,GAAA,EAAI,CAAE,QAAA,CAAS,EAAE,EAAA,EAAI,GAAA,EAAK,CAAA,CAAE,MAAM,MAAM;AAAA,QAAC,CAAC,CAAA;AAC7F,QAAA,WAAA,GAAc,IAAA;AAAA,MAChB;AAAA,IACF;AAAA,GACF;AACF;ACpMO,SAAS,aAAA,GAA2B;AACzC,EAAA,uBACEA,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,uBAAA,EAAqB,IAAA;AAAA,MACrB,aAAA,EAAY,MAAA;AAAA,MACZ,SAAA,EAAU,mCAAA;AAAA,MACV,KAAA,EAAO,EAAE,SAAA,EAAW,MAAA,EAAQ,OAAO,MAAA;AAAO;AAAA,GAC5C;AAEJ","file":"index.js","sourcesContent":["import type { ReactNode } from \"react\"\n\n/** Minimal internal states used as router-level defaults. */\n\nexport function DefaultPending(): ReactNode {\n return (\n <div className=\"flex min-h-[40vh] items-center justify-center\" role=\"status\" aria-live=\"polite\">\n <div className=\"flex items-center gap-3 text-sm text-[var(--muted-foreground,#71717a)]\">\n <span className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\" />\n Loading…\n </div>\n </div>\n )\n}\n\nexport function DefaultError({ error }: { error: unknown }): ReactNode {\n const message = error instanceof Error ? error.message : String(error)\n return (\n <div className=\"mx-auto max-w-2xl p-6\" role=\"alert\">\n <div className=\"rounded-lg border border-[var(--border,#e4e4e7)] bg-[var(--card,#fff)] p-6\">\n <h2 className=\"text-lg font-semibold text-[var(--foreground,#09090b)]\">Something went wrong</h2>\n <p className=\"mt-2 text-sm text-[var(--muted-foreground,#71717a)]\">{message}</p>\n </div>\n </div>\n )\n}\n\nexport function DefaultNotFound(): ReactNode {\n return (\n <div className=\"mx-auto max-w-2xl p-6 text-center\">\n <p className=\"text-5xl font-bold text-[var(--muted-foreground,#a1a1aa)]\">404</p>\n <h2 className=\"mt-3 text-lg font-semibold text-[var(--foreground,#09090b)]\">Page not found</h2>\n <p className=\"mt-1 text-sm text-[var(--muted-foreground,#71717a)]\">\n The page you are looking for does not exist.\n </p>\n </div>\n )\n}\n","import { Component, type ErrorInfo, type ReactNode } from \"react\"\nimport { DefaultError } from \"./states\"\n\ninterface Props {\n children: ReactNode\n fallback?: (error: unknown) => ReactNode\n}\n\ninterface State {\n error: unknown\n}\n\n/**\n * Top-level error boundary that wraps the entire application (outside the\n * router). Route-level errors are handled by the router's errorComponent; this\n * catches catastrophic render failures in the provider tree.\n */\nexport class AppErrorBoundary extends Component<Props, State> {\n state: State = { error: null }\n\n static getDerivedStateFromError(error: unknown): State {\n return { error }\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo): void {\n // Forwarded to the terminal in dev via the console bridge.\n console.error(\"[vantage] Unhandled application error:\", error, info.componentStack)\n }\n\n render(): ReactNode {\n if (this.state.error != null) {\n return this.props.fallback\n ? this.props.fallback(this.state.error)\n : <DefaultError error={this.state.error} />\n }\n return this.props.children\n }\n}\n","import {\n createRootRoute,\n createRoute,\n createRouter,\n lazyRouteComponent,\n Outlet,\n} from \"@tanstack/react-router\"\nimport { isDraftSettling } from \"./draft-state\"\nimport type { ClientManifest, Loader } from \"./manifest\"\nimport { DefaultError, DefaultNotFound, DefaultPending } from \"./states\"\n\n// The programmatic route tree fights TanStack's file-route generics, which are\n// designed for codegen. Internal assembly is intentionally untyped; the public\n// surface (pages, definePage) stays fully typed.\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype AnyRoute = any\n\nfunction RootPassthrough() {\n return <Outlet />\n}\n\nfunction lazyComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\nfunction lazyErrorComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\n/**\n * While a draft is showing, a failing route must not draw the error page: the\n * error goes up to the draft boundary, which keeps the previous screen. With no\n * draft active this renders the wrapped component untouched.\n */\nfunction draftGuarded(Inner: AnyRoute): AnyRoute {\n return function DraftGuardedError(props: { error: unknown }) {\n if (isDraftSettling()) throw props.error\n return <Inner {...props} />\n }\n}\n\nexport interface BuildRouterOptions {\n /** Route the draft preview's failures to the draft boundary (see `draftGuarded`). */\n draft?: boolean\n}\n\nexport interface BuiltRouter {\n router: AnyRoute\n /** routeId -> page meta, for the title manager. */\n meta: Map<string, { title?: string; description?: string; routePath: string }>\n}\n\n/** Assemble a TanStack Router instance from the generated manifest. */\nexport function buildRouter(manifest: ClientManifest, options: BuildRouterOptions = {}): BuiltRouter {\n const guard = options.draft ? draftGuarded : (c: AnyRoute) => c\n const rootRoute = createRootRoute({\n component: manifest.rootLayout ? lazyComponent(manifest.rootLayout) : RootPassthrough,\n errorComponent: guard(manifest.error ? lazyErrorComponent(manifest.error) : DefaultError),\n notFoundComponent: manifest.notFound ? lazyComponent(manifest.notFound) : DefaultNotFound,\n })\n\n const layoutById = new Map<string, AnyRoute>()\n const childrenByParent = new Map<string, AnyRoute[]>()\n const meta = new Map<string, { title?: string; description?: string; routePath: string }>()\n\n const pushChild = (parentKey: string, route: AnyRoute) => {\n const list = childrenByParent.get(parentKey) ?? []\n list.push(route)\n childrenByParent.set(parentKey, list)\n }\n\n // 1. Create layout routes (parents referenced lazily via getParentRoute).\n for (const layout of manifest.layouts) {\n const parentKey = layout.parentId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n layout.parentId ? layoutById.get(layout.parentId)! : rootRoute,\n path: layout.path,\n component: lazyComponent(layout.load),\n } as AnyRoute)\n layoutById.set(layout.id, route)\n pushChild(parentKey, route)\n }\n\n // 2. Create page routes.\n for (const page of manifest.pages) {\n const parentKey = page.parentLayoutId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n page.parentLayoutId ? layoutById.get(page.parentLayoutId)! : rootRoute,\n path: page.path,\n component: lazyComponent(page.load),\n staticData: { title: page.title, description: page.description, routePath: page.routePath },\n } as AnyRoute)\n pushChild(parentKey, route)\n // route.id is finalized after createRouter; index by routePath-derived key\n // is unreliable, so the title manager reads staticData off matches instead.\n }\n\n // 3. Attach children — deepest layouts first so nested trees are built before\n // their parent references them.\n const layoutsDeepFirst = [...manifest.layouts].sort(\n (a, b) => layoutDepth(b, manifest) - layoutDepth(a, manifest),\n )\n for (const layout of layoutsDeepFirst) {\n const route = layoutById.get(layout.id)!\n route.addChildren(childrenByParent.get(layout.id) ?? [])\n }\n rootRoute.addChildren(childrenByParent.get(\"__root__\") ?? [])\n\n const router = createRouter({\n routeTree: rootRoute,\n defaultPendingComponent: DefaultPending,\n defaultErrorComponent: guard(DefaultError),\n defaultNotFoundComponent: DefaultNotFound,\n defaultPreload: \"intent\",\n scrollRestoration: true,\n // The router's own outermost boundary would catch the error a guarded error\n // component rethrows and draw its stock error page; let it reach the draft\n // boundary around the router instead.\n ...(options.draft ? { disableGlobalCatchBoundary: true } : {}),\n } as AnyRoute)\n\n return { router, meta }\n}\n\nfunction layoutDepth(layout: { id: string; parentId: string | null }, manifest: ClientManifest): number {\n let depth = 0\n let current: string | null = layout.parentId\n const byId = new Map(manifest.layouts.map((l) => [l.id, l]))\n while (current) {\n depth++\n current = byId.get(current)?.parentId ?? null\n }\n return depth\n}\n","import { Component, createRef, type ReactNode } from \"react\"\nimport { isDraftActive, isDraftSettling, SETTLING_MS, setDraftActive } from \"./draft-state\"\n\n/** The slice of Vite's HMR context the draft layer uses. */\nexport interface DraftHot {\n on(event: string, cb: (data: any) => void): void // eslint-disable-line @typescript-eslint/no-explicit-any\n send(event: string, data?: unknown): void\n}\n\nconst resetListeners = new Set<() => void>()\n\n/** The files the server last said it holds a draft of (project-relative), to tell which one a failure came from. */\nlet draftFiles: string[] = []\n\n/**\n * How long a screen held after a draft failed waits for the version the server\n * falls back to. The update normally follows within a frame or two; if none\n * comes (nothing on disk to go back to) the children are drawn again after this.\n * Not before `isDraftSettling` is over: a final version that really throws would\n * be taken for the draft's failure once more and held with nobody left to reset it.\n */\nexport const DRAFT_END_RESET_MS = SETTLING_MS + 100\n\n/** Ask every draft boundary to draw its children again. */\nexport function resetDraftBoundaries(): void {\n for (const reset of resetListeners) reset()\n}\n\n/**\n * Wire the server's draft events to the client:\n * vantage:draft-state → `window.__VANTAGE_DRAFT__`, and back to live content a moment after it ends\n * vantage:draft-page → `onPage` (the router lives in bootstrap)\n * vantage:draft-page-closed → `onPageClosed` (a new page that was never written)\n * vite:afterUpdate → a newer version arrived, so try drawing again\n */\nexport function connectDraft(\n hot: DraftHot,\n handlers: { onPage(route: string): void; onPageClosed?(route: string): void },\n): void {\n hot.on(\"vantage:draft-state\", (data: { active?: boolean; files?: unknown } | undefined) => {\n const active = data?.active === true\n // Kept when the draft ends: a failure reported a moment later still names its file.\n if (active && Array.isArray(data?.files)) draftFiles = data.files.filter((f): f is string => typeof f === \"string\")\n setDraftActive(active)\n // Not at once: the server announces the end before it sends the version it\n // fell back to, and drawing the failing one again here would show the error page.\n if (!active) setTimeout(resetDraftBoundaries, DRAFT_END_RESET_MS)\n })\n hot.on(\"vantage:draft-page\", (data: { route?: string } | undefined) => {\n if (typeof data?.route === \"string\" && data.route !== \"\") handlers.onPage(data.route)\n })\n hot.on(\"vantage:draft-page-closed\", (data: { route?: string } | undefined) => {\n if (typeof data?.route === \"string\" && data.route !== \"\") handlers.onPageClosed?.(data.route)\n })\n hot.on(\"vite:afterUpdate\", () => resetDraftBoundaries())\n // The server only announces a change, so a page that loads while a draft is showing has to ask.\n hot.send(\"vantage:draft-sync\")\n}\n\n/**\n * The draft file a failure came from: the one named first in the stack (the\n * module that threw, then the components that rendered it). Browser stacks name\n * modules by their dev-server URL, so a project-relative path is looked for as a\n * `/path` followed by nothing that could extend it.\n */\nexport function draftFileInStack(stack: string | undefined, files: readonly string[]): string | undefined {\n if (!stack) return undefined\n let best: { file: string; at: number } | undefined\n for (const file of files) {\n const needle = `/${file}`\n for (let at = stack.indexOf(needle); at !== -1; at = stack.indexOf(needle, at + 1)) {\n if (/[\\w./-]/.test(stack.charAt(at + needle.length))) continue\n if (best === undefined || at < best.at) best = { file, at }\n break\n }\n }\n return best?.file\n}\n\n/**\n * Tell the server the draft threw while rendering, so it can fall back to the\n * version before. `file` is the draft the failure came from when the stack names\n * one; without it the server steps back the draft it applied last.\n */\nexport function reportDraftRenderError(hot: DraftHot, error: unknown, componentStack?: string): void {\n const message = error instanceof Error ? error.message : String(error)\n const stack = [error instanceof Error ? error.stack : undefined, componentStack].filter(Boolean).join(\"\\n\")\n const file = draftFileInStack(stack, draftFiles)\n hot.send(\"vantage:draft-render-error\", file === undefined ? { message } : { file, message })\n}\n\n/**\n * Tell the surrounding editor a draft page is on screen. A no-op outside an\n * iframe: there is nobody to tell.\n */\nexport function announceDraftPage(route: string, parent: Window = window.parent): void {\n if (parent === window) return\n parent.postMessage({ source: \"vantage\", type: \"vantage:draft-page-opened\", path: route }, \"*\")\n}\n\n/** Tell the surrounding editor a draft page it was told about is gone. */\nexport function announceDraftPageClosed(route: string, parent: Window = window.parent): void {\n if (parent === window) return\n parent.postMessage({ source: \"vantage\", type: \"vantage:draft-page-closed\", path: route }, \"*\")\n}\n\n/** A copy of what is on screen, canvases included (cloning a canvas leaves it blank). */\nfunction freeze(host: HTMLElement): Node {\n const copy = host.cloneNode(true) as HTMLElement\n const from = host.querySelectorAll(\"canvas\")\n const to = copy.querySelectorAll(\"canvas\")\n from.forEach((canvas, i) => {\n try {\n to[i]?.getContext(\"2d\")?.drawImage(canvas, 0, 0)\n } catch {\n /* a canvas that cannot be read stays blank */\n }\n })\n return copy\n}\n\ninterface Props {\n children: ReactNode\n onError?: (error: unknown, componentStack?: string) => void\n}\n\ninterface State {\n hasError: boolean\n error: unknown\n /** The failure happened while a draft was showing (the draft may end before the screen is redrawn). */\n draft: boolean\n generation: number\n}\n\n/**\n * Keeps the previous screen up when a draft throws while rendering.\n *\n * Wraps the router. While a draft is showing, the error components rethrow\n * (see `build-router`) instead of drawing the error page, and that lands here:\n * the DOM as it was just before the failure is copied and kept, the server is\n * told (`onError`), and it falls back to the version before. The next HMR\n * update — or the draft ending — draws the children again. Without an active\n * draft nothing is caught: the error goes on to `AppErrorBoundary` as before.\n */\nexport class DraftFreezeBoundary extends Component<Props, State> {\n state: State = { hasError: false, error: null, draft: false, generation: 0 }\n private host = createRef<HTMLDivElement>()\n private frozen = createRef<HTMLDivElement>()\n\n static getDerivedStateFromError(error: unknown): Partial<State> {\n return { hasError: true, error, draft: isDraftSettling() }\n }\n\n componentDidMount(): void {\n resetListeners.add(this.reset)\n }\n\n componentWillUnmount(): void {\n resetListeners.delete(this.reset)\n }\n\n // Runs before the commit touches the DOM, so the screen is still the last good one.\n getSnapshotBeforeUpdate(_props: Props, prev: State): Node | null {\n if (!prev.hasError && this.state.hasError && this.host.current) return freeze(this.host.current)\n return null\n }\n\n componentDidUpdate(_props: Props, _prev: State, snapshot: Node | null): void {\n if (snapshot && this.frozen.current) this.frozen.current.replaceChildren(...Array.from(snapshot.childNodes))\n }\n\n componentDidCatch(error: unknown, info?: { componentStack?: string | null }): void {\n if (isDraftSettling()) this.props.onError?.(error, info?.componentStack ?? undefined)\n }\n\n private reset = (): void => {\n if (this.state.hasError) {\n this.setState((s) => ({ hasError: false, error: null, draft: false, generation: s.generation + 1 }))\n }\n }\n\n render(): ReactNode {\n if (this.state.hasError) {\n // Not a draft's failure: leave it to the boundary above.\n if (!this.state.draft) throw this.state.error\n return <div ref={this.frozen} data-vantage-draft-frozen style={{ display: \"contents\" }} />\n }\n return (\n <div key={this.state.generation} ref={this.host} style={{ display: \"contents\" }}>\n {this.props.children}\n </div>\n )\n }\n}\n","/**\n * Stale-chunk self-healing.\n *\n * A published app is served build-by-build: its HTML references content-hashed\n * JS chunks that belong to one build. When the app is re-published, an\n * already-open tab can end up requesting a chunk hash that the newly-served\n * build no longer has (the routing pin that keeps a session on one build is\n * short-lived by design), which fails the dynamic import. Vite emits\n * `vite:preloadError` for exactly that case.\n *\n * We reload once to pick up the new build. A short sessionStorage cooldown keeps\n * a genuinely-unreachable chunk (offline, or a build that was garbage-collected)\n * from turning into an infinite reload loop — after the first failed reload the\n * error is allowed to surface to the error boundary instead.\n */\nconst RELOAD_COOLDOWN_MS = 10_000\nconst RELOAD_STAMP_KEY = \"__vantage_chunk_reload_at\"\n\n// Messages browsers use when a dynamic import / module preload fails to load.\nconst DYNAMIC_IMPORT_FAILURE = /Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i\n\nfunction reloadOnceForStaleChunk(): void {\n let last = 0\n try {\n last = Number(window.sessionStorage.getItem(RELOAD_STAMP_KEY) ?? \"0\")\n } catch {\n // sessionStorage can throw in private/embedded contexts — treat as \"no prior reload\".\n }\n if (Number.isFinite(last) && Date.now() - last < RELOAD_COOLDOWN_MS) {\n // Already reloaded very recently; the chunk is still unreachable, so stop\n // reloading and let the error surface rather than looping.\n return\n }\n try {\n window.sessionStorage.setItem(RELOAD_STAMP_KEY, String(Date.now()))\n } catch {\n // best-effort — a failed write just means we can't dedupe, not a reason to skip healing.\n }\n window.location.reload()\n}\n\n/**\n * Register global listeners that reload the page when a chunk from a\n * now-replaced build fails to load. Safe to call once at bootstrap; a no-op\n * outside the browser.\n */\nexport function registerChunkErrorSelfHeal(): void {\n if (typeof window === \"undefined\") return\n\n // Vite's canonical signal for a failed dynamic-import preload. Calling\n // preventDefault() stops Vite from re-throwing; we reload instead.\n window.addEventListener(\"vite:preloadError\", (event) => {\n event.preventDefault()\n reloadOnceForStaleChunk()\n })\n\n // Belt-and-suspenders: a dynamic import that fails without a modulepreload\n // surfaces as an unhandled rejection. Only act on the specific stale-module\n // messages so unrelated rejections are left alone.\n window.addEventListener(\"unhandledrejection\", (event) => {\n const reason = event.reason\n const message = reason instanceof Error ? reason.message : String(reason ?? \"\")\n if (DYNAMIC_IMPORT_FAILURE.test(message)) {\n reloadOnceForStaleChunk()\n }\n })\n}\n","import { StrictMode, useSyncExternalStore } from \"react\"\nimport { createRoot } from \"react-dom/client\"\nimport { RouterProvider } from \"@tanstack/react-router\"\nimport { QueryClientProvider } from \"@tanstack/react-query\"\nimport { API_REFRESH_DEBOUNCE_MS, createQueryClient, refreshApiQueries } from \"../query/client\"\nimport { setRoutes } from \"../router/registry\"\nimport { AppErrorBoundary } from \"./error-boundary\"\nimport { buildRouter } from \"./build-router\"\nimport {\n announceDraftPage,\n announceDraftPageClosed,\n connectDraft,\n DraftFreezeBoundary,\n reportDraftRenderError,\n type DraftHot,\n} from \"./draft\"\nimport { registerChunkErrorSelfHeal } from \"./self-heal\"\nimport type { ClientManifest } from \"./manifest\"\n\nexport interface BootstrapOptions {\n /**\n * The HMR context of the generated entry, passed only when the draft preview\n * is on. Its presence is what switches the draft behaviour on; without it the\n * client is exactly what it was.\n */\n hot?: DraftHot\n}\n\nexport interface BootstrapHandle {\n /** The route tree changed (a page appeared or went away): draw from the new manifest. */\n update(manifest: ClientManifest): void\n /** A `server/api` module changed (dev): refetch the API queries, errored ones included. */\n refreshApi(): void\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyRouter = any\n\n/** The current router, swappable without remounting the providers above it. */\nfunction createRouterHolder(initial: AnyRouter) {\n let current = initial\n const listeners = new Set<() => void>()\n return {\n get: (): AnyRouter => current,\n set(next: AnyRouter) {\n current = next\n for (const l of listeners) l()\n },\n subscribe(l: () => void) {\n listeners.add(l)\n return () => {\n listeners.delete(l)\n }\n },\n }\n}\n\ntype RouterHolder = ReturnType<typeof createRouterHolder>\n\nfunction SwappableRouter({ holder }: { holder: RouterHolder }) {\n const router = useSyncExternalStore(holder.subscribe, holder.get)\n return <RouterProvider router={router} />\n}\n\n/**\n * Client entrypoint. The generated `.vantage/client-entry.tsx` calls this with\n * the route manifest. Owns React root creation and the provider tree:\n *\n * <AppErrorBoundary>\n * <QueryClientProvider>\n * <RouterProvider />\n *\n * With the draft preview on (`options.hot`) the router sits in a swappable\n * holder inside a `DraftFreezeBoundary`, so a new route tree can replace it and\n * a failing draft can keep the previous screen.\n */\nexport function bootstrap(manifest: ClientManifest, options: BootstrapOptions = {}): BootstrapHandle {\n const { hot } = options\n // Recover from stale chunks after a re-publish: reload once when a dynamic\n // import fails because the served build changed under an open tab.\n registerChunkErrorSelfHeal()\n\n // Publish the route list before the first render so `useRoutes()` is\n // populated for the very first page, not one paint late.\n setRoutes(manifest)\n\n const holder = createRouterHolder(buildRouter(manifest, { draft: Boolean(hot) }).router)\n const queryClient = createQueryClient()\n // Several api module changes arrive in a burst (a check creates and deletes\n // temporary modules): coalesce them into one refetch.\n let refreshTimer: ReturnType<typeof setTimeout> | undefined\n const refreshApi = () => {\n clearTimeout(refreshTimer)\n refreshTimer = setTimeout(() => void refreshApiQueries(queryClient), API_REFRESH_DEBOUNCE_MS)\n }\n\n // The document's initial title is the fallback for pages without a definePage\n // title, so navigating away from a titled page doesn't leave a stale title.\n const defaultTitle = document.title\n\n const updateTitle = () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const matches: any[] = holder.get().state?.matches ?? []\n const leaf = matches[matches.length - 1]\n const title = leaf?.staticData?.title\n document.title = typeof title === \"string\" && title.length > 0 ? title : defaultTitle\n } catch {\n /* title updates are best-effort */\n }\n }\n let unsubscribeTitle: (() => void) | undefined = holder.get().subscribe?.(\"onResolved\", updateTitle)\n\n const el = document.getElementById(\"root\")\n if (!el) {\n throw new Error('[vantage] Root element \"#root\" was not found in the document.')\n }\n\n if (!hot) {\n createRoot(el).render(\n <StrictMode>\n <AppErrorBoundary>\n <QueryClientProvider client={queryClient}>\n <RouterProvider router={holder.get()} />\n </QueryClientProvider>\n </AppErrorBoundary>\n </StrictMode>,\n )\n updateTitle()\n // Only the draft preview swaps route trees; anyone else gets a plain reload.\n return { update: () => location.reload(), refreshApi }\n }\n\n let currentManifest = manifest\n /** A draft page announced before the route tree that holds it arrived. */\n let pendingRoute: string | null = null\n /** The draft page last opened, so its removal can move the screen off it. */\n let openedRoute: string | null = null\n\n const hasRoute = (route: string) => currentManifest.pages.some((p) => p.routePath === route)\n // A route with parameters has no single URL to move to.\n const navigable = (route: string) => !/[:*]/.test(route)\n\n const open = async (route: string): Promise<void> => {\n openedRoute = route\n try {\n await holder.get().navigate({ to: route })\n } catch {\n /* the screen stays where it was */\n }\n announceDraftPage(route)\n }\n\n connectDraft(hot, {\n onPage(route) {\n // Nothing to open for a route with parameters (the server does not announce one either).\n if (!navigable(route)) return\n if (hasRoute(route)) void open(route)\n else pendingRoute = route\n },\n onPageClosed(route) {\n if (!navigable(route)) return\n if (pendingRoute === route) pendingRoute = null\n announceDraftPageClosed(route)\n },\n })\n\n createRoot(el).render(\n <StrictMode>\n <AppErrorBoundary>\n <QueryClientProvider client={queryClient}>\n <DraftFreezeBoundary onError={(error, componentStack) => reportDraftRenderError(hot, error, componentStack)}>\n <SwappableRouter holder={holder} />\n </DraftFreezeBoundary>\n </QueryClientProvider>\n </AppErrorBoundary>\n </StrictMode>,\n )\n updateTitle()\n\n return {\n refreshApi,\n update(next) {\n currentManifest = next\n setRoutes(next)\n unsubscribeTitle?.()\n holder.set(buildRouter(next, { draft: true }).router)\n // A router that replaces a running one is not started by the provider: without\n // this the page it opens on stays blank until something navigates.\n void holder.get().load?.()\n unsubscribeTitle = holder.get().subscribe?.(\"onResolved\", updateTitle)\n\n if (pendingRoute !== null && hasRoute(pendingRoute)) {\n const route = pendingRoute\n pendingRoute = null\n void open(route)\n } else if (openedRoute !== null && !hasRoute(openedRoute)) {\n // The draft page was dropped: don't leave the screen on a dead route.\n if (location.pathname === openedRoute) void holder.get().navigate({ to: \"/\" }).catch(() => {})\n openedRoute = null\n }\n },\n }\n}\n","import type { ReactNode } from \"react\"\n\n/**\n * A frame with nothing in it, drawn where a part has not been written yet. Same\n * look as the placeholder the draft layer declares for a missing component, so\n * the two read as one thing on screen.\n */\nexport function DraftSkeleton(): ReactNode {\n return (\n <div\n data-vantage-skeleton\n aria-hidden=\"true\"\n className=\"animate-pulse rounded-md bg-muted\"\n style={{ minHeight: \"4rem\", width: \"100%\" }}\n />\n )\n}\n"]}
|