boltdocs 2.7.9 → 2.7.11
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/{cache-DorPMFgW.cjs → cache-Ba-DZQNH.cjs} +1 -1
- package/dist/{cache-CQKlT4fI.mjs → cache-BuMZ58L5.mjs} +1 -1
- package/dist/chunk-CU-zTemE.cjs +6 -0
- package/dist/client/index.cjs +1929 -1
- package/dist/client/index.js +1880 -1
- package/dist/client/mdx.cjs +7 -1
- package/dist/client/mdx.js +7 -1
- package/dist/client/primitives.cjs +60 -1
- package/dist/client/primitives.js +20 -1
- package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
- package/dist/docs-layout-DwFndmj5.js +1231 -0
- package/dist/doctor-Be7Ly1oM.mjs +21 -0
- package/dist/{doctor-D4_Y7M4p.cjs → doctor-CrytFkqW.cjs} +1 -1
- package/dist/doctor-jMxWZyLJ.cjs +21 -0
- package/dist/generator-CHqxiQhF.cjs +21 -0
- package/dist/generator-ClVanhvi.mjs +21 -0
- package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
- package/dist/icons-dev-Df8OQ481.js +839 -0
- package/dist/image-DtrI2cw3.cjs +268 -0
- package/dist/image-jxPb-2iV.js +214 -0
- package/dist/mdx-BdWkJTeB.cjs +523 -0
- package/dist/mdx-UTTLFWJq.js +494 -0
- package/dist/meta-loader-CWg2gnbY.mjs +6 -0
- package/dist/meta-loader-Cv9O0Pzl.cjs +6 -0
- 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/routes/worker.cjs +1 -1
- package/dist/node/routes/worker.mjs +1 -1
- package/dist/node-BSM4qcDK.cjs +111 -0
- package/dist/node-BspZN3R2.mjs +111 -0
- package/dist/{package-VfQM94VL.cjs → package-DIIrjuWI.cjs} +1 -1
- package/dist/{package-B4MD00N3.mjs → package-K0zsjGIz.mjs} +1 -1
- package/dist/{parser-Bh11BsdA.cjs → parser-Aq8LoH-0.cjs} +1 -1
- package/dist/{parser-DYRzXWmA.cjs → parser-CdNbqN5y.cjs} +1 -1
- package/dist/parser-nE792MLO.mjs +6 -0
- package/dist/rolldown-runtime-fkIsjY3S.mjs +6 -0
- package/dist/{routes-Co1mRM58.cjs → routes-2k3tbUmC.cjs} +1 -1
- package/dist/routes-CpxZIsMM.mjs +6 -0
- package/dist/{routes-CHf76Ye4.cjs → routes-DP1vmWRj.cjs} +1 -1
- package/dist/search-dialog-BHuIiUC6.js +8 -0
- package/dist/search-dialog-BNF10tDl.js +375 -0
- package/dist/search-dialog-BwkDuI9R.cjs +220 -0
- package/dist/search-dialog-C7xuvyNk.cjs +386 -0
- package/dist/search-dialog-CIQg6k8c.cjs +8 -0
- package/dist/search-dialog-D-DDN7zJ.js +208 -0
- package/dist/utils-CG65J0Sc.mjs +7 -0
- package/dist/utils-CKunkU96.cjs +7 -0
- package/dist/{worker-pool-BwU8ckrg.cjs → worker-pool-Crbqgw5R.cjs} +1 -1
- package/package.json +5 -5
- package/dist/chunk-Ds5LZdWN.cjs +0 -6
- package/dist/docs-layout-KoWNZc8_.js +0 -6
- package/dist/docs-layout-x2yKt2cL.cjs +0 -6
- package/dist/doctor-BD1BSB03.mjs +0 -23
- package/dist/doctor-BHc9ua6r.cjs +0 -23
- package/dist/generator-DGW6pkCC.cjs +0 -22
- package/dist/generator-Dv3wEmhZ.mjs +0 -22
- package/dist/icons-dev-B_RZIyxu.js +0 -6
- package/dist/icons-dev-BlV3wWFT.cjs +0 -6
- package/dist/image-BHhTvQzr.cjs +0 -6
- package/dist/image-CqKzYD8f.js +0 -6
- package/dist/mdx-DudBEac0.js +0 -7
- package/dist/mdx-r4cDQxWu.cjs +0 -7
- package/dist/meta-loader-0gJ4PtBC.cjs +0 -6
- package/dist/meta-loader-9IpAHWDS.mjs +0 -6
- package/dist/node-DBaH7kat.mjs +0 -111
- package/dist/node-t5C3Q85p.cjs +0 -111
- package/dist/parser-9cVdK7w9.mjs +0 -6
- package/dist/routes-DwrMa5-z.mjs +0 -6
- package/dist/search-dialog-B584t9ZF.js +0 -6
- package/dist/search-dialog-BvBopRsZ.cjs +0 -6
- package/dist/search-dialog-ByvGScjt.js +0 -6
- package/dist/search-dialog-Cyko6TJm.cjs +0 -6
- package/dist/search-dialog-D6BNohIJ.js +0 -6
- package/dist/search-dialog-DuYTIefy.cjs +0 -6
- package/dist/utils-BxNAXhZZ.mjs +0 -7
- package/dist/utils-Clzu7jvb.cjs +0 -7
- package/src/client/app/config-context.tsx +0 -51
- package/src/client/app/doc-page.tsx +0 -38
- package/src/client/app/docs-layout.tsx +0 -28
- package/src/client/app/head.tsx +0 -122
- package/src/client/app/helmet-compat.tsx +0 -36
- package/src/client/app/mdx-component.tsx +0 -8
- package/src/client/app/mdx-components-context.tsx +0 -72
- package/src/client/app/routes-context.tsx +0 -34
- package/src/client/app/scroll-handler.tsx +0 -74
- package/src/client/app/theme-context.tsx +0 -103
- package/src/client/app/ui-context.tsx +0 -42
- package/src/client/components/docs-layout-default.tsx +0 -85
- package/src/client/components/icons-dev.tsx +0 -282
- package/src/client/components/mdx/callout.tsx +0 -97
- package/src/client/components/mdx/card.tsx +0 -99
- package/src/client/components/mdx/cards.tsx +0 -27
- package/src/client/components/mdx/code-block.tsx +0 -184
- package/src/client/components/mdx/field.tsx +0 -33
- package/src/client/components/mdx/image.tsx +0 -44
- package/src/client/components/mdx/index.ts +0 -19
- package/src/client/components/mdx/table.tsx +0 -54
- package/src/client/components/mdx/typographics.tsx +0 -120
- package/src/client/components/mdx/use-code-block.ts +0 -34
- package/src/client/components/primitives/breadcrumbs.tsx +0 -54
- package/src/client/components/primitives/button-group.tsx +0 -54
- package/src/client/components/primitives/button.tsx +0 -6
- package/src/client/components/primitives/code-block.tsx +0 -120
- package/src/client/components/primitives/docs-layout.tsx +0 -125
- package/src/client/components/primitives/error-boundary.tsx +0 -107
- package/src/client/components/primitives/heading.tsx +0 -128
- package/src/client/components/primitives/helpers/observer.ts +0 -141
- package/src/client/components/primitives/image.tsx +0 -26
- package/src/client/components/primitives/link.tsx +0 -102
- package/src/client/components/primitives/menu.tsx +0 -137
- package/src/client/components/primitives/navbar.tsx +0 -466
- package/src/client/components/primitives/on-this-page.tsx +0 -430
- package/src/client/components/primitives/page-nav.tsx +0 -51
- package/src/client/components/primitives/popover.tsx +0 -28
- package/src/client/components/primitives/search-dialog.tsx +0 -193
- package/src/client/components/primitives/sidebar.tsx +0 -423
- package/src/client/components/primitives/skeleton.tsx +0 -26
- package/src/client/components/primitives/tabs.tsx +0 -70
- package/src/client/components/primitives/tooltip.tsx +0 -81
- package/src/client/components/primitives/types.ts +0 -11
- package/src/client/components/ui-base/banner.tsx +0 -66
- package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
- package/src/client/components/ui-base/copy-markdown.tsx +0 -107
- package/src/client/components/ui-base/error-boundary.tsx +0 -15
- package/src/client/components/ui-base/github-stars.tsx +0 -29
- package/src/client/components/ui-base/icons.tsx +0 -240
- package/src/client/components/ui-base/index.ts +0 -16
- package/src/client/components/ui-base/last-updated.tsx +0 -27
- package/src/client/components/ui-base/navbar.tsx +0 -266
- package/src/client/components/ui-base/not-found.tsx +0 -26
- package/src/client/components/ui-base/on-this-page.tsx +0 -57
- package/src/client/components/ui-base/page-nav.tsx +0 -50
- package/src/client/components/ui-base/search-dialog.tsx +0 -163
- package/src/client/components/ui-base/search-highlight.tsx +0 -10
- package/src/client/components/ui-base/sidebar.tsx +0 -92
- package/src/client/components/ui-base/tabs.tsx +0 -83
- package/src/client/components/ui-base/theme-toggle.tsx +0 -130
- package/src/client/components/ui-base/version-i18n.tsx +0 -80
- package/src/client/hooks/index.ts +0 -13
- package/src/client/hooks/use-analytics.ts +0 -272
- package/src/client/hooks/use-breadcrumbs.ts +0 -22
- package/src/client/hooks/use-i18n.ts +0 -182
- package/src/client/hooks/use-localized-to.ts +0 -113
- package/src/client/hooks/use-location.ts +0 -5
- package/src/client/hooks/use-navbar.ts +0 -130
- package/src/client/hooks/use-page-nav.ts +0 -46
- package/src/client/hooks/use-routes.ts +0 -108
- package/src/client/hooks/use-search-highlight.ts +0 -185
- package/src/client/hooks/use-search.ts +0 -118
- package/src/client/hooks/use-sidebar.ts +0 -205
- package/src/client/hooks/use-tabs.ts +0 -46
- package/src/client/hooks/use-version.ts +0 -111
- package/src/client/index.ts +0 -31
- package/src/client/mdx.ts +0 -2
- package/src/client/primitives.ts +0 -19
- package/src/client/ssg/boltdocs-shell.tsx +0 -148
- package/src/client/ssg/create-routes.tsx +0 -473
- package/src/client/ssg/index.ts +0 -4
- package/src/client/ssg/mdx-page.tsx +0 -38
- package/src/client/store/boltdocs-context.tsx +0 -137
- package/src/client/theme/neutral.css +0 -141
- package/src/client/theme/reset.css +0 -189
- package/src/client/types.ts +0 -116
- package/src/client/utils/cn.ts +0 -6
- package/src/client/utils/copy-clipboard.ts +0 -22
- package/src/client/utils/get-base-file-path.ts +0 -21
- package/src/client/utils/github.ts +0 -121
- package/src/client/utils/i18n.ts +0 -23
- package/src/client/utils/path.ts +0 -9
- package/src/client/utils/react-to-text.ts +0 -34
- package/src/client/virtual.d.ts +0 -24
- /package/dist/{worker-pool-Bd8Y9KDv.mjs → worker-pool-CGn7DrLb.mjs} +0 -0
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
const BASE_URL = 'https://api.github.com'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Get the number of stars for a GitHub repository.
|
|
5
|
-
* @param repo - owner/repo
|
|
6
|
-
* @param token - The GitHub token.
|
|
7
|
-
* @param baseUrl - The GitHub API base URL.
|
|
8
|
-
* @returns The number of stars for the repository.
|
|
9
|
-
* @example
|
|
10
|
-
* getStarsRepo('owner/repo') // 100k
|
|
11
|
-
*/
|
|
12
|
-
export async function getStarsRepo(
|
|
13
|
-
repo: string,
|
|
14
|
-
token?: string,
|
|
15
|
-
baseUrl: string = BASE_URL,
|
|
16
|
-
) {
|
|
17
|
-
const headers = new Headers()
|
|
18
|
-
if (token) {
|
|
19
|
-
headers.append('authorization', token)
|
|
20
|
-
}
|
|
21
|
-
const response = await fetch(`${baseUrl}/repos/${repo}`, {
|
|
22
|
-
headers,
|
|
23
|
-
})
|
|
24
|
-
const data = await response.json()
|
|
25
|
-
if (data.stargazers_count !== undefined) {
|
|
26
|
-
return formatStars(data.stargazers_count)
|
|
27
|
-
} else {
|
|
28
|
-
return '0' // Fallback
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Format a number of stars in a compact form.
|
|
34
|
-
* @param count - The number of stars to format.
|
|
35
|
-
* @returns The formatted number of stars.
|
|
36
|
-
*/
|
|
37
|
-
const formatStars = (count: number): string => {
|
|
38
|
-
return Intl.NumberFormat('en', {
|
|
39
|
-
notation: 'compact',
|
|
40
|
-
compactDisplay: 'short',
|
|
41
|
-
}).format(count)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface GetGithubLastCommitOptions {
|
|
45
|
-
repo: string
|
|
46
|
-
token?: string
|
|
47
|
-
owner: string
|
|
48
|
-
path: string
|
|
49
|
-
sha?: string
|
|
50
|
-
baseUrl?: string
|
|
51
|
-
options?: RequestInit
|
|
52
|
-
params?: Record<string, string>
|
|
53
|
-
parser?: (data: ResponseLastCommit[0]) => string
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
type ResponseLastCommit = {
|
|
57
|
-
sha: string
|
|
58
|
-
commit: {
|
|
59
|
-
committer: {
|
|
60
|
-
date: string
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}[]
|
|
64
|
-
|
|
65
|
-
const parserDefault = (data: ResponseLastCommit[0]) => {
|
|
66
|
-
return new Intl.DateTimeFormat('en-US', {
|
|
67
|
-
year: 'numeric',
|
|
68
|
-
month: 'long',
|
|
69
|
-
day: 'numeric',
|
|
70
|
-
}).format(new Date(data.commit.committer.date))
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export async function getGithubLastEdit({
|
|
74
|
-
repo,
|
|
75
|
-
token,
|
|
76
|
-
owner,
|
|
77
|
-
path,
|
|
78
|
-
sha,
|
|
79
|
-
baseUrl = BASE_URL,
|
|
80
|
-
options = {},
|
|
81
|
-
params: customParams = {},
|
|
82
|
-
parser = parserDefault,
|
|
83
|
-
}: GetGithubLastCommitOptions): Promise<string | null> {
|
|
84
|
-
const headers = new Headers(options.headers)
|
|
85
|
-
const params = new URLSearchParams()
|
|
86
|
-
params.set('path', path)
|
|
87
|
-
params.set('page', '1')
|
|
88
|
-
params.set('per_page', '1')
|
|
89
|
-
|
|
90
|
-
if (sha) params.set('sha', sha)
|
|
91
|
-
|
|
92
|
-
for (const [key, value] of Object.entries(customParams)) {
|
|
93
|
-
params.set(key, value)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (token) {
|
|
97
|
-
headers.append('authorization', token)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const res = await fetch(
|
|
101
|
-
`${baseUrl}/repos/${owner}/${repo}/commits?${params.toString()}`,
|
|
102
|
-
{
|
|
103
|
-
...options,
|
|
104
|
-
headers,
|
|
105
|
-
},
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
if (!res.ok) throw new Error(`Github API error ${await res.text()}`)
|
|
109
|
-
const data = (await res.json()) as ResponseLastCommit
|
|
110
|
-
|
|
111
|
-
const lastCommit = data[0]
|
|
112
|
-
|
|
113
|
-
// Validation Internal
|
|
114
|
-
if (!lastCommit.commit.committer.date) {
|
|
115
|
-
console.warn('Commit found but no date available')
|
|
116
|
-
return null
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (data.length === 0) return null
|
|
120
|
-
return parser(lastCommit)
|
|
121
|
-
}
|
package/src/client/utils/i18n.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieves the correct translation from a value that can be either
|
|
3
|
-
* a simple string or a map of locale-specific strings.
|
|
4
|
-
*
|
|
5
|
-
* @param value - The text to translate
|
|
6
|
-
* @param locale - The current active locale (e.g., 'en', 'es')
|
|
7
|
-
* @returns The translated string
|
|
8
|
-
*/
|
|
9
|
-
export function getTranslated(
|
|
10
|
-
value: string | Record<string, string> | undefined,
|
|
11
|
-
locale?: string,
|
|
12
|
-
): string {
|
|
13
|
-
if (!value) return ''
|
|
14
|
-
if (typeof value === 'string') return value
|
|
15
|
-
|
|
16
|
-
if (locale && value[locale]) {
|
|
17
|
-
return value[locale]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Fallback: Use the first available translation or an empty string
|
|
21
|
-
const firstValue = Object.values(value)[0]
|
|
22
|
-
return firstValue || ''
|
|
23
|
-
}
|
package/src/client/utils/path.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalizes a URL path by stripping any trailing slash unless it's the root path.
|
|
3
|
-
*
|
|
4
|
-
* @param p - The path to normalize.
|
|
5
|
-
* @returns The normalized path.
|
|
6
|
-
*/
|
|
7
|
-
export function normalizePath(p: string): string {
|
|
8
|
-
return p.endsWith('/') && p.length > 1 ? p.slice(0, -1) : p
|
|
9
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isValidElement,
|
|
3
|
-
type ReactNode,
|
|
4
|
-
type JSXElementConstructor,
|
|
5
|
-
} from 'react'
|
|
6
|
-
|
|
7
|
-
type ResolverMap = Map<
|
|
8
|
-
string | JSXElementConstructor<object>,
|
|
9
|
-
(props: object) => string
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
const reactToText = (node: ReactNode, resolvers?: ResolverMap): string => {
|
|
13
|
-
if (node == null || typeof node === 'boolean') return ''
|
|
14
|
-
|
|
15
|
-
if (typeof node === 'string' || typeof node === 'number') return String(node)
|
|
16
|
-
|
|
17
|
-
if (Array.isArray(node))
|
|
18
|
-
return node.map((n) => reactToText(n, resolvers)).join('')
|
|
19
|
-
|
|
20
|
-
if (isValidElement(node)) {
|
|
21
|
-
const resolver = resolvers?.get(
|
|
22
|
-
node.type as string | JSXElementConstructor<object>,
|
|
23
|
-
)
|
|
24
|
-
if (resolver) return resolver(node.props as object)
|
|
25
|
-
return reactToText(
|
|
26
|
-
(node.props as { children?: ReactNode }).children,
|
|
27
|
-
resolvers,
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return ''
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { reactToText }
|
package/src/client/virtual.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
declare module 'virtual:boltdocs-routes' {
|
|
2
|
-
const routes: any[]
|
|
3
|
-
export default routes
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
declare module 'virtual:boltdocs-config' {
|
|
7
|
-
const config: any
|
|
8
|
-
export default config
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare module 'virtual:boltdocs-layout' {
|
|
12
|
-
const Layout: React.ComponentType<{ children: React.ReactNode; route?: any }>
|
|
13
|
-
export default Layout
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
declare module 'virtual:boltdocs-mdx-components' {
|
|
17
|
-
const components: any
|
|
18
|
-
export default components
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare module 'virtual:boltdocs-entry' {
|
|
22
|
-
const code: string
|
|
23
|
-
export default code
|
|
24
|
-
}
|
|
File without changes
|