@contentbit/studio 0.5.0 → 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/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 +2 -0
- package/dist/server/scan.d.ts.map +1 -1
- package/dist/server/scan.js +59 -119
- package/dist/server/server.js +2 -2
- package/dist/server/types.d.ts +20 -2
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/routes/document.tsx +39 -0
- package/src/routes/index.tsx +21 -1
- package/src/server/index.ts +2 -0
- package/src/server/scan.test.ts +96 -0
- package/src/server/scan.ts +65 -131
- package/src/server/types.ts +20 -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
|
@@ -28,6 +28,8 @@ export async function startStudio(options) {
|
|
|
28
28
|
includeGenericBlocks: options.includeGenericBlocks,
|
|
29
29
|
linkOptions: options.linkOptions,
|
|
30
30
|
minSectionWords: options.minSectionWords,
|
|
31
|
+
seoConfig: options.seoConfig,
|
|
32
|
+
seoConfigPath: options.seoConfigPath,
|
|
31
33
|
};
|
|
32
34
|
const vite = await createServer({
|
|
33
35
|
root,
|
|
@@ -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"}
|
package/dist/server/scan.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { basename, isAbsolute, join, relative } from 'node:path';
|
|
5
|
-
import { pathToFileURL } from 'node:url';
|
|
6
|
-
import { glob } from 'tinyglobby';
|
|
1
|
+
import { compareContentProjectFindings, createLinkGraphView, createSeoBrief, readContentPageFacts, summarizeContentProjectFindings, } from '@contentbit/core';
|
|
2
|
+
import { loadContentProject } from '@contentbit/project';
|
|
3
|
+
import { basename, relative } from 'node:path';
|
|
7
4
|
import { renderStudioPreview } from './preview.js';
|
|
8
5
|
export async function scanProject(options) {
|
|
9
6
|
const context = await scanContext(options);
|
|
@@ -48,6 +45,17 @@ export async function scanProject(options) {
|
|
|
48
45
|
withSecondary,
|
|
49
46
|
},
|
|
50
47
|
...(context.scan.linkGraph ? { linkGraph: context.scan.linkGraph } : {}),
|
|
48
|
+
...(context.scan.seo
|
|
49
|
+
? {
|
|
50
|
+
seo: {
|
|
51
|
+
schemaVersion: context.scan.seo.schemaVersion,
|
|
52
|
+
pages: context.scan.seo.pages.length,
|
|
53
|
+
existing: context.scan.seo.pages.filter((page) => page.source === 'existing').length,
|
|
54
|
+
planned: context.scan.seo.pages.filter((page) => page.source === 'planned').length,
|
|
55
|
+
findings: context.scan.seo.findings.length,
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
: {}),
|
|
51
59
|
findings: context.findings,
|
|
52
60
|
};
|
|
53
61
|
}
|
|
@@ -66,6 +74,8 @@ export async function scanDocument(options, requestedPath) {
|
|
|
66
74
|
const page = context.index
|
|
67
75
|
? [...context.index.pages.values()].find((entry) => entry.path === file)
|
|
68
76
|
: undefined;
|
|
77
|
+
const seoPage = context.scan.seo?.pages.find((entry) => entry.path === file);
|
|
78
|
+
const seoBrief = context.scan.seo && seoPage ? createSeoBrief(context.scan.seo, seoPage.id) : undefined;
|
|
69
79
|
return {
|
|
70
80
|
file: summary,
|
|
71
81
|
source: scanned.source,
|
|
@@ -78,6 +88,7 @@ export async function scanDocument(options, requestedPath) {
|
|
|
78
88
|
? page.linkedFromRefs
|
|
79
89
|
: page.linkedFrom
|
|
80
90
|
: [],
|
|
91
|
+
...(seoBrief ? { seoBrief } : {}),
|
|
81
92
|
previewHtml,
|
|
82
93
|
};
|
|
83
94
|
}
|
|
@@ -86,85 +97,43 @@ export async function scanGraph(options) {
|
|
|
86
97
|
if (!context.index)
|
|
87
98
|
return { nodes: [], edges: [] };
|
|
88
99
|
const summaryByPath = new Map(context.summaries.map((summary) => [summary.path, summary]));
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...(
|
|
100
|
+
const view = createLinkGraphView(context.index, context.scan.linkDiagnostics ?? []);
|
|
101
|
+
const nodes = view.nodes.map((node) => ({
|
|
102
|
+
id: node.id,
|
|
103
|
+
label: node.label,
|
|
104
|
+
path: node.path,
|
|
105
|
+
status: summaryByPath.get(node.path)?.status ?? 'healthy',
|
|
106
|
+
slug: node.slug,
|
|
107
|
+
...(node.key ? { key: node.key } : {}),
|
|
108
|
+
...(node.locale ? { locale: node.locale } : {}),
|
|
97
109
|
}));
|
|
98
|
-
const
|
|
99
|
-
const edges = [];
|
|
100
|
-
for (const page of context.index.pages.values()) {
|
|
101
|
-
for (const ref of page.linkRefs) {
|
|
102
|
-
const target = [...context.index.pages.values()].find((candidate) => candidate.slug === ref.slug &&
|
|
103
|
-
candidate.key === ref.key &&
|
|
104
|
-
candidate.locale === ref.locale);
|
|
105
|
-
edges.push({
|
|
106
|
-
from: pageIdentity(page),
|
|
107
|
-
to: target ? pageIdentity(target) : undefined,
|
|
108
|
-
target: ref.target ?? ref.key ?? ref.slug,
|
|
109
|
-
status: target === page
|
|
110
|
-
? 'self'
|
|
111
|
-
: ref.locale && ref.locale !== page.locale
|
|
112
|
-
? 'cross-locale'
|
|
113
|
-
: 'resolved',
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
for (const finding of context.findings) {
|
|
118
|
-
if (finding.source !== 'links')
|
|
119
|
-
continue;
|
|
120
|
-
if (finding.code !== 'CB_LINK_UNRESOLVED' && finding.code !== 'CB_LINK_LOCALE_MISSING')
|
|
121
|
-
continue;
|
|
122
|
-
const page = pageByPath.get(finding.file);
|
|
123
|
-
if (!page)
|
|
124
|
-
continue;
|
|
125
|
-
edges.push({
|
|
126
|
-
from: pageIdentity(page),
|
|
127
|
-
target: targetFromMessage(finding.message) ?? 'unresolved',
|
|
128
|
-
status: 'unresolved',
|
|
129
|
-
});
|
|
130
|
-
}
|
|
110
|
+
const edges = view.edges;
|
|
131
111
|
return { nodes, edges };
|
|
132
112
|
}
|
|
133
113
|
async function scanContext(options) {
|
|
134
|
-
if (options.globs.length === 0)
|
|
135
|
-
throw new Error('studio: provide at least one file or glob.');
|
|
136
114
|
const cwd = options.cwd ?? process.cwd();
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
115
|
+
const project = await loadContentProject({
|
|
116
|
+
cmd: 'studio',
|
|
117
|
+
positionals: options.globs,
|
|
118
|
+
cwd,
|
|
119
|
+
registry: options.registryPath,
|
|
120
|
+
includeGenericBlocks: options.includeGenericBlocks,
|
|
143
121
|
linkOptions: options.linkOptions,
|
|
144
|
-
|
|
122
|
+
scan: {
|
|
123
|
+
minSectionWords: options.minSectionWords,
|
|
124
|
+
seoConfig: options.seoConfig,
|
|
125
|
+
seoConfigPath: options.seoConfigPath,
|
|
126
|
+
},
|
|
145
127
|
});
|
|
128
|
+
const { files, scan } = project;
|
|
146
129
|
const findings = scan.findings
|
|
147
130
|
.map((finding) => findingFromProjectFinding(finding, cwd))
|
|
148
131
|
.sort(compareFindings);
|
|
149
|
-
const summaries = scan.files.map((file) => fileSummary(file.path, cwd, file.frontmatter, file.stats, findings.filter((finding) => finding.file === file.path), options));
|
|
132
|
+
const summaries = scan.files.map((file) => fileSummary(file.path, cwd, file.frontmatter, file.stats, findings.filter((finding) => finding.file === file.path), options, scan.seo?.pages.find((page) => page.path === file.path)));
|
|
150
133
|
const index = scan.linkIndex;
|
|
151
134
|
findings.sort(compareFindings);
|
|
152
135
|
return { files, scan, findings, summaries, index };
|
|
153
136
|
}
|
|
154
|
-
async function loadStudioRegistry(registryPath, cwd = process.cwd(), includeGenericBlocks = true) {
|
|
155
|
-
const registry = createBlockRegistry();
|
|
156
|
-
if (includeGenericBlocks)
|
|
157
|
-
registry.use(genericBlocks());
|
|
158
|
-
if (!registryPath)
|
|
159
|
-
return registry;
|
|
160
|
-
const resolvedPath = isAbsolute(registryPath) ? registryPath : join(cwd, registryPath);
|
|
161
|
-
const mod = (await import(pathToFileURL(resolvedPath).href));
|
|
162
|
-
if (!Array.isArray(mod.default)) {
|
|
163
|
-
throw new Error(`--registry module must default-export an array of block definitions: ${resolvedPath}`);
|
|
164
|
-
}
|
|
165
|
-
registry.use(mod.default);
|
|
166
|
-
return registry;
|
|
167
|
-
}
|
|
168
137
|
function findingFromProjectFinding(finding, cwd) {
|
|
169
138
|
return {
|
|
170
139
|
severity: finding.severity,
|
|
@@ -178,20 +147,17 @@ function findingFromProjectFinding(finding, cwd) {
|
|
|
178
147
|
...(finding.hint ? { hint: finding.hint } : {}),
|
|
179
148
|
};
|
|
180
149
|
}
|
|
181
|
-
function fileSummary(file, cwd, frontmatter, stats, findings, options) {
|
|
150
|
+
function fileSummary(file, cwd, frontmatter, stats, findings, options, seoPage) {
|
|
182
151
|
const counts = summarize(findings);
|
|
183
|
-
const
|
|
184
|
-
const slug = stringValue(frontmatter[options.linkOptions?.slugField ?? 'slug']);
|
|
185
|
-
const key = stringValue(frontmatter[options.linkOptions?.keyField ?? 'key']);
|
|
186
|
-
const locale = stringValue(frontmatter[options.linkOptions?.localeField ?? 'locale']);
|
|
152
|
+
const facts = readContentPageFacts(frontmatter, options.linkOptions);
|
|
187
153
|
return {
|
|
188
154
|
path: file,
|
|
189
155
|
relativePath: relativePath(cwd, file),
|
|
190
156
|
title: titleFor(file, frontmatter, stats),
|
|
191
|
-
...(slug ? { slug } : {}),
|
|
192
|
-
...(key ? { key } : {}),
|
|
193
|
-
...(locale ? { locale } : {}),
|
|
194
|
-
...(keywords ? { keywords } : {}),
|
|
157
|
+
...(facts.slug ? { slug: facts.slug } : {}),
|
|
158
|
+
...(facts.key ? { key: facts.key } : {}),
|
|
159
|
+
...(facts.locale ? { locale: facts.locale } : {}),
|
|
160
|
+
...(facts.keywords ? { keywords: facts.keywords } : {}),
|
|
195
161
|
words: stats.length.words,
|
|
196
162
|
readingMinutes: stats.length.readingMinutes,
|
|
197
163
|
blocks: stats.blocks.total,
|
|
@@ -199,6 +165,17 @@ function fileSummary(file, cwd, frontmatter, stats, findings, options) {
|
|
|
199
165
|
links: stats.links.total,
|
|
200
166
|
externalLinks: stats.links.external,
|
|
201
167
|
missingAlt: stats.images.missingAlt,
|
|
168
|
+
...(seoPage
|
|
169
|
+
? {
|
|
170
|
+
seo: {
|
|
171
|
+
id: seoPage.id,
|
|
172
|
+
source: seoPage.source,
|
|
173
|
+
...(seoPage.type ? { type: seoPage.type } : {}),
|
|
174
|
+
...(seoPage.intent ? { intent: seoPage.intent } : {}),
|
|
175
|
+
findings: findings.filter((finding) => finding.source === 'seo').length,
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
: {}),
|
|
202
179
|
findings: counts,
|
|
203
180
|
status: statusFor(counts),
|
|
204
181
|
};
|
|
@@ -206,24 +183,8 @@ function fileSummary(file, cwd, frontmatter, stats, findings, options) {
|
|
|
206
183
|
function titleFor(file, frontmatter, stats) {
|
|
207
184
|
return stringValue(frontmatter.title) ?? stats.outline[0]?.text ?? basename(file);
|
|
208
185
|
}
|
|
209
|
-
function keywordData(value) {
|
|
210
|
-
if (!value || typeof value !== 'object')
|
|
211
|
-
return undefined;
|
|
212
|
-
const record = value;
|
|
213
|
-
const primary = stringValue(record.primary);
|
|
214
|
-
const secondary = Array.isArray(record.secondary)
|
|
215
|
-
? record.secondary.filter((item) => typeof item === 'string')
|
|
216
|
-
: undefined;
|
|
217
|
-
return primary || (secondary?.length ?? 0) > 0
|
|
218
|
-
? { ...(primary ? { primary } : {}), ...(secondary ? { secondary } : {}) }
|
|
219
|
-
: undefined;
|
|
220
|
-
}
|
|
221
186
|
function summarize(findings) {
|
|
222
|
-
return
|
|
223
|
-
errors: findings.filter((finding) => finding.severity === 'error').length,
|
|
224
|
-
warnings: findings.filter((finding) => finding.severity === 'warning').length,
|
|
225
|
-
suggestions: findings.filter((finding) => finding.severity === 'info').length,
|
|
226
|
-
};
|
|
187
|
+
return summarizeContentProjectFindings(findings);
|
|
227
188
|
}
|
|
228
189
|
function statusFor(findings) {
|
|
229
190
|
if (findings.errors > 0)
|
|
@@ -238,33 +199,12 @@ function findAllowedFile(context, cwd, requestedPath) {
|
|
|
238
199
|
return (context.files.find((file) => file === requestedPath || relativePath(cwd, file) === requestedPath) ?? null);
|
|
239
200
|
}
|
|
240
201
|
function compareFindings(a, b) {
|
|
241
|
-
return (
|
|
202
|
+
return (compareContentProjectFindings(a, b) ||
|
|
242
203
|
a.relativePath.localeCompare(b.relativePath) ||
|
|
243
204
|
(a.line ?? 0) - (b.line ?? 0) ||
|
|
244
205
|
(a.column ?? 0) - (b.column ?? 0) ||
|
|
245
206
|
a.code.localeCompare(b.code));
|
|
246
207
|
}
|
|
247
|
-
function rank(finding) {
|
|
248
|
-
if (finding.severity === 'error' && finding.source === 'validation')
|
|
249
|
-
return 0;
|
|
250
|
-
if (finding.severity === 'error' && finding.source === 'links')
|
|
251
|
-
return 1;
|
|
252
|
-
if (finding.severity === 'warning')
|
|
253
|
-
return 2;
|
|
254
|
-
if (finding.code === 'CB_THIN_SECTION')
|
|
255
|
-
return 3;
|
|
256
|
-
if (finding.code === 'CB_BLOCKLESS_DOCUMENT')
|
|
257
|
-
return 4;
|
|
258
|
-
if (finding.code === 'CB_IMAGE_ALT_MISSING')
|
|
259
|
-
return 5;
|
|
260
|
-
return 6;
|
|
261
|
-
}
|
|
262
|
-
function pageIdentity(page) {
|
|
263
|
-
return `${page.locale ?? ''}\0${page.key ?? page.slug}`;
|
|
264
|
-
}
|
|
265
|
-
function targetFromMessage(message) {
|
|
266
|
-
return message.match(/linksTo "([^"]+)"/)?.[1];
|
|
267
|
-
}
|
|
268
208
|
function stringValue(value) {
|
|
269
209
|
return typeof value === 'string' && value.trim().length > 0 ? value : undefined;
|
|
270
210
|
}
|
package/dist/server/server.js
CHANGED
|
@@ -3415,7 +3415,7 @@ var defaultSerovalPlugins = [
|
|
|
3415
3415
|
* the dev styles URL for route-scoped CSS collection.
|
|
3416
3416
|
*/
|
|
3417
3417
|
async function getStartManifest(matchedRoutes) {
|
|
3418
|
-
const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-
|
|
3418
|
+
const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-BSt6T4tK.js");
|
|
3419
3419
|
const startManifest = tsrStartManifest();
|
|
3420
3420
|
let routes = startManifest.routes;
|
|
3421
3421
|
routes[rootRouteId];
|
|
@@ -5130,7 +5130,7 @@ var getBaseManifest = getProdBaseManifest;
|
|
|
5130
5130
|
var createEarlyHintsForRequest = createEarlyHintsCollector;
|
|
5131
5131
|
async function loadEntries() {
|
|
5132
5132
|
const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
|
|
5133
|
-
import("./assets/router-
|
|
5133
|
+
import("./assets/router-734kIJxk.js"),
|
|
5134
5134
|
import("./assets/start-q50h9Mc3.js"),
|
|
5135
5135
|
import("./assets/empty-plugin-adapters-DKUlnwwl.js")
|
|
5136
5136
|
]);
|
package/dist/server/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DocumentStats, LinkReference, LinkResolverOptions } from '@contentbit/core';
|
|
1
|
+
import type { DocumentStats, LinkReference, LinkResolverOptions, SeoBrief } from '@contentbit/core';
|
|
2
2
|
import type { BlockComponent } from '@contentbit/react';
|
|
3
3
|
export type StudioSeverity = 'error' | 'warning' | 'info';
|
|
4
4
|
export type StudioStatus = 'error' | 'warning' | 'suggestion' | 'healthy';
|
|
5
|
-
export type StudioFindingSource = 'validation' | 'links' | 'stats';
|
|
5
|
+
export type StudioFindingSource = 'validation' | 'links' | 'stats' | 'seo';
|
|
6
6
|
export interface StudioFinding {
|
|
7
7
|
severity: StudioSeverity;
|
|
8
8
|
source: StudioFindingSource;
|
|
@@ -17,6 +17,7 @@ export interface StudioFinding {
|
|
|
17
17
|
export interface StudioKeywordData {
|
|
18
18
|
primary?: string;
|
|
19
19
|
secondary?: string[];
|
|
20
|
+
lsi?: string[];
|
|
20
21
|
}
|
|
21
22
|
export interface StudioFileSummary {
|
|
22
23
|
path: string;
|
|
@@ -33,6 +34,13 @@ export interface StudioFileSummary {
|
|
|
33
34
|
links: number;
|
|
34
35
|
externalLinks: number;
|
|
35
36
|
missingAlt: number;
|
|
37
|
+
seo?: {
|
|
38
|
+
id: string;
|
|
39
|
+
source: 'existing' | 'planned';
|
|
40
|
+
type?: string;
|
|
41
|
+
intent?: string;
|
|
42
|
+
findings: number;
|
|
43
|
+
};
|
|
36
44
|
findings: {
|
|
37
45
|
errors: number;
|
|
38
46
|
warnings: number;
|
|
@@ -64,6 +72,13 @@ export interface StudioProject {
|
|
|
64
72
|
links: number;
|
|
65
73
|
orphans: number;
|
|
66
74
|
};
|
|
75
|
+
seo?: {
|
|
76
|
+
schemaVersion: string;
|
|
77
|
+
pages: number;
|
|
78
|
+
existing: number;
|
|
79
|
+
planned: number;
|
|
80
|
+
findings: number;
|
|
81
|
+
};
|
|
67
82
|
findings: StudioFinding[];
|
|
68
83
|
}
|
|
69
84
|
export interface StudioDocument {
|
|
@@ -74,6 +89,7 @@ export interface StudioDocument {
|
|
|
74
89
|
findings: StudioFinding[];
|
|
75
90
|
linksTo: string[] | LinkReference[];
|
|
76
91
|
linkedFrom: string[] | LinkReference[];
|
|
92
|
+
seoBrief?: SeoBrief;
|
|
77
93
|
previewHtml: string;
|
|
78
94
|
}
|
|
79
95
|
export interface StudioGraphNode {
|
|
@@ -102,6 +118,8 @@ export interface StudioOptions {
|
|
|
102
118
|
cwd?: string;
|
|
103
119
|
linkOptions?: LinkResolverOptions;
|
|
104
120
|
minSectionWords?: number;
|
|
121
|
+
seoConfig?: unknown;
|
|
122
|
+
seoConfigPath?: string;
|
|
105
123
|
previewComponents?: () => Promise<Record<string, BlockComponent> | undefined>;
|
|
106
124
|
}
|
|
107
125
|
export interface StartStudioOptions extends StudioOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa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W,CAAC,EAAE,mBAAmB,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,SAAS,CAAC,CAAA;CAC9E;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentbit/studio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Local read-only content studio for contentbit projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -48,9 +48,10 @@
|
|
|
48
48
|
"tinyglobby": "^0.2.10",
|
|
49
49
|
"tw-animate-css": "^1.4.0",
|
|
50
50
|
"vite": "^8",
|
|
51
|
-
"@contentbit/blocks": "0.
|
|
52
|
-
"@contentbit/core": "0.
|
|
53
|
-
"@contentbit/
|
|
51
|
+
"@contentbit/blocks": "0.6.0",
|
|
52
|
+
"@contentbit/core": "0.6.0",
|
|
53
|
+
"@contentbit/project": "0.6.0",
|
|
54
|
+
"@contentbit/react": "0.6.0"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@testing-library/dom": "^10.4.1",
|