@alauda/doom 1.10.11 → 1.11.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/export.js +1 -1
- package/lib/cli/load-config.js +7 -6
- package/lib/global/SiteOverrides/index.js +0 -1
- package/lib/global/VersionsNav/index.js +3 -4
- package/lib/plugins/index.d.ts +0 -1
- package/lib/plugins/index.js +0 -1
- package/lib/runtime/components/ExternalSiteLink.js +2 -3
- package/lib/runtime/components/OpenAPIPath.js +2 -3
- package/lib/runtime/components/OpenAPIRef.js +2 -3
- package/lib/runtime/components/Overview.js +4 -9
- package/lib/runtime/components/_utils.d.ts +1 -1
- package/lib/runtime/components/_utils.js +2 -4
- package/lib/theme.js +3 -5
- package/package.json +27 -30
- package/LICENSE +0 -21
- package/README.md +0 -29
- package/lib/cli/export-pdf-core/generatePdf.d.ts +0 -25
- package/lib/cli/export-pdf-core/generatePdf.js +0 -91
- package/lib/cli/export-pdf-core/index.d.ts +0 -3
- package/lib/cli/export-pdf-core/index.js +0 -3
- package/lib/cli/export-pdf-core/types.d.ts +0 -15
- package/lib/cli/export-pdf-core/types.js +0 -1
- package/lib/cli/export-pdf-core/utils/convertPathToPosix.d.ts +0 -8
- package/lib/cli/export-pdf-core/utils/convertPathToPosix.js +0 -26
- package/lib/cli/export-pdf-core/utils/getUrlLink.d.ts +0 -4
- package/lib/cli/export-pdf-core/utils/getUrlLink.js +0 -7
- package/lib/cli/export-pdf-core/utils/index.d.ts +0 -3
- package/lib/cli/export-pdf-core/utils/index.js +0 -3
- package/lib/cli/export-pdf-core/utils/mergePDF.d.ts +0 -26
- package/lib/cli/export-pdf-core/utils/mergePDF.js +0 -137
- package/lib/cli/html-export-pdf/core/index.d.ts +0 -3
- package/lib/cli/html-export-pdf/core/index.js +0 -3
- package/lib/cli/html-export-pdf/core/outline.d.ts +0 -47
- package/lib/cli/html-export-pdf/core/outline.js +0 -217
- package/lib/cli/html-export-pdf/core/postprocesser.d.ts +0 -14
- package/lib/cli/html-export-pdf/core/postprocesser.js +0 -36
- package/lib/cli/html-export-pdf/core/printer.d.ts +0 -59
- package/lib/cli/html-export-pdf/core/printer.js +0 -235
- package/lib/cli/html-export-pdf/index.d.ts +0 -2
- package/lib/cli/html-export-pdf/index.js +0 -2
- package/lib/cli/html-export-pdf/utils/cliProgress.d.ts +0 -13
- package/lib/cli/html-export-pdf/utils/cliProgress.js +0 -80
- package/lib/cli/html-export-pdf/utils/fs.d.ts +0 -5
- package/lib/cli/html-export-pdf/utils/fs.js +0 -18
- package/lib/cli/html-export-pdf/utils/getAbsFileName.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/getAbsFileName.js +0 -4
- package/lib/cli/html-export-pdf/utils/getDirname.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/getDirname.js +0 -5
- package/lib/cli/html-export-pdf/utils/index.d.ts +0 -7
- package/lib/cli/html-export-pdf/utils/index.js +0 -7
- package/lib/cli/html-export-pdf/utils/isValidUrl.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/isValidUrl.js +0 -3
- package/lib/cli/html-export-pdf/utils/optionsCustomProcessing.d.ts +0 -2
- package/lib/cli/html-export-pdf/utils/optionsCustomProcessing.js +0 -6
- package/lib/cli/html-export-pdf/utils/replaceExt.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/replaceExt.js +0 -19
- package/lib/cli/merge-pdfs/formatDate.d.ts +0 -1
- package/lib/cli/merge-pdfs/formatDate.js +0 -23
- package/lib/cli/merge-pdfs/index.d.ts +0 -8
- package/lib/cli/merge-pdfs/index.js +0 -62
- package/lib/plugins/sitemap/index.d.ts +0 -16
- package/lib/plugins/sitemap/index.js +0 -51
- package/pyodide/README.md +0 -90
- package/pyodide/console.html +0 -259
- package/pyodide/ffi.d.ts +0 -1118
- package/pyodide/micropip-0.8.0-py3-none-any.whl +0 -0
- package/pyodide/package.json +0 -59
- package/pyodide/packaging-24.2-py3-none-any.whl +0 -0
- package/pyodide/pyodide-lock.json +0 -1
- package/pyodide/pyodide.asm.js +0 -17
- package/pyodide/pyodide.asm.wasm +0 -0
- package/pyodide/pyodide.d.ts +0 -1627
- package/pyodide/pyodide.js +0 -6
- package/pyodide/pyodide.js.map +0 -1
- package/pyodide/pyodide.mjs +0 -4
- package/pyodide/pyodide.mjs.map +0 -1
- package/pyodide/pypdf-3.8.1-py3-none-any.whl +0 -0
- package/pyodide/python_stdlib.zip +0 -0
- package/pyodide/repodata.json +0 -1
package/lib/cli/export.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { generatePdf, } from '@alauda/doom-export';
|
|
3
4
|
import { logger, serve } from '@rspress/core';
|
|
4
5
|
import { removeLeadingSlash } from '@rspress/shared';
|
|
5
6
|
import { Command } from 'commander';
|
|
@@ -7,7 +8,6 @@ import { cyan, yellow } from 'yoctocolors';
|
|
|
7
8
|
import { autoSidebar, } from '../plugins/index.js';
|
|
8
9
|
import { getPdfName } from '../shared/index.js';
|
|
9
10
|
import { pathExists, setNodeEnv } from '../utils/index.js';
|
|
10
|
-
import { generatePdf, } from './export-pdf-core/index.js';
|
|
11
11
|
import { loadConfig } from './load-config.js';
|
|
12
12
|
const collectPages = (sidebarItems, base) => {
|
|
13
13
|
const pages = new Map();
|
package/lib/cli/load-config.js
CHANGED
|
@@ -8,13 +8,14 @@ import { pluginYaml } from '@rsbuild/plugin-yaml';
|
|
|
8
8
|
import { logger } from '@rspress/core';
|
|
9
9
|
import { pluginAlgolia } from '@rspress/plugin-algolia';
|
|
10
10
|
import { pluginLlms } from '@rspress/plugin-llms';
|
|
11
|
+
import { pluginSitemap } from '@rspress/plugin-sitemap';
|
|
11
12
|
import { addLeadingSlash, addTrailingSlash, normalizeSlash, removeLeadingSlash, } from '@rspress/shared';
|
|
12
13
|
import { transformerMetaHighlight, transformerMetaWordHighlight, transformerNotationDiff, transformerNotationErrorLevel, transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight, transformerRemoveNotationEscape, } from '@shikijs/transformers';
|
|
13
14
|
import { difference } from 'es-toolkit';
|
|
14
15
|
import { glob } from 'tinyglobby';
|
|
15
16
|
import { cyan } from 'yoctocolors';
|
|
16
17
|
import { attributesPlugin } from '../plugins/attributes/index.js';
|
|
17
|
-
import { apiPlugin, autoSidebarPlugin, autoTocPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin, replacePlugin,
|
|
18
|
+
import { apiPlugin, autoSidebarPlugin, autoTocPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin, replacePlugin, } from '../plugins/index.js';
|
|
18
19
|
import { isExplicitlyUnversioned, UNVERSIONED, } from '../shared/index.js';
|
|
19
20
|
import { pathExists, pkgResolve, resolveStaticConfig } from '../utils/index.js';
|
|
20
21
|
import { DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS, I18N_FILE, SITES_FILE, YAML_EXTENSIONS, } from './constants.js';
|
|
@@ -178,6 +179,11 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
|
|
|
178
179
|
plugins: [
|
|
179
180
|
algoliaOptions && pluginAlgolia(),
|
|
180
181
|
pluginLlms(),
|
|
182
|
+
siteUrl &&
|
|
183
|
+
config.siteUrl &&
|
|
184
|
+
pluginSitemap({
|
|
185
|
+
siteUrl: config.siteUrl,
|
|
186
|
+
}),
|
|
181
187
|
apiPlugin({
|
|
182
188
|
localBasePath,
|
|
183
189
|
}),
|
|
@@ -195,11 +201,6 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
|
|
|
195
201
|
localBasePath,
|
|
196
202
|
force,
|
|
197
203
|
}),
|
|
198
|
-
siteUrl &&
|
|
199
|
-
config.siteUrl &&
|
|
200
|
-
sitemapPlugin({
|
|
201
|
-
domain: config.siteUrl,
|
|
202
|
-
}),
|
|
203
204
|
].filter(Boolean),
|
|
204
205
|
search: algoliaOptions ? false : undefined,
|
|
205
206
|
builderConfig: {
|
|
@@ -24,7 +24,6 @@ const concatTitle = (title, suffix) => {
|
|
|
24
24
|
return `${title} ${suffix}`;
|
|
25
25
|
};
|
|
26
26
|
export const SiteOverrides = () => {
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...
|
|
28
27
|
const { siteData, page } = usePageData();
|
|
29
28
|
const { pageType,
|
|
30
29
|
// Inject by remark-plugin-toc
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isProduction, NoSSR,
|
|
2
|
+
import { isProduction, NoSSR, useSite, withBase } from '@rspress/core/runtime';
|
|
3
3
|
import {} from '@rspress/shared';
|
|
4
4
|
import virtual from 'doom-@global-virtual';
|
|
5
5
|
import { noop } from 'es-toolkit';
|
|
@@ -27,11 +27,10 @@ if (!isProduction()) {
|
|
|
27
27
|
ALLOWED_LEGACY_DOMAINS.add('localhost');
|
|
28
28
|
}
|
|
29
29
|
const VersionsNav_ = () => {
|
|
30
|
-
|
|
31
|
-
const { siteData } = usePageData();
|
|
30
|
+
const { site } = useSite();
|
|
32
31
|
const lang = useLang();
|
|
33
32
|
const t = useTranslation();
|
|
34
|
-
const siteTitle =
|
|
33
|
+
const siteTitle = site.originalTitle ?? site.title;
|
|
35
34
|
const downloadLink = useMemo(() => {
|
|
36
35
|
if (!virtual.download) {
|
|
37
36
|
return;
|
package/lib/plugins/index.d.ts
CHANGED
package/lib/plugins/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { NoSSR, useLang,
|
|
2
|
+
import { NoSSR, useLang, useSite } from '@rspress/core/runtime';
|
|
3
3
|
import { addTrailingSlash, isExternalUrl, normalizeHref, parseUrl, removeLeadingSlash, } from '@rspress/shared';
|
|
4
4
|
import { DEFAULT_PAGE_EXTENSIONS } from '@rspress/shared/constants';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
@@ -11,8 +11,7 @@ import { useIsPrint } from '../hooks/index.js';
|
|
|
11
11
|
import { Directive } from './Directive.js';
|
|
12
12
|
const ExternalSiteLink_ = ({ name, href = '', className, ...props }) => {
|
|
13
13
|
const isPrint = useIsPrint();
|
|
14
|
-
|
|
15
|
-
const { siteData } = usePageData();
|
|
14
|
+
const { site: siteData } = useSite();
|
|
16
15
|
const site = useMemo(() => virtual.sites?.find((s) => s.name === name), [name]);
|
|
17
16
|
const lang = useLang();
|
|
18
17
|
if (!site) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { usePage } from '@rspress/core/runtime';
|
|
3
3
|
import { Badge } from '@rspress/core/theme';
|
|
4
4
|
import openapisMap from 'doom-@api-openapisMap';
|
|
5
5
|
import virtual from 'doom-@api-virtual';
|
|
@@ -92,8 +92,7 @@ const getRefsForPath = (openapi, path, knownRefs) => {
|
|
|
92
92
|
return Array.from(refs);
|
|
93
93
|
};
|
|
94
94
|
export const OpenAPIPath = ({ path, openapiPath: openapiPath_, pathPrefix: pathPrefix_, }) => {
|
|
95
|
-
|
|
96
|
-
const { page } = usePageData();
|
|
95
|
+
const { page } = usePage();
|
|
97
96
|
const pathPrefix = pathPrefix_ ?? (virtual.pathPrefix || '');
|
|
98
97
|
const uid = useId();
|
|
99
98
|
const slugger = useMemo(() => new BananaSlug(), []);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { usePage } from '@rspress/core/runtime';
|
|
3
3
|
import openapisMap from 'doom-@api-openapisMap';
|
|
4
4
|
import { useId, useMemo } from 'react';
|
|
5
5
|
import { modelName, omitRoutePathRefs, resolveRef } from '../utils.js';
|
|
@@ -70,8 +70,7 @@ const getRefsForSchema = (openapi, schema, knownRefs) => {
|
|
|
70
70
|
return Array.from(refs);
|
|
71
71
|
};
|
|
72
72
|
export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, isCommonRef = true, collectRefs = true, }) => {
|
|
73
|
-
|
|
74
|
-
const { page } = usePageData();
|
|
73
|
+
const { page } = usePage();
|
|
75
74
|
let uid = useUid();
|
|
76
75
|
const innerUid = useId();
|
|
77
76
|
if (isCommonRef) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isEqualPath,
|
|
2
|
+
import { isEqualPath, usePageData, useSidebar } from '@rspress/core/runtime';
|
|
3
3
|
import { Link, renderInlineMarkdown } from '@rspress/core/theme';
|
|
4
4
|
import { Fragment, useCallback, useMemo } from 'react';
|
|
5
5
|
import classes from '../../../styles/overview.module.scss';
|
|
@@ -17,14 +17,9 @@ const getChildLink = (traverseItem) => {
|
|
|
17
17
|
// In overpage page, we select all the related sidebar groups and show the groups in the page.
|
|
18
18
|
// 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.
|
|
19
19
|
export function Overview(props) {
|
|
20
|
-
const { siteData, page: { routePath, frontmatter, title },
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...
|
|
22
|
-
} = usePageData();
|
|
20
|
+
const { siteData, page: { routePath, frontmatter, title }, } = usePageData();
|
|
23
21
|
const { content, groups: customGroups, defaultGroupTitle = 'Others' } = props;
|
|
24
|
-
const subFilter = useCallback((link) =>
|
|
25
|
-
// sidebar items link without base path
|
|
26
|
-
// pages route path with base path
|
|
27
|
-
link.startsWith(routePath.replace(/overview$/, '')) &&
|
|
22
|
+
const subFilter = useCallback((link) => link.startsWith(routePath.replace(/overview$/, '')) &&
|
|
28
23
|
!isEqualPath(link, routePath), [routePath]);
|
|
29
24
|
const { pages } = siteData;
|
|
30
25
|
const overviewModules = useMemo(() => pages.filter((page) => subFilter(page.routePath)), [pages, subFilter]);
|
|
@@ -113,6 +108,6 @@ export function Overview(props) {
|
|
|
113
108
|
}, [getGroup, overviewSidebarGroups]);
|
|
114
109
|
const groups = customGroups ?? defaultGroups;
|
|
115
110
|
return (_jsxs("div", { className: "overview-index doom-overview-index rp-mx-auto", children: [content, groups.map((group) => (_jsxs(Fragment, { children: [(!title || [title, defaultGroupTitle].includes(group.name)) &&
|
|
116
|
-
groups.length === 1 ? (_jsx("h2", { style: { paddingTop: 0 } })) : (_jsx("h2", { ...renderInlineMarkdown(group.name) })), _jsx("div", { className: classes.overviewGroups, children: group.items.map((item) => (_jsxs("div", { className: classes.overviewGroup, children: [_jsx("h3", { style: { marginBottom: 8 }, children: _jsx(Link, { href:
|
|
111
|
+
groups.length === 1 ? (_jsx("h2", { style: { paddingTop: 0 } })) : (_jsx("h2", { ...renderInlineMarkdown(group.name) })), _jsx("div", { className: classes.overviewGroups, children: group.items.map((item) => (_jsxs("div", { className: classes.overviewGroup, children: [_jsx("h3", { style: { marginBottom: 8 }, children: _jsx(Link, { href: item.link, ...renderInlineMarkdown(item.text) }) }), _jsx("div", { className: classes.overviewDescription, children: item.description }), _jsx("ul", { className: "rp-list-none", children: item.headers?.map((header) => (_jsx("li", { className: `${classes.overviewGroupLi} ${classes[`level${header.depth}`]} first:rp-mt-2`, children: _jsx(Link, { href: `${item.link}#${header.id}`, ...renderInlineMarkdown(header.text) }) }, header.id))) })] }, item.link))) })] }, group.name)))] }));
|
|
117
112
|
}
|
|
118
113
|
export default Overview;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SidebarDivider, SidebarItem, SidebarSectionHeader } from '@rspress/core';
|
|
2
|
-
import type
|
|
2
|
+
import { type NormalizedSidebarGroup } from '@rspress/shared';
|
|
3
3
|
export declare const isSidebarDivider: (item: NormalizedSidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader) => item is SidebarDivider;
|
|
4
4
|
export declare const isSidebarSectionHeader: (item: NormalizedSidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader) => item is SidebarSectionHeader;
|
|
5
5
|
export declare const isSingleFile: (item: SidebarItem | SidebarSectionHeader | SidebarDivider | NormalizedSidebarGroup) => item is SidebarItem | (NormalizedSidebarGroup & {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { normalizeHref } from '@rspress/shared';
|
|
1
2
|
function removeIndex(link) {
|
|
2
|
-
|
|
3
|
-
return link.slice(0, -5);
|
|
4
|
-
}
|
|
5
|
-
return link;
|
|
3
|
+
return normalizeHref(link, true);
|
|
6
4
|
}
|
|
7
5
|
export const isSidebarDivider = (item) => {
|
|
8
6
|
return 'dividerType' in item;
|
package/lib/theme.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useLang,
|
|
2
|
+
import { useLang, useSite, withBase } from '@rspress/core/runtime';
|
|
3
3
|
import { Search as OriginalSearch, Layout as OriginalLayout, getCustomMDXComponent, } from '@rspress/core/theme';
|
|
4
4
|
import { Search as AlgoliaSearch, ZH_LOCALES, } from '@rspress/plugin-algolia/runtime';
|
|
5
5
|
import virtual from 'doom-@global-virtual';
|
|
@@ -33,7 +33,7 @@ const getClosestSidebar_ = (sidebarItems, pathname, exportItem, matched, depth =
|
|
|
33
33
|
depth,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
const sidebarLink = cleanupUrlPath(
|
|
36
|
+
const sidebarLink = cleanupUrlPath(sidebar.link || '');
|
|
37
37
|
if (sidebarLink === pathname) {
|
|
38
38
|
return matched;
|
|
39
39
|
}
|
|
@@ -60,9 +60,7 @@ const getClosestSidebar = (sidebarItems, pathname) => {
|
|
|
60
60
|
};
|
|
61
61
|
// eslint-disable-next-line import-x/export
|
|
62
62
|
export const Layout = () => {
|
|
63
|
-
const {
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...
|
|
65
|
-
} = usePageData();
|
|
63
|
+
const { site: { lang: siteLang, themeConfig }, } = useSite();
|
|
66
64
|
const lang = useLang();
|
|
67
65
|
const t = useTranslation();
|
|
68
66
|
const { pathname } = useLocation();
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/alauda/doom.git",
|
|
9
|
+
"directory": "packages/doom"
|
|
10
|
+
},
|
|
7
11
|
"homepage": "https://github.com/alauda/doom#readme",
|
|
8
12
|
"license": "MIT",
|
|
9
13
|
"engines": {
|
|
@@ -11,21 +15,19 @@
|
|
|
11
15
|
},
|
|
12
16
|
"bin": "lib/cli/index.js",
|
|
13
17
|
"exports": {
|
|
14
|
-
"./package.json": "./package.json",
|
|
15
18
|
"./config": "./lib/config.js",
|
|
16
19
|
"./cspell": "./lib/cspell.js",
|
|
17
20
|
"./eslint": "./lib/eslint.js",
|
|
18
21
|
"./runtime": "./lib/runtime/index.js",
|
|
19
22
|
"./theme": "./lib/theme.js",
|
|
20
|
-
"./types": "./lib/types.js"
|
|
23
|
+
"./types": "./lib/types.js",
|
|
24
|
+
"./package.json": "./package.json"
|
|
21
25
|
},
|
|
22
26
|
"files": [
|
|
23
27
|
"assets",
|
|
24
28
|
"global.d.ts",
|
|
25
29
|
"lib",
|
|
26
|
-
"
|
|
27
|
-
"styles",
|
|
28
|
-
"!lib/*.tsbuildinfo"
|
|
30
|
+
"styles"
|
|
29
31
|
],
|
|
30
32
|
"keywords": [
|
|
31
33
|
"document",
|
|
@@ -36,28 +38,29 @@
|
|
|
36
38
|
"rspress-plugins"
|
|
37
39
|
],
|
|
38
40
|
"dependencies": {
|
|
41
|
+
"@alauda/doom-export": "^0.1.0",
|
|
39
42
|
"@cspell/eslint-plugin": "^8.19.4 || ^9.2.0",
|
|
40
|
-
"@eslint-react/eslint-plugin": "^1.52.
|
|
41
|
-
"@inquirer/prompts": "^7.8.
|
|
43
|
+
"@eslint-react/eslint-plugin": "^1.52.6",
|
|
44
|
+
"@inquirer/prompts": "^7.8.4",
|
|
42
45
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
43
|
-
"@playwright/browser-chromium": "^1.
|
|
46
|
+
"@playwright/browser-chromium": "^1.55.0",
|
|
44
47
|
"@rsbuild/plugin-react": "^1.3.5",
|
|
45
48
|
"@rsbuild/plugin-sass": "^1.3.5",
|
|
46
49
|
"@rsbuild/plugin-svgr": "^1.2.2",
|
|
47
50
|
"@rsbuild/plugin-yaml": "^1.0.3",
|
|
48
|
-
"@rspress/core": "2.0.0-beta.
|
|
49
|
-
"@rspress/plugin-algolia": "2.0.0-beta.
|
|
50
|
-
"@rspress/plugin-llms": "2.0.0-beta.
|
|
51
|
-
"@rspress/
|
|
52
|
-
"@
|
|
51
|
+
"@rspress/core": "2.0.0-beta.28",
|
|
52
|
+
"@rspress/plugin-algolia": "2.0.0-beta.28",
|
|
53
|
+
"@rspress/plugin-llms": "2.0.0-beta.28",
|
|
54
|
+
"@rspress/plugin-sitemap": "2.0.0-beta.28",
|
|
55
|
+
"@rspress/shared": "2.0.0-beta.28",
|
|
56
|
+
"@shikijs/transformers": "^3.11.0",
|
|
53
57
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
54
58
|
"chokidar": "^4.0.3",
|
|
55
|
-
"cli-progress": "^3.12.0",
|
|
56
59
|
"clsx": "^2.1.1",
|
|
57
60
|
"commander": "^13.1.0 || ^14.0.0",
|
|
58
61
|
"ejs": "^3.1.10",
|
|
59
|
-
"es-toolkit": "^1.39.
|
|
60
|
-
"eslint": "^9.
|
|
62
|
+
"es-toolkit": "^1.39.10",
|
|
63
|
+
"eslint": "^9.34.0",
|
|
61
64
|
"eslint-plugin-mdx": "^3.6.2",
|
|
62
65
|
"globals": "^16.3.0",
|
|
63
66
|
"html-tag-names": "^2.1.0",
|
|
@@ -67,14 +70,11 @@
|
|
|
67
70
|
"mdast-util-phrasing": "^4.1.0",
|
|
68
71
|
"mdast-util-to-markdown": "^2.1.2",
|
|
69
72
|
"mdast-util-to-string": "^4.0.0",
|
|
70
|
-
"mermaid": "^11.
|
|
71
|
-
"openai": "^5.
|
|
73
|
+
"mermaid": "^11.10.1",
|
|
74
|
+
"openai": "^5.15.0",
|
|
72
75
|
"openapi-types": "^12.1.3",
|
|
73
76
|
"p-ratelimit": "^1.0.1",
|
|
74
|
-
"pdf-lib": "^1.17.1",
|
|
75
|
-
"pdf-merger-js": "^5.1.2",
|
|
76
77
|
"picomatch": "^4.0.3",
|
|
77
|
-
"playwright": "^1.54.2",
|
|
78
78
|
"pluralize": "^8.0.0",
|
|
79
79
|
"react-markdown": "^10.1.0",
|
|
80
80
|
"rehype-raw": "^7.0.0",
|
|
@@ -91,23 +91,20 @@
|
|
|
91
91
|
"remark-mdx": "^3.1.0",
|
|
92
92
|
"remark-message-control": "^8.0.0",
|
|
93
93
|
"remark-stringify": "^11.0.0",
|
|
94
|
-
"shiki": "^3.
|
|
94
|
+
"shiki": "^3.11.0",
|
|
95
95
|
"simple-git": "^3.28.0",
|
|
96
96
|
"string-width": "^7.2.0",
|
|
97
97
|
"swagger2openapi": "^7.0.8",
|
|
98
98
|
"tinyglobby": "^0.2.14",
|
|
99
99
|
"type-fest": "^4.41.0",
|
|
100
100
|
"typescript": "^5.9.2",
|
|
101
|
-
"typescript-eslint": "^8.
|
|
101
|
+
"typescript-eslint": "^8.41.0",
|
|
102
102
|
"unified": "^11.0.5",
|
|
103
103
|
"unified-lint-rule": "^3.0.1",
|
|
104
104
|
"unist-util-position": "^5.0.0",
|
|
105
105
|
"unist-util-visit-parents": "^6.0.1",
|
|
106
106
|
"x-fetch": "^0.2.6",
|
|
107
107
|
"yaml": "^2.8.1",
|
|
108
|
-
"yoctocolors": "^2.1.
|
|
109
|
-
},
|
|
110
|
-
"publishConfig": {
|
|
111
|
-
"registry": "https://registry.npmjs.org"
|
|
108
|
+
"yoctocolors": "^2.1.2"
|
|
112
109
|
}
|
|
113
|
-
}
|
|
110
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024-present Alauda.io
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Doom
|
|
2
|
-
|
|
3
|
-
[](https://github.com/alauda/doom/actions/workflows/ci.yml?query=branch%3Amain)
|
|
4
|
-
[](https://github.com/plantain-00/type-coverage)
|
|
5
|
-
[](https://coderabbit.ai)
|
|
6
|
-
[](https://www.npmjs.com/package/@alauda/doom)
|
|
7
|
-
[](https://github.com/alauda/doom/releases)
|
|
8
|
-
[](https://deepwiki.com/alauda/doom)
|
|
9
|
-
|
|
10
|
-
[](https://conventionalcommits.org)
|
|
11
|
-
[](https://renovatebot.com)
|
|
12
|
-
[](https://standardjs.com)
|
|
13
|
-
[](https://github.com/prettier/prettier)
|
|
14
|
-
[](https://github.com/changesets/changesets)
|
|
15
|
-
|
|
16
|
-
Doctor Doom making docs.
|
|
17
|
-
|
|
18
|
-
Please view <https://doom.js.org/> for its documents.
|
|
19
|
-
|
|
20
|
-
## Changelog
|
|
21
|
-
|
|
22
|
-
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
|
|
23
|
-
|
|
24
|
-
## License
|
|
25
|
-
|
|
26
|
-
[MIT][] © [Alauda][]
|
|
27
|
-
|
|
28
|
-
[alauda]: https://www.alauda.io
|
|
29
|
-
[MIT]: http://opensource.org/licenses/MIT
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type PrinterOptions } from '../html-export-pdf/index.js';
|
|
2
|
-
import type { LaunchOptions, Page, PDFOptions } from './types.js';
|
|
3
|
-
import { type PDFOutline } from './utils/index.js';
|
|
4
|
-
export interface GeneratePdfOptions {
|
|
5
|
-
pages: Page[];
|
|
6
|
-
tempDir: string;
|
|
7
|
-
port: number;
|
|
8
|
-
host: string;
|
|
9
|
-
outFile: string;
|
|
10
|
-
outDir: string;
|
|
11
|
-
cleanupTempDir?: boolean;
|
|
12
|
-
allOutlines?: PDFOutline[];
|
|
13
|
-
launchOptions?: LaunchOptions;
|
|
14
|
-
pdfOptions?: PDFOptions;
|
|
15
|
-
pdfOutlines?: boolean;
|
|
16
|
-
urlOrigin?: string;
|
|
17
|
-
printerOptions?: PrinterOptions;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Generate PDF from VuePress or VitePress dev server.
|
|
21
|
-
*/
|
|
22
|
-
export declare function generatePdf({ pages, tempDir, port, host, outFile, outDir, cleanupTempDir, allOutlines, urlOrigin, pdfOptions, pdfOutlines, launchOptions, printerOptions, }: GeneratePdfOptions): Promise<{
|
|
23
|
-
exportedPath: string;
|
|
24
|
-
allOutlines: PDFOutline[];
|
|
25
|
-
}>;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import process from 'node:process';
|
|
4
|
-
import { red, yellow } from 'yoctocolors';
|
|
5
|
-
import { createProgress, isValidUrl, Printer, writeFileSafe, } from '../html-export-pdf/index.js';
|
|
6
|
-
import { getUrlLink, mergePDF, } from './utils/index.js';
|
|
7
|
-
/**
|
|
8
|
-
* Generate PDF from VuePress or VitePress dev server.
|
|
9
|
-
*/
|
|
10
|
-
export async function generatePdf({ pages, tempDir, port, host, outFile, outDir, cleanupTempDir = true, allOutlines = [], urlOrigin, pdfOptions, pdfOutlines = true, launchOptions, printerOptions, }) {
|
|
11
|
-
await fs.mkdir(tempDir, { recursive: true });
|
|
12
|
-
const isValidUrlOrigin = isValidUrl(urlOrigin ?? '');
|
|
13
|
-
if (urlOrigin && !isValidUrlOrigin) {
|
|
14
|
-
process.stdout.write(red(`${urlOrigin} is not a valid URL`));
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
let userURLOrigin = '';
|
|
18
|
-
if (urlOrigin && isValidUrlOrigin) {
|
|
19
|
-
userURLOrigin = new URL(urlOrigin).origin;
|
|
20
|
-
}
|
|
21
|
-
const localURLOrigin = `${host}:${port}`;
|
|
22
|
-
const normalizePages = pages.map((page) => {
|
|
23
|
-
return {
|
|
24
|
-
url: page.path,
|
|
25
|
-
title: page.title,
|
|
26
|
-
location: urlOrigin
|
|
27
|
-
? `${userURLOrigin}${page.path}`
|
|
28
|
-
: `http://${localURLOrigin}${page.path}`,
|
|
29
|
-
pagePath: path.resolve(tempDir, `${page.key}.pdf`),
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
if (allOutlines.length) {
|
|
33
|
-
const allOutlinesMapping = new Map(allOutlines);
|
|
34
|
-
allOutlines = normalizePages.map(({ location }) => {
|
|
35
|
-
const { link } = getUrlLink(location);
|
|
36
|
-
return [link, allOutlinesMapping.get(link)];
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const singleBar = createProgress();
|
|
41
|
-
singleBar.start(normalizePages.length);
|
|
42
|
-
const printer = new Printer(printerOptions);
|
|
43
|
-
const page = await printer.setup(launchOptions);
|
|
44
|
-
if (urlOrigin && isValidUrlOrigin) {
|
|
45
|
-
await page.route('**/*', (route) => {
|
|
46
|
-
const reqUrl = route.request().url();
|
|
47
|
-
if (!isValidUrl(reqUrl)) {
|
|
48
|
-
return route.continue();
|
|
49
|
-
}
|
|
50
|
-
// http or https
|
|
51
|
-
const parsedUrl = new URL(reqUrl);
|
|
52
|
-
if (userURLOrigin === parsedUrl.origin) {
|
|
53
|
-
parsedUrl.host = host;
|
|
54
|
-
parsedUrl.protocol = 'http:';
|
|
55
|
-
parsedUrl.port = `${port}`;
|
|
56
|
-
const parsedUrlString = parsedUrl.toString();
|
|
57
|
-
return route.continue({
|
|
58
|
-
url: parsedUrlString,
|
|
59
|
-
headers: Object.assign({}, route.request().headers(), {
|
|
60
|
-
refer: parsedUrlString,
|
|
61
|
-
// Same origin
|
|
62
|
-
// origin: parsedUrl.origin,
|
|
63
|
-
// CORS
|
|
64
|
-
// host: parsedUrl.host,
|
|
65
|
-
}),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
for (const { location, pagePath, title } of normalizePages) {
|
|
71
|
-
const { data, outlineNodes } = await printer.pdf(location, {
|
|
72
|
-
format: 'A4',
|
|
73
|
-
...pdfOptions,
|
|
74
|
-
}, pdfOutlines);
|
|
75
|
-
if (pdfOutlines) {
|
|
76
|
-
allOutlines.push([getUrlLink(location).link, outlineNodes]);
|
|
77
|
-
}
|
|
78
|
-
await writeFileSafe(pagePath, data);
|
|
79
|
-
singleBar.increment(1, { headTitle: title || (await page.title()) });
|
|
80
|
-
}
|
|
81
|
-
singleBar.stop();
|
|
82
|
-
await printer.closeBrowser();
|
|
83
|
-
}
|
|
84
|
-
const exportedPath = await mergePDF(normalizePages, outFile, outDir, allOutlines);
|
|
85
|
-
const message = `Exported to ${yellow(exportedPath)}\n`;
|
|
86
|
-
process.stdout.write(message);
|
|
87
|
-
if (cleanupTempDir) {
|
|
88
|
-
await fs.rm(tempDir, { force: true, recursive: true });
|
|
89
|
-
}
|
|
90
|
-
return { exportedPath, allOutlines };
|
|
91
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface CommandOptions {
|
|
2
|
-
config?: string;
|
|
3
|
-
outDir?: string;
|
|
4
|
-
outFile?: string;
|
|
5
|
-
debug?: boolean;
|
|
6
|
-
urlOrigin?: string;
|
|
7
|
-
pdfOutlines?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface Page {
|
|
10
|
-
title?: string;
|
|
11
|
-
key: string;
|
|
12
|
-
path: string;
|
|
13
|
-
}
|
|
14
|
-
export type { Browser, PDFOptions } from '../html-export-pdf/index.js';
|
|
15
|
-
export type { LaunchOptions } from 'playwright';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a file path to a POSIX-style path.
|
|
3
|
-
* On Windows, it replaces DOS device paths and converts backslashes to forward slashes.
|
|
4
|
-
* @param path - The file path to convert.
|
|
5
|
-
* @returns The converted POSIX-style path.
|
|
6
|
-
* @see https://github.com/mrmlnc/fast-glob/blob/28a3d61e44d5d9193ba97de4f21df6dc7725f7c0/src/utils/path.ts
|
|
7
|
-
*/
|
|
8
|
-
export declare function convertPathToPosix(path: string): string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { platform } from 'node:os';
|
|
2
|
-
/**
|
|
3
|
-
* The device path (\\.\ or \\?\).
|
|
4
|
-
* https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
|
|
5
|
-
*/
|
|
6
|
-
const DOS_DEVICE_PATH_RE = /^\\\\(?<path>[.?])/;
|
|
7
|
-
/**
|
|
8
|
-
* All backslashes except those escaping special characters.
|
|
9
|
-
* Windows: !()+@{}
|
|
10
|
-
* https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
|
11
|
-
*/
|
|
12
|
-
const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@{}])/g;
|
|
13
|
-
/**
|
|
14
|
-
* Converts a file path to a POSIX-style path.
|
|
15
|
-
* On Windows, it replaces DOS device paths and converts backslashes to forward slashes.
|
|
16
|
-
* @param path - The file path to convert.
|
|
17
|
-
* @returns The converted POSIX-style path.
|
|
18
|
-
* @see https://github.com/mrmlnc/fast-glob/blob/28a3d61e44d5d9193ba97de4f21df6dc7725f7c0/src/utils/path.ts
|
|
19
|
-
*/
|
|
20
|
-
export function convertPathToPosix(path) {
|
|
21
|
-
return platform() === 'win32'
|
|
22
|
-
? path
|
|
23
|
-
.replace(DOS_DEVICE_PATH_RE, '//$1')
|
|
24
|
-
.replaceAll(WINDOWS_BACKSLASHES_RE, '/')
|
|
25
|
-
: path;
|
|
26
|
-
}
|