boltdocs 3.3.4 → 3.3.5
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-1CsvBIsN.cjs → build-B672n0hL.cjs} +1 -1
- package/dist/{build-COgv-rkY.mjs → build-BVoMHMhw.mjs} +1 -1
- package/dist/client/index.cjs +55 -24
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +55 -24
- package/dist/client/primitives.d.cts +1 -1
- package/dist/client/primitives.d.ts +1 -1
- package/dist/{dev-UWVM3ah-.mjs → dev-B49V6O6p.mjs} +1 -1
- package/dist/{dev-C_9iBwmu.cjs → dev-DbuhNcF5.cjs} +1 -1
- package/dist/{index-Cg3TmXIZ.d.ts → index-B3o307nd.d.ts} +6 -2
- package/dist/{index-CSiMUBhC.d.cts → index-Bg-JtZeK.d.cts} +6 -2
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{node-C3HctGaH.cjs → node-BljvHMpS.cjs} +2 -2
- package/dist/{node-CUiheODn.mjs → node-CWxGw4H4.mjs} +2 -2
- package/dist/{package-Cwma8oO7.cjs → package-CNqjEYE1.cjs} +1 -1
- package/dist/{package-CKC-4LtU.mjs → package-sdcKhDhe.mjs} +1 -1
- package/dist/{plugin-C8UMIA-4.mjs → plugin-BPcm1cU0.mjs} +2 -2
- package/dist/{plugin-BX6TXR8x.cjs → plugin-WUhxnpko.cjs} +2 -2
- package/dist/{plugin-context-BxF88sW4.cjs → plugin-context-CscLcXjH.cjs} +1 -1
- package/dist/{plugin-context-BKK-nfOd.mjs → plugin-context-DuSg-Hax.mjs} +1 -1
- package/dist/{plugin-lifecycle-BjMclfc3.cjs → plugin-lifecycle-BywrEoWK.cjs} +1 -1
- package/dist/{search-dialog-MmwxFMmE.js → search-dialog-B9mdxsUC.js} +1 -1
- package/dist/{search-dialog-D3jtaw6w.cjs → search-dialog-Bp_ouN1c.cjs} +36 -11
- package/dist/{search-dialog-DmirOMPg.cjs → search-dialog-DCtm2dyR.cjs} +1 -1
- package/dist/{search-dialog-DRiXejws.js → search-dialog-an2BNMj6.js} +36 -11
- package/dist/{virtual-modules-XBiJoTsp.mjs → virtual-modules-B2X4Ht2r.mjs} +1 -1
- package/dist/{virtual-modules-hndVivLR.cjs → virtual-modules-DPsdHKcu.cjs} +1 -1
- package/package.json +5 -5
|
@@ -8,7 +8,6 @@ const require_link = require('./link-vZjmD-es.cjs');
|
|
|
8
8
|
const require_search_dialog = require('./search-dialog-x_qHU8ty.cjs');
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
-
let flexsearch = require("flexsearch");
|
|
12
11
|
let virtual_boltdocs_search = require("virtual:boltdocs-search");
|
|
13
12
|
virtual_boltdocs_search = require_router.__toESM(virtual_boltdocs_search);
|
|
14
13
|
|
|
@@ -31,7 +30,24 @@ function useRoutes() {
|
|
|
31
30
|
const { pathname } = location;
|
|
32
31
|
const { currentLocale: currentLocaleStore, currentVersion: currentVersionStore } = require_link.useBoltdocsContext();
|
|
33
32
|
const currentPath = require_link.normalizePath(pathname);
|
|
34
|
-
const currentRoute =
|
|
33
|
+
const currentRoute = (0, react.useMemo)(() => {
|
|
34
|
+
const direct = routeIndex.byPath.get(currentPath);
|
|
35
|
+
if (direct) return direct;
|
|
36
|
+
const target = currentPath.split("/").filter(Boolean);
|
|
37
|
+
if (target.length === 0) return void 0;
|
|
38
|
+
let best;
|
|
39
|
+
for (const [key, route] of routeIndex.byPath) {
|
|
40
|
+
if (!route.collection) continue;
|
|
41
|
+
const segments = key.split("/").filter(Boolean);
|
|
42
|
+
if (segments.length === 0 || segments.length > target.length) continue;
|
|
43
|
+
const offset = target.length - segments.length;
|
|
44
|
+
if (segments.every((segment, i) => segment === target[offset + i]) && (!best || segments.length > best.depth)) best = {
|
|
45
|
+
route,
|
|
46
|
+
depth: segments.length
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return best?.route;
|
|
50
|
+
}, [routeIndex, currentPath]);
|
|
35
51
|
const pathParts = pathname.split("/").filter(Boolean);
|
|
36
52
|
const urlLocale = config.i18n ? pathParts.find((part) => Array.isArray(config.i18n?.locales) ? config.i18n?.locales.includes(part) : part in (config.i18n?.locales || {})) : void 0;
|
|
37
53
|
const currentLocale = config.i18n ? urlLocale || currentLocaleStore || config.i18n.defaultLocale : void 0;
|
|
@@ -253,16 +269,25 @@ function useSearch(routes) {
|
|
|
253
269
|
(0, react.useEffect)(() => {
|
|
254
270
|
if (algoliaConfig) return;
|
|
255
271
|
if (!isOpen || searchData.length === 0 || index) return;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
272
|
+
let cancelled = false;
|
|
273
|
+
import("flexsearch").then(({ Index: FlexIndex }) => {
|
|
274
|
+
if (cancelled) return;
|
|
275
|
+
const newIndex = new FlexIndex({
|
|
276
|
+
tokenize: "forward",
|
|
277
|
+
cache: true
|
|
278
|
+
});
|
|
279
|
+
for (let i = 0; i < searchData.length; i++) {
|
|
280
|
+
const doc = searchData[i];
|
|
281
|
+
if (!doc) continue;
|
|
282
|
+
newIndex.add(i, `${doc.title} ${doc.content}`);
|
|
283
|
+
}
|
|
284
|
+
setIndex(newIndex);
|
|
285
|
+
}).catch((err) => {
|
|
286
|
+
console.error("[boltdocs] Failed to load search engine:", err);
|
|
259
287
|
});
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
newIndex.add(i, `${doc.title} ${doc.content}`);
|
|
264
|
-
}
|
|
265
|
-
setIndex(newIndex);
|
|
288
|
+
return () => {
|
|
289
|
+
cancelled = true;
|
|
290
|
+
};
|
|
266
291
|
}, [
|
|
267
292
|
isOpen,
|
|
268
293
|
index,
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const require_search_dialog = require('./search-dialog-
|
|
6
|
+
const require_search_dialog = require('./search-dialog-Bp_ouN1c.cjs');
|
|
7
7
|
|
|
8
8
|
exports.SearchDialog = require_search_dialog.SearchDialog;
|
|
@@ -8,7 +8,6 @@ import { E as useLocation, O as useNavigate } from "./router-CZBxMRAH.js";
|
|
|
8
8
|
import { i as ErrorBoundary, n as Navbar, t as SearchDialog$1 } from "./search-dialog-BqkzDTq2.js";
|
|
9
9
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { Index } from "flexsearch";
|
|
12
11
|
import fetchSearchData from "virtual:boltdocs-search";
|
|
13
12
|
|
|
14
13
|
//#region src/client/hooks/use-routes.ts
|
|
@@ -30,7 +29,24 @@ function useRoutes() {
|
|
|
30
29
|
const { pathname } = location;
|
|
31
30
|
const { currentLocale: currentLocaleStore, currentVersion: currentVersionStore } = useBoltdocsContext();
|
|
32
31
|
const currentPath = normalizePath(pathname);
|
|
33
|
-
const currentRoute =
|
|
32
|
+
const currentRoute = useMemo(() => {
|
|
33
|
+
const direct = routeIndex.byPath.get(currentPath);
|
|
34
|
+
if (direct) return direct;
|
|
35
|
+
const target = currentPath.split("/").filter(Boolean);
|
|
36
|
+
if (target.length === 0) return void 0;
|
|
37
|
+
let best;
|
|
38
|
+
for (const [key, route] of routeIndex.byPath) {
|
|
39
|
+
if (!route.collection) continue;
|
|
40
|
+
const segments = key.split("/").filter(Boolean);
|
|
41
|
+
if (segments.length === 0 || segments.length > target.length) continue;
|
|
42
|
+
const offset = target.length - segments.length;
|
|
43
|
+
if (segments.every((segment, i) => segment === target[offset + i]) && (!best || segments.length > best.depth)) best = {
|
|
44
|
+
route,
|
|
45
|
+
depth: segments.length
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return best?.route;
|
|
49
|
+
}, [routeIndex, currentPath]);
|
|
34
50
|
const pathParts = pathname.split("/").filter(Boolean);
|
|
35
51
|
const urlLocale = config.i18n ? pathParts.find((part) => Array.isArray(config.i18n?.locales) ? config.i18n?.locales.includes(part) : part in (config.i18n?.locales || {})) : void 0;
|
|
36
52
|
const currentLocale = config.i18n ? urlLocale || currentLocaleStore || config.i18n.defaultLocale : void 0;
|
|
@@ -252,16 +268,25 @@ function useSearch(routes) {
|
|
|
252
268
|
useEffect(() => {
|
|
253
269
|
if (algoliaConfig) return;
|
|
254
270
|
if (!isOpen || searchData.length === 0 || index) return;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
271
|
+
let cancelled = false;
|
|
272
|
+
import("flexsearch").then(({ Index: FlexIndex }) => {
|
|
273
|
+
if (cancelled) return;
|
|
274
|
+
const newIndex = new FlexIndex({
|
|
275
|
+
tokenize: "forward",
|
|
276
|
+
cache: true
|
|
277
|
+
});
|
|
278
|
+
for (let i = 0; i < searchData.length; i++) {
|
|
279
|
+
const doc = searchData[i];
|
|
280
|
+
if (!doc) continue;
|
|
281
|
+
newIndex.add(i, `${doc.title} ${doc.content}`);
|
|
282
|
+
}
|
|
283
|
+
setIndex(newIndex);
|
|
284
|
+
}).catch((err) => {
|
|
285
|
+
console.error("[boltdocs] Failed to load search engine:", err);
|
|
258
286
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
newIndex.add(i, `${doc.title} ${doc.content}`);
|
|
263
|
-
}
|
|
264
|
-
setIndex(newIndex);
|
|
287
|
+
return () => {
|
|
288
|
+
cancelled = true;
|
|
289
|
+
};
|
|
265
290
|
}, [
|
|
266
291
|
isOpen,
|
|
267
292
|
index,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{_ as e,g as t,h as n}from"./plugin-context-
|
|
6
|
+
import{_ as e,g as t,h as n}from"./plugin-context-DuSg-Hax.mjs";import{u as r}from"./utils-8lzafE49.mjs";import{c as i,l as a,s as o,t as s}from"./routes-C4wrLWwu.mjs";import c from"node:path";import l from"node:fs";function u(e){return typeof e==`string`?[e]:Array.isArray(e)?e.flatMap(u):e&&typeof e==`object`?Object.values(e).flatMap(u):[]}const d=new Set([`title`,`description`,`permalink`,`sidebarPosition`,`sidebarLabel`,`sidebarHidden`,`hidden`,`category`,`order`,`badge`,`icon`,`date`,`lastUpdated`,`groupTitle`,`groupPosition`,`seo`]);function f(e){let t=[];for(let n of e){let e=``;n.frontmatter&&(e=u(Object.entries(n.frontmatter).filter(([e])=>!d.has(e)).map(([e,t])=>t)).join(` `));let r=(e?`${n._content||``} ${e}`:n._content||``).slice(0,500);if(t.push({id:n.path,title:n.title,content:r,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings)for(let e of n.headings)t.push({id:`${n.path}#${e.id}`,title:e.text,content:`${e.text} in ${n.title}`,url:`${n.path}#${e.id}`,display:`${n.title} > ${e.text}`,locale:n.locale,version:n.version})}return t}function p(e){return{path:e.path,filePath:e.filePath,title:e.title,description:e.description||``,sidebarPosition:e.sidebarPosition,badge:e.badge,icon:e.icon,headings:e.headings||[],frontmatter:e.frontmatter,locale:e.locale,version:e.version,tab:e.tab,collection:e.collection,tags:e.tags,author:e.author,draft:e.draft,excerpt:e.excerpt,coverImage:e.coverImage,group:e.group,groupTitle:e.groupTitle,groupPosition:e.groupPosition,groupIcon:e.groupIcon,subRouteGroup:e.subRouteGroup,seo:e.seo,date:e.date,lastUpdated:e.lastUpdated,category:e.category,order:e.order,sidebarLabel:e.sidebarLabel,sidebarHidden:e.sidebarHidden,slugParts:e.slugParts}}function m(e){return{routeCacheContext:e,routeGenerationFingerprint:void 0,directoryMetaCache:null,routesDataMap:new Map,collectionsDataMap:new Map,searchDataMap:new Map}}const h=m();function g(e){return e??h}function _(e){let t=g(e);t.directoryMetaCache=null,t.routeGenerationFingerprint=void 0,t.routeCacheVariant=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()}function v(e,t){return(!t.routeCacheContext||t.routeCacheContext.disposed)&&(t.routeCacheContext=o(e),t.routeCacheVariant=void 0,t.routeGenerationFingerprint=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()),t.routeCacheContext}async function y(e,t,n,r){let o=g(n),c=v(e,o),l=a(t),u=(r?.fingerprint===l&&c.variants.get(l)===r?r:void 0)??i(c,l);o.routeCacheVariant=u,o.routeGenerationFingerprint=l;let d=await s(e,t,void 0,!1,c,u);o.routesDataMap.clear();for(let e of d)o.routesDataMap.set(e.path,e);b(o)}function b(e){let t=g(e),n=Array.from(t.routesDataMap.values()),r=f(n);t.searchDataMap.clear();for(let e of r)t.searchDataMap.set(e.id,e);t.collectionsDataMap.clear();for(let e of n)if(e.collection){let n={path:e.path,title:e.title,date:e.date,excerpt:e.excerpt,tags:e.tags,author:e.author,coverImage:e.coverImage,filePath:e.filePath,locale:e.locale,version:e.version,frontmatter:e.frontmatter,draft:e.frontmatter?.draft,collection:e.collection};t.collectionsDataMap.set(e.filePath,n)}}async function x(e,t,n){let r=g(n);v(e,r);let i=a(t);(r.routesDataMap.size===0||r.routeGenerationFingerprint!==i)&&(r.routesDataMap.clear(),r.collectionsDataMap.clear(),r.searchDataMap.clear(),await y(e,t,r))}function S(e){let t=g(e),n={},r=Array.from(t.collectionsDataMap.values()).sort((e,t)=>{let n=e=>{if(!e)return-1/0;let t=new Date(e).getTime();return Number.isFinite(t)?t:-1/0},r=n(e.date),i=n(t.date)-r;return i===0?e.path.localeCompare(t.path):i});for(let e of r){let t=e.collection;t&&(n[t]||(n[t]=[]),n[t].push(e))}return n}function C(e,t=e=>e){let n=Array.from(e.values(),t).sort((e,t)=>{let n=e=>{if(typeof e!=`object`||!e)return String(e);let t=e;return`${String(t.path||``)}\u0000${String(t.id||``)}\u0000${String(t.filePath||``)}`};return n(e).localeCompare(n(t))});return`export default ${JSON.stringify(n)};`}function w(e){return Array.from(g(e).searchDataMap.values()).sort((e,t)=>e.id.localeCompare(t.id))}function T(e){return`export default ${JSON.stringify(e)};`}async function E(e,t,n,r,i){let o=g(n);r&&(o.routeCacheContext=r),i&&(o.routeCacheVariant=i);let s=a(t);o.routeGenerationFingerprint!==s&&(o.routesDataMap.clear(),o.collectionsDataMap.clear(),o.searchDataMap.clear());let c=new Map(o.routesDataMap),l=new Map(o.collectionsDataMap),u=new Map(o.searchDataMap);await y(e,t,o);let d={routes:{updated:[],deleted:[]},collections:{updated:[],deleted:[]},search:{updated:[],deleted:[]}};for(let[e,t]of o.routesDataMap){let n=c.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.routes.updated.push(p(t))}for(let e of c.keys())o.routesDataMap.has(e)||d.routes.deleted.push(e);for(let[e,t]of o.collectionsDataMap){let n=l.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.collections.updated.push(t)}for(let e of l.keys())o.collectionsDataMap.has(e)||d.collections.deleted.push(e);for(let[e,t]of o.searchDataMap){let n=u.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&d.search.updated.push(t)}for(let e of u.keys())o.searchDataMap.has(e)||d.search.deleted.push(e);return d}function D(i,a,o,s,u,d){let f=u?.virtualModuleRegistry??n,m=g(d);return{name:`vite-plugin-boltdocs-virtual-modules`,resolveId(e){if(o()?.root||process.cwd(),e.includes(`boltdocs-entry`)||e===`virtual:boltdocs-entry`||e===`boltdocs/entry`||e===`boltdocs-entry`||e===`\0virtual:boltdocs-entry`||e===`\0virtual:boltdocs-entry.tsx`)return`\0virtual:boltdocs-entry.tsx`;if(e.includes(`boltdocs-client`)||e===`virtual:boltdocs-client`||e===`boltdocs/client`||e===`boltdocs-client`||e===`\0virtual:boltdocs-client.mjs`)return`\0virtual:boltdocs-client.mjs`;if(e.startsWith(`\0`)){let t=e.slice(1);if(!t.startsWith(`virtual:boltdocs-`)&&f?.has(t))return e}else if(!e.startsWith(`virtual:boltdocs-`)&&f?.has(e))return`\0`+e;return e.startsWith(`virtual:boltdocs-`)?`\0`+e:e.startsWith(`\0virtual:boltdocs-`)?e:null},async load(n,u){let d=a(),h=n.startsWith(`\0`)?n.slice(1):n;if(!h.includes(`boltdocs-entry.tsx`)&&!h.includes(`boltdocs-client.mjs`)&&!h.startsWith(`virtual:boltdocs-`)&&f?.has(h)){let e=f?.get(h);if(!e)return null;try{let t=await e.loader();if(typeof t!=`string`)throw Error(`[boltdocs] Plugin virtual module '${h}' loader must return a string source code, got ${typeof t}.`);return t}catch(e){throw Error(`[boltdocs] Plugin virtual module '${h}' failed to load: ${e instanceof Error?e.message:String(e)}`)}}if(n.includes(`boltdocs-entry.tsx`)||n===`\0virtual:boltdocs-entry`){let e=this.environment?.config?.consumer,n=o(),r=e===void 0?!!n?.build?.ssr:e!==`client`;return t({...i,ssr:r,useCompiledPages:n?.command===`build`},d)}if(n.includes(`boltdocs-client.mjs`)||n===`\0virtual:boltdocs-client.ts`||n===`virtual:boltdocs-client`){let t=e,n=t;for(;t!==c.parse(t).root;){if(l.existsSync(c.join(t,`package.json`))&&JSON.parse(l.readFileSync(c.join(t,`package.json`),`utf-8`)).name===`boltdocs`){n=t;break}t=c.dirname(t)}let i=c.join(n,`src/client/index.ts`),a=c.join(n,`dist/client/index.js`);return`export * from '${r(l.existsSync(i)?i:a)}';`}if(!n.startsWith(`\0virtual:boltdocs-`))return;let g=n.replace(`\0virtual:boltdocs-`,``).replace(/\.tsx?$/,``);if(g===`routes`)return await x(s,d,m),C(m.routesDataMap,p);if(g===`collections`)return await x(s,d,m),T(S(m));if(g===`config`){await x(s,d,m);let e=m.routeCacheVariant?.directoryMeta||{};m.directoryMetaCache=e;let t=[...new Set(Array.from(m.routesDataMap.values()).map(e=>e.collection).filter(e=>!!e))].sort((e,t)=>e.localeCompare(t)),n=d?.collections,r=n?{...n,labels:{...n.labels||{},...Object.fromEntries(t.map(e=>[e,n.labels?.[e]??e]))}}:t.length>0?t:void 0,i={base:d?.base,theme:d?.theme,i18n:d?.i18n,versions:d?.versions,siteUrl:d?.siteUrl,integrations:d?.integrations,collections:r,seo:d?.seo,experimental:d?.experimental,plugins:d?.plugins?.map(e=>({name:e.name})),directoryMeta:e};return`export default ${JSON.stringify(i,null,2)};`}if(g===`entry`){let e=this,n=o(),r=e.environment?.config?.consumer,a=r===void 0?!!(u?.ssr??n?.build?.ssr):r!==`client`;return t({...i,ssr:a,useCompiledPages:n?.command===`build`},d)}if(g===`mdx-components`){let e=[`tsx`,`ts`,`jsx`,`js`],t=null;for(let n of e){let e=c.resolve(s,`mdx-components.${n}`);if(l.existsSync(e)){t=e;break}}let n={};if(d?.plugins)for(let e of d.plugins)e.components&&Object.assign(n,e.components);let i=Object.entries(n),a=i.map(([e,t],n)=>`import * as _pluginCompMod_${n} from '${t}';`).join(`
|
|
7
7
|
`),o=i.map(([e],t)=>`${JSON.stringify(e)}: _pluginCompMod_${t}[${JSON.stringify(e)}] || _pluginCompMod_${t}["default"] || _pluginCompMod_${t}`).join(`,
|
|
8
8
|
`);if(t){let e=r(t);return`${a}
|
|
9
9
|
import * as components from '${e}';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const e=require(`./chunk-D1Md3oWO.cjs`),t=require(`./utils-ej6_SjIZ.cjs`),n=require(`./plugin-context-
|
|
6
|
+
const e=require(`./chunk-D1Md3oWO.cjs`),t=require(`./utils-ej6_SjIZ.cjs`),n=require(`./plugin-context-CscLcXjH.cjs`),r=require(`./routes-C0kb4ue6.cjs`);let i=require(`node:path`);i=e.r(i);let a=require(`node:fs`);a=e.r(a);function o(e){return typeof e==`string`?[e]:Array.isArray(e)?e.flatMap(o):e&&typeof e==`object`?Object.values(e).flatMap(o):[]}const s=new Set([`title`,`description`,`permalink`,`sidebarPosition`,`sidebarLabel`,`sidebarHidden`,`hidden`,`category`,`order`,`badge`,`icon`,`date`,`lastUpdated`,`groupTitle`,`groupPosition`,`seo`]);function c(e){let t=[];for(let n of e){let e=``;n.frontmatter&&(e=o(Object.entries(n.frontmatter).filter(([e])=>!s.has(e)).map(([e,t])=>t)).join(` `));let r=(e?`${n._content||``} ${e}`:n._content||``).slice(0,500);if(t.push({id:n.path,title:n.title,content:r,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings)for(let e of n.headings)t.push({id:`${n.path}#${e.id}`,title:e.text,content:`${e.text} in ${n.title}`,url:`${n.path}#${e.id}`,display:`${n.title} > ${e.text}`,locale:n.locale,version:n.version})}return t}function l(e){return{path:e.path,filePath:e.filePath,title:e.title,description:e.description||``,sidebarPosition:e.sidebarPosition,badge:e.badge,icon:e.icon,headings:e.headings||[],frontmatter:e.frontmatter,locale:e.locale,version:e.version,tab:e.tab,collection:e.collection,tags:e.tags,author:e.author,draft:e.draft,excerpt:e.excerpt,coverImage:e.coverImage,group:e.group,groupTitle:e.groupTitle,groupPosition:e.groupPosition,groupIcon:e.groupIcon,subRouteGroup:e.subRouteGroup,seo:e.seo,date:e.date,lastUpdated:e.lastUpdated,category:e.category,order:e.order,sidebarLabel:e.sidebarLabel,sidebarHidden:e.sidebarHidden,slugParts:e.slugParts}}function u(e){return{routeCacheContext:e,routeGenerationFingerprint:void 0,directoryMetaCache:null,routesDataMap:new Map,collectionsDataMap:new Map,searchDataMap:new Map}}const d=u();function f(e){return e??d}function p(e){let t=f(e);t.directoryMetaCache=null,t.routeGenerationFingerprint=void 0,t.routeCacheVariant=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()}function m(e,t){return(!t.routeCacheContext||t.routeCacheContext.disposed)&&(t.routeCacheContext=r.s(e),t.routeCacheVariant=void 0,t.routeGenerationFingerprint=void 0,t.routesDataMap.clear(),t.collectionsDataMap.clear(),t.searchDataMap.clear()),t.routeCacheContext}async function h(e,t,n,i){let a=f(n),o=m(e,a),s=r.l(t),c=(i?.fingerprint===s&&o.variants.get(s)===i?i:void 0)??r.c(o,s);a.routeCacheVariant=c,a.routeGenerationFingerprint=s;let l=await r.t(e,t,void 0,!1,o,c);a.routesDataMap.clear();for(let e of l)a.routesDataMap.set(e.path,e);g(a)}function g(e){let t=f(e),n=Array.from(t.routesDataMap.values()),r=c(n);t.searchDataMap.clear();for(let e of r)t.searchDataMap.set(e.id,e);t.collectionsDataMap.clear();for(let e of n)if(e.collection){let n={path:e.path,title:e.title,date:e.date,excerpt:e.excerpt,tags:e.tags,author:e.author,coverImage:e.coverImage,filePath:e.filePath,locale:e.locale,version:e.version,frontmatter:e.frontmatter,draft:e.frontmatter?.draft,collection:e.collection};t.collectionsDataMap.set(e.filePath,n)}}async function _(e,t,n){let i=f(n);m(e,i);let a=r.l(t);(i.routesDataMap.size===0||i.routeGenerationFingerprint!==a)&&(i.routesDataMap.clear(),i.collectionsDataMap.clear(),i.searchDataMap.clear(),await h(e,t,i))}function v(e){let t=f(e),n={},r=Array.from(t.collectionsDataMap.values()).sort((e,t)=>{let n=e=>{if(!e)return-1/0;let t=new Date(e).getTime();return Number.isFinite(t)?t:-1/0},r=n(e.date),i=n(t.date)-r;return i===0?e.path.localeCompare(t.path):i});for(let e of r){let t=e.collection;t&&(n[t]||(n[t]=[]),n[t].push(e))}return n}function y(e,t=e=>e){let n=Array.from(e.values(),t).sort((e,t)=>{let n=e=>{if(typeof e!=`object`||!e)return String(e);let t=e;return`${String(t.path||``)}\u0000${String(t.id||``)}\u0000${String(t.filePath||``)}`};return n(e).localeCompare(n(t))});return`export default ${JSON.stringify(n)};`}function b(e){return Array.from(f(e).searchDataMap.values()).sort((e,t)=>e.id.localeCompare(t.id))}function x(e){return`export default ${JSON.stringify(e)};`}async function S(e,t,n,i,a){let o=f(n);i&&(o.routeCacheContext=i),a&&(o.routeCacheVariant=a);let s=r.l(t);o.routeGenerationFingerprint!==s&&(o.routesDataMap.clear(),o.collectionsDataMap.clear(),o.searchDataMap.clear());let c=new Map(o.routesDataMap),u=new Map(o.collectionsDataMap),d=new Map(o.searchDataMap);await h(e,t,o);let p={routes:{updated:[],deleted:[]},collections:{updated:[],deleted:[]},search:{updated:[],deleted:[]}};for(let[e,t]of o.routesDataMap){let n=c.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&p.routes.updated.push(l(t))}for(let e of c.keys())o.routesDataMap.has(e)||p.routes.deleted.push(e);for(let[e,t]of o.collectionsDataMap){let n=u.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&p.collections.updated.push(t)}for(let e of u.keys())o.collectionsDataMap.has(e)||p.collections.deleted.push(e);for(let[e,t]of o.searchDataMap){let n=d.get(e);(!n||JSON.stringify(n)!==JSON.stringify(t))&&p.search.updated.push(t)}for(let e of d.keys())o.searchDataMap.has(e)||p.search.deleted.push(e);return p}function C(e,r,o,s,c,u){let d=c?.virtualModuleRegistry??n.h,p=f(u);return{name:`vite-plugin-boltdocs-virtual-modules`,resolveId(e){if(o()?.root||process.cwd(),e.includes(`boltdocs-entry`)||e===`virtual:boltdocs-entry`||e===`boltdocs/entry`||e===`boltdocs-entry`||e===`\0virtual:boltdocs-entry`||e===`\0virtual:boltdocs-entry.tsx`)return`\0virtual:boltdocs-entry.tsx`;if(e.includes(`boltdocs-client`)||e===`virtual:boltdocs-client`||e===`boltdocs/client`||e===`boltdocs-client`||e===`\0virtual:boltdocs-client.mjs`)return`\0virtual:boltdocs-client.mjs`;if(e.startsWith(`\0`)){let t=e.slice(1);if(!t.startsWith(`virtual:boltdocs-`)&&d?.has(t))return e}else if(!e.startsWith(`virtual:boltdocs-`)&&d?.has(e))return`\0`+e;return e.startsWith(`virtual:boltdocs-`)?`\0`+e:e.startsWith(`\0virtual:boltdocs-`)?e:null},async load(c,u){let f=r(),m=c.startsWith(`\0`)?c.slice(1):c;if(!m.includes(`boltdocs-entry.tsx`)&&!m.includes(`boltdocs-client.mjs`)&&!m.startsWith(`virtual:boltdocs-`)&&d?.has(m)){let e=d?.get(m);if(!e)return null;try{let t=await e.loader();if(typeof t!=`string`)throw Error(`[boltdocs] Plugin virtual module '${m}' loader must return a string source code, got ${typeof t}.`);return t}catch(e){throw Error(`[boltdocs] Plugin virtual module '${m}' failed to load: ${e instanceof Error?e.message:String(e)}`)}}if(c.includes(`boltdocs-entry.tsx`)||c===`\0virtual:boltdocs-entry`){let t=this.environment?.config?.consumer,r=o(),i=t===void 0?!!r?.build?.ssr:t!==`client`;return n.g({...e,ssr:i,useCompiledPages:r?.command===`build`},f)}if(c.includes(`boltdocs-client.mjs`)||c===`\0virtual:boltdocs-client.ts`||c===`virtual:boltdocs-client`){let e=__dirname,n=e;for(;e!==i.default.parse(e).root;){if(a.default.existsSync(i.default.join(e,`package.json`))&&JSON.parse(a.default.readFileSync(i.default.join(e,`package.json`),`utf-8`)).name===`boltdocs`){n=e;break}e=i.default.dirname(e)}let r=i.default.join(n,`src/client/index.ts`),o=i.default.join(n,`dist/client/index.js`);return`export * from '${t.u(a.default.existsSync(r)?r:o)}';`}if(!c.startsWith(`\0virtual:boltdocs-`))return;let h=c.replace(`\0virtual:boltdocs-`,``).replace(/\.tsx?$/,``);if(h===`routes`)return await _(s,f,p),y(p.routesDataMap,l);if(h===`collections`)return await _(s,f,p),x(v(p));if(h===`config`){await _(s,f,p);let e=p.routeCacheVariant?.directoryMeta||{};p.directoryMetaCache=e;let t=[...new Set(Array.from(p.routesDataMap.values()).map(e=>e.collection).filter(e=>!!e))].sort((e,t)=>e.localeCompare(t)),n=f?.collections,r=n?{...n,labels:{...n.labels||{},...Object.fromEntries(t.map(e=>[e,n.labels?.[e]??e]))}}:t.length>0?t:void 0,i={base:f?.base,theme:f?.theme,i18n:f?.i18n,versions:f?.versions,siteUrl:f?.siteUrl,integrations:f?.integrations,collections:r,seo:f?.seo,experimental:f?.experimental,plugins:f?.plugins?.map(e=>({name:e.name})),directoryMeta:e};return`export default ${JSON.stringify(i,null,2)};`}if(h===`entry`){let t=this,r=o(),i=t.environment?.config?.consumer,a=i===void 0?!!(u?.ssr??r?.build?.ssr):i!==`client`;return n.g({...e,ssr:a,useCompiledPages:r?.command===`build`},f)}if(h===`mdx-components`){let e=[`tsx`,`ts`,`jsx`,`js`],n=null;for(let t of e){let e=i.default.resolve(s,`mdx-components.${t}`);if(a.default.existsSync(e)){n=e;break}}let r={};if(f?.plugins)for(let e of f.plugins)e.components&&Object.assign(r,e.components);let o=Object.entries(r),c=o.map(([e,t],n)=>`import * as _pluginCompMod_${n} from '${t}';`).join(`
|
|
7
7
|
`),l=o.map(([e],t)=>`${JSON.stringify(e)}: _pluginCompMod_${t}[${JSON.stringify(e)}] || _pluginCompMod_${t}["default"] || _pluginCompMod_${t}`).join(`,
|
|
8
8
|
`);if(n){let e=t.u(n);return`${c}
|
|
9
9
|
import * as components from '${e}';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boltdocs",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"description": "A lightweight documentation generator for React projects.",
|
|
5
5
|
"main": "dist/node/index.mjs",
|
|
6
6
|
"module": "dist/node/index.mjs",
|
|
@@ -107,11 +107,11 @@
|
|
|
107
107
|
"tailwind-merge": "3.5.0",
|
|
108
108
|
"vite": "8.1.5",
|
|
109
109
|
"zod": "4.3.6",
|
|
110
|
-
"@bdocs/parser": "1.2.0",
|
|
111
110
|
"@bdocs/plugin-image-optimizer": "0.2.2",
|
|
112
|
-
"@bdocs/
|
|
113
|
-
"@bdocs/
|
|
114
|
-
"@bdocs/
|
|
111
|
+
"@bdocs/ssg": "0.4.3",
|
|
112
|
+
"@bdocs/unist-utils": "0.2.1",
|
|
113
|
+
"@bdocs/parser": "1.2.0",
|
|
114
|
+
"@bdocs/processor-satteri": "0.3.3"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"react": "19.0.0",
|