@blackwork/docs 0.1.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/LICENSE +21 -0
- package/README.md +330 -0
- package/dist/_virtual/_rolldown/runtime.cjs +9 -0
- package/dist/config/defaults.cjs +9 -0
- package/dist/config/defaults.mjs +9 -0
- package/dist/config/define-config.cjs +9 -0
- package/dist/config/define-config.d.mts +7 -0
- package/dist/config/define-config.d.ts +7 -0
- package/dist/config/define-config.mjs +9 -0
- package/dist/config/define-docs-config.cjs +9 -0
- package/dist/config/define-docs-config.d.mts +9 -0
- package/dist/config/define-docs-config.d.ts +9 -0
- package/dist/config/define-docs-config.mjs +9 -0
- package/dist/config/load-content-config.cjs +9 -0
- package/dist/config/load-content-config.d.mts +8 -0
- package/dist/config/load-content-config.d.ts +8 -0
- package/dist/config/load-content-config.mjs +9 -0
- package/dist/config/types.d.mts +78 -0
- package/dist/config/types.d.ts +78 -0
- package/dist/index.cjs +9 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.mjs +9 -0
- package/dist/mdx/default-docs-components.cjs +9 -0
- package/dist/mdx/default-docs-components.d.mts +7 -0
- package/dist/mdx/default-docs-components.d.ts +7 -0
- package/dist/mdx/default-docs-components.mjs +9 -0
- package/dist/mdx/merge-docs-components.cjs +9 -0
- package/dist/mdx/merge-docs-components.d.mts +7 -0
- package/dist/mdx/merge-docs-components.d.ts +7 -0
- package/dist/mdx/merge-docs-components.mjs +9 -0
- package/dist/metadata/create-doc-metadata.cjs +9 -0
- package/dist/metadata/create-doc-metadata.d.mts +33 -0
- package/dist/metadata/create-doc-metadata.d.ts +33 -0
- package/dist/metadata/create-doc-metadata.mjs +9 -0
- package/dist/navigation/build-locale-links.cjs +9 -0
- package/dist/navigation/build-locale-links.d.mts +24 -0
- package/dist/navigation/build-locale-links.d.ts +24 -0
- package/dist/navigation/build-locale-links.mjs +9 -0
- package/dist/navigation/build-pager.cjs +9 -0
- package/dist/navigation/build-pager.d.mts +25 -0
- package/dist/navigation/build-pager.d.ts +25 -0
- package/dist/navigation/build-pager.mjs +9 -0
- package/dist/navigation/build-sidebar.cjs +9 -0
- package/dist/navigation/build-sidebar.d.mts +28 -0
- package/dist/navigation/build-sidebar.d.ts +28 -0
- package/dist/navigation/build-sidebar.mjs +9 -0
- package/dist/navigation/resolve-sidebar.cjs +9 -0
- package/dist/navigation/resolve-sidebar.d.mts +20 -0
- package/dist/navigation/resolve-sidebar.d.ts +20 -0
- package/dist/navigation/resolve-sidebar.mjs +9 -0
- package/dist/next/context.cjs +9 -0
- package/dist/next/context.mjs +9 -0
- package/dist/next/load-doc-content.cjs +9 -0
- package/dist/next/load-doc-content.mjs +9 -0
- package/dist/next/load-generated-manifest.cjs +9 -0
- package/dist/next/load-generated-manifest.mjs +9 -0
- package/dist/next/metadata.cjs +9 -0
- package/dist/next/metadata.d.mts +12 -0
- package/dist/next/metadata.d.ts +12 -0
- package/dist/next/metadata.mjs +9 -0
- package/dist/next/page.cjs +9 -0
- package/dist/next/page.d.mts +16 -0
- package/dist/next/page.d.ts +16 -0
- package/dist/next/page.mjs +9 -0
- package/dist/next/render-route.cjs +9 -0
- package/dist/next/render-route.d.mts +10 -0
- package/dist/next/render-route.d.ts +10 -0
- package/dist/next/render-route.mjs +9 -0
- package/dist/next/resolve-document-lang.cjs +9 -0
- package/dist/next/resolve-document-lang.mjs +9 -0
- package/dist/next/root-layout.cjs +9 -0
- package/dist/next/root-layout.d.mts +19 -0
- package/dist/next/root-layout.d.ts +19 -0
- package/dist/next/root-layout.mjs +9 -0
- package/dist/next-plugin/generate.cjs +32 -0
- package/dist/next-plugin/generate.mjs +32 -0
- package/dist/next.cjs +9 -0
- package/dist/next.d.mts +21 -0
- package/dist/next.d.ts +21 -0
- package/dist/next.mjs +9 -0
- package/dist/routing/build-static-params.cjs +9 -0
- package/dist/routing/build-static-params.d.mts +13 -0
- package/dist/routing/build-static-params.d.ts +13 -0
- package/dist/routing/build-static-params.mjs +9 -0
- package/dist/routing/resolve-docs-route.cjs +9 -0
- package/dist/routing/resolve-docs-route.d.mts +35 -0
- package/dist/routing/resolve-docs-route.d.ts +35 -0
- package/dist/routing/resolve-docs-route.mjs +9 -0
- package/dist/runtime.cjs +9 -0
- package/dist/runtime.d.mts +4 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.mjs +9 -0
- package/dist/source/build-docs-source.cjs +9 -0
- package/dist/source/build-docs-source.mjs +9 -0
- package/dist/source/collect-docs-manifest.cjs +9 -0
- package/dist/source/collect-docs-manifest.mjs +9 -0
- package/dist/source/create-docs-source-from-manifest.cjs +9 -0
- package/dist/source/create-docs-source-from-manifest.mjs +9 -0
- package/dist/source/create-docs-source.cjs +9 -0
- package/dist/source/create-docs-source.d.mts +10 -0
- package/dist/source/create-docs-source.d.ts +10 -0
- package/dist/source/create-docs-source.mjs +9 -0
- package/dist/source/types.d.mts +36 -0
- package/dist/source/types.d.ts +36 -0
- package/dist/theme/components/content-shell.cjs +9 -0
- package/dist/theme/components/content-shell.d.mts +17 -0
- package/dist/theme/components/content-shell.d.ts +17 -0
- package/dist/theme/components/content-shell.mjs +9 -0
- package/dist/theme/components/docs-rail-scroll-state.cjs +9 -0
- package/dist/theme/components/docs-rail-scroll-state.mjs +9 -0
- package/dist/theme/components/docs-rail-scroll.cjs +9 -0
- package/dist/theme/components/docs-rail-scroll.mjs +9 -0
- package/dist/theme/components/docs-scroll-reset.cjs +9 -0
- package/dist/theme/components/docs-scroll-reset.mjs +9 -0
- package/dist/theme/components/docs-shell.cjs +9 -0
- package/dist/theme/components/docs-shell.d.mts +17 -0
- package/dist/theme/components/docs-shell.d.ts +17 -0
- package/dist/theme/components/docs-shell.mjs +9 -0
- package/dist/theme/components/docs-toc-geometry.cjs +9 -0
- package/dist/theme/components/docs-toc-geometry.mjs +9 -0
- package/dist/theme/components/docs-toc.cjs +9 -0
- package/dist/theme/components/docs-toc.mjs +9 -0
- package/dist/theme/components/footer.cjs +9 -0
- package/dist/theme/components/footer.d.mts +11 -0
- package/dist/theme/components/footer.d.ts +11 -0
- package/dist/theme/components/footer.mjs +9 -0
- package/dist/theme/components/header.cjs +9 -0
- package/dist/theme/components/header.d.mts +16 -0
- package/dist/theme/components/header.d.ts +16 -0
- package/dist/theme/components/header.mjs +9 -0
- package/dist/theme/components/home-shell.cjs +9 -0
- package/dist/theme/components/home-shell.d.mts +14 -0
- package/dist/theme/components/home-shell.d.ts +14 -0
- package/dist/theme/components/home-shell.mjs +9 -0
- package/dist/theme/components/link.cjs +9 -0
- package/dist/theme/components/link.d.mts +9 -0
- package/dist/theme/components/link.d.ts +9 -0
- package/dist/theme/components/link.mjs +9 -0
- package/dist/theme/components/shell-shared.cjs +9 -0
- package/dist/theme/components/shell-shared.mjs +9 -0
- package/dist/theme/create-home-data.cjs +9 -0
- package/dist/theme/create-home-data.d.mts +18 -0
- package/dist/theme/create-home-data.d.ts +18 -0
- package/dist/theme/create-home-data.mjs +9 -0
- package/dist/theme/slots.cjs +9 -0
- package/dist/theme/slots.d.mts +7 -0
- package/dist/theme/slots.d.ts +7 -0
- package/dist/theme/slots.mjs +9 -0
- package/dist/theme/types.d.mts +64 -0
- package/dist/theme/types.d.ts +64 -0
- package/dist/theme.cjs +9 -0
- package/dist/theme.d.mts +11 -0
- package/dist/theme.d.ts +11 -0
- package/dist/theme.mjs +9 -0
- package/package.json +81 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig } from "./config/types.mjs";
|
|
3
|
+
import { defineConfig } from "./config/define-config.mjs";
|
|
4
|
+
import { DefineDocsConfigOptions, defineDocsConfig } from "./config/define-docs-config.mjs";
|
|
5
|
+
import { CreateDocsSourceOptions, DocEntry, DocFormat, DocsSource } from "./source/types.mjs";
|
|
6
|
+
import { CreateDocMetadataOptions, DocsMetadata, DocsMetadataAlternates, DocsMetadataRobots, createDocMetadata } from "./metadata/create-doc-metadata.mjs";
|
|
7
|
+
import { BuildLocaleLinksOptions, DocsLocaleLink, buildLocaleLinks } from "./navigation/build-locale-links.mjs";
|
|
8
|
+
import { BuildPagerOptions, DocsPager, DocsPagerLink, buildPager } from "./navigation/build-pager.mjs";
|
|
9
|
+
import { BuildSidebarOptions, DocsSidebarItem, buildSidebar } from "./navigation/build-sidebar.mjs";
|
|
10
|
+
import { DocsRouteParams, DocsRouteResolution, ResolveDocsRouteOptions, ResolvedDocsNotFoundRoute, ResolvedDocsPageRoute, ResolvedDocsRedirectRoute, resolveDocsRoute } from "./routing/resolve-docs-route.mjs";
|
|
11
|
+
import { DocsRootLayout, DocsRootLayoutProps } from "./next/root-layout.mjs";
|
|
12
|
+
import { BuildDocsStaticParamsOptions, buildDocsStaticParams } from "./routing/build-static-params.mjs";
|
|
13
|
+
import { createDocsSource } from "./source/create-docs-source.mjs";
|
|
14
|
+
import { GenerateMetadataOptions } from "./next/metadata.mjs";
|
|
15
|
+
import { DocsPageProps, GenerateStaticParamsOptions } from "./next/page.mjs";
|
|
16
|
+
import * as _$react from "react";
|
|
17
|
+
|
|
18
|
+
//#region src/index.d.ts
|
|
19
|
+
declare const dynamicParams = false;
|
|
20
|
+
declare const generateMetadata: (options?: GenerateMetadataOptions) => Promise<DocsMetadata | Record<string, never>>;
|
|
21
|
+
declare const generateStaticParams: (options?: GenerateStaticParamsOptions) => Promise<DocsRouteParams[]>;
|
|
22
|
+
declare const DocsPage: (options: DocsPageProps) => Promise<_$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | (string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined)>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { type BuildDocsStaticParamsOptions, type BuildLocaleLinksOptions, type BuildPagerOptions, type BuildSidebarOptions, type CreateDocMetadataOptions, type CreateDocsSourceOptions, type DefineDocsConfigOptions, type DocEntry, type DocFormat, type DocsConfig, type DocsContentConfig, type DocsContentSectionConfig, type DocsHomeConfig, type DocsLocaleDefinition, type DocsLocaleLink, type DocsMdxConfig, type DocsMetadata, type DocsMetadataAlternates, type DocsMetadataRobots, DocsPage, type DocsPageProps, type DocsPager, type DocsPagerLink, DocsRootLayout, type DocsRootLayoutProps, type DocsRouteParams, type DocsRouteResolution, type DocsSectionConfig, type DocsSectionLayout, type DocsSidebarConfigNode, type DocsSidebarGroupConfig, type DocsSidebarItem, type DocsSidebarItemConfig, type DocsSidebarLabel, type DocsSidebarMode, type DocsSiteConfig, type DocsSlotsConfig, type DocsSource, type DocsThemeConfig, type GenerateMetadataOptions, type GenerateStaticParamsOptions, type NormalizedDocsConfig, type NormalizedDocsContentConfig, type NormalizedDocsContentSectionConfig, type ResolveDocsRouteOptions, type ResolvedDocsNotFoundRoute, type ResolvedDocsPageRoute, type ResolvedDocsRedirectRoute, buildDocsStaticParams, buildLocaleLinks, buildPager, buildSidebar, createDocMetadata, createDocsSource, defineConfig, defineDocsConfig, dynamicParams, generateMetadata, generateStaticParams, resolveDocsRoute };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig } from "./config/types.js";
|
|
3
|
+
import { defineConfig } from "./config/define-config.js";
|
|
4
|
+
import { DefineDocsConfigOptions, defineDocsConfig } from "./config/define-docs-config.js";
|
|
5
|
+
import { CreateDocsSourceOptions, DocEntry, DocFormat, DocsSource } from "./source/types.js";
|
|
6
|
+
import { CreateDocMetadataOptions, DocsMetadata, DocsMetadataAlternates, DocsMetadataRobots, createDocMetadata } from "./metadata/create-doc-metadata.js";
|
|
7
|
+
import { BuildLocaleLinksOptions, DocsLocaleLink, buildLocaleLinks } from "./navigation/build-locale-links.js";
|
|
8
|
+
import { BuildPagerOptions, DocsPager, DocsPagerLink, buildPager } from "./navigation/build-pager.js";
|
|
9
|
+
import { BuildSidebarOptions, DocsSidebarItem, buildSidebar } from "./navigation/build-sidebar.js";
|
|
10
|
+
import { DocsRouteParams, DocsRouteResolution, ResolveDocsRouteOptions, ResolvedDocsNotFoundRoute, ResolvedDocsPageRoute, ResolvedDocsRedirectRoute, resolveDocsRoute } from "./routing/resolve-docs-route.js";
|
|
11
|
+
import { DocsRootLayout, DocsRootLayoutProps } from "./next/root-layout.js";
|
|
12
|
+
import { BuildDocsStaticParamsOptions, buildDocsStaticParams } from "./routing/build-static-params.js";
|
|
13
|
+
import { createDocsSource } from "./source/create-docs-source.js";
|
|
14
|
+
import { GenerateMetadataOptions } from "./next/metadata.js";
|
|
15
|
+
import { DocsPageProps, GenerateStaticParamsOptions } from "./next/page.js";
|
|
16
|
+
import * as _$react from "react";
|
|
17
|
+
|
|
18
|
+
//#region src/index.d.ts
|
|
19
|
+
declare const dynamicParams = false;
|
|
20
|
+
declare const generateMetadata: (options?: GenerateMetadataOptions) => Promise<DocsMetadata | Record<string, never>>;
|
|
21
|
+
declare const generateStaticParams: (options?: GenerateStaticParamsOptions) => Promise<DocsRouteParams[]>;
|
|
22
|
+
declare const DocsPage: (options: DocsPageProps) => Promise<_$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | (string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined)>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { type BuildDocsStaticParamsOptions, type BuildLocaleLinksOptions, type BuildPagerOptions, type BuildSidebarOptions, type CreateDocMetadataOptions, type CreateDocsSourceOptions, type DefineDocsConfigOptions, type DocEntry, type DocFormat, type DocsConfig, type DocsContentConfig, type DocsContentSectionConfig, type DocsHomeConfig, type DocsLocaleDefinition, type DocsLocaleLink, type DocsMdxConfig, type DocsMetadata, type DocsMetadataAlternates, type DocsMetadataRobots, DocsPage, type DocsPageProps, type DocsPager, type DocsPagerLink, DocsRootLayout, type DocsRootLayoutProps, type DocsRouteParams, type DocsRouteResolution, type DocsSectionConfig, type DocsSectionLayout, type DocsSidebarConfigNode, type DocsSidebarGroupConfig, type DocsSidebarItem, type DocsSidebarItemConfig, type DocsSidebarLabel, type DocsSidebarMode, type DocsSiteConfig, type DocsSlotsConfig, type DocsSource, type DocsThemeConfig, type GenerateMetadataOptions, type GenerateStaticParamsOptions, type NormalizedDocsConfig, type NormalizedDocsContentConfig, type NormalizedDocsContentSectionConfig, type ResolveDocsRouteOptions, type ResolvedDocsNotFoundRoute, type ResolvedDocsPageRoute, type ResolvedDocsRedirectRoute, buildDocsStaticParams, buildLocaleLinks, buildPager, buildSidebar, createDocMetadata, createDocsSource, defineConfig, defineDocsConfig, dynamicParams, generateMetadata, generateStaticParams, resolveDocsRoute };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{defineConfig as e}from"./config/define-config.mjs";import{defineDocsConfig as t}from"./config/define-docs-config.mjs";import{buildLocaleLinks as n}from"./navigation/build-locale-links.mjs";import{createDocMetadata as r}from"./metadata/create-doc-metadata.mjs";import{buildPager as i}from"./navigation/build-pager.mjs";import{buildSidebar as a}from"./navigation/build-sidebar.mjs";import{DocsRootLayout as o}from"./next/root-layout.mjs";import{buildDocsStaticParams as s}from"./routing/build-static-params.mjs";import{resolveDocsRoute as c}from"./routing/resolve-docs-route.mjs";import{createDocsSource as l}from"./source/create-docs-source.mjs";const u=!1,d=async(e={})=>(await import(`./next/metadata.mjs`)).generateMetadata(e),f=async(e={})=>(await import(`./next/page.mjs`)).generateStaticParams(e),p=async e=>(await import(`./next/page.mjs`)).DocsPage(e);export{p as DocsPage,o as DocsRootLayout,s as buildDocsStaticParams,n as buildLocaleLinks,i as buildPager,a as buildSidebar,r as createDocMetadata,l as createDocsSource,e as defineConfig,t as defineDocsConfig,u as dynamicParams,d as generateMetadata,f as generateStaticParams,c as resolveDocsRoute};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`react`),t=require(`@blackwork/machine`);const n=(0,t.mergeComponents)(t.defaultComponents,{table:({children:t,node:n,...r})=>(0,e.createElement)(`div`,{className:`my-6 w-full overflow-x-auto`},(0,e.createElement)(`table`,r,t))});exports.defaultDocsComponents=n;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{createElement as e}from"react";import{defaultComponents as t,mergeComponents as n}from"@blackwork/machine";const r=n(t,{table:({children:t,node:n,...r})=>e(`div`,{className:`my-6 w-full overflow-x-auto`},e(`table`,r,t))});export{r as defaultDocsComponents};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./default-docs-components.cjs`);let t=require(`@blackwork/machine`);const n=(...n)=>(0,t.mergeComponents)(e.defaultDocsComponents,...n);exports.mergeDocsComponents=n;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{defaultDocsComponents as e}from"./default-docs-components.mjs";import{mergeComponents as t}from"@blackwork/machine";const n=(...n)=>t(e,...n);export{n as mergeDocsComponents};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`../config/define-config.cjs`),t=require(`../navigation/build-locale-links.cjs`),n=e=>e===`/`?e:e.endsWith(`/`)?e.slice(0,-1):e,r=(e,t)=>{if(!e)return t;let n=e.endsWith(`/`)?e.slice(0,-1):e;return t===`/`?`${n}/`:`${n}${t}`},i=(e,t)=>t?`${e} | ${t}`:e;function a({config:a,entry:o,pathname:s,source:c}){let l=e.defineConfig(a),u=t.buildLocaleLinks({config:l,entry:o,source:c}),d=u.length>0?Object.fromEntries(u.map(e=>[e.lang||e.locale,r(l.site.url,e.href)])):void 0,f={title:i(o.title,l.site.title),description:o.description||l.site.description||``,alternates:{canonical:r(l.site.url,o.href),...d?{languages:d}:{}}};return n(s??o.href)!==n(o.href)&&(f.robots={index:!1,follow:!0}),f}exports.createDocMetadata=a;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, NormalizedDocsConfig } from "../config/types.mjs";
|
|
3
|
+
import { DocEntry, DocsSource } from "../source/types.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/metadata/create-doc-metadata.d.ts
|
|
6
|
+
interface DocsMetadataAlternates {
|
|
7
|
+
canonical?: string;
|
|
8
|
+
languages?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
interface DocsMetadataRobots {
|
|
11
|
+
index?: boolean;
|
|
12
|
+
follow?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface DocsMetadata {
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
alternates: DocsMetadataAlternates;
|
|
18
|
+
robots?: DocsMetadataRobots;
|
|
19
|
+
}
|
|
20
|
+
interface CreateDocMetadataOptions {
|
|
21
|
+
config?: DocsConfig | NormalizedDocsConfig;
|
|
22
|
+
entry: DocEntry;
|
|
23
|
+
pathname?: string;
|
|
24
|
+
source: DocsSource;
|
|
25
|
+
}
|
|
26
|
+
declare function createDocMetadata({
|
|
27
|
+
config,
|
|
28
|
+
entry,
|
|
29
|
+
pathname,
|
|
30
|
+
source
|
|
31
|
+
}: CreateDocMetadataOptions): DocsMetadata;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { CreateDocMetadataOptions, DocsMetadata, DocsMetadataAlternates, DocsMetadataRobots, createDocMetadata };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, NormalizedDocsConfig } from "../config/types.js";
|
|
3
|
+
import { DocEntry, DocsSource } from "../source/types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/metadata/create-doc-metadata.d.ts
|
|
6
|
+
interface DocsMetadataAlternates {
|
|
7
|
+
canonical?: string;
|
|
8
|
+
languages?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
interface DocsMetadataRobots {
|
|
11
|
+
index?: boolean;
|
|
12
|
+
follow?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface DocsMetadata {
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
alternates: DocsMetadataAlternates;
|
|
18
|
+
robots?: DocsMetadataRobots;
|
|
19
|
+
}
|
|
20
|
+
interface CreateDocMetadataOptions {
|
|
21
|
+
config?: DocsConfig | NormalizedDocsConfig;
|
|
22
|
+
entry: DocEntry;
|
|
23
|
+
pathname?: string;
|
|
24
|
+
source: DocsSource;
|
|
25
|
+
}
|
|
26
|
+
declare function createDocMetadata({
|
|
27
|
+
config,
|
|
28
|
+
entry,
|
|
29
|
+
pathname,
|
|
30
|
+
source
|
|
31
|
+
}: CreateDocMetadataOptions): DocsMetadata;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { CreateDocMetadataOptions, DocsMetadata, DocsMetadataAlternates, DocsMetadataRobots, createDocMetadata };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{defineConfig as e}from"../config/define-config.mjs";import{buildLocaleLinks as t}from"../navigation/build-locale-links.mjs";const n=e=>e===`/`?e:e.endsWith(`/`)?e.slice(0,-1):e,r=(e,t)=>{if(!e)return t;let n=e.endsWith(`/`)?e.slice(0,-1):e;return t===`/`?`${n}/`:`${n}${t}`},i=(e,t)=>t?`${e} | ${t}`:e;function a({config:a,entry:o,pathname:s,source:c}){let l=e(a),u=t({config:l,entry:o,source:c}),d=u.length>0?Object.fromEntries(u.map(e=>[e.lang||e.locale,r(l.site.url,e.href)])):void 0,f={title:i(o.title,l.site.title),description:o.description||l.site.description||``,alternates:{canonical:r(l.site.url,o.href),...d?{languages:d}:{}}};return n(s??o.href)!==n(o.href)&&(f.robots={index:!1,follow:!0}),f}export{a as createDocMetadata};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`../config/define-config.cjs`),t=(e,t)=>{let n=Object.entries(e.content.locales??{});return e.content.locales?.[t]||n.find(([e,n])=>e===t||n.code===t)?.[1]};function n({config:n,entry:r,source:i}){let a=e.defineConfig(n);return i.getLocaleCodes().flatMap(e=>{let n=i.getEntry(e,r.slugSegments);if(!n)return[];let o=t(a,e);return{locale:e,href:n.href,label:o?.label,lang:o?.lang,current:e===r.locale}})}exports.buildLocaleLinks=n;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, NormalizedDocsConfig } from "../config/types.mjs";
|
|
3
|
+
import { DocEntry, DocsSource } from "../source/types.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/navigation/build-locale-links.d.ts
|
|
6
|
+
interface DocsLocaleLink {
|
|
7
|
+
locale: string;
|
|
8
|
+
href: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
lang?: string;
|
|
11
|
+
current: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface BuildLocaleLinksOptions {
|
|
14
|
+
config?: DocsConfig | NormalizedDocsConfig;
|
|
15
|
+
entry: DocEntry;
|
|
16
|
+
source: DocsSource;
|
|
17
|
+
}
|
|
18
|
+
declare function buildLocaleLinks({
|
|
19
|
+
config,
|
|
20
|
+
entry,
|
|
21
|
+
source
|
|
22
|
+
}: BuildLocaleLinksOptions): DocsLocaleLink[];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { BuildLocaleLinksOptions, DocsLocaleLink, buildLocaleLinks };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, NormalizedDocsConfig } from "../config/types.js";
|
|
3
|
+
import { DocEntry, DocsSource } from "../source/types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/navigation/build-locale-links.d.ts
|
|
6
|
+
interface DocsLocaleLink {
|
|
7
|
+
locale: string;
|
|
8
|
+
href: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
lang?: string;
|
|
11
|
+
current: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface BuildLocaleLinksOptions {
|
|
14
|
+
config?: DocsConfig | NormalizedDocsConfig;
|
|
15
|
+
entry: DocEntry;
|
|
16
|
+
source: DocsSource;
|
|
17
|
+
}
|
|
18
|
+
declare function buildLocaleLinks({
|
|
19
|
+
config,
|
|
20
|
+
entry,
|
|
21
|
+
source
|
|
22
|
+
}: BuildLocaleLinksOptions): DocsLocaleLink[];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { BuildLocaleLinksOptions, DocsLocaleLink, buildLocaleLinks };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{defineConfig as e}from"../config/define-config.mjs";const t=(e,t)=>{let n=Object.entries(e.content.locales??{});return e.content.locales?.[t]||n.find(([e,n])=>e===t||n.code===t)?.[1]};function n({config:n,entry:r,source:i}){let a=e(n);return i.getLocaleCodes().flatMap(e=>{let n=i.getEntry(e,r.slugSegments);if(!n)return[];let o=t(a,e);return{locale:e,href:n.href,label:o?.label,lang:o?.lang,current:e===r.locale}})}export{n as buildLocaleLinks};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`./resolve-sidebar.cjs`),t=e=>e?{href:e.href,title:e.title}:null;function n({entries:n,currentHref:r,sidebar:i}){let a=i?e.flattenResolvedSidebarItems(i).filter(e=>!e.isExternal):n,o=a.findIndex(e=>e.href===r);return o<0?{previous:null,next:null}:{previous:t(a[o-1]),next:t(a[o+1])}}exports.buildPager=n;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocEntry } from "../source/types.mjs";
|
|
3
|
+
import { DocsResolvedSidebarNode } from "./resolve-sidebar.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/navigation/build-pager.d.ts
|
|
6
|
+
interface DocsPagerLink {
|
|
7
|
+
href: string;
|
|
8
|
+
title: string;
|
|
9
|
+
}
|
|
10
|
+
interface DocsPager {
|
|
11
|
+
previous: DocsPagerLink | null;
|
|
12
|
+
next: DocsPagerLink | null;
|
|
13
|
+
}
|
|
14
|
+
interface BuildPagerOptions {
|
|
15
|
+
entries: DocEntry[];
|
|
16
|
+
currentHref: string;
|
|
17
|
+
sidebar?: DocsResolvedSidebarNode[];
|
|
18
|
+
}
|
|
19
|
+
declare function buildPager({
|
|
20
|
+
entries,
|
|
21
|
+
currentHref,
|
|
22
|
+
sidebar
|
|
23
|
+
}: BuildPagerOptions): DocsPager;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { BuildPagerOptions, DocsPager, DocsPagerLink, buildPager };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocEntry } from "../source/types.js";
|
|
3
|
+
import { DocsResolvedSidebarNode } from "./resolve-sidebar.js";
|
|
4
|
+
|
|
5
|
+
//#region src/navigation/build-pager.d.ts
|
|
6
|
+
interface DocsPagerLink {
|
|
7
|
+
href: string;
|
|
8
|
+
title: string;
|
|
9
|
+
}
|
|
10
|
+
interface DocsPager {
|
|
11
|
+
previous: DocsPagerLink | null;
|
|
12
|
+
next: DocsPagerLink | null;
|
|
13
|
+
}
|
|
14
|
+
interface BuildPagerOptions {
|
|
15
|
+
entries: DocEntry[];
|
|
16
|
+
currentHref: string;
|
|
17
|
+
sidebar?: DocsResolvedSidebarNode[];
|
|
18
|
+
}
|
|
19
|
+
declare function buildPager({
|
|
20
|
+
entries,
|
|
21
|
+
currentHref,
|
|
22
|
+
sidebar
|
|
23
|
+
}: BuildPagerOptions): DocsPager;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { BuildPagerOptions, DocsPager, DocsPagerLink, buildPager };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{flattenResolvedSidebarItems as e}from"./resolve-sidebar.mjs";const t=e=>e?{href:e.href,title:e.title}:null;function n({entries:n,currentHref:r,sidebar:i}){let a=i?e(i).filter(e=>!e.isExternal):n,o=a.findIndex(e=>e.href===r);return o<0?{previous:null,next:null}:{previous:t(a[o-1]),next:t(a[o+1])}}export{n as buildPager};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`./resolve-sidebar.cjs`);function t({config:t,entries:n,currentHref:r,sectionKey:i}){return e.flattenResolvedSidebarItems(e.resolveSidebar({config:t,entries:n,currentHref:r,sectionKey:i})).map(e=>({depth:e.depth,href:e.href,slugSegments:[...e.slugSegments],title:e.title,...e.parentHref?{parentHref:e.parentHref}:{},isActive:e.isActive,...e.isExternal?{isExternal:!0}:{}}))}exports.buildSidebar=t;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, NormalizedDocsConfig } from "../config/types.mjs";
|
|
3
|
+
import { DocEntry } from "../source/types.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/navigation/build-sidebar.d.ts
|
|
6
|
+
interface DocsSidebarItem {
|
|
7
|
+
depth: number;
|
|
8
|
+
href: string;
|
|
9
|
+
slugSegments: string[];
|
|
10
|
+
title: string;
|
|
11
|
+
parentHref?: string;
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
isExternal?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface BuildSidebarOptions {
|
|
16
|
+
config?: DocsConfig | NormalizedDocsConfig;
|
|
17
|
+
entries: DocEntry[];
|
|
18
|
+
currentHref?: string;
|
|
19
|
+
sectionKey?: string;
|
|
20
|
+
}
|
|
21
|
+
declare function buildSidebar({
|
|
22
|
+
config,
|
|
23
|
+
entries,
|
|
24
|
+
currentHref,
|
|
25
|
+
sectionKey
|
|
26
|
+
}: BuildSidebarOptions): DocsSidebarItem[];
|
|
27
|
+
//#endregion
|
|
28
|
+
export { BuildSidebarOptions, DocsSidebarItem, buildSidebar };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { DocsConfig, NormalizedDocsConfig } from "../config/types.js";
|
|
3
|
+
import { DocEntry } from "../source/types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/navigation/build-sidebar.d.ts
|
|
6
|
+
interface DocsSidebarItem {
|
|
7
|
+
depth: number;
|
|
8
|
+
href: string;
|
|
9
|
+
slugSegments: string[];
|
|
10
|
+
title: string;
|
|
11
|
+
parentHref?: string;
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
isExternal?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface BuildSidebarOptions {
|
|
16
|
+
config?: DocsConfig | NormalizedDocsConfig;
|
|
17
|
+
entries: DocEntry[];
|
|
18
|
+
currentHref?: string;
|
|
19
|
+
sectionKey?: string;
|
|
20
|
+
}
|
|
21
|
+
declare function buildSidebar({
|
|
22
|
+
config,
|
|
23
|
+
entries,
|
|
24
|
+
currentHref,
|
|
25
|
+
sectionKey
|
|
26
|
+
}: BuildSidebarOptions): DocsSidebarItem[];
|
|
27
|
+
//#endregion
|
|
28
|
+
export { BuildSidebarOptions, DocsSidebarItem, buildSidebar };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{flattenResolvedSidebarItems as e,resolveSidebar as t}from"./resolve-sidebar.mjs";function n({config:n,entries:r,currentHref:i,sectionKey:a}){return e(t({config:n,entries:r,currentHref:i,sectionKey:a})).map(e=>({depth:e.depth,href:e.href,slugSegments:[...e.slugSegments],title:e.title,...e.parentHref?{parentHref:e.parentHref}:{},isActive:e.isActive,...e.isExternal?{isExternal:!0}:{}}))}export{n as buildSidebar};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`../config/define-config.cjs`),t=e=>e.join(`/`),n=(e,n)=>{let r=[];for(let i=1;i<e.slugSegments.length;i+=1){let a=n.get(t(e.slugSegments.slice(0,i)));a&&r.push(a)}return r},r=e=>e[0]?.locale??`en`,i=(e,t)=>t?e.filter(e=>e.slugSegments[0]===t):e,a=({defaultLocale:e,fallback:t,label:n,locale:r,onError:i})=>typeof n==`string`?n:n?.[r]?n[r]:e&&n?.[e]?n[e]:t||i(),o=({href:e,siteUrl:t})=>{try{let n=new URL(e),r=t?new URL(t):void 0;return!r||n.origin!==r.origin?null:n.pathname}catch{return e}},s=({defaultLocale:e,href:t,locale:n})=>{let r=(t.split(/[?#]/u,1)[0]||`/`).split(`/`).filter(Boolean);return r[0]===n||e&&r[0]===e?r.slice(1):r},c=({href:e,locale:t,sectionKey:n})=>Error(`[blackwork-docs] Invalid sidebar item in section "${n}": href "${e}" does not match any document entry in locale "${t}". Add the page or remove the sidebar item.`),l=({currentHref:e,defaultLocale:n,entryLookup:r,item:i,locale:l,sectionKey:u,siteUrl:d})=>{let f=o({href:i.href,siteUrl:d});if(f===null)return{type:`item`,depth:0,href:i.href,slugSegments:[],title:a({defaultLocale:n,label:i.label,locale:l,onError:()=>{throw Error(`[blackwork-docs] Invalid sidebar item in section "${u}": external href "${i.href}" requires a label for locale "${l}" or defaultLocale "${n??`unknown`}".`)}}),isActive:i.href===e,isExternal:!0};let p=s({defaultLocale:n,href:f,locale:l}),m=r.get(t(p));if(!m)throw c({href:i.href,locale:l,sectionKey:u});return{type:`item`,depth:0,href:m.href,slugSegments:[...m.slugSegments],title:a({defaultLocale:n,fallback:m.title,label:i.label,locale:l,onError:()=>{throw c({href:i.href,locale:l,sectionKey:u})}}),isActive:m.href===e,isExternal:!1}},u=({currentHref:e,defaultLocale:t,entryLookup:n,locale:r,node:i,sectionKey:o,siteUrl:s})=>i.type===`item`?l({currentHref:e,defaultLocale:t,entryLookup:n,item:i,locale:r,sectionKey:o,siteUrl:s}):{type:`group`,title:a({defaultLocale:t,label:i.label,locale:r,onError:()=>{throw Error(`[blackwork-docs] Invalid sidebar group in section "${o}": label is required for locale "${r}" or defaultLocale "${t??`unknown`}".`)}}),items:i.items.map(i=>l({currentHref:e,defaultLocale:t,entryLookup:n,item:i,locale:r,sectionKey:o,siteUrl:s}))},d=({currentHref:e,entries:r})=>{let i=new Map(r.map(e=>[t(e.slugSegments),e]));return r.map(t=>{let r=n(t,i).at(-1);return{type:`item`,depth:Math.max(t.slugSegments.length-1,0),href:t.href,slugSegments:[...t.slugSegments],title:t.title,...r?{parentHref:r.href}:{},isActive:t.href===e,isExternal:!1}})},f=e=>e.flatMap(e=>e.type===`group`?e.items:e);function p({config:n,currentHref:a,entries:o,sectionKey:s}){let c=e.defineConfig(n),l=r(o),f=(s?c.content.sections?.[s]:void 0)?.sidebar??`auto`;if(f===!1)return[];if(f===`auto`)return d({currentHref:a,entries:i(o,s)});let p=new Map(o.map(e=>[t(e.slugSegments),e]));return f.map(e=>u({currentHref:a,defaultLocale:c.content.defaultLocale,entryLookup:p,locale:l,node:e,sectionKey:s??`root`,siteUrl:c.site.url}))}exports.flattenResolvedSidebarItems=f,exports.resolveSidebar=p;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/navigation/resolve-sidebar.d.ts
|
|
3
|
+
interface DocsResolvedSidebarItem {
|
|
4
|
+
type: 'item';
|
|
5
|
+
depth: number;
|
|
6
|
+
href: string;
|
|
7
|
+
slugSegments: string[];
|
|
8
|
+
title: string;
|
|
9
|
+
parentHref?: string;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
isExternal: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DocsResolvedSidebarGroup {
|
|
14
|
+
type: 'group';
|
|
15
|
+
title: string;
|
|
16
|
+
items: DocsResolvedSidebarItem[];
|
|
17
|
+
}
|
|
18
|
+
type DocsResolvedSidebarNode = DocsResolvedSidebarGroup | DocsResolvedSidebarItem;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DocsResolvedSidebarNode };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/navigation/resolve-sidebar.d.ts
|
|
3
|
+
interface DocsResolvedSidebarItem {
|
|
4
|
+
type: 'item';
|
|
5
|
+
depth: number;
|
|
6
|
+
href: string;
|
|
7
|
+
slugSegments: string[];
|
|
8
|
+
title: string;
|
|
9
|
+
parentHref?: string;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
isExternal: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DocsResolvedSidebarGroup {
|
|
14
|
+
type: 'group';
|
|
15
|
+
title: string;
|
|
16
|
+
items: DocsResolvedSidebarItem[];
|
|
17
|
+
}
|
|
18
|
+
type DocsResolvedSidebarNode = DocsResolvedSidebarGroup | DocsResolvedSidebarItem;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DocsResolvedSidebarNode };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{defineConfig as e}from"../config/define-config.mjs";const t=e=>e.join(`/`),n=(e,n)=>{let r=[];for(let i=1;i<e.slugSegments.length;i+=1){let a=n.get(t(e.slugSegments.slice(0,i)));a&&r.push(a)}return r},r=e=>e[0]?.locale??`en`,i=(e,t)=>t?e.filter(e=>e.slugSegments[0]===t):e,a=({defaultLocale:e,fallback:t,label:n,locale:r,onError:i})=>typeof n==`string`?n:n?.[r]?n[r]:e&&n?.[e]?n[e]:t||i(),o=({href:e,siteUrl:t})=>{try{let n=new URL(e),r=t?new URL(t):void 0;return!r||n.origin!==r.origin?null:n.pathname}catch{return e}},s=({defaultLocale:e,href:t,locale:n})=>{let r=(t.split(/[?#]/u,1)[0]||`/`).split(`/`).filter(Boolean);return r[0]===n||e&&r[0]===e?r.slice(1):r},c=({href:e,locale:t,sectionKey:n})=>Error(`[blackwork-docs] Invalid sidebar item in section "${n}": href "${e}" does not match any document entry in locale "${t}". Add the page or remove the sidebar item.`),l=({currentHref:e,defaultLocale:n,entryLookup:r,item:i,locale:l,sectionKey:u,siteUrl:d})=>{let f=o({href:i.href,siteUrl:d});if(f===null)return{type:`item`,depth:0,href:i.href,slugSegments:[],title:a({defaultLocale:n,label:i.label,locale:l,onError:()=>{throw Error(`[blackwork-docs] Invalid sidebar item in section "${u}": external href "${i.href}" requires a label for locale "${l}" or defaultLocale "${n??`unknown`}".`)}}),isActive:i.href===e,isExternal:!0};let p=s({defaultLocale:n,href:f,locale:l}),m=r.get(t(p));if(!m)throw c({href:i.href,locale:l,sectionKey:u});return{type:`item`,depth:0,href:m.href,slugSegments:[...m.slugSegments],title:a({defaultLocale:n,fallback:m.title,label:i.label,locale:l,onError:()=>{throw c({href:i.href,locale:l,sectionKey:u})}}),isActive:m.href===e,isExternal:!1}},u=({currentHref:e,defaultLocale:t,entryLookup:n,locale:r,node:i,sectionKey:o,siteUrl:s})=>i.type===`item`?l({currentHref:e,defaultLocale:t,entryLookup:n,item:i,locale:r,sectionKey:o,siteUrl:s}):{type:`group`,title:a({defaultLocale:t,label:i.label,locale:r,onError:()=>{throw Error(`[blackwork-docs] Invalid sidebar group in section "${o}": label is required for locale "${r}" or defaultLocale "${t??`unknown`}".`)}}),items:i.items.map(i=>l({currentHref:e,defaultLocale:t,entryLookup:n,item:i,locale:r,sectionKey:o,siteUrl:s}))},d=({currentHref:e,entries:r})=>{let i=new Map(r.map(e=>[t(e.slugSegments),e]));return r.map(t=>{let r=n(t,i).at(-1);return{type:`item`,depth:Math.max(t.slugSegments.length-1,0),href:t.href,slugSegments:[...t.slugSegments],title:t.title,...r?{parentHref:r.href}:{},isActive:t.href===e,isExternal:!1}})},f=e=>e.flatMap(e=>e.type===`group`?e.items:e);function p({config:n,currentHref:a,entries:o,sectionKey:s}){let c=e(n),l=r(o),f=(s?c.content.sections?.[s]:void 0)?.sidebar??`auto`;if(f===!1)return[];if(f===`auto`)return d({currentHref:a,entries:i(o,s)});let p=new Map(o.map(e=>[t(e.slugSegments),e]));return f.map(e=>u({currentHref:a,defaultLocale:c.content.defaultLocale,entryLookup:p,locale:l,node:e,sectionKey:s??`root`,siteUrl:c.site.url}))}export{f as flattenResolvedSidebarItems,p as resolveSidebar};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`../config/define-config.cjs`),t=require(`../source/create-docs-source.cjs`),n=require(`./load-generated-manifest.cjs`),r=async({config:r,rootDir:i}={})=>{let a=e.defineConfig(r);return{normalizedConfig:a,source:await n.loadGeneratedDocsSource()??t.createDocsSource({rootDir:i,config:a})}};exports.createNextDocsContext=r;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{defineConfig as e}from"../config/define-config.mjs";import{createDocsSource as t}from"../source/create-docs-source.mjs";import{loadGeneratedDocsSource as n}from"./load-generated-manifest.mjs";const r=async({config:r,rootDir:i}={})=>{let a=e(r);return{normalizedConfig:a,source:await n()??t({rootDir:i,config:a})}};export{r as createNextDocsContext};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../mdx/merge-docs-components.cjs`);let t=require(`node:fs`),n=require(`@blackwork/machine/server`);const r=e=>e.format===`mdx`?`mdx`:`markdown`,i=async({config:i,entry:a})=>(0,n.compile)(a.loadSource?await a.loadSource():(0,t.readFileSync)(a.sourcePath,`utf8`),{format:r(a),components:e.mergeDocsComponents(i.mdx.components)});exports.loadDocContent=i;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{mergeDocsComponents as e}from"../mdx/merge-docs-components.mjs";import{readFileSync as t}from"node:fs";import{compile as n}from"@blackwork/machine/server";const r=e=>e.format===`mdx`?`mdx`:`markdown`,i=async({config:i,entry:a})=>n(a.loadSource?await a.loadSource():t(a.sourcePath,`utf8`),{format:r(a),components:e(i.mdx.components)});export{i as loadDocContent};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`../source/create-docs-source-from-manifest.cjs`),t=async()=>{try{let e=await import(`private-blackwork-docs-root/.blackwork/docs/manifest.mjs`);return e.docsManifest??e.default??null}catch{return null}},n=async()=>{let n=await t();return n?e.createDocsSourceFromManifest(n):null};exports.loadGeneratedDocsSource=n;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
import{createDocsSourceFromManifest as e}from"../source/create-docs-source-from-manifest.mjs";const t=async()=>{try{let e=await import(`private-blackwork-docs-root/.blackwork/docs/manifest.mjs`);return e.docsManifest??e.default??null}catch{return null}},n=async()=>{let n=await t();return n?e(n):null};export{n as loadGeneratedDocsSource};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.1.0
|
|
4
|
+
* description: Next-first documentation framework for Blackwork projects.
|
|
5
|
+
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
|
|
6
|
+
* homepage: https://chengpeiquan.com
|
|
7
|
+
* license: MIT
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`../metadata/create-doc-metadata.cjs`),t=require(`../routing/resolve-docs-route.cjs`),n=require(`./context.cjs`),r=async({config:r,params:i,rootDir:a}={})=>{let{normalizedConfig:o,source:s}=await n.createNextDocsContext({config:r,rootDir:a}),c=t.resolveDocsRoute({source:s,params:await i});if(c.kind===`notFound`)return{};let l=c.kind===`redirect`?s.getLegacyAliasHref(c.locale,c.slugSegments)??c.entry.href:c.entry.href;return e.createDocMetadata({config:o,entry:c.entry,pathname:l,source:s})};exports.generateMetadata=r;
|