@alauda/doom 0.15.2 → 0.15.4
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/export-pdf-core/generatePdf.js +3 -3
- package/lib/cli/export-pdf-core/utils/mergePDF.js +4 -4
- package/lib/cli/html-export-pdf/utils/cliProgress.js +1 -1
- package/lib/cli/html-export-pdf/utils/fs.js +1 -1
- package/lib/global/PrintStyle/index.js +1 -1
- package/lib/global/SiteOverrides/index.js +1 -1
- package/lib/global/VersionsNav/index.js +2 -2
- package/lib/plugins/auto-sidebar/index.js +1 -1
- package/lib/plugins/auto-sidebar/walk.js +1 -1
- package/lib/plugins/mermaid/remark-mermaid.d.ts +1 -1
- package/lib/plugins/replace/index.js +5 -2
- package/lib/plugins/replace/normalize-img-src.js +1 -1
- package/lib/plugins/replace/rehype-normalize-link.d.ts +3 -0
- package/lib/plugins/replace/rehype-normalize-link.js +69 -0
- package/lib/plugins/replace/remark-replace.js +1 -1
- package/lib/plugins/replace/resolve-reference.js +1 -1
- package/lib/plugins/replace/utils.d.ts +1 -0
- package/lib/plugins/replace/utils.js +1 -0
- package/lib/plugins/shiki/rehypePlugin.d.ts +1 -1
- package/lib/plugins/shiki/rehypePlugin.js +2 -2
- package/lib/runtime/components/AcpApisOverview.js +1 -1
- package/lib/runtime/components/ExternalSiteLink.js +3 -3
- package/lib/runtime/components/K8sCrd.js +1 -1
- package/lib/runtime/components/K8sPermissionTable.js +2 -2
- package/lib/runtime/components/Mermaid.js +1 -1
- package/lib/runtime/components/OpenAPIPath.js +3 -3
- package/lib/runtime/components/OpenAPIRef.js +1 -1
- package/lib/runtime/components/Overview.js +1 -1
- package/lib/runtime/components/QuickNav.js +1 -1
- package/lib/runtime/components/_ExternalSiteBase.js +3 -3
- package/lib/runtime/hooks/useSiteOverrides.js +1 -1
- package/lib/runtime/utils.js +1 -1
- package/lib/utils/git.js +1 -1
- package/lib/utils/types.d.ts +2 -0
- package/package.json +10 -10
- package/styles/global.scss +0 -12
- package/styles/overview.module.scss +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import process from 'node:process';
|
|
3
|
-
import fse from 'fs-extra';
|
|
4
4
|
import { red, yellow } from 'yoctocolors';
|
|
5
5
|
import { createProgress, isValidUrl, Printer, writeFileSafe, } from '../html-export-pdf/index.js';
|
|
6
6
|
import { getUrlLink, mergePDF, } from './utils/index.js';
|
|
@@ -8,7 +8,7 @@ import { getUrlLink, mergePDF, } from './utils/index.js';
|
|
|
8
8
|
* Generate PDF from VuePress or VitePress dev server.
|
|
9
9
|
*/
|
|
10
10
|
export async function generatePdf({ pages, tempDir, port, host, outFile, outDir, urlOrigin, pdfOptions, pdfOutlines = true, launchOptions, printerOptions, }) {
|
|
11
|
-
|
|
11
|
+
await fs.mkdir(tempDir, { recursive: true });
|
|
12
12
|
const isValidUrlOrigin = isValidUrl(urlOrigin ?? '');
|
|
13
13
|
if (urlOrigin && !isValidUrlOrigin) {
|
|
14
14
|
process.stdout.write(red(`${urlOrigin} is not a valid URL`));
|
|
@@ -76,6 +76,6 @@ export async function generatePdf({ pages, tempDir, port, host, outFile, outDir,
|
|
|
76
76
|
const exportedPath = await mergePDF(normalizePages, outFile, outDir, allOutlines);
|
|
77
77
|
const message = `\nExported to ${yellow(exportedPath)}\n`;
|
|
78
78
|
process.stdout.write(message);
|
|
79
|
-
|
|
79
|
+
await fs.rm(tempDir, { force: true, recursive: true });
|
|
80
80
|
return exportedPath;
|
|
81
81
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fse from 'fs-extra';
|
|
2
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
3
|
import { join, relative } from 'node:path';
|
|
4
4
|
import process from 'node:process';
|
|
5
5
|
import { asPDFName, PDFArray, PDFDict, PDFDocument, PDFObject, PDFString, } from 'pdf-lib';
|
|
@@ -108,7 +108,7 @@ export const replaceLinksWithOutline = async (pdfData, pdfOutlines) => {
|
|
|
108
108
|
export async function mergePDF(pages, outFile, outDir, pdfOutlines) {
|
|
109
109
|
const saveDirPath = join(process.cwd(), outDir);
|
|
110
110
|
if (outDir) {
|
|
111
|
-
|
|
111
|
+
await fs.mkdir(saveDirPath, { recursive: true });
|
|
112
112
|
}
|
|
113
113
|
const saveFilePath = join(saveDirPath, outFile);
|
|
114
114
|
if (pages.length === 0) {
|
|
@@ -116,7 +116,7 @@ export async function mergePDF(pages, outFile, outDir, pdfOutlines) {
|
|
|
116
116
|
process.exit(1);
|
|
117
117
|
}
|
|
118
118
|
else if (pages.length === 1) {
|
|
119
|
-
|
|
119
|
+
await fs.rename(pages[0].pagePath, saveFilePath);
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
122
|
let pdfData;
|
|
@@ -134,7 +134,7 @@ export async function mergePDF(pages, outFile, outDir, pdfOutlines) {
|
|
|
134
134
|
}
|
|
135
135
|
pdfData = await merger.saveAsBuffer();
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
await fs.writeFile(saveFilePath, pdfData);
|
|
138
138
|
}
|
|
139
139
|
return relative(process.cwd(), saveFilePath);
|
|
140
140
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useSiteOverrides } from '@alauda/doom/runtime';
|
|
2
1
|
import { usePageData } from '@rspress/core/runtime';
|
|
3
2
|
import { useEffect } from 'react';
|
|
3
|
+
import { useSiteOverrides } from '@alauda/doom/runtime';
|
|
4
4
|
const setNavBarSpans = (logoText) => {
|
|
5
5
|
const navBarLinks = document.querySelectorAll('[class^=navBarTitle] > a');
|
|
6
6
|
if (!navBarLinks.length) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from '@alauda/doom/runtime';
|
|
3
2
|
import { isProduction, NoSSR, removeTrailingSlash, useLang, usePageData, } from '@rspress/core/runtime';
|
|
3
|
+
import virtual from 'doom-@global-virtual';
|
|
4
4
|
import { noop } from 'es-toolkit';
|
|
5
5
|
import { useEffect, useMemo, useState } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
@@ -8,7 +8,7 @@ import { parse } from 'yaml';
|
|
|
8
8
|
import { ACP_BASE, getPdfName } from '../../shared/index.js';
|
|
9
9
|
import { NavMenuGroup } from './NavMenuGroup.js';
|
|
10
10
|
import { NavMenuSingleItem } from './NavMenuSingleItem.js';
|
|
11
|
-
import
|
|
11
|
+
import { useTranslation } from '@alauda/doom/runtime';
|
|
12
12
|
const getNavMenu = () => {
|
|
13
13
|
if (typeof document === 'undefined') {
|
|
14
14
|
return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { addTrailingSlash, } from '@rspress/core';
|
|
2
1
|
import path from 'node:path';
|
|
2
|
+
import { addTrailingSlash, } from '@rspress/core';
|
|
3
3
|
import { combineWalkResult } from './utils.js';
|
|
4
4
|
import { walk } from './walk.js';
|
|
5
5
|
// Scan all the directories and files in the work directory(such as `docs`), and then generate the nav and sidebar configuration according to the directory structure.
|
|
@@ -4,8 +4,8 @@ import { isExternalUrl, removeLeadingSlash, removeTrailingSlash, slash, withBase
|
|
|
4
4
|
import { logger } from '@rspress/shared/logger';
|
|
5
5
|
import { unset } from 'es-toolkit/compat';
|
|
6
6
|
import picomatch from 'picomatch';
|
|
7
|
-
import { detectFilePath, extractInfoFromFrontmatter } from './utils.js';
|
|
8
7
|
import { pathExists, readJson } from '../../utils/index.js';
|
|
8
|
+
import { detectFilePath, extractInfoFromFrontmatter } from './utils.js';
|
|
9
9
|
const sidebarSorter = (a, b) => {
|
|
10
10
|
const aWeight = 'weight' in a && a.weight != null ? a.weight : 100;
|
|
11
11
|
const bWeight = 'weight' in b && b.weight != null ? b.weight : 100;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import { logger } from '@rspress/shared/logger';
|
|
3
|
+
import { rehypeNormalizeLink } from './rehype-normalize-link.js';
|
|
3
4
|
import { remarkExplicitJsx } from './remark-explicit-jsx.js';
|
|
4
5
|
import { MD_RELEASE_COMMENT_PATTERN, MDX_RELEASE_COMMENT_PATTERN, remarkReplace, } from './remark-replace.js';
|
|
5
6
|
import { mdProcessor, mdxProcessor, normalizeReferenceItems } from './utils.js';
|
|
@@ -11,8 +12,8 @@ export const replacePlugin = ({ lang, localBasePath, force, }) => {
|
|
|
11
12
|
return {
|
|
12
13
|
name: 'doom-replace',
|
|
13
14
|
config(config) {
|
|
14
|
-
config.markdown
|
|
15
|
-
config.markdown.remarkPlugins
|
|
15
|
+
config.markdown ??= {};
|
|
16
|
+
config.markdown.remarkPlugins ??= [];
|
|
16
17
|
config.markdown.remarkPlugins.push([
|
|
17
18
|
remarkReplace,
|
|
18
19
|
{
|
|
@@ -24,6 +25,8 @@ export const replacePlugin = ({ lang, localBasePath, force, }) => {
|
|
|
24
25
|
force,
|
|
25
26
|
},
|
|
26
27
|
], remarkExplicitJsx);
|
|
28
|
+
config.markdown.rehypePlugins ??= [];
|
|
29
|
+
config.markdown.rehypePlugins.push(rehypeNormalizeLink);
|
|
27
30
|
return (userConfig = config);
|
|
28
31
|
},
|
|
29
32
|
async modifySearchIndexData(pages) {
|
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { isExternalUrl, removeLeadingSlash } from '@rspress/core';
|
|
4
4
|
import { cloneDeep } from 'es-toolkit';
|
|
5
5
|
import { visit } from 'unist-util-visit';
|
|
6
|
-
|
|
6
|
+
import { RELATIVE_URL_PATTERN } from './utils.js';
|
|
7
7
|
export const normalizeImgSrc = (content, { refSource, localPublicBase, publicBase, sourceBase, targetBase, force, translating, }) => {
|
|
8
8
|
content = cloneDeep(content);
|
|
9
9
|
const resolveImgSrc = (src, force) => {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { isExternalUrl } from '@rspress/core';
|
|
2
|
+
import { visit } from 'unist-util-visit';
|
|
3
|
+
import { getASTNodeImport } from './utils.js';
|
|
4
|
+
const getMdxSrcAttribute = (tempVar) => {
|
|
5
|
+
return {
|
|
6
|
+
type: 'mdxJsxAttribute',
|
|
7
|
+
name: 'src',
|
|
8
|
+
value: {
|
|
9
|
+
type: 'mdxJsxAttributeValueExpression',
|
|
10
|
+
value: tempVar,
|
|
11
|
+
data: {
|
|
12
|
+
estree: {
|
|
13
|
+
type: 'Program',
|
|
14
|
+
sourceType: 'module',
|
|
15
|
+
body: [
|
|
16
|
+
{
|
|
17
|
+
type: 'ExpressionStatement',
|
|
18
|
+
expression: {
|
|
19
|
+
type: 'Identifier',
|
|
20
|
+
name: tempVar,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const normalizeImageUrl = (imageUrl) => {
|
|
30
|
+
if (isExternalUrl(imageUrl) || imageUrl.startsWith('/')) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
return imageUrl;
|
|
34
|
+
};
|
|
35
|
+
export const rehypeNormalizeLink = () => {
|
|
36
|
+
return (tree) => {
|
|
37
|
+
const images = [];
|
|
38
|
+
visit(tree, 'element', (node) => {
|
|
39
|
+
if (node.tagName !== 'img') {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const { alt, src } = node.properties || {};
|
|
43
|
+
if (typeof src !== 'string') {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const imagePath = normalizeImageUrl(src);
|
|
47
|
+
if (!imagePath) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// relative path
|
|
51
|
+
const tempVariableName = `doom_image${images.length}`;
|
|
52
|
+
Object.assign(node, {
|
|
53
|
+
type: 'mdxJsxFlowElement',
|
|
54
|
+
name: 'img',
|
|
55
|
+
children: [],
|
|
56
|
+
attributes: [
|
|
57
|
+
alt && {
|
|
58
|
+
type: 'mdxJsxAttribute',
|
|
59
|
+
name: 'alt',
|
|
60
|
+
value: alt,
|
|
61
|
+
},
|
|
62
|
+
getMdxSrcAttribute(tempVariableName),
|
|
63
|
+
].filter(Boolean),
|
|
64
|
+
});
|
|
65
|
+
images.push(getASTNodeImport(tempVariableName, imagePath));
|
|
66
|
+
});
|
|
67
|
+
tree.children.unshift(...images);
|
|
68
|
+
};
|
|
69
|
+
};
|
|
@@ -5,9 +5,9 @@ import { logger } from '@rspress/shared/logger';
|
|
|
5
5
|
import { parse, stringify } from 'yaml';
|
|
6
6
|
import { cyan, red } from 'yoctocolors';
|
|
7
7
|
import { normalizeImgSrc } from './normalize-img-src.js';
|
|
8
|
-
import { getFrontmatterNode, isCI, mdProcessor, mdxProcessor } from './utils.js';
|
|
9
8
|
import { resolveReference } from './resolve-reference.js';
|
|
10
9
|
import { resolveRelease } from './resolve-release.js';
|
|
10
|
+
import { getFrontmatterNode, isCI, mdProcessor, mdxProcessor } from './utils.js';
|
|
11
11
|
const MD_REF_START_COMMENT_PATTERN = /<!-{2,} *reference-start#(.+) *-{2,}>/;
|
|
12
12
|
const MDX_REF_START_COMMENT_PATTERN = /{\/\*+ *reference-start#(.+) *\*+\/}/;
|
|
13
13
|
const MDX_REF_START_PATTERN = /\/\*+ *reference-start#(.+) *\*+\//;
|
|
@@ -4,9 +4,9 @@ import { isProduction } from '@rspress/core';
|
|
|
4
4
|
import { logger } from '@rspress/shared/logger';
|
|
5
5
|
import { render } from 'ejs';
|
|
6
6
|
import { red } from 'yoctocolors';
|
|
7
|
+
import { resolveRepo } from '../../utils/index.js';
|
|
7
8
|
import { parseToc } from './parse-toc.js';
|
|
8
9
|
import { getFrontmatterNode, mdProcessor, mdxProcessor } from './utils.js';
|
|
9
|
-
import { resolveRepo } from '../../utils/index.js';
|
|
10
10
|
const refCache = new Map();
|
|
11
11
|
const resolveReference_ = async (localBasePath, localPublicBase, items, refName, force) => {
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
@@ -2,6 +2,7 @@ import type { Root, YAML } from 'mdast';
|
|
|
2
2
|
import type { MdxjsEsm } from 'mdast-util-mdxjs-esm';
|
|
3
3
|
import { type Options } from 'remark-stringify';
|
|
4
4
|
import type { NormalizedReferenceSource, ReferenceItem } from './types.js';
|
|
5
|
+
export declare const RELATIVE_URL_PATTERN: RegExp;
|
|
5
6
|
/**
|
|
6
7
|
* hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
|
|
7
8
|
*/
|
|
@@ -6,6 +6,7 @@ import remarkParse from 'remark-parse';
|
|
|
6
6
|
import remarkStringify, {} from 'remark-stringify';
|
|
7
7
|
import { unified } from 'unified';
|
|
8
8
|
import { red } from 'yoctocolors';
|
|
9
|
+
export const RELATIVE_URL_PATTERN = /^\.\.?\//;
|
|
9
10
|
/**
|
|
10
11
|
* hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
|
|
11
12
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { visit } from 'unist-util-visit';
|
|
2
|
-
import { fromHtml } from 'hast-util-from-html';
|
|
3
1
|
import { logger } from '@rspress/shared/logger';
|
|
2
|
+
import { fromHtml } from 'hast-util-from-html';
|
|
3
|
+
import { visit } from 'unist-util-visit';
|
|
4
4
|
// TODO: migrate to official @shikijs/rehype plugin after upgrading unified/remark/rehype packages
|
|
5
5
|
export const rehypePluginShiki = ({ highlighter, theme }) => (tree) => {
|
|
6
6
|
visit(tree, 'element', (node, index, parent) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ExternalApisOverview from './ExternalApisOverview.js';
|
|
2
|
+
import { ExternalApisOverview } from './ExternalApisOverview.js';
|
|
3
3
|
export const AcpApisOverview = () => _jsx(ExternalApisOverview, { name: "acp" });
|
|
4
4
|
export default AcpApisOverview;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { NoSSR, useLang } from '@rspress/core/runtime';
|
|
3
3
|
import { addTrailingSlash, isExternalUrl, removeLeadingSlash, } from '@rspress/shared';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
|
-
import { Directive } from './Directive.js';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
7
5
|
import virtual from 'doom-@global-virtual';
|
|
6
|
+
import { useMemo } from 'react';
|
|
8
7
|
import classes from '../../../styles/link.module.scss';
|
|
9
8
|
import { useIsPrint } from '../hooks/index.js';
|
|
9
|
+
import { Directive } from './Directive.js';
|
|
10
10
|
const ExternalSiteLink_ = ({ name, href = '', className, ...props }) => {
|
|
11
11
|
const isPrint = useIsPrint();
|
|
12
12
|
const site = useMemo(() => virtual.sites?.find((s) => s.name === name), []);
|
|
@@ -3,11 +3,11 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
* modified based on @see https://github.com/crdsdev/doc/blob/main/template/doc.html
|
|
4
4
|
*/
|
|
5
5
|
import { Badge, Button, getCustomMDXComponent } from '@rspress/core/theme';
|
|
6
|
+
import crdsMap from 'doom-@api-crdsMap';
|
|
6
7
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
8
|
import { useIsPrint, useTranslation } from '../hooks/index.js';
|
|
8
9
|
import { Directive } from './Directive.js';
|
|
9
10
|
import { Markdown } from './_Markdown.js';
|
|
10
|
-
import crdsMap from 'doom-@api-crdsMap';
|
|
11
11
|
export const K8sCrdSchemaPart = ({ name, parent, schema: property, expandAll, }) => {
|
|
12
12
|
const [open, setOpen] = useState(expandAll);
|
|
13
13
|
const onToggle = useCallback((open) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLang } from '@rspress/core/runtime';
|
|
3
3
|
import { getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
|
+
import functionResourcesMap from 'doom-@permission-functionResourcesMap';
|
|
5
|
+
import roleTemplatesMap from 'doom-@permission-roleTemplatesMap';
|
|
4
6
|
import { intersection, sortBy } from 'es-toolkit';
|
|
5
7
|
import { Fragment, useMemo, useState } from 'react';
|
|
6
8
|
import { useTranslation } from '../hooks/index.js';
|
|
7
|
-
import functionResourcesMap from 'doom-@permission-functionResourcesMap';
|
|
8
|
-
import roleTemplatesMap from 'doom-@permission-roleTemplatesMap';
|
|
9
9
|
export const VerbsMap = {
|
|
10
10
|
view: ['get', 'list', 'watch'],
|
|
11
11
|
create: ['create'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useDark } from '@rspress/core/runtime';
|
|
3
|
-
import clsx from 'clsx';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
4
|
import mermaid from 'mermaid';
|
|
5
5
|
import { useEffect, useId, useRef } from 'react';
|
|
6
6
|
export const Mermaid = ({ className, children }) => {
|
|
@@ -1,16 +1,16 @@
|
|
|
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 { Badge, getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
|
+
import openapisMap from 'doom-@api-openapisMap';
|
|
5
|
+
import virtual from 'doom-@api-virtual';
|
|
4
6
|
import BananaSlug from 'github-slugger';
|
|
5
7
|
import { OpenAPIV3 } from 'openapi-types';
|
|
6
8
|
import { Fragment, useMemo, useState } from 'react';
|
|
7
9
|
import { omitRoutePathRefs, resolveRef } from '../utils.js';
|
|
10
|
+
import { OpenAPIRef } from './OpenAPIRef.js';
|
|
8
11
|
import { HeadingTitle } from './_HeadingTitle.js';
|
|
9
12
|
import { Markdown } from './_Markdown.js';
|
|
10
13
|
import { RefLink } from './_RefLink.js';
|
|
11
|
-
import OpenAPIRef from './OpenAPIRef.js';
|
|
12
|
-
import openapisMap from 'doom-@api-openapisMap';
|
|
13
|
-
import virtual from 'doom-@api-virtual';
|
|
14
14
|
export const OpenAPIParameters = ({ parameters, openapi, }) => {
|
|
15
15
|
const [X] = useState(getCustomMDXComponent);
|
|
16
16
|
return (_jsx(X.ul, { children: parameters.map((param, index) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
|
+
import openapisMap from 'doom-@api-openapisMap';
|
|
4
5
|
import { useMemo, useState } from 'react';
|
|
5
6
|
import { modelName, omitRoutePathRefs, resolveRef } from '../utils.js';
|
|
6
7
|
import { HeadingTitle } from './_HeadingTitle.js';
|
|
7
8
|
import { Markdown } from './_Markdown.js';
|
|
8
9
|
import { RefLink } from './_RefLink.js';
|
|
9
|
-
import openapisMap from 'doom-@api-openapisMap';
|
|
10
10
|
export const OpenAPIProperties = ({ properties, openapi, }) => {
|
|
11
11
|
const [X] = useState(getCustomMDXComponent);
|
|
12
12
|
return (_jsx(X.ul, { children: Object.entries(properties).map(([name, prop], index) => {
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Link, renderInlineMarkdown, useSidebarData } from '@rspress/core/theme';
|
|
3
3
|
import { isEqualPath, normalizeHrefInRuntime as normalizeHref, usePageData, withBase, } from '@rspress/runtime';
|
|
4
4
|
import { Fragment, useMemo } from 'react';
|
|
5
|
-
import { findItemByRoutePath } from './_utils.js';
|
|
6
5
|
import classes from '../../../styles/overview.module.scss';
|
|
6
|
+
import { findItemByRoutePath } from './_utils.js';
|
|
7
7
|
// The sidebar data include two types: sidebar item and sidebar group.
|
|
8
8
|
// In overpage page, we select all the related sidebar groups and show the groups in the page.
|
|
9
9
|
// In the meantime, some sidebar items also should be shown in the page, we collect them in the group named 'Others' and show them in the page.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Link } from '@rspress/core/theme';
|
|
3
2
|
import { normalizeImagePath } from '@rspress/core/runtime';
|
|
3
|
+
import { Link } from '@rspress/core/theme';
|
|
4
4
|
import classes from '../../../styles/quick-nav.module.scss';
|
|
5
5
|
export const QuickNav = ({ items }) => {
|
|
6
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))) }));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLang } from '@rspress/core/runtime';
|
|
3
|
+
import virtual from 'doom-@global-virtual';
|
|
3
4
|
import { useMemo } from 'react';
|
|
4
5
|
import { handleCJKWhitespaces } from '../utils.js';
|
|
5
|
-
import Directive from './Directive.js';
|
|
6
|
-
import ExternalSiteLink from './ExternalSiteLink.js';
|
|
7
|
-
import virtual from 'doom-@global-virtual';
|
|
6
|
+
import { Directive } from './Directive.js';
|
|
7
|
+
import { ExternalSiteLink } from './ExternalSiteLink.js';
|
|
8
8
|
const SiteNotes = {
|
|
9
9
|
en({ name, displayName }) {
|
|
10
10
|
return (_jsxs(_Fragment, { children: ["Because ", displayName, " releases on a different cadence from Alauda Container Platform, the ", displayName, " documentation is now available as a separate documentation set at", ' ', _jsx(ExternalSiteLink, { name: name, children: displayName }), "."] }));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isProduction, usePageData } from '@rspress/core/runtime';
|
|
2
|
+
import virtual from 'doom-@global-virtual';
|
|
2
3
|
import { merge } from 'es-toolkit/compat';
|
|
3
4
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
5
|
import { parse } from 'yaml';
|
|
5
6
|
import { namedTerms } from '../../terms.js';
|
|
6
7
|
import { useLocale } from './useTranslation.js';
|
|
7
|
-
import virtual from 'doom-@global-virtual';
|
|
8
8
|
const normalizeOverrides = (origin) => Object.keys(origin).reduce((acc, key_) => {
|
|
9
9
|
const key = key_;
|
|
10
10
|
const term = origin[key];
|
package/lib/runtime/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import virtual from 'doom-@api-virtual';
|
|
1
2
|
import { last, upperFirst } from 'es-toolkit';
|
|
2
3
|
import { get } from 'es-toolkit/compat';
|
|
3
|
-
import virtual from 'doom-@api-virtual';
|
|
4
4
|
export const modelName = (ref) => upperFirst(last(ref.split('.')));
|
|
5
5
|
export const resolveRef = (openapi, ref) => {
|
|
6
6
|
if (!ref.startsWith('#/')) {
|
package/lib/utils/git.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { logger } from '@rspress/shared/logger';
|
|
4
5
|
import { simpleGit } from 'simple-git';
|
|
5
6
|
import { cyan, red } from 'yoctocolors';
|
|
6
|
-
import os from 'node:os';
|
|
7
7
|
const remotesFolder = path.resolve(os.homedir(), '.doom/remotes');
|
|
8
8
|
const DEFAULT_USERNAME = 'oauth2';
|
|
9
9
|
const { GITHUB_USERNAME = DEFAULT_USERNAME, GITHUB_TOKEN, GITLAB_USERNAME = DEFAULT_USERNAME, GITLAB_TOKEN, } = process.env;
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { serve } from '@rspress/core';
|
|
2
|
+
|
|
2
3
|
import type { ApiPluginOptions, AutoSidebarPluginOptions, PermissionPluginOptions, ReferenceItem, ReleaseNotesOptions } from '../plugins/index.js';
|
|
3
4
|
import type { DoomSite } from '../shared/index.js';
|
|
5
|
+
|
|
4
6
|
export type BaseServeOptions = Parameters<typeof serve>[0];
|
|
5
7
|
export type ServeOptions = Omit<BaseServeOptions, 'config'>;
|
|
6
8
|
export interface GlobalCliOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"export": "yarn doom export",
|
|
35
35
|
"fixture": "yarn dev fixture-docs",
|
|
36
36
|
"lint": "run-p 'lint:*'",
|
|
37
|
-
"lint:es": "eslint .",
|
|
37
|
+
"lint:es": "eslint . --cache",
|
|
38
38
|
"lint:tsc": "tsc -b",
|
|
39
39
|
"prepare": "simple-git-hooks && patch-package && yarn-berry-deduplicate",
|
|
40
40
|
"prepublishOnly": "yarn build",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@inquirer/prompts": "^7.4.0",
|
|
47
47
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
48
|
-
"@playwright/browser-chromium": "^1.51.
|
|
48
|
+
"@playwright/browser-chromium": "^1.51.1",
|
|
49
49
|
"@rsbuild/plugin-yaml": "^1.0.2",
|
|
50
|
-
"@rspress/core": "1.43.
|
|
50
|
+
"@rspress/core": "1.43.8",
|
|
51
51
|
"@shikijs/transformers": "^3.2.1",
|
|
52
52
|
"chokidar": "^4.0.3",
|
|
53
53
|
"cli-progress": "^3.12.0",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"commander": "^13.1.0",
|
|
56
56
|
"ejs": "^3.1.10",
|
|
57
57
|
"es-toolkit": "^1.33.0",
|
|
58
|
-
"fs-extra": "^11.3.0",
|
|
59
58
|
"html-tag-names": "^2.1.0",
|
|
60
59
|
"mermaid": "^11.5.0",
|
|
61
60
|
"openai": "^5.0.0-beta.0",
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
"pdf-lib": "^1.17.1",
|
|
65
64
|
"pdf-merger-js": "^5.1.2",
|
|
66
65
|
"picomatch": "^4.0.2",
|
|
67
|
-
"playwright": "^1.51.
|
|
66
|
+
"playwright": "^1.51.1",
|
|
68
67
|
"react-markdown": "^8.0.7",
|
|
69
68
|
"rehype-raw": "^6.1.1",
|
|
70
69
|
"remark-directive": "^2.0.1",
|
|
@@ -84,21 +83,22 @@
|
|
|
84
83
|
"@swc/core": "1.11.11",
|
|
85
84
|
"@types/cli-progress": "^3.11.6",
|
|
86
85
|
"@types/ejs": "^3.1.5",
|
|
87
|
-
"@types/fs-extra": "^11.0.4",
|
|
88
86
|
"@types/node": "^18.19.80",
|
|
89
87
|
"@types/picomatch": "^3.0.2",
|
|
90
|
-
"@types/react": "^18.3.
|
|
88
|
+
"@types/react": "^18.3.19",
|
|
91
89
|
"@types/react-dom": "^18.3.5",
|
|
92
90
|
"@types/swagger2openapi": "^7.0.4",
|
|
93
91
|
"@unts/patch-package": "^8.1.1",
|
|
94
92
|
"eslint": "^9.22.0",
|
|
93
|
+
"eslint-import-resolver-typescript": "^4.2.2",
|
|
94
|
+
"eslint-plugin-import-x": "^4.9.1",
|
|
95
95
|
"lint-staged": "^15.5.0",
|
|
96
96
|
"npm-run-all2": "^7.0.2",
|
|
97
97
|
"prettier": "^3.5.3",
|
|
98
98
|
"prettier-plugin-pkg": "^0.18.1",
|
|
99
|
-
"simple-git-hooks": "^2.
|
|
99
|
+
"simple-git-hooks": "^2.12.1",
|
|
100
100
|
"typescript": "^5.8.2",
|
|
101
|
-
"typescript-eslint": "^8.
|
|
101
|
+
"typescript-eslint": "^8.27.0",
|
|
102
102
|
"yarn-berry-deduplicate": "^6.1.1"
|
|
103
103
|
},
|
|
104
104
|
"publishConfig": {
|
package/styles/global.scss
CHANGED
|
@@ -90,18 +90,6 @@ td {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
[class^='aside-container_']:has(.hidden) {
|
|
94
|
-
display: none;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
[class*=' sticky_'] + section .rspress-local-toc-container {
|
|
98
|
-
margin-top: var(--rp-nav-height);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.rspress-sidebar-menu-container:has(ul:empty) {
|
|
102
|
-
display: none;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
93
|
@mixin print {
|
|
106
94
|
.rspress {
|
|
107
95
|
&-nav,
|