@alauda/doom 0.14.2 → 0.14.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.
Files changed (88) hide show
  1. package/global.d.ts +1 -28
  2. package/lib/cli/export.js +4 -5
  3. package/lib/cli/index.js +3 -2
  4. package/lib/cli/load-config.d.ts +4 -3
  5. package/lib/cli/load-config.js +25 -22
  6. package/lib/cli/new.d.ts +1 -1
  7. package/lib/cli/new.js +1 -2
  8. package/lib/cli/translate.js +1 -2
  9. package/lib/config.d.ts +2 -2
  10. package/lib/global/SiteOverrides/index.d.ts +1 -2
  11. package/lib/global/SiteOverrides/index.js +1 -1
  12. package/lib/global/VersionsNav/NavMenuGroup.d.ts +2 -1
  13. package/lib/global/VersionsNav/NavMenuGroup.js +3 -5
  14. package/lib/global/VersionsNav/NavMenuSingleItem.d.ts +9 -8
  15. package/lib/global/VersionsNav/NavMenuSingleItem.js +7 -5
  16. package/lib/global/VersionsNav/index.d.ts +1 -2
  17. package/lib/global/VersionsNav/index.js +23 -9
  18. package/lib/plugins/api/index.d.ts +2 -1
  19. package/lib/plugins/api/index.js +4 -4
  20. package/lib/plugins/auto-sidebar/index.d.ts +3 -1
  21. package/lib/plugins/auto-sidebar/index.js +2 -1
  22. package/lib/plugins/auto-sidebar/type.d.ts +0 -2
  23. package/lib/plugins/auto-sidebar/walk.d.ts +2 -2
  24. package/lib/plugins/auto-sidebar/walk.js +2 -1
  25. package/lib/plugins/global/index.d.ts +7 -3
  26. package/lib/plugins/global/index.js +7 -5
  27. package/lib/plugins/permission/index.d.ts +2 -1
  28. package/lib/plugins/permission/index.js +3 -3
  29. package/lib/plugins/replace/index.d.ts +4 -5
  30. package/lib/plugins/replace/index.js +22 -19
  31. package/lib/plugins/replace/types.d.ts +1 -1
  32. package/lib/plugins/replace/utils.d.ts +1 -1
  33. package/lib/plugins/replace/utils.js +1 -1
  34. package/lib/runtime/hooks/useTranslation.d.ts +1 -1
  35. package/lib/runtime/index.js +2 -0
  36. package/lib/runtime/translation.d.ts +2 -0
  37. package/lib/runtime/translation.js +2 -0
  38. package/lib/shared/helpers.d.ts +2 -0
  39. package/lib/shared/helpers.js +2 -0
  40. package/lib/types.d.ts +30 -0
  41. package/lib/utils/helpers.d.ts +1 -2
  42. package/lib/utils/helpers.js +2 -3
  43. package/lib/utils/index.d.ts +0 -1
  44. package/lib/utils/index.js +0 -1
  45. package/lib/utils/types.d.ts +14 -13
  46. package/package.json +3 -2
  47. package/lib/cli/export-pdf-core/utils/filterRoute.d.ts +0 -8
  48. package/lib/cli/export-pdf-core/utils/filterRoute.js +0 -11
  49. package/lib/cli/export-pdf-core/utils/timeTransformer.d.ts +0 -8
  50. package/lib/cli/export-pdf-core/utils/timeTransformer.js +0 -22
  51. package/lib/plugins/reference/index.d.ts +0 -10
  52. package/lib/plugins/reference/index.js +0 -60
  53. package/lib/plugins/reference/normalize-img-src.d.ts +0 -10
  54. package/lib/plugins/reference/normalize-img-src.js +0 -59
  55. package/lib/plugins/reference/parse-toc.d.ts +0 -17
  56. package/lib/plugins/reference/parse-toc.js +0 -51
  57. package/lib/plugins/reference/remark-normalize-link.d.ts +0 -12
  58. package/lib/plugins/reference/remark-normalize-link.js +0 -114
  59. package/lib/plugins/reference/remark-replace.d.ts +0 -16
  60. package/lib/plugins/reference/remark-replace.js +0 -172
  61. package/lib/plugins/reference/remark-toc.d.ts +0 -19
  62. package/lib/plugins/reference/remark-toc.js +0 -61
  63. package/lib/plugins/reference/resolve-reference.d.ts +0 -8
  64. package/lib/plugins/reference/resolve-reference.js +0 -134
  65. package/lib/plugins/reference/resolve-release.d.ts +0 -2
  66. package/lib/plugins/reference/resolve-release.js +0 -93
  67. package/lib/plugins/reference/types.d.ts +0 -32
  68. package/lib/plugins/reference/utils.d.ts +0 -14
  69. package/lib/plugins/reference/utils.js +0 -85
  70. package/lib/plugins/replace/remark-jsx-table.d.ts +0 -3
  71. package/lib/plugins/replace/remark-jsx-table.js +0 -10
  72. package/lib/runtime/components/CompanyBrand.d.ts +0 -2
  73. package/lib/runtime/components/CompanyBrand.js +0 -4
  74. package/lib/runtime/components/ProductBrand.d.ts +0 -2
  75. package/lib/runtime/components/ProductBrand.js +0 -4
  76. package/lib/runtime/components/ProductShortBrand.d.ts +0 -2
  77. package/lib/runtime/components/ProductShortBrand.js +0 -4
  78. package/lib/runtime/components/_BrandBase.d.ts +0 -5
  79. package/lib/runtime/components/_BrandBase.js +0 -7
  80. package/lib/runtime/components/_Directive.d.ts +0 -10
  81. package/lib/runtime/components/_Directive.js +0 -16
  82. package/lib/runtime/hooks/use.d.ts +0 -12
  83. package/lib/runtime/hooks/use.js +0 -37
  84. package/lib/runtime/types.d.ts +0 -5
  85. package/lib/runtime/types.js +0 -1
  86. package/lib/shared/constants.d.ts +0 -3
  87. package/lib/shared/constants.js +0 -6
  88. /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,3 +0,0 @@
1
- import { Root } from 'mdast';
2
- import type { Plugin } from 'unified';
3
- export declare const remarkJsxTable: Plugin<[], Root>;
@@ -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,2 +0,0 @@
1
- export declare const CompanyBrand: () => import("react/jsx-runtime").JSX.Element;
2
- export default CompanyBrand;
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { BrandBase } from './_BrandBase.js';
3
- export const CompanyBrand = () => _jsx(BrandBase, { type: "company" });
4
- export default CompanyBrand;
@@ -1,2 +0,0 @@
1
- export declare const ProductBrand: () => import("react/jsx-runtime").JSX.Element;
2
- export default ProductBrand;
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { BrandBase } from './_BrandBase.js';
3
- export const ProductBrand = () => _jsx(BrandBase, { type: "product" });
4
- export default ProductBrand;
@@ -1,2 +0,0 @@
1
- export declare const ProductShortBrand: () => import("react/jsx-runtime").JSX.Element;
2
- export default ProductShortBrand;
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { BrandBase } from './_BrandBase.js';
3
- export const ProductShortBrand = () => _jsx(BrandBase, { type: "productShort" });
4
- export default ProductShortBrand;
@@ -1,5 +0,0 @@
1
- import type { SiteBrand } from '../types.js';
2
- export interface BrandBaseProps {
3
- type: keyof SiteBrand;
4
- }
5
- export declare const BrandBase: ({ type }: BrandBaseProps) => import("react/jsx-runtime").JSX.Element;
@@ -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 {};
@@ -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;
@@ -1,5 +0,0 @@
1
- export interface SiteBrand {
2
- company: string;
3
- product: string;
4
- productShort: string;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export declare const JSON_EXTENSION = ".json";
2
- export declare const YAML_EXTENSIONS: readonly [".yaml", ".yml"];
3
- export declare const STATIC_CONFIG_EXTENSIONS: readonly [".json", ".yaml", ".yml"];
@@ -1,6 +0,0 @@
1
- export const JSON_EXTENSION = '.json';
2
- export const YAML_EXTENSIONS = ['.yaml', '.yml'];
3
- export const STATIC_CONFIG_EXTENSIONS = [
4
- JSON_EXTENSION,
5
- ...YAML_EXTENSIONS,
6
- ];
File without changes