@alauda/doom 1.13.2 → 1.14.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/lib/cli/index.js +1 -0
- package/lib/cli/load-config.d.ts +1 -1
- package/lib/cli/load-config.js +6 -2
- package/lib/cli/new.js +1 -3
- package/lib/global/VersionsNav/index.js +4 -4
- package/lib/runtime/components/OpenAPIRef.js +1 -0
- package/lib/runtime/hooks/useInterval.js +1 -0
- package/lib/runtime/hooks/useIsPrint.js +3 -2
- package/lib/runtime/hooks/useMemoizedFn.js +1 -0
- package/lib/runtime/hooks/useTranslation.d.ts +1 -1
- package/lib/types.d.ts +1 -0
- package/package.json +15 -16
- package/styles/overview.module.scss +4 -0
package/lib/cli/index.js
CHANGED
|
@@ -46,6 +46,7 @@ program
|
|
|
46
46
|
.option('-a, --algolia [boolean|alauda]', 'Whether to enable or use the alauda (docs.alauda.io) preset for Algolia search', parseBooleanOrString, false)
|
|
47
47
|
.option('-S, --site-url', 'Whether to enable the siteUrl for sitemap generation', parseBoolean, false)
|
|
48
48
|
.option('-n, --no-open', 'Do not open the browser after starting the server')
|
|
49
|
+
.option('--lang <language>', 'Specify the language of the documentation')
|
|
49
50
|
.command('dev', { isDefault: true })
|
|
50
51
|
.description('Start the development server')
|
|
51
52
|
.argument('[root]', 'Root directory of the documentation')
|
package/lib/cli/load-config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UserConfig } from '@rspress/core';
|
|
2
2
|
import type { GlobalCliOptions } from '../types.ts';
|
|
3
|
-
export declare function loadConfig(root?: string | URL, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, redirect, editRepo, algolia, siteUrl, }?: GlobalCliOptions): Promise<{
|
|
3
|
+
export declare function loadConfig(root?: string | URL, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, redirect, editRepo, algolia, siteUrl, lang, }?: GlobalCliOptions): Promise<{
|
|
4
4
|
config: UserConfig;
|
|
5
5
|
configFilePath: string;
|
|
6
6
|
}>;
|
package/lib/cli/load-config.js
CHANGED
|
@@ -64,7 +64,10 @@ const ALAUDA_RU_ALGOLIA_OPTIONS = {
|
|
|
64
64
|
apiKey: '786fa6da36fe76777d688387c0520c5b',
|
|
65
65
|
indexName: 'docs_alauda_io_gbnijigq50_pages',
|
|
66
66
|
};
|
|
67
|
-
const getCommonConfig = async ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy, include, exclude, redirect, editRepo, algolia, siteUrl, }) => {
|
|
67
|
+
const getCommonConfig = async ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy, include, exclude, redirect, editRepo, algolia, siteUrl, lang, }) => {
|
|
68
|
+
if (lang != null) {
|
|
69
|
+
config.lang = lang;
|
|
70
|
+
}
|
|
68
71
|
const fallbackToZh = 'lang' in config && !config.lang;
|
|
69
72
|
root = resolveDocRoot(root, config.root);
|
|
70
73
|
const localBasePath = configFilePath ? path.dirname(configFilePath) : root;
|
|
@@ -272,7 +275,7 @@ const findConfig = async (basePath) => {
|
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
};
|
|
275
|
-
export async function loadConfig(root, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, redirect, editRepo, algolia, siteUrl, } = {}) {
|
|
278
|
+
export async function loadConfig(root, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, redirect, editRepo, algolia, siteUrl, lang, } = {}) {
|
|
276
279
|
let configFilePath;
|
|
277
280
|
if (configFile) {
|
|
278
281
|
configFilePath = path.resolve(configFile);
|
|
@@ -344,6 +347,7 @@ export async function loadConfig(root, { config: configFile, base, prefix, v: ve
|
|
|
344
347
|
editRepo,
|
|
345
348
|
algolia,
|
|
346
349
|
siteUrl,
|
|
350
|
+
lang,
|
|
347
351
|
});
|
|
348
352
|
base = commonConfig.base;
|
|
349
353
|
const mergedConfig = mergeRsbuildConfig(commonConfig, config, {
|
package/lib/cli/new.js
CHANGED
|
@@ -128,9 +128,7 @@ export const newCommand = new Command('new')
|
|
|
128
128
|
});
|
|
129
129
|
const files = new Set(dirents
|
|
130
130
|
.filter((d) => d.isFile())
|
|
131
|
-
.map((d) => path.relative(source, path.resolve(d.parentPath
|
|
132
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
133
|
-
d.path, d.name))));
|
|
131
|
+
.map((d) => path.relative(source, path.resolve(d.parentPath, d.name))));
|
|
134
132
|
for (const matcher of layout.matchers || []) {
|
|
135
133
|
const matched = await glob(matcher.match.map((m) => render(m, { parameters })), { cwd: source });
|
|
136
134
|
for (const file of matched) {
|
|
@@ -17,12 +17,12 @@ const getNavMenu = () => {
|
|
|
17
17
|
}
|
|
18
18
|
return document.querySelector('.rspress-nav-menu');
|
|
19
19
|
};
|
|
20
|
-
const LEGACY_VERSIONS = ['
|
|
20
|
+
const LEGACY_VERSIONS = ['3.18.1', '3.18.0', '3.16', '3.14'];
|
|
21
21
|
const LEGACY_NAV_ITEMS = LEGACY_VERSIONS.map((v) => ({
|
|
22
22
|
text: v,
|
|
23
|
-
link: `https://
|
|
23
|
+
link: `https://cloud.alauda.cn/v3/document/navigation?version=v${v}&language=true`,
|
|
24
24
|
}));
|
|
25
|
-
const ALLOWED_LEGACY_DOMAINS = new Set(['docs.alauda.cn'
|
|
25
|
+
const ALLOWED_LEGACY_DOMAINS = new Set(['docs.alauda.cn']);
|
|
26
26
|
if (!isProduction()) {
|
|
27
27
|
ALLOWED_LEGACY_DOMAINS.add('localhost');
|
|
28
28
|
}
|
|
@@ -86,7 +86,7 @@ const VersionsNav_ = () => {
|
|
|
86
86
|
});
|
|
87
87
|
const newNavMenu = getNavMenu();
|
|
88
88
|
if (newNavMenu !== navMenu) {
|
|
89
|
-
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
|
89
|
+
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect, react-hooks/set-state-in-effect
|
|
90
90
|
setNavMenu(newNavMenu);
|
|
91
91
|
}
|
|
92
92
|
else if (navMenu.parentNode) {
|
|
@@ -79,6 +79,7 @@ export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, isCommonRef = tr
|
|
|
79
79
|
else if (!uid) {
|
|
80
80
|
uid = innerUid;
|
|
81
81
|
}
|
|
82
|
+
// eslint-disable-next-line react-hooks/preserve-manual-memoization
|
|
82
83
|
const [schemaItem, openapi, openapiPath] = useMemo(() => {
|
|
83
84
|
for (const [pathname, openapi] of Object.entries(openapisMap)) {
|
|
84
85
|
if (openapiPath_ && pathname !== openapiPath_) {
|
|
@@ -14,10 +14,11 @@ const getPrintMediaQuery = () => {
|
|
|
14
14
|
return matchMedia('print');
|
|
15
15
|
};
|
|
16
16
|
export function useIsPrintMedia() {
|
|
17
|
+
// eslint-disable-next-line @eslint-react/naming-convention/use-state
|
|
17
18
|
const [printMediaQuery] = useState(getPrintMediaQuery);
|
|
18
|
-
const [isPrint,
|
|
19
|
+
const [isPrint, setIsPrint] = useState(!!printMediaQuery?.matches);
|
|
19
20
|
const onChange = useCallback((mqList) => {
|
|
20
|
-
|
|
21
|
+
setIsPrint(mqList.matches);
|
|
21
22
|
}, []);
|
|
22
23
|
useEffect(() => {
|
|
23
24
|
printMediaQuery?.addEventListener('change', onChange);
|
|
@@ -5,6 +5,7 @@ export const useMemoizedFn =
|
|
|
5
5
|
(fn) => {
|
|
6
6
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
7
7
|
const fnRef = useRef(fn);
|
|
8
|
+
// eslint-disable-next-line react-hooks/refs
|
|
8
9
|
fnRef.current = fn;
|
|
9
10
|
return useCallback(
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Language } from '../../shared/index.js';
|
|
2
2
|
export declare const useLang: () => Language;
|
|
3
|
-
export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "toc" | "create" | "update" | "
|
|
3
|
+
export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "toc" | "create" | "update" | "password" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "view" | "chinese" | "english" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf" | "view_docs_as_pdf" | "ai_assistant" | "close" | "exclamation" | "semicolon" | "period" | "colon" | "user_login" | "user_login_tip" | "customer_portal_global" | "customer_portal_china" | "user_login_region_china_tip" | "user_login_region_global_tip" | "account_id" | "username" | "captcha" | "login" | "current_field" | "field_required" | "ERR_INTERNET_DISCONNECTED" | "AccountDisabledError" | "CaptchaError" | "LoginError" | "NetworkError" | "TenantError" | "TenantNotFoundError" | "logout" | "hi_there" | "ai_assistant_tip" | "ai_assistant_placeholder" | "max_chars_exceeded_tip" | "thinking" | "thinking_process" | "referenced_doc_links" | "view_more_related_docs" | "view_less_related_docs" | "new_chat") => string;
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"homepage": "https://github.com/alauda/doom#readme",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=20.19.0"
|
|
15
15
|
},
|
|
16
16
|
"bin": "lib/cli/index.js",
|
|
17
17
|
"exports": {
|
|
@@ -40,12 +40,11 @@
|
|
|
40
40
|
"rspress-plugins"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@alauda/doom-export": "^0.
|
|
44
|
-
"@cspell/eslint-plugin": "^
|
|
45
|
-
"@eslint-react/eslint-plugin": "^
|
|
46
|
-
"@inquirer/prompts": "^7.
|
|
43
|
+
"@alauda/doom-export": "^0.2.0",
|
|
44
|
+
"@cspell/eslint-plugin": "^9.2.1",
|
|
45
|
+
"@eslint-react/eslint-plugin": "^2.2.2",
|
|
46
|
+
"@inquirer/prompts": "^7.9.0",
|
|
47
47
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
48
|
-
"@playwright/browser-chromium": "^1.55.1",
|
|
49
48
|
"@rsbuild/plugin-react": "^1.4.1",
|
|
50
49
|
"@rsbuild/plugin-sass": "^1.4.0",
|
|
51
50
|
"@rsbuild/plugin-svgr": "^1.2.2",
|
|
@@ -60,10 +59,10 @@
|
|
|
60
59
|
"ab64": "^0.1.6",
|
|
61
60
|
"chokidar": "^4.0.3",
|
|
62
61
|
"clsx": "^2.1.1",
|
|
63
|
-
"commander": "^
|
|
62
|
+
"commander": "^14.0.1",
|
|
64
63
|
"ejs": "^3.1.10",
|
|
65
|
-
"es-toolkit": "^1.
|
|
66
|
-
"eslint": "^9.
|
|
64
|
+
"es-toolkit": "^1.40.0",
|
|
65
|
+
"eslint": "^9.37.0",
|
|
67
66
|
"eslint-plugin-mdx": "^3.6.2",
|
|
68
67
|
"globals": "^16.4.0",
|
|
69
68
|
"html-tag-names": "^2.1.0",
|
|
@@ -75,13 +74,13 @@
|
|
|
75
74
|
"mdast-util-to-markdown": "^2.1.2",
|
|
76
75
|
"mdast-util-to-string": "^4.0.0",
|
|
77
76
|
"mermaid": "^11.12.0",
|
|
78
|
-
"openai": "^
|
|
77
|
+
"openai": "^6.3.0",
|
|
79
78
|
"openapi-types": "^12.1.3",
|
|
80
79
|
"p-ratelimit": "^1.0.1",
|
|
81
80
|
"picomatch": "^4.0.3",
|
|
82
81
|
"pluralize": "^8.0.0",
|
|
83
82
|
"react-markdown": "^10.1.0",
|
|
84
|
-
"react-tooltip": "^5.
|
|
83
|
+
"react-tooltip": "^5.30.0",
|
|
85
84
|
"rehype-raw": "^7.0.0",
|
|
86
85
|
"rehype-sanitize": "^6.0.0",
|
|
87
86
|
"remark-directive": "^4.0.0",
|
|
@@ -98,12 +97,12 @@
|
|
|
98
97
|
"remark-stringify": "^11.0.0",
|
|
99
98
|
"shiki": "^3.13.0",
|
|
100
99
|
"simple-git": "^3.28.0",
|
|
101
|
-
"string-width": "^
|
|
100
|
+
"string-width": "^8.1.0",
|
|
102
101
|
"swagger2openapi": "^7.0.8",
|
|
103
102
|
"tinyglobby": "^0.2.15",
|
|
104
|
-
"type-fest": "^
|
|
105
|
-
"typescript": "^5.9.
|
|
106
|
-
"typescript-eslint": "^8.
|
|
103
|
+
"type-fest": "^5.1.0",
|
|
104
|
+
"typescript": "^5.9.3",
|
|
105
|
+
"typescript-eslint": "^8.46.1",
|
|
107
106
|
"unified": "^11.0.5",
|
|
108
107
|
"unified-lint-rule": "^3.0.1",
|
|
109
108
|
"unist-util-position": "^5.0.0",
|