@contentbit/studio 0.4.2 → 0.6.0
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/README.md +8 -4
- package/dist/client/assets/api-DbvlDnoO.js +1 -0
- package/dist/client/assets/document-RcoEgi0r.js +1 -0
- package/dist/client/assets/{index-DTXIZgkK.js → index-BOeG6kVU.js} +2 -2
- package/dist/client/assets/routes-cJNV3NIG.js +1 -0
- package/dist/server/assets/{_tanstack-start-manifest_v-wPlN1Hjy.js → _tanstack-start-manifest_v-BSt6T4tK.js} +4 -4
- package/dist/server/assets/{document-DjmCb_Rp.js → document-DlS34LM6.js} +1 -1
- package/dist/server/assets/{document-CxPFBdxd.js → document-G8TsI311.js} +49 -15
- package/dist/server/assets/{router-D4DnWGjU.js → router-734kIJxk.js} +2 -2
- package/dist/server/assets/{routes-BVJt9Z6a.js → routes-FGdym0e5.js} +28 -4
- package/dist/server/assets/{routes-6jOjWQ0D.js → routes-p0tk6PAr.js} +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +27 -8
- package/dist/server/preview.d.ts +4 -2
- package/dist/server/preview.d.ts.map +1 -1
- package/dist/server/preview.js +1 -1
- package/dist/server/scan.d.ts.map +1 -1
- package/dist/server/scan.js +84 -222
- package/dist/server/server.js +2 -2
- package/dist/server/types.d.ts +21 -2
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/routes/document.tsx +39 -0
- package/src/routes/index.tsx +21 -1
- package/src/server/index.ts +43 -14
- package/src/server/preview.ts +3 -2
- package/src/server/scan.test.ts +138 -0
- package/src/server/scan.ts +107 -277
- package/src/server/types.ts +21 -2
- package/dist/client/assets/api-MWiK2l_P.js +0 -1
- package/dist/client/assets/document-w62o-wDp.js +0 -1
- package/dist/client/assets/routes-Dg9spe-7.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,o as n,r,s as i,t as a}from"./index-BOeG6kVU.js";import{a as o,c as s,i as c,l,n as u,o as d,r as f,s as p,u as m}from"./api-DbvlDnoO.js";var h=m(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),g=m(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),_=m(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),v=m(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),y=m(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),b=i(n()),x=e();function S(){let e=a.useSearch(),n=t({from:`/`}),[r,i]=(0,b.useState)(null),[m,h]=(0,b.useState)(null),[_,S]=(0,b.useState)(null),[O,j]=(0,b.useState)(!1);async function M(){j(!0),S(null);try{let[e,t]=await Promise.all([f(),u()]);i(e),h(t)}catch(e){S(e instanceof Error?e.message:String(e))}finally{j(!1)}}(0,b.useEffect)(()=>{M()},[]);let N=(0,b.useMemo)(()=>{if(!r)return[];let t=e.q.toLowerCase().trim();return r.files.filter(n=>{let r=[n.relativePath,n.title,n.slug,n.key,n.locale,n.keywords?.primary,...n.keywords?.secondary??[],...n.keywords?.lsi??[]].filter(Boolean).join(` `).toLowerCase();return(e.status===`all`||n.status===e.status)&&r.includes(t)}).sort((t,n)=>A(t,n,e.sort,e.dir))},[r,e.dir,e.q,e.sort,e.status]);function P(e){n({to:`/`,search:t=>({...t,...e})})}function F(t){P({sort:t,dir:e.sort===t&&e.dir===`asc`?`desc`:`asc`})}return(0,x.jsxs)(`main`,{className:`min-h-svh bg-background text-foreground`,children:[(0,x.jsx)(`section`,{className:`border-b bg-muted/30`,children:(0,x.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-6 px-5 py-6`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-end md:justify-between`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`font-mono text-xs uppercase text-muted-foreground`,children:`contentbit studio`}),(0,x.jsx)(`h1`,{className:`mt-1 text-3xl font-semibold tracking-tight`,children:`Content dashboard`}),(0,x.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm text-muted-foreground`,children:`Read-only view of content health, structure, links, keywords, and previews.`})]}),(0,x.jsxs)(c,{onClick:M,disabled:O,className:`w-fit gap-2`,children:[(0,x.jsx)(s,{className:O?`size-4 animate-spin`:`size-4`}),`Refresh`]})]}),r&&(0,x.jsxs)(`div`,{className:`grid gap-px overflow-hidden rounded-sm border bg-border md:grid-cols-4`,children:[(0,x.jsx)(w,{label:`files`,value:r.summary.files,icon:(0,x.jsx)(v,{className:`size-4`})}),(0,x.jsx)(w,{label:`findings`,value:r.summary.errors+r.summary.warnings+r.summary.suggestions,icon:(0,x.jsx)(o,{className:`size-4`}),tone:r.summary.errors>0?`bad`:r.summary.warnings>0?`warn`:`ok`}),(0,x.jsx)(w,{label:`blocks`,value:r.summary.blocks,icon:(0,x.jsx)(g,{className:`size-4`})}),(0,x.jsx)(w,{label:`graph`,value:r.linkGraph?`${r.linkGraph.pages}/${r.linkGraph.links}`:`off`,icon:(0,x.jsx)(l,{className:`size-4`})})]})]})}),(0,x.jsxs)(`section`,{className:`mx-auto grid max-w-7xl gap-5 px-5 py-5 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 md:flex-row`,children:[(0,x.jsxs)(`label`,{className:`relative flex min-w-0 flex-1 items-center`,children:[(0,x.jsx)(p,{className:`pointer-events-none absolute left-3 size-4 text-muted-foreground`}),(0,x.jsx)(`input`,{value:e.q,onChange:e=>P({q:e.target.value}),placeholder:`Search path, title, slug, keyword...`,className:`h-10 w-full border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-foreground`})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1 border bg-background p-1`,children:[(0,x.jsx)(y,{className:`mx-2 size-4 text-muted-foreground`}),[`all`,`error`,`warning`,`suggestion`,`healthy`].map(t=>(0,x.jsx)(`button`,{onClick:()=>P({status:t}),className:e.status===t?`bg-foreground px-2.5 py-1.5 text-xs font-medium text-background`:`px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground`,children:t},t))]})]}),(0,x.jsxs)(`div`,{className:`overflow-hidden border`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_0.6fr_0.6fr_0.6fr_2rem] gap-px border-b bg-border text-xs font-medium uppercase text-muted-foreground`,children:[(0,x.jsx)(k,{label:`Document`,active:e.sort===`document`,onClick:()=>F(`document`)}),(0,x.jsx)(k,{label:`Status`,active:e.sort===`status`,onClick:()=>F(`status`)}),(0,x.jsx)(k,{label:`Blocks`,active:e.sort===`blocks`,onClick:()=>F(`blocks`)}),(0,x.jsx)(k,{label:`Keywords`,active:e.sort===`keywords`,onClick:()=>F(`keywords`)}),(0,x.jsx)(`div`,{className:`bg-muted/50 px-2 py-2`})]}),_?(0,x.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:_}):r?(0,x.jsxs)(`div`,{className:`divide-y`,children:[N.map(e=>(0,x.jsx)(C,{file:e},e.path)),N.length===0&&(0,x.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No documents match the current filters.`})]}):(0,x.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Scanning content...`})]})]}),(0,x.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[r?.seo&&(0,x.jsxs)(E,{title:`SEO`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-3 gap-px overflow-hidden border bg-border text-center`,children:[(0,x.jsx)(T,{value:r.seo.pages,label:`pages`}),(0,x.jsx)(T,{value:r.seo.planned,label:`planned`}),(0,x.jsx)(T,{value:r.seo.findings,label:`findings`})]}),(0,x.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(d,{className:`size-4`}),(0,x.jsx)(`span`,{children:r.seo.schemaVersion})]})]}),(0,x.jsxs)(E,{title:`Link graph`,children:[r?.linkGraph?(0,x.jsxs)(`div`,{className:`grid grid-cols-3 gap-px overflow-hidden border bg-border text-center`,children:[(0,x.jsx)(T,{value:r.linkGraph.pages,label:`pages`}),(0,x.jsx)(T,{value:r.linkGraph.links,label:`links`}),(0,x.jsx)(T,{value:r.linkGraph.orphans,label:`orphans`})]}):(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No slug frontmatter detected.`}),m&&m.edges.length>0&&(0,x.jsx)(`ul`,{className:`mt-3 flex max-h-56 flex-col gap-2 overflow-auto text-xs`,children:m.edges.slice(0,12).map((e,t)=>(0,x.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:e.status===`unresolved`?`text-destructive`:`text-muted-foreground`,children:e.status}),(0,x.jsx)(`span`,{className:`truncate`,children:e.target})]},`${e.from}-${e.target}-${t}`))})]}),(0,x.jsx)(E,{title:`Block usage`,children:r&&Object.keys(r.blockUsage).length>0?(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(r.blockUsage).map(([e,t])=>(0,x.jsxs)(`span`,{className:`border bg-muted px-2 py-1 font-mono text-xs`,children:[e,` x`,t]},e))}):(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No blocks found yet.`})}),(0,x.jsx)(E,{title:`Keyword coverage`,children:r&&(0,x.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,x.jsx)(D,{label:`primary`,value:r.keywordCoverage.withPrimary,total:r.keywordCoverage.total}),(0,x.jsx)(D,{label:`secondary`,value:r.keywordCoverage.withSecondary,total:r.keywordCoverage.total})]})})]})]})]})}function C({file:e}){return(0,x.jsxs)(r,{to:`/document`,search:{path:e.path},className:`grid grid-cols-[1.4fr_0.6fr_0.6fr_0.6fr_2rem] gap-px bg-border text-sm transition-colors hover:bg-foreground/20`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 bg-background px-3 py-3`,children:[(0,x.jsx)(`p`,{className:`truncate font-medium`,children:e.title}),(0,x.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.relativePath})]}),(0,x.jsx)(`div`,{className:`bg-background px-3 py-3`,children:(0,x.jsx)(O,{status:e.status})}),(0,x.jsx)(`div`,{className:`bg-background px-3 py-3 font-mono text-xs`,children:e.blocks}),(0,x.jsx)(`div`,{className:`bg-background px-3 py-3 text-xs text-muted-foreground`,children:e.keywords?.primary?`primary`:`missing`}),(0,x.jsx)(`div`,{className:`flex items-center justify-center bg-background px-2 py-3`,children:(0,x.jsx)(h,{className:`size-4 text-muted-foreground`})})]})}function w({label:e,value:t,icon:n,tone:r}){return(0,x.jsxs)(`div`,{className:`bg-background p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex items-center justify-between text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`text-xs uppercase`,children:e}),n]}),(0,x.jsx)(`div`,{className:`font-mono text-3xl font-semibold ${r===`bad`?`text-destructive`:r===`warn`?`text-amber-600`:r===`ok`?`text-emerald-600`:`text-foreground`}`,children:t})]})}function T({value:e,label:t}){return(0,x.jsxs)(`div`,{className:`bg-background px-2 py-2`,children:[(0,x.jsx)(`div`,{className:`font-mono text-lg font-semibold`,children:e}),(0,x.jsx)(`div`,{className:`text-[0.65rem] uppercase text-muted-foreground`,children:t})]})}function E({title:e,children:t}){return(0,x.jsxs)(`section`,{className:`border bg-background p-4`,children:[(0,x.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:e}),t]})}function D({label:e,value:t,total:n}){let r=n===0?0:Math.round(t/n*100);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`mb-1 flex justify-between text-xs`,children:[(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,x.jsxs)(`span`,{className:`font-mono`,children:[r,`%`]})]}),(0,x.jsx)(`div`,{className:`h-2 bg-muted`,children:(0,x.jsx)(`div`,{className:`h-full bg-foreground`,style:{width:`${r}%`}})})]})}function O({status:e}){return(0,x.jsx)(`span`,{className:`inline-flex border px-2 py-0.5 text-xs ${e===`error`?`border-destructive/40 bg-destructive/10 text-destructive`:e===`warning`?`border-amber-500/40 bg-amber-500/10 text-amber-700`:e===`suggestion`?`border-blue-500/40 bg-blue-500/10 text-blue-700`:`border-emerald-500/40 bg-emerald-500/10 text-emerald-700`}`,children:e})}function k({label:e,active:t,onClick:n}){return(0,x.jsxs)(`button`,{className:t?`flex items-center gap-1 bg-muted px-3 py-2 text-foreground`:`flex items-center gap-1 bg-muted/50 px-3 py-2 hover:text-foreground`,onClick:n,children:[e,(0,x.jsx)(_,{className:`size-3`})]})}function A(e,t,n,r){let i=r===`asc`?1:-1,a={error:0,warning:1,suggestion:2,healthy:3};return((n===`status`?a[e.status]-a[t.status]:n===`blocks`?e.blocks-t.blocks:n===`keywords`?j(e)-j(t):n===`findings`?M(e)-M(t):e.relativePath.localeCompare(t.relativePath))||e.relativePath.localeCompare(t.relativePath))*i}function j(e){return+!!e.keywords?.primary+ +!!e.keywords?.secondary?.length+ +!!e.keywords?.lsi?.length}function M(e){return e.findings.errors*100+e.findings.warnings*10+e.findings.suggestions}export{S as component};
|
|
@@ -3,22 +3,22 @@ var tsrStartManifest = () => ({ routes: {
|
|
|
3
3
|
__root__: {
|
|
4
4
|
filePath: "/home/runner/work/contentbit/contentbit/packages/studio/src/routes/__root.tsx",
|
|
5
5
|
children: ["/", "/document"],
|
|
6
|
-
preloads: ["/assets/index-
|
|
6
|
+
preloads: ["/assets/index-BOeG6kVU.js"],
|
|
7
7
|
scripts: [{ attrs: {
|
|
8
8
|
type: "module",
|
|
9
9
|
async: !0,
|
|
10
|
-
src: "/assets/index-
|
|
10
|
+
src: "/assets/index-BOeG6kVU.js"
|
|
11
11
|
} }]
|
|
12
12
|
},
|
|
13
13
|
"/": {
|
|
14
14
|
filePath: "/home/runner/work/contentbit/contentbit/packages/studio/src/routes/index.tsx",
|
|
15
15
|
children: void 0,
|
|
16
|
-
preloads: ["/assets/routes-
|
|
16
|
+
preloads: ["/assets/routes-cJNV3NIG.js", "/assets/api-DbvlDnoO.js"]
|
|
17
17
|
},
|
|
18
18
|
"/document": {
|
|
19
19
|
filePath: "/home/runner/work/contentbit/contentbit/packages/studio/src/routes/document.tsx",
|
|
20
20
|
children: void 0,
|
|
21
|
-
preloads: ["/assets/document-
|
|
21
|
+
preloads: ["/assets/document-RcoEgi0r.js", "/assets/api-DbvlDnoO.js"]
|
|
22
22
|
}
|
|
23
23
|
} });
|
|
24
24
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
|
|
2
2
|
//#region src/routes/document.tsx
|
|
3
|
-
var $$splitComponentImporter = () => import("./document-
|
|
3
|
+
var $$splitComponentImporter = () => import("./document-G8TsI311.js");
|
|
4
4
|
var Route = createFileRoute("/document")({
|
|
5
5
|
validateSearch: (search) => ({ path: typeof search.path === "string" ? search.path : "" }),
|
|
6
6
|
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as Route } from "./document-
|
|
1
|
+
import { t as Route } from "./document-DlS34LM6.js";
|
|
2
2
|
import { i as Button, t as fetchDocument } from "./api-Bqt_atjc.js";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { Link } from "@tanstack/react-router";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { AlertTriangle, ArrowLeft, BarChart3, Braces, FileCode2, Link2, RefreshCw, Search } from "lucide-react";
|
|
6
|
+
import { AlertTriangle, ArrowLeft, BarChart3, Braces, FileCode2, Link2, RefreshCw, Search, Target } from "lucide-react";
|
|
7
7
|
//#region src/routes/document.tsx?tsr-split=component
|
|
8
8
|
function DocumentDetail() {
|
|
9
9
|
const search = Route.useSearch();
|
|
@@ -144,24 +144,58 @@ function DocumentDetail() {
|
|
|
144
144
|
icon: /* @__PURE__ */ jsx(Braces, { className: "size-4" }),
|
|
145
145
|
children: document.file.keywords ? /* @__PURE__ */ jsxs("div", {
|
|
146
146
|
className: "space-y-3 text-sm",
|
|
147
|
-
children: [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
children: "
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
147
|
+
children: [
|
|
148
|
+
document.file.keywords.primary && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
149
|
+
className: "text-xs uppercase text-muted-foreground",
|
|
150
|
+
children: "Primary"
|
|
151
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
152
|
+
className: "mt-1 font-medium",
|
|
153
|
+
children: document.file.keywords.primary
|
|
154
|
+
})] }),
|
|
155
|
+
(document.file.keywords.secondary?.length ?? 0) > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
156
|
+
className: "text-xs uppercase text-muted-foreground",
|
|
157
|
+
children: "Secondary"
|
|
158
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
159
|
+
className: "mt-2 flex flex-wrap gap-1",
|
|
160
|
+
children: document.file.keywords.secondary?.map((keyword) => /* @__PURE__ */ jsx(Badge, { children: keyword }, keyword))
|
|
161
|
+
})] }),
|
|
162
|
+
(document.file.keywords.lsi?.length ?? 0) > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
163
|
+
className: "text-xs uppercase text-muted-foreground",
|
|
164
|
+
children: "LSI"
|
|
165
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
166
|
+
className: "mt-2 flex flex-wrap gap-1",
|
|
167
|
+
children: document.file.keywords.lsi?.map((keyword) => /* @__PURE__ */ jsx(Badge, { children: keyword }, keyword))
|
|
168
|
+
})] })
|
|
169
|
+
]
|
|
160
170
|
}) : /* @__PURE__ */ jsx("p", {
|
|
161
171
|
className: "text-sm text-muted-foreground",
|
|
162
172
|
children: "No keyword frontmatter found."
|
|
163
173
|
})
|
|
164
174
|
}),
|
|
175
|
+
document.seoBrief && /* @__PURE__ */ jsx(Panel, {
|
|
176
|
+
title: "SEO Brief",
|
|
177
|
+
icon: /* @__PURE__ */ jsx(Target, { className: "size-4" }),
|
|
178
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
179
|
+
className: "space-y-3 text-sm",
|
|
180
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
181
|
+
className: "flex flex-wrap gap-1",
|
|
182
|
+
children: [
|
|
183
|
+
document.seoBrief.target.type && /* @__PURE__ */ jsx(Badge, { children: document.seoBrief.target.type }),
|
|
184
|
+
document.seoBrief.target.intent && /* @__PURE__ */ jsx(Badge, { children: document.seoBrief.target.intent }),
|
|
185
|
+
/* @__PURE__ */ jsx(Badge, { children: document.seoBrief.target.source })
|
|
186
|
+
]
|
|
187
|
+
}), document.seoBrief.acceptanceChecks.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
188
|
+
className: "text-xs uppercase text-muted-foreground",
|
|
189
|
+
children: "Acceptance"
|
|
190
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
191
|
+
className: "mt-2 space-y-1",
|
|
192
|
+
children: document.seoBrief.acceptanceChecks.map((check) => /* @__PURE__ */ jsx("li", {
|
|
193
|
+
className: "border bg-muted/40 px-2 py-1",
|
|
194
|
+
children: check
|
|
195
|
+
}, check))
|
|
196
|
+
})] })]
|
|
197
|
+
})
|
|
198
|
+
}),
|
|
165
199
|
/* @__PURE__ */ jsx(Panel, {
|
|
166
200
|
title: "Findings",
|
|
167
201
|
icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Route$1 } from "./document-
|
|
2
|
-
import { t as Route$2 } from "./routes-
|
|
1
|
+
import { t as Route$1 } from "./document-DlS34LM6.js";
|
|
2
|
+
import { t as Route$2 } from "./routes-p0tk6PAr.js";
|
|
3
3
|
import { HeadContent, Scripts, createRootRoute, createRouter } from "@tanstack/react-router";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/styles.css?url
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as Route } from "./routes-
|
|
1
|
+
import { t as Route } from "./routes-p0tk6PAr.js";
|
|
2
2
|
import { i as Button, n as fetchGraph, r as fetchProject } from "./api-Bqt_atjc.js";
|
|
3
3
|
import { useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { Link, useNavigate } from "@tanstack/react-router";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { AlertTriangle, ArrowRight, Blocks, ChevronsUpDown, FileText, Filter, Link2, RefreshCw, Search } from "lucide-react";
|
|
6
|
+
import { AlertTriangle, ArrowRight, Blocks, ChevronsUpDown, FileText, Filter, Link2, RefreshCw, Search, Target } from "lucide-react";
|
|
7
7
|
//#region src/routes/index.tsx?tsr-split=component
|
|
8
8
|
function Dashboard() {
|
|
9
9
|
const search = Route.useSearch();
|
|
@@ -39,7 +39,8 @@ function Dashboard() {
|
|
|
39
39
|
file.key,
|
|
40
40
|
file.locale,
|
|
41
41
|
file.keywords?.primary,
|
|
42
|
-
...file.keywords?.secondary ?? []
|
|
42
|
+
...file.keywords?.secondary ?? [],
|
|
43
|
+
...file.keywords?.lsi ?? []
|
|
43
44
|
].filter(Boolean).join(" ").toLowerCase();
|
|
44
45
|
return (search.status === "all" || file.status === search.status) && haystack.includes(query);
|
|
45
46
|
}).sort((a, b) => compareFiles(a, b, search.sort, search.dir));
|
|
@@ -191,6 +192,29 @@ function Dashboard() {
|
|
|
191
192
|
}), /* @__PURE__ */ jsxs("aside", {
|
|
192
193
|
className: "flex flex-col gap-4",
|
|
193
194
|
children: [
|
|
195
|
+
project?.seo && /* @__PURE__ */ jsxs(Panel, {
|
|
196
|
+
title: "SEO",
|
|
197
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
198
|
+
className: "grid grid-cols-3 gap-px overflow-hidden border bg-border text-center",
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsx(TinyMetric, {
|
|
201
|
+
value: project.seo.pages,
|
|
202
|
+
label: "pages"
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ jsx(TinyMetric, {
|
|
205
|
+
value: project.seo.planned,
|
|
206
|
+
label: "planned"
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ jsx(TinyMetric, {
|
|
209
|
+
value: project.seo.findings,
|
|
210
|
+
label: "findings"
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
214
|
+
className: "mt-3 flex items-center gap-2 text-xs text-muted-foreground",
|
|
215
|
+
children: [/* @__PURE__ */ jsx(Target, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: project.seo.schemaVersion })]
|
|
216
|
+
})]
|
|
217
|
+
}),
|
|
194
218
|
/* @__PURE__ */ jsxs(Panel, {
|
|
195
219
|
title: "Link graph",
|
|
196
220
|
children: [project?.linkGraph ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -377,7 +401,7 @@ function compareFiles(a, b, sort, dir) {
|
|
|
377
401
|
return ((sort === "status" ? statusOrder[a.status] - statusOrder[b.status] : sort === "blocks" ? a.blocks - b.blocks : sort === "keywords" ? keywordScore(a) - keywordScore(b) : sort === "findings" ? findingScore(a) - findingScore(b) : a.relativePath.localeCompare(b.relativePath)) || a.relativePath.localeCompare(b.relativePath)) * direction;
|
|
378
402
|
}
|
|
379
403
|
function keywordScore(file) {
|
|
380
|
-
return (file.keywords?.primary ? 1 : 0) + (file.keywords?.secondary?.length ? 1 : 0);
|
|
404
|
+
return (file.keywords?.primary ? 1 : 0) + (file.keywords?.secondary?.length ? 1 : 0) + (file.keywords?.lsi?.length ? 1 : 0);
|
|
381
405
|
}
|
|
382
406
|
function findingScore(file) {
|
|
383
407
|
return file.findings.errors * 100 + file.findings.warnings * 10 + file.findings.suggestions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
|
|
2
2
|
//#region src/routes/index.tsx
|
|
3
|
-
var $$splitComponentImporter = () => import("./routes-
|
|
3
|
+
var $$splitComponentImporter = () => import("./routes-FGdym0e5.js");
|
|
4
4
|
var Route = createFileRoute("/")({
|
|
5
5
|
validateSearch: (search) => ({
|
|
6
6
|
q: typeof search.q === "string" ? search.q : "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqD,KAAK,aAAa,EAAE,MAAM,MAAM,CAAA;AAI5F,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,YAAY,CAAA;AAEnE,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACrB,IAAI,EAAE,aAAa,CAAA;CACpB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqD,KAAK,aAAa,EAAE,MAAM,MAAM,CAAA;AAI5F,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,YAAY,CAAA;AAEnE,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACrB,IAAI,EAAE,aAAa,CAAA;CACpB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CA0DpF"}
|
package/dist/server/index.js
CHANGED
|
@@ -25,8 +25,11 @@ export async function startStudio(options) {
|
|
|
25
25
|
globs: options.globs,
|
|
26
26
|
cwd,
|
|
27
27
|
registryPath: options.registryPath,
|
|
28
|
+
includeGenericBlocks: options.includeGenericBlocks,
|
|
28
29
|
linkOptions: options.linkOptions,
|
|
29
30
|
minSectionWords: options.minSectionWords,
|
|
31
|
+
seoConfig: options.seoConfig,
|
|
32
|
+
seoConfigPath: options.seoConfigPath,
|
|
30
33
|
};
|
|
31
34
|
const vite = await createServer({
|
|
32
35
|
root,
|
|
@@ -59,15 +62,26 @@ export async function startStudio(options) {
|
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
64
|
async function loadProjectComponents(vite, options) {
|
|
65
|
+
const merged = {};
|
|
62
66
|
for (const candidate of componentCandidates(options)) {
|
|
63
|
-
if (!existsSync(candidate))
|
|
67
|
+
if (!existsSync(candidate.path))
|
|
64
68
|
continue;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
let mod;
|
|
70
|
+
try {
|
|
71
|
+
mod = (await vite.ssrLoadModule(candidate.path));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
if (!candidate.bestEffort)
|
|
75
|
+
throw new Error(`Failed to load block components: ${candidate.path}`);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const maps = [mod.styledComponents, mod.blockComponents, mod.components, mod.default];
|
|
79
|
+
for (const components of maps) {
|
|
80
|
+
if (components && typeof components === 'object')
|
|
81
|
+
Object.assign(merged, components);
|
|
82
|
+
}
|
|
69
83
|
}
|
|
70
|
-
return undefined;
|
|
84
|
+
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
71
85
|
}
|
|
72
86
|
function componentCandidates(options) {
|
|
73
87
|
const dirs = new Set();
|
|
@@ -78,14 +92,19 @@ function componentCandidates(options) {
|
|
|
78
92
|
dirs.add(dirname(registryPath));
|
|
79
93
|
}
|
|
80
94
|
dirs.add(join(options.cwd, 'blocks'));
|
|
81
|
-
|
|
95
|
+
const rendererCandidates = [
|
|
96
|
+
join(options.cwd, 'components/content-blocks/content-renderer.tsx'),
|
|
97
|
+
join(options.cwd, 'src/components/content-blocks/content-renderer.tsx'),
|
|
98
|
+
].map((path) => ({ path, bestEffort: true }));
|
|
99
|
+
const blockComponentCandidates = [...dirs].flatMap((dir) => [
|
|
82
100
|
join(dir, 'components.tsx'),
|
|
83
101
|
join(dir, 'components.ts'),
|
|
84
102
|
join(dir, 'preview.tsx'),
|
|
85
103
|
join(dir, 'preview.ts'),
|
|
86
104
|
join(dir, 'renderers.tsx'),
|
|
87
105
|
join(dir, 'renderers.ts'),
|
|
88
|
-
]);
|
|
106
|
+
].map((path) => ({ path, bestEffort: false })));
|
|
107
|
+
return [...rendererCandidates, ...blockComponentCandidates];
|
|
89
108
|
}
|
|
90
109
|
function studioApiPlugin(options) {
|
|
91
110
|
return {
|
package/dist/server/preview.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { BlockComponent } from '@contentbit/react';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function renderStudioPreview(document:
|
|
2
|
+
import type { ValidatedDocumentNode } from '@contentbit/core';
|
|
3
|
+
export declare function renderStudioPreview(document: ValidatedDocumentNode, components?: Record<string, BlockComponent>, _options?: {
|
|
4
|
+
includeGenericComponents?: boolean;
|
|
5
|
+
}): string;
|
|
4
6
|
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/server/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/server/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAc7D,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,qBAAqB,EAC/B,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAM,EAC/C,QAAQ,GAAE;IAAE,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAO,GACpD,MAAM,CASR"}
|
package/dist/server/preview.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createElement } from 'react';
|
|
|
3
3
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
5
5
|
import remarkGfm from 'remark-gfm';
|
|
6
|
-
export function renderStudioPreview(document, components = {}) {
|
|
6
|
+
export function renderStudioPreview(document, components = {}, _options = {}) {
|
|
7
7
|
return renderToStaticMarkup(createElement(ContentBlocks, {
|
|
8
8
|
document,
|
|
9
9
|
components,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/server/scan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/server/scan.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,cAAc,EAGd,WAAW,EAGX,aAAa,EACb,aAAa,EAEd,MAAM,YAAY,CAAA;AAUnB,wBAAsB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAwDhF;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,aAAa,EACtB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAoChC;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAiB5E"}
|