@alauda/doom 0.14.1 → 0.14.3
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/global.d.ts +1 -28
- package/lib/cli/export.js +4 -5
- package/lib/cli/index.js +3 -2
- package/lib/cli/load-config.d.ts +4 -3
- package/lib/cli/load-config.js +26 -23
- package/lib/cli/new.d.ts +1 -1
- package/lib/cli/new.js +1 -2
- package/lib/cli/translate.js +1 -2
- package/lib/config.d.ts +2 -2
- package/lib/global/SiteOverrides/index.d.ts +1 -2
- package/lib/global/SiteOverrides/index.js +1 -1
- package/lib/global/VersionsNav/NavMenuGroup.d.ts +2 -1
- package/lib/global/VersionsNav/NavMenuGroup.js +3 -5
- package/lib/global/VersionsNav/NavMenuSingleItem.d.ts +9 -8
- package/lib/global/VersionsNav/NavMenuSingleItem.js +7 -5
- package/lib/global/VersionsNav/index.d.ts +1 -2
- package/lib/global/VersionsNav/index.js +20 -8
- package/lib/plugins/api/index.d.ts +2 -1
- package/lib/plugins/api/index.js +4 -4
- package/lib/plugins/auto-sidebar/index.d.ts +3 -1
- package/lib/plugins/auto-sidebar/index.js +2 -1
- package/lib/plugins/auto-sidebar/type.d.ts +0 -2
- package/lib/plugins/auto-sidebar/walk.d.ts +2 -2
- package/lib/plugins/auto-sidebar/walk.js +2 -1
- package/lib/plugins/global/index.d.ts +7 -3
- package/lib/plugins/global/index.js +7 -5
- package/lib/plugins/permission/index.d.ts +2 -1
- package/lib/plugins/permission/index.js +3 -3
- package/lib/plugins/replace/index.d.ts +4 -5
- package/lib/plugins/replace/index.js +22 -19
- package/lib/plugins/replace/types.d.ts +1 -1
- package/lib/plugins/replace/utils.d.ts +1 -1
- package/lib/plugins/replace/utils.js +1 -1
- package/lib/runtime/hooks/useTranslation.d.ts +1 -1
- package/lib/runtime/index.js +2 -0
- package/lib/runtime/translation.d.ts +2 -0
- package/lib/runtime/translation.js +2 -0
- package/lib/shared/helpers.d.ts +2 -0
- package/lib/shared/helpers.js +2 -0
- package/lib/types.d.ts +30 -0
- package/lib/utils/helpers.d.ts +1 -2
- package/lib/utils/helpers.js +2 -3
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/types.d.ts +14 -13
- package/package.json +3 -2
- package/lib/cli/export-pdf-core/utils/filterRoute.d.ts +0 -8
- package/lib/cli/export-pdf-core/utils/filterRoute.js +0 -11
- package/lib/cli/export-pdf-core/utils/timeTransformer.d.ts +0 -8
- package/lib/cli/export-pdf-core/utils/timeTransformer.js +0 -22
- package/lib/plugins/reference/index.d.ts +0 -10
- package/lib/plugins/reference/index.js +0 -60
- package/lib/plugins/reference/normalize-img-src.d.ts +0 -10
- package/lib/plugins/reference/normalize-img-src.js +0 -59
- package/lib/plugins/reference/parse-toc.d.ts +0 -17
- package/lib/plugins/reference/parse-toc.js +0 -51
- package/lib/plugins/reference/remark-normalize-link.d.ts +0 -12
- package/lib/plugins/reference/remark-normalize-link.js +0 -114
- package/lib/plugins/reference/remark-replace.d.ts +0 -16
- package/lib/plugins/reference/remark-replace.js +0 -172
- package/lib/plugins/reference/remark-toc.d.ts +0 -19
- package/lib/plugins/reference/remark-toc.js +0 -61
- package/lib/plugins/reference/resolve-reference.d.ts +0 -8
- package/lib/plugins/reference/resolve-reference.js +0 -134
- package/lib/plugins/reference/resolve-release.d.ts +0 -2
- package/lib/plugins/reference/resolve-release.js +0 -93
- package/lib/plugins/reference/types.d.ts +0 -32
- package/lib/plugins/reference/utils.d.ts +0 -14
- package/lib/plugins/reference/utils.js +0 -85
- package/lib/plugins/replace/remark-jsx-table.d.ts +0 -3
- package/lib/plugins/replace/remark-jsx-table.js +0 -10
- package/lib/runtime/components/CompanyBrand.d.ts +0 -2
- package/lib/runtime/components/CompanyBrand.js +0 -4
- package/lib/runtime/components/ProductBrand.d.ts +0 -2
- package/lib/runtime/components/ProductBrand.js +0 -4
- package/lib/runtime/components/ProductShortBrand.d.ts +0 -2
- package/lib/runtime/components/ProductShortBrand.js +0 -4
- package/lib/runtime/components/_BrandBase.d.ts +0 -5
- package/lib/runtime/components/_BrandBase.js +0 -7
- package/lib/runtime/components/_Directive.d.ts +0 -10
- package/lib/runtime/components/_Directive.js +0 -16
- package/lib/runtime/hooks/use.d.ts +0 -12
- package/lib/runtime/hooks/use.js +0 -37
- package/lib/runtime/types.d.ts +0 -5
- package/lib/runtime/types.js +0 -1
- package/lib/shared/constants.d.ts +0 -3
- package/lib/shared/constants.js +0 -6
- /package/lib/{plugins/reference/types.js → types.js} +0 -0
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { logger } from '@rspress/shared/logger';
|
|
2
|
-
import remarkFrontmatter from 'remark-frontmatter';
|
|
3
|
-
import remarkGfm from 'remark-gfm';
|
|
4
|
-
import remarkMdx from 'remark-mdx';
|
|
5
|
-
import remarkParse from 'remark-parse';
|
|
6
|
-
import remarkStringify from 'remark-stringify';
|
|
7
|
-
import { unified } from 'unified';
|
|
8
|
-
import { red } from 'yoctocolors';
|
|
9
|
-
/**
|
|
10
|
-
* hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
|
|
11
|
-
*/
|
|
12
|
-
export const extractTextAndId = (title) => {
|
|
13
|
-
const customIdReg = /{#.*}/;
|
|
14
|
-
const text = title.replace(customIdReg, '').trimEnd();
|
|
15
|
-
const customId = title.match(customIdReg)?.[0]?.slice(2, -1) || '';
|
|
16
|
-
return [text, customId];
|
|
17
|
-
};
|
|
18
|
-
export const normalizeReferenceItems = (items) => items.reduce((acc, curr) => {
|
|
19
|
-
for (const source of curr.sources) {
|
|
20
|
-
if (source.name in acc) {
|
|
21
|
-
logger.error(`Duplicate source name \`${red(source.name)}\` will be deduplicated`);
|
|
22
|
-
}
|
|
23
|
-
const repo = curr.repo;
|
|
24
|
-
const extra = {};
|
|
25
|
-
if (repo) {
|
|
26
|
-
const url = new URL(repo, 'https://gitlab-ce.alauda.cn');
|
|
27
|
-
extra.repo = url.toString();
|
|
28
|
-
extra.slug = url.pathname.slice(1);
|
|
29
|
-
}
|
|
30
|
-
const [path, anchor] = source.path.split('#');
|
|
31
|
-
acc[source.name] = {
|
|
32
|
-
...source,
|
|
33
|
-
...extra,
|
|
34
|
-
publicBase: curr.publicBase,
|
|
35
|
-
path,
|
|
36
|
-
anchor,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return acc;
|
|
40
|
-
}, {});
|
|
41
|
-
// Construct import statement for AST
|
|
42
|
-
// Such as: import image1 from './test.png'
|
|
43
|
-
export const getASTNodeImport = (name, from) => ({
|
|
44
|
-
type: 'mdxjsEsm',
|
|
45
|
-
value: `import ${name} from ${JSON.stringify(from)}`,
|
|
46
|
-
data: {
|
|
47
|
-
estree: {
|
|
48
|
-
type: 'Program',
|
|
49
|
-
sourceType: 'module',
|
|
50
|
-
body: [
|
|
51
|
-
{
|
|
52
|
-
type: 'ImportDeclaration',
|
|
53
|
-
specifiers: [
|
|
54
|
-
{
|
|
55
|
-
type: 'ImportDefaultSpecifier',
|
|
56
|
-
local: { type: 'Identifier', name },
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
source: {
|
|
60
|
-
type: 'Literal',
|
|
61
|
-
value: from,
|
|
62
|
-
raw: JSON.stringify(from),
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
export const stringifySettings = {
|
|
70
|
-
bullet: '-',
|
|
71
|
-
listItemIndent: 'one',
|
|
72
|
-
rule: '-',
|
|
73
|
-
tightDefinitions: true,
|
|
74
|
-
};
|
|
75
|
-
export const mdProcessor = unified()
|
|
76
|
-
.use(remarkParse)
|
|
77
|
-
.use(remarkFrontmatter)
|
|
78
|
-
.use(remarkGfm)
|
|
79
|
-
.use(remarkStringify, stringifySettings)
|
|
80
|
-
.freeze();
|
|
81
|
-
export const mdxProcessor = mdProcessor().use(remarkMdx).freeze();
|
|
82
|
-
export const getFrontmatterNode = (ast) => {
|
|
83
|
-
const firstNode = ast.children[0];
|
|
84
|
-
return firstNode.type === 'yaml' ? firstNode : undefined;
|
|
85
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { visit } from 'unist-util-visit';
|
|
2
|
-
export const remarkJsxTable = () => (ast) => {
|
|
3
|
-
visit(ast, 'mdxJsxFlowElement', (node) => {
|
|
4
|
-
if (node.name &&
|
|
5
|
-
['table', 'tr', 'th', 'td'].includes(node.name) &&
|
|
6
|
-
node.data?._mdxExplicitJsx) {
|
|
7
|
-
delete node.data._mdxExplicitJsx;
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useSiteOverrides } from '../hooks/index.js';
|
|
3
|
-
import { handleCJKWhitespaces } from '../utils.js';
|
|
4
|
-
export const BrandBase = ({ type }) => {
|
|
5
|
-
const { brand } = useSiteOverrides();
|
|
6
|
-
return _jsx(_Fragment, { children: handleCJKWhitespaces(brand?.[type]) });
|
|
7
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface DirectiveProps {
|
|
3
|
-
type?: 'danger' | 'details' | 'info' | 'note' | 'tip' | 'warning';
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
className?: string;
|
|
6
|
-
title?: ReactNode;
|
|
7
|
-
open?: boolean;
|
|
8
|
-
onToggle?: (open: boolean) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const Directive: ({ className, type, title, children, open, onToggle, }: DirectiveProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
|
-
import { upperCase } from 'es-toolkit';
|
|
4
|
-
import { useCallback } from 'react';
|
|
5
|
-
export const Directive = ({ className, type = 'info', title, children, open, onToggle, }) => {
|
|
6
|
-
const rootClassName = clsx('rspress-directive', type, className);
|
|
7
|
-
const titleNode = title || upperCase(type);
|
|
8
|
-
const contentNode = (_jsx("div", { className: "rspress-directive-content", children: children }));
|
|
9
|
-
const handleToggle = useCallback((ev) => {
|
|
10
|
-
onToggle?.(ev.currentTarget.open);
|
|
11
|
-
}, [onToggle]);
|
|
12
|
-
if (type === 'details') {
|
|
13
|
-
return (_jsxs("details", { className: rootClassName, open: open, onToggle: handleToggle, children: [_jsx("summary", { className: "rspress-directive-title", children: titleNode }), contentNode] }));
|
|
14
|
-
}
|
|
15
|
-
return (_jsxs("div", { className: rootClassName, children: [_jsx("div", { className: "rspress-directive-title", children: titleNode }), contentNode] }));
|
|
16
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the value from the promise, or throw.
|
|
3
|
-
*
|
|
4
|
-
* This function add some symbol properties to the promise.
|
|
5
|
-
*
|
|
6
|
-
* @param promise
|
|
7
|
-
* @returns
|
|
8
|
-
* @see https://github.com/facebook/react/pull/25084
|
|
9
|
-
*/
|
|
10
|
-
declare function usePromise<T>(promise: Promise<T>): T;
|
|
11
|
-
export declare const use: typeof usePromise;
|
|
12
|
-
export {};
|
package/lib/runtime/hooks/use.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const PROMISE_STATUS = Symbol('PROMISE_STATUS');
|
|
3
|
-
const PROMISE_VALUE = Symbol('PROMISE_VALUE');
|
|
4
|
-
const PROMISE_REASON = Symbol('PROMISE_REASON');
|
|
5
|
-
/**
|
|
6
|
-
* Get the value from the promise, or throw.
|
|
7
|
-
*
|
|
8
|
-
* This function add some symbol properties to the promise.
|
|
9
|
-
*
|
|
10
|
-
* @param promise
|
|
11
|
-
* @returns
|
|
12
|
-
* @see https://github.com/facebook/react/pull/25084
|
|
13
|
-
*/
|
|
14
|
-
function usePromise(promise) {
|
|
15
|
-
const modified = promise;
|
|
16
|
-
switch (modified[PROMISE_STATUS]) {
|
|
17
|
-
case 'fulfilled':
|
|
18
|
-
return modified[PROMISE_VALUE];
|
|
19
|
-
case 'rejected':
|
|
20
|
-
throw modified[PROMISE_REASON];
|
|
21
|
-
case 'pending':
|
|
22
|
-
throw modified;
|
|
23
|
-
default: {
|
|
24
|
-
modified[PROMISE_STATUS] = 'pending';
|
|
25
|
-
throw modified.then((value) => {
|
|
26
|
-
modified[PROMISE_STATUS] = 'fulfilled';
|
|
27
|
-
modified[PROMISE_VALUE] = value;
|
|
28
|
-
}, (reason) => {
|
|
29
|
-
modified[PROMISE_STATUS] = 'rejected';
|
|
30
|
-
modified[PROMISE_REASON] = reason;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export const use =
|
|
36
|
-
// @ts-expect-error - unavailable in react <19
|
|
37
|
-
React.use || usePromise;
|
package/lib/runtime/types.d.ts
DELETED
package/lib/runtime/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/shared/constants.js
DELETED
|
File without changes
|