@alauda/doom 1.0.0-next.3 → 1.0.0-next.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/lib/cli/helpers.d.ts +1 -0
- package/lib/cli/helpers.js +3 -1
- package/lib/cli/index.js +3 -5
- package/lib/cli/load-config.js +9 -5
- package/lib/cli/translate.js +1 -1
- package/lib/plugins/shiki/index.d.ts +0 -1
- package/lib/plugins/shiki/index.js +0 -1
- package/lib/runtime/components/OpenAPIPath.js +5 -4
- package/lib/runtime/components/OpenAPIRef.d.ts +2 -1
- package/lib/runtime/components/OpenAPIRef.js +7 -3
- package/lib/runtime/components/_HeadingTitle.d.ts +2 -1
- package/lib/runtime/components/_HeadingTitle.js +11 -5
- package/lib/runtime/components/_Markdown.js +1 -3
- package/lib/types.d.ts +1 -1
- package/package.json +8 -9
- package/lib/plugins/shiki/rehype-fix.d.ts +0 -9
- package/lib/plugins/shiki/rehype-fix.js +0 -25
package/lib/cli/helpers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const parseBoolean: (value?: string) => boolean;
|
|
2
|
+
export declare const parseBooleanOrString: (value?: string) => string | boolean;
|
|
2
3
|
export declare const getMatchedDocFilePaths: (matched: string[]) => Promise<(string | string[])[]>;
|
|
3
4
|
/**
|
|
4
5
|
* Support custom id like `#hello world {#custom-id}`
|
package/lib/cli/helpers.js
CHANGED
|
@@ -2,8 +2,10 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import { glob } from 'tinyglobby';
|
|
3
3
|
import { xfetch } from 'x-fetch';
|
|
4
4
|
import { parse } from 'yaml';
|
|
5
|
-
import { FALSY_VALUES } from '../shared/index.js';
|
|
5
|
+
import { FALSY_VALUES, TRUTHY_VALUES } from '../shared/index.js';
|
|
6
6
|
export const parseBoolean = (value) => value === undefined || !FALSY_VALUES.has(value);
|
|
7
|
+
export const parseBooleanOrString = (value) => value === undefined ||
|
|
8
|
+
(FALSY_VALUES.has(value) ? false : TRUTHY_VALUES.has(value) || value);
|
|
7
9
|
const DOC_PATTERN = /\.mdx?$/;
|
|
8
10
|
const isDoc = (filename) => DOC_PATTERN.test(filename);
|
|
9
11
|
export const getMatchedDocFilePaths = (matched) => Promise.all(matched.map(async (it) => {
|
package/lib/cli/index.js
CHANGED
|
@@ -9,11 +9,10 @@ import { build, dev, serve } from '@rspress/core';
|
|
|
9
9
|
import { watch } from 'chokidar';
|
|
10
10
|
import { program } from 'commander';
|
|
11
11
|
import { green } from 'yoctocolors';
|
|
12
|
-
import { FALSY_VALUES, TRUTHY_VALUES } from '../shared/index.js';
|
|
13
12
|
import { setNodeEnv } from '../utils/index.js';
|
|
14
13
|
import { CWD, DEFAULT_CONFIGS, I18N_FILE, SITES_FILE } from './constants.js';
|
|
15
14
|
import { exportCommand } from './export.js';
|
|
16
|
-
import { parseBoolean } from './helpers.js';
|
|
15
|
+
import { parseBoolean, parseBooleanOrString } from './helpers.js';
|
|
17
16
|
import { lintCommand } from './lint.js';
|
|
18
17
|
import { loadConfig } from './load-config.js';
|
|
19
18
|
import { newCommand } from './new.js';
|
|
@@ -43,9 +42,8 @@ program
|
|
|
43
42
|
.option('-E, --exclude <language...>', 'Include all languages except the specific language(s), `ru` for example')
|
|
44
43
|
.option('-o, --out-dir <path>', 'Override the `outDir` defined in the config file or the default `dist/{base}/{version}`, the resulting path will be `dist/{outDir}/{version}`')
|
|
45
44
|
.option('-r, --redirect <enum>', 'Whether to redirect to the locale closest to `navigator.language` when the user visits the site, could be `auto`, `never` or `only-default-lang`', 'only-default-lang')
|
|
46
|
-
.option('-R, --edit-repo [boolean|url]', 'Whether to enable or override the `editRepoBaseUrl` config feature, `https://github.com/` prefix could be omitted',
|
|
47
|
-
|
|
48
|
-
.option('-a, --algolia', 'Whether to enable Algolia search', parseBoolean, false)
|
|
45
|
+
.option('-R, --edit-repo [boolean|url]', 'Whether to enable or override the `editRepoBaseUrl` config feature, `https://github.com/` prefix could be omitted', parseBooleanOrString, false)
|
|
46
|
+
.option('-a, --algolia [boolean|alauda]', 'Whether to enable or use the alauda (docs.alauda.io) preset for Algolia search', parseBooleanOrString, false)
|
|
49
47
|
.option('-S, --site-url', 'Whether to enable the siteUrl for sitemap generation', parseBoolean, false)
|
|
50
48
|
.option('-n, --no-open [boolean]', 'Do not open the browser after starting the server')
|
|
51
49
|
.command('dev', { isDefault: true })
|
package/lib/cli/load-config.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { nodeTypes } from '@mdx-js/mdx';
|
|
4
3
|
import { pluginSass } from '@rsbuild/plugin-sass';
|
|
5
4
|
import { pluginYaml } from '@rsbuild/plugin-yaml';
|
|
6
5
|
import { addLeadingSlash, addTrailingSlash, normalizeSlash, removeLeadingSlash, } from '@rspress/core';
|
|
@@ -9,9 +8,8 @@ import { pluginLlms } from '@rspress/plugin-llms';
|
|
|
9
8
|
import { logger } from '@rspress/shared/logger';
|
|
10
9
|
import { transformerMetaHighlight, transformerMetaWordHighlight, transformerNotationDiff, transformerNotationErrorLevel, transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight, transformerRemoveNotationEscape, } from '@shikijs/transformers';
|
|
11
10
|
import { difference } from 'es-toolkit';
|
|
12
|
-
import rehypeRaw from 'rehype-raw';
|
|
13
11
|
import { cyan } from 'yoctocolors';
|
|
14
|
-
import { apiPlugin, autoSidebarPlugin, autoTocPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin,
|
|
12
|
+
import { apiPlugin, autoSidebarPlugin, autoTocPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin, replacePlugin, sitemapPlugin, } from '../plugins/index.js';
|
|
15
13
|
import { isExplicitlyUnversioned, UNVERSIONED, } from '../shared/index.js';
|
|
16
14
|
import { pathExists, pkgResolve, resolveStaticConfig } from '../utils/index.js';
|
|
17
15
|
import { CWD, DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS, I18N_FILE, SITES_FILE, YAML_EXTENSIONS, } from './constants.js';
|
|
@@ -49,6 +47,11 @@ const KNOWN_LOCALE_CONFIGS = {
|
|
|
49
47
|
},
|
|
50
48
|
},
|
|
51
49
|
};
|
|
50
|
+
const ALAUDA_ALGOLIA_OPTIONS = {
|
|
51
|
+
appId: 'XN35Q5JLSV',
|
|
52
|
+
apiKey: '487fb969bdcda09dd4950468d7d8b61e',
|
|
53
|
+
indexName: 'docs_alauda_io_xn35q5jlsv_pages',
|
|
54
|
+
};
|
|
52
55
|
const getCommonConfig = async ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy, include, exclude, redirect, editRepo, algolia, siteUrl, }) => {
|
|
53
56
|
const fallbackToZh = 'lang' in config && !config.lang;
|
|
54
57
|
root = resolveDocRoot(CWD, root, config.root);
|
|
@@ -106,7 +109,9 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
|
|
|
106
109
|
}
|
|
107
110
|
const unusedLanguages = difference(allLanguages, locales.map(({ lang }) => lang));
|
|
108
111
|
const { editLink, ...zhLocale } = KNOWN_LOCALE_CONFIGS.zh;
|
|
109
|
-
const algoliaOptions = algolia
|
|
112
|
+
const algoliaOptions = ((algolia && config.algolia) ??
|
|
113
|
+
(algolia === 'alauda' && ALAUDA_ALGOLIA_OPTIONS)) ||
|
|
114
|
+
null;
|
|
110
115
|
return {
|
|
111
116
|
userBase,
|
|
112
117
|
root,
|
|
@@ -128,7 +133,6 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
|
|
|
128
133
|
},
|
|
129
134
|
markdown: {
|
|
130
135
|
checkDeadLinks: true,
|
|
131
|
-
rehypePlugins: [[rehypeRaw, { passThrough: nodeTypes }], rehypeFix],
|
|
132
136
|
shiki: {
|
|
133
137
|
transformers: [
|
|
134
138
|
// builtin transformers
|
package/lib/cli/translate.js
CHANGED
|
@@ -90,7 +90,7 @@ export const translate = async ({ source, sourceContent, target, targetContent =
|
|
|
90
90
|
terms = await resolveTerms();
|
|
91
91
|
}
|
|
92
92
|
const finalSystemPrompt = await render(systemPrompt?.trim() || DEFAULT_SYSTEM_PROMPT, { sourceLang, targetLang, userPrompt, additionalPrompts, terms }, { async: true });
|
|
93
|
-
const { choices } = await openai.
|
|
93
|
+
const { choices } = await openai.chat.completions.parse({
|
|
94
94
|
messages: [
|
|
95
95
|
{
|
|
96
96
|
role: 'system',
|
|
@@ -5,7 +5,7 @@ import openapisMap from 'doom-@api-openapisMap';
|
|
|
5
5
|
import virtual from 'doom-@api-virtual';
|
|
6
6
|
import BananaSlug from 'github-slugger';
|
|
7
7
|
import { OpenAPIV3 } from 'openapi-types';
|
|
8
|
-
import { Fragment, useMemo } from 'react';
|
|
8
|
+
import { Fragment, useId, useMemo } from 'react';
|
|
9
9
|
import { omitRoutePathRefs, resolveRef } from '../utils.js';
|
|
10
10
|
import { OpenAPIProperties, OpenAPIProperty, OpenAPIRef } from './OpenAPIRef.js';
|
|
11
11
|
import { HeadingTitle } from './_HeadingTitle.js';
|
|
@@ -91,6 +91,7 @@ const getRefsForPath = (openapi, path, knownRefs) => {
|
|
|
91
91
|
export const OpenAPIPath = ({ path, openapiPath: openapiPath_, pathPrefix: pathPrefix_, }) => {
|
|
92
92
|
const { page } = usePageData();
|
|
93
93
|
const pathPrefix = pathPrefix_ ?? (virtual.pathPrefix || '');
|
|
94
|
+
const uid = useId();
|
|
94
95
|
const slugger = useMemo(() => new BananaSlug(), []);
|
|
95
96
|
const [pathItem, openapi, openapiPath, refs] = useMemo(() => {
|
|
96
97
|
for (const [pathname, openapi] of Object.entries(openapisMap)) {
|
|
@@ -113,7 +114,7 @@ export const OpenAPIPath = ({ path, openapiPath: openapiPath_, pathPrefix: pathP
|
|
|
113
114
|
console.error(`No OpenAPI path definition found for ${path}`);
|
|
114
115
|
return null;
|
|
115
116
|
}
|
|
116
|
-
return (_jsxs(_Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 2, children: [pathPrefix, path] }), pathItem.parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 3, children: "Common Parameters" }), _jsx(OpenAPIParameters, { parameters: pathItem.parameters, openapi: openapi })] })), Object.values(OpenAPIV3.HttpMethods).map((method) => {
|
|
117
|
+
return (_jsxs(_Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, uid: uid, level: 2, children: [pathPrefix, path] }), pathItem.parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, uid: uid, level: 3, children: "Common Parameters" }), _jsx(OpenAPIParameters, { parameters: pathItem.parameters, openapi: openapi })] })), Object.values(OpenAPIV3.HttpMethods).map((method) => {
|
|
117
118
|
if (!pathItem[method]) {
|
|
118
119
|
return null;
|
|
119
120
|
}
|
|
@@ -125,9 +126,9 @@ export const OpenAPIPath = ({ path, openapiPath: openapiPath_, pathPrefix: pathP
|
|
|
125
126
|
const requestBodySchema = requestBodyRef
|
|
126
127
|
? resolveRef(openapi, requestBodyRef)
|
|
127
128
|
: undefined;
|
|
128
|
-
return (_jsxs(Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 3, children: [_jsx("code", { children: method }), summary] }), _jsx(Markdown, { children: description }), parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Parameters" }), _jsx(OpenAPIParameters, { parameters: parameters, openapi: openapi })] })), requestBodySchema && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Request Body" }), _jsxs(X.p, { children: [_jsx(RefLink, { "$ref": requestBodyRef }), requestBodySchema.required && _jsx(Badge, { children: "required" })] })] })), responses && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Response" }), _jsx(OpenAPIResponses, { responses: responses, openapi: openapi })] }))] }, method));
|
|
129
|
+
return (_jsxs(Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, uid: uid, level: 3, children: [_jsx("code", { children: method }), summary] }), _jsx(Markdown, { children: description }), parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, uid: uid, level: 4, children: "Parameters" }), _jsx(OpenAPIParameters, { parameters: parameters, openapi: openapi })] })), requestBodySchema && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, uid: uid, level: 4, children: "Request Body" }), _jsxs(X.p, { children: [_jsx(RefLink, { "$ref": requestBodyRef }), requestBodySchema.required && _jsx(Badge, { children: "required" })] })] })), responses && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, uid: uid, level: 4, children: "Response" }), _jsx(OpenAPIResponses, { responses: responses, openapi: openapi })] }))] }, method));
|
|
129
130
|
}), refs?.map((ref) => {
|
|
130
|
-
return (_jsx(OpenAPIRef, { schema: ref, openapiPath: openapiPath, collectRefs: false }, ref));
|
|
131
|
+
return (_jsx(OpenAPIRef, { schema: ref, openapiPath: openapiPath, uid: uid, collectRefs: false }, ref));
|
|
131
132
|
})] }));
|
|
132
133
|
};
|
|
133
134
|
export default OpenAPIPath;
|
|
@@ -8,6 +8,7 @@ export interface OpenAPIRefProps {
|
|
|
8
8
|
* The specific path to the OpenAPI schema, otherwise the first matched will be used.
|
|
9
9
|
*/
|
|
10
10
|
openapiPath?: string;
|
|
11
|
+
uid?: string;
|
|
11
12
|
collectRefs?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare const OpenAPIProperty: ({ name, property, openapi, }: {
|
|
@@ -19,5 +20,5 @@ export declare const OpenAPIProperties: ({ properties, openapi, }: {
|
|
|
19
20
|
properties: Record<string, OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.SchemaObject>;
|
|
20
21
|
openapi: OpenAPIV3_1.Document;
|
|
21
22
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare const OpenAPIRef: ({ schema, openapiPath: openapiPath_, collectRefs, }: OpenAPIRefProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export declare const OpenAPIRef: ({ schema, openapiPath: openapiPath_, uid, collectRefs, }: OpenAPIRefProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
23
24
|
export default OpenAPIRef;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { usePageData } from '@rspress/core/runtime';
|
|
3
3
|
import openapisMap from 'doom-@api-openapisMap';
|
|
4
|
-
import { useMemo } from 'react';
|
|
4
|
+
import { useId, useMemo } from 'react';
|
|
5
5
|
import { modelName, omitRoutePathRefs, resolveRef } from '../utils.js';
|
|
6
6
|
import { HeadingTitle } from './_HeadingTitle.js';
|
|
7
7
|
import { Markdown } from './_Markdown.js';
|
|
@@ -68,8 +68,12 @@ const getRefsForSchema = (openapi, schema, knownRefs) => {
|
|
|
68
68
|
collectRefs(refSchema);
|
|
69
69
|
return Array.from(refs);
|
|
70
70
|
};
|
|
71
|
-
export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, collectRefs = true, }) => {
|
|
71
|
+
export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, uid, collectRefs = true, }) => {
|
|
72
72
|
const { page } = usePageData();
|
|
73
|
+
const innerUid = useId();
|
|
74
|
+
if (uid == null) {
|
|
75
|
+
uid = innerUid;
|
|
76
|
+
}
|
|
73
77
|
const [schemaItem, openapi, openapiPath] = useMemo(() => {
|
|
74
78
|
for (const [pathname, openapi] of Object.entries(openapisMap)) {
|
|
75
79
|
if (openapiPath_ && pathname !== openapiPath_) {
|
|
@@ -91,6 +95,6 @@ export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, collectRefs = tr
|
|
|
91
95
|
return getRefsForSchema(openapi, schema, omitRoutePathRefs(page.routePath));
|
|
92
96
|
}
|
|
93
97
|
}, [collectRefs, openapi, page.routePath, schema]);
|
|
94
|
-
return (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slug: schema, level: 2, children: modelName(schema) }), _jsx(Markdown, { children: schemaItem.description }), schemaItem.properties && (_jsx(OpenAPIProperties, { properties: schemaItem.properties, openapi: openapi })), refs?.map((schema) => (_jsx(OpenAPIRef, { schema: schema, openapiPath: openapiPath, collectRefs: false }, schema)))] }));
|
|
98
|
+
return (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { uid: uid, slug: schema, level: 2, children: modelName(schema) }), _jsx(Markdown, { children: schemaItem.description }), schemaItem.properties && (_jsx(OpenAPIProperties, { properties: schemaItem.properties, openapi: openapi })), refs?.map((schema) => (_jsx(OpenAPIRef, { schema: schema, openapiPath: openapiPath, uid: uid, collectRefs: false }, schema)))] }));
|
|
95
99
|
};
|
|
96
100
|
export default OpenAPIRef;
|
|
@@ -3,7 +3,8 @@ import { type ReactNode } from 'react';
|
|
|
3
3
|
export interface HeadingTitleProps {
|
|
4
4
|
slug?: string;
|
|
5
5
|
slugger?: BananaSlug;
|
|
6
|
+
uid?: string;
|
|
6
7
|
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
8
|
children: ReactNode;
|
|
8
9
|
}
|
|
9
|
-
export declare const HeadingTitle: ({ slug, slugger, level, children, }: HeadingTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const HeadingTitle: ({ slug, slugger, uid, level, children, }: HeadingTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,14 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import BananaSlug from 'github-slugger';
|
|
3
3
|
import { Children, useMemo } from 'react';
|
|
4
4
|
import { X } from './_X.js';
|
|
5
|
-
|
|
5
|
+
// TODO: use context to simplify the usage of `slugger` and `uid`
|
|
6
|
+
export const HeadingTitle = ({ slug, slugger, uid, level, children, }) => {
|
|
6
7
|
const HeadingComponents = useMemo(() => {
|
|
7
8
|
return [null, X.h1, X.h2, X.h3, X.h4, X.h5, X.h6];
|
|
8
9
|
}, [X]);
|
|
9
10
|
const HeadingComponent = HeadingComponents[level];
|
|
10
|
-
const id = useMemo(() =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.
|
|
11
|
+
const id = useMemo(() => [
|
|
12
|
+
uid,
|
|
13
|
+
slug ||
|
|
14
|
+
slugger?.slug(Children.toArray(children)
|
|
15
|
+
.filter((it) => typeof it === 'string')
|
|
16
|
+
.join('')),
|
|
17
|
+
]
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join('-') || undefined, [slug, uid, children]);
|
|
14
20
|
return (_jsxs(HeadingComponent, { id: id, children: [children, _jsx(X.a, { className: "header-anchor", href: `#${id}`, "aria-hidden": true, children: "#" })] }));
|
|
15
21
|
};
|
|
@@ -3,6 +3,4 @@ import {} from 'react';
|
|
|
3
3
|
import ReactMarkdown from 'react-markdown';
|
|
4
4
|
import remarkGfm from 'remark-gfm';
|
|
5
5
|
import { X } from './_X.js';
|
|
6
|
-
export const Markdown = ({ children }) => {
|
|
7
|
-
return (children && (_jsx(ReactMarkdown, { remarkPlugins: [[remarkGfm]], components: X, skipHtml: true, children: children })));
|
|
8
|
-
};
|
|
6
|
+
export const Markdown = ({ children }) => children && (_jsx(ReactMarkdown, { remarkPlugins: [[remarkGfm]], components: X, skipHtml: true, children: children }));
|
package/lib/types.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface GlobalCliOptions {
|
|
|
20
20
|
outDir?: string;
|
|
21
21
|
redirect?: 'auto' | 'never' | 'only-default-lang';
|
|
22
22
|
editRepo?: boolean | string;
|
|
23
|
-
algolia?: boolean;
|
|
23
|
+
algolia?: boolean | 'alauda';
|
|
24
24
|
siteUrl?: boolean;
|
|
25
25
|
}
|
|
26
26
|
export interface TranslateOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": "git+https://github.com/alauda/doom.git",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@cspell/eslint-plugin": "^9.0.2",
|
|
38
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
38
|
+
"@eslint-react/eslint-plugin": "^1.51.0",
|
|
39
39
|
"@inquirer/prompts": "^7.5.3",
|
|
40
40
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
41
41
|
"@playwright/browser-chromium": "^1.52.0",
|
|
42
42
|
"@rsbuild/plugin-sass": "^1.3.1",
|
|
43
43
|
"@rsbuild/plugin-yaml": "^1.0.2",
|
|
44
|
-
"@rspress/core": "2.0.0-beta.
|
|
45
|
-
"@rspress/plugin-algolia": "2.0.0-beta.
|
|
46
|
-
"@rspress/plugin-llms": "^2.0.0-beta.
|
|
44
|
+
"@rspress/core": "2.0.0-beta.10",
|
|
45
|
+
"@rspress/plugin-algolia": "2.0.0-beta.10",
|
|
46
|
+
"@rspress/plugin-llms": "^2.0.0-beta.10",
|
|
47
47
|
"@shikijs/transformers": "^3.4.2",
|
|
48
48
|
"chokidar": "^4.0.3",
|
|
49
49
|
"cli-progress": "^3.12.0",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"commander": "^13.1.0",
|
|
52
52
|
"ejs": "^3.1.10",
|
|
53
53
|
"es-toolkit": "^1.38.0",
|
|
54
|
-
"eslint": "^9.
|
|
54
|
+
"eslint": "^9.28.0",
|
|
55
55
|
"eslint-plugin-mdx": "^3.4.2",
|
|
56
56
|
"html-tag-names": "^2.1.0",
|
|
57
57
|
"mdast-util-mdx": "^3.0.0",
|
|
58
58
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
59
59
|
"mermaid": "^11.6.0",
|
|
60
|
-
"openai": "^5.
|
|
60
|
+
"openai": "^5.1.0",
|
|
61
61
|
"openapi-types": "^12.1.3",
|
|
62
62
|
"p-ratelimit": "^1.0.1",
|
|
63
63
|
"pdf-lib": "^1.17.1",
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"picomatch": "^4.0.2",
|
|
66
66
|
"playwright": "^1.52.0",
|
|
67
67
|
"react-markdown": "^10.1.0",
|
|
68
|
-
"rehype-raw": "^7.0.0",
|
|
69
68
|
"remark-directive": "^4.0.0",
|
|
70
69
|
"remark-frontmatter": "^5.0.0",
|
|
71
70
|
"remark-gfm": "^4.0.1",
|
|
@@ -76,7 +75,7 @@
|
|
|
76
75
|
"swagger2openapi": "^7.0.8",
|
|
77
76
|
"tinyglobby": "^0.2.14",
|
|
78
77
|
"type-fest": "^4.41.0",
|
|
79
|
-
"typescript-eslint": "^8.33.
|
|
78
|
+
"typescript-eslint": "^8.33.1",
|
|
80
79
|
"x-fetch": "^0.2.6",
|
|
81
80
|
"yaml": "^2.8.0",
|
|
82
81
|
"yoctocolors": "^2.1.1"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Root } from 'hast';
|
|
2
|
-
import type { Plugin } from 'unified';
|
|
3
|
-
/**
|
|
4
|
-
* Restores metadata (e.g., titles) for code blocks that `rehype-raw` removes unexpectedly.
|
|
5
|
-
* This function addresses a compatibility issue where `rehype-raw` strips metadata from code blocks.
|
|
6
|
-
* @see https://github.com/syntax-tree/hast-util-raw/issues/29
|
|
7
|
-
* @see https://github.com/web-infra-dev/rspress/blob/ab7567460e63712300b64d7ab46065a2f1c1e069/packages/core/src/node/mdx/rehypePlugins/codeMeta.ts#L5-L22
|
|
8
|
-
*/
|
|
9
|
-
export declare const rehypeFix: Plugin<[], Root>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { visit } from 'unist-util-visit';
|
|
2
|
-
/**
|
|
3
|
-
* Restores metadata (e.g., titles) for code blocks that `rehype-raw` removes unexpectedly.
|
|
4
|
-
* This function addresses a compatibility issue where `rehype-raw` strips metadata from code blocks.
|
|
5
|
-
* @see https://github.com/syntax-tree/hast-util-raw/issues/29
|
|
6
|
-
* @see https://github.com/web-infra-dev/rspress/blob/ab7567460e63712300b64d7ab46065a2f1c1e069/packages/core/src/node/mdx/rehypePlugins/codeMeta.ts#L5-L22
|
|
7
|
-
*/
|
|
8
|
-
export const rehypeFix = function () {
|
|
9
|
-
return (ast) => {
|
|
10
|
-
visit(ast, 'element', (node) => {
|
|
11
|
-
// <pre><code>...</code></pre>
|
|
12
|
-
// 1. Find pre element
|
|
13
|
-
const childNode = node.children.at(0);
|
|
14
|
-
if (node.tagName === 'pre' &&
|
|
15
|
-
childNode?.type === 'element' &&
|
|
16
|
-
childNode.tagName === 'code') {
|
|
17
|
-
if (!childNode.data?.meta &&
|
|
18
|
-
typeof childNode.properties.meta === 'string') {
|
|
19
|
-
;
|
|
20
|
-
(childNode.data ??= {}).meta ??= childNode.properties.meta;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
};
|