@alauda/doom 0.20.5 → 0.20.6
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/load-config.d.ts +1 -1
- package/lib/cli/load-config.js +15 -11
- package/lib/runtime/components/QuickNav.d.ts +13 -0
- package/lib/runtime/components/QuickNav.js +8 -0
- package/lib/types.d.ts +2 -2
- package/lib/utils/types.d.ts +32 -0
- package/lib/utils/types.js +1 -0
- package/package.json +5 -4
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.js';
|
|
3
|
-
export declare function loadConfig(root?: string, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy,
|
|
3
|
+
export declare function loadConfig(root?: string, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, }?: GlobalCliOptions): Promise<{
|
|
4
4
|
config: UserConfig;
|
|
5
5
|
filepath?: string;
|
|
6
6
|
}>;
|
package/lib/cli/load-config.js
CHANGED
|
@@ -5,6 +5,7 @@ import { pluginYaml } from '@rsbuild/plugin-yaml';
|
|
|
5
5
|
import { addLeadingSlash, addTrailingSlash, normalizeSlash, removeLeadingSlash, } from '@rspress/core';
|
|
6
6
|
import { logger } from '@rspress/shared/logger';
|
|
7
7
|
import { transformerMetaHighlight, transformerMetaWordHighlight, transformerNotationDiff, transformerNotationErrorLevel, transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight, transformerRemoveNotationEscape, } from '@shikijs/transformers';
|
|
8
|
+
import { difference } from 'es-toolkit';
|
|
8
9
|
import rehypeRaw from 'rehype-raw';
|
|
9
10
|
import { apiPlugin, autoSidebarPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin, replacePlugin, shikiPlugin, } from '../plugins/index.js';
|
|
10
11
|
import { isExplicitlyUnversioned, UNVERSIONED, } from '../shared/index.js';
|
|
@@ -34,7 +35,7 @@ const KNOWN_LOCALE_CONFIGS = {
|
|
|
34
35
|
nextPageText: 'Следующая страница',
|
|
35
36
|
},
|
|
36
37
|
};
|
|
37
|
-
const getCommonConfig = async ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy,
|
|
38
|
+
const getCommonConfig = async ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy, include, exclude, }) => {
|
|
38
39
|
const fallbackToZh = 'lang' in config && !config.lang;
|
|
39
40
|
root = resolveDocRoot(CWD, root, config.root);
|
|
40
41
|
const localBasePath = configFilePath ? path.dirname(configFilePath) : root;
|
|
@@ -42,7 +43,8 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
|
|
|
42
43
|
if (version && !isExplicitlyUnversioned(version)) {
|
|
43
44
|
base = userBase + `${version}/`;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
const allLanguages = [];
|
|
47
|
+
const locales = [];
|
|
46
48
|
if (!fallbackToZh) {
|
|
47
49
|
const dirents = await fs.readdir(root, { withFileTypes: true });
|
|
48
50
|
for (const dirent of dirents) {
|
|
@@ -50,24 +52,25 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
|
|
|
50
52
|
if (!dirent.isDirectory() || ['public', 'shared'].includes(name)) {
|
|
51
53
|
continue;
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
allLanguages.push(name);
|
|
56
|
+
if (include?.length) {
|
|
57
|
+
if (!include.includes(name)) {
|
|
55
58
|
continue;
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
else if (
|
|
59
|
-
if (
|
|
61
|
+
else if (exclude?.length) {
|
|
62
|
+
if (exclude.includes(name)) {
|
|
60
63
|
continue;
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
(locales ??= []).push({
|
|
66
|
+
locales.push({
|
|
65
67
|
lang: name,
|
|
66
68
|
label: name,
|
|
67
69
|
...KNOWN_LOCALE_CONFIGS[name],
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
}
|
|
73
|
+
const unusedLanguages = difference(allLanguages, locales.map(({ lang }) => lang));
|
|
71
74
|
return {
|
|
72
75
|
userBase,
|
|
73
76
|
root,
|
|
@@ -82,6 +85,7 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
|
|
|
82
85
|
'doom.config.*',
|
|
83
86
|
'**/assets/**/*',
|
|
84
87
|
'**/*.d.ts',
|
|
88
|
+
...unusedLanguages.map((lang) => `${lang}/**/*`),
|
|
85
89
|
],
|
|
86
90
|
},
|
|
87
91
|
markdown: {
|
|
@@ -172,7 +176,7 @@ const findConfig = async (basePath) => {
|
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
};
|
|
175
|
-
export async function loadConfig(root, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy,
|
|
179
|
+
export async function loadConfig(root, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, } = {}) {
|
|
176
180
|
let configFilePath;
|
|
177
181
|
if (configFile) {
|
|
178
182
|
configFilePath = path.resolve(configFile);
|
|
@@ -234,8 +238,8 @@ export async function loadConfig(root, { config: configFile, base, prefix, v: ve
|
|
|
234
238
|
force,
|
|
235
239
|
open,
|
|
236
240
|
lazy,
|
|
237
|
-
|
|
238
|
-
|
|
241
|
+
include,
|
|
242
|
+
exclude,
|
|
239
243
|
});
|
|
240
244
|
base = commonConfig.base;
|
|
241
245
|
const mergedConfig = mergeRsbuildConfig(commonConfig, config, {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface QuickNavItem {
|
|
2
|
+
icon: string;
|
|
3
|
+
title: string;
|
|
4
|
+
links: Array<{
|
|
5
|
+
title: string;
|
|
6
|
+
href: string;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export interface QuickNavProps {
|
|
10
|
+
items: QuickNavItem[];
|
|
11
|
+
}
|
|
12
|
+
export declare const QuickNav: ({ items }: QuickNavProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default QuickNav;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { normalizeImagePath } from '@rspress/core/runtime';
|
|
3
|
+
import { Link } from '@rspress/core/theme';
|
|
4
|
+
import classes from '../../../styles/quick-nav.module.scss';
|
|
5
|
+
export const QuickNav = ({ items }) => {
|
|
6
|
+
return (_jsx("ul", { className: classes.container, children: items.map((item, index) => (_jsxs("li", { className: classes.item, children: [_jsxs("div", { className: classes.title, title: item.title, children: [_jsx("img", { src: normalizeImagePath(item.icon), alt: item.title }), item.title] }), _jsx("hr", { className: classes.divider }), _jsx("ul", { className: classes.links, children: item.links.map((link, index) => (_jsx("li", { children: _jsx(Link, { href: link.href, title: link.title, children: link.title }) }, index))) })] }, index))) }));
|
|
7
|
+
};
|
|
8
|
+
export default QuickNav;
|
package/lib/types.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export interface GlobalCliOptions {
|
|
|
14
14
|
force?: boolean;
|
|
15
15
|
open?: boolean;
|
|
16
16
|
lazy?: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
include?: string[];
|
|
18
|
+
exclude?: string[];
|
|
19
19
|
outDir?: string;
|
|
20
20
|
}
|
|
21
21
|
export interface TranslateOptions {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { serve } from '@rspress/core';
|
|
2
|
+
|
|
3
|
+
import type { ApiPluginOptions, AutoSidebarPluginOptions, PermissionPluginOptions, ReferenceItem, ReleaseNotesOptions } from '../plugins/index.js';
|
|
4
|
+
import type { DoomSite } from '../shared/index.js';
|
|
5
|
+
|
|
6
|
+
export type BaseServeOptions = Parameters<typeof serve>[0];
|
|
7
|
+
export type ServeOptions = Omit<BaseServeOptions, 'config'>;
|
|
8
|
+
export interface GlobalCliOptions {
|
|
9
|
+
config?: string;
|
|
10
|
+
base?: string;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
v?: string;
|
|
13
|
+
download?: boolean;
|
|
14
|
+
ignore?: boolean;
|
|
15
|
+
force?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare module '@rspress/shared' {
|
|
18
|
+
interface UserConfig {
|
|
19
|
+
userBase?: string;
|
|
20
|
+
api?: Omit<ApiPluginOptions, 'localBasePath'>;
|
|
21
|
+
sites?: DoomSite[];
|
|
22
|
+
permission?: PermissionPluginOptions;
|
|
23
|
+
reference?: ReferenceItem[];
|
|
24
|
+
sidebar?: Omit<AutoSidebarPluginOptions, 'download' | 'excludeRoutes'>;
|
|
25
|
+
releaseNotes?: ReleaseNotesOptions;
|
|
26
|
+
internalRoutes?: string[];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export type ContentProcessor = {
|
|
30
|
+
type: 'ejsTemplate';
|
|
31
|
+
data?: Record<string, unknown>;
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": "https://gitlab-ce.alauda.cn/idp/Doom.git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"translate": "yarn doom translate fixture-docs"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@inquirer/prompts": "^7.
|
|
44
|
+
"@inquirer/prompts": "^7.5.0",
|
|
45
45
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
46
46
|
"@playwright/browser-chromium": "^1.52.0",
|
|
47
47
|
"@rsbuild/plugin-yaml": "^1.0.2",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@eslint/js": "^9.25.1",
|
|
81
81
|
"@swc-node/register": "^1.10.10",
|
|
82
|
-
"@swc/core": "1.11.
|
|
82
|
+
"@swc/core": "1.11.22",
|
|
83
83
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
84
84
|
"@types/cli-progress": "^3.11.6",
|
|
85
85
|
"@types/ejs": "^3.1.5",
|
|
@@ -96,7 +96,8 @@
|
|
|
96
96
|
"npm-run-all2": "^7.0.2",
|
|
97
97
|
"prettier": "^3.5.3",
|
|
98
98
|
"prettier-plugin-pkg": "^0.19.0",
|
|
99
|
-
"
|
|
99
|
+
"prettier-plugin-properties": "^0.3.0",
|
|
100
|
+
"simple-git-hooks": "^2.13.0",
|
|
100
101
|
"typescript": "^5.8.3",
|
|
101
102
|
"typescript-eslint": "^8.31.0",
|
|
102
103
|
"yarn-berry-deduplicate": "^6.1.3"
|