@alauda/doom 1.0.2 → 1.1.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/global.d.ts CHANGED
@@ -2,3 +2,18 @@
2
2
  /// <reference types="@alauda/doom/types" />
3
3
 
4
4
  type MDXProvidedComponents = typeof import('@alauda/doom/runtime')
5
+
6
+ declare module '*.module.scss' {
7
+ const classes: { [key: string]: string }
8
+ export default classes
9
+ }
10
+
11
+ declare module '*.svg' {
12
+ const content: string
13
+ export default content
14
+ }
15
+
16
+ declare module '*.svg?react' {
17
+ const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
18
+ export default ReactComponent
19
+ }
@@ -1,6 +1,8 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
+ import { pluginReact } from '@rsbuild/plugin-react';
3
4
  import { pluginSass } from '@rsbuild/plugin-sass';
5
+ import { pluginSvgr } from '@rsbuild/plugin-svgr';
4
6
  import { pluginYaml } from '@rsbuild/plugin-yaml';
5
7
  import { addLeadingSlash, addTrailingSlash, normalizeSlash, removeLeadingSlash, } from '@rspress/core';
6
8
  import { pluginAlgolia } from '@rspress/plugin-algolia';
@@ -200,7 +202,12 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
200
202
  dev: {
201
203
  lazyCompilation: lazy,
202
204
  },
203
- plugins: [pluginSass(), pluginYaml()],
205
+ plugins: [pluginReact(), pluginSass(), pluginSvgr(), pluginYaml()],
206
+ resolve: {
207
+ alias: {
208
+ classnames$: 'clsx',
209
+ },
210
+ },
204
211
  server: {
205
212
  open,
206
213
  },
@@ -247,6 +247,9 @@ export const translateCommand = new Command('translate')
247
247
  if (sourceFrontmatter.i18n?.title?.[target]) {
248
248
  newFrontmatter.title = sourceFrontmatter.i18n.title[target];
249
249
  }
250
+ if (typeof newFrontmatter.title !== 'string') {
251
+ delete newFrontmatter.title;
252
+ }
250
253
  targetContent = matter.stringify(content.startsWith('\n') ? content : '\n' + content, newFrontmatter);
251
254
  await fs.mkdir(targetBase, { recursive: true });
252
255
  await fs.writeFile(targetFilePath, targetContent);
@@ -33,7 +33,7 @@ const ExternalSiteLink_ = ({ name, href = '', className, ...props }) => {
33
33
  ? site.base
34
34
  : addTrailingSlash(site.base + site.version)) +
35
35
  (lang ? addTrailingSlash(lang) : '') +
36
- (hash ? `${url}#${hash}` : url), target: "_blank", rel: "noopener noreferrer", className: clsx(classes.link, 'cursor-pointer', className), ...props }));
36
+ (hash ? `${url}#${hash}` : url), target: "_blank", rel: "noopener noreferrer", className: clsx(classes.link, 'rp-cursor-pointer', className), ...props }));
37
37
  };
38
38
  export const ExternalSiteLink = (props) => (_jsx(NoSSR, { children: _jsx(ExternalSiteLink_, { ...props }) }));
39
39
  export default ExternalSiteLink;
@@ -51,7 +51,7 @@ export const K8sCrdSchema = ({ schema, version, }) => {
51
51
  const toggleExpandAll = useCallback(() => {
52
52
  setExpandAll((all) => !all);
53
53
  }, []);
54
- return (_jsxs(_Fragment, { children: [_jsx(Markdown, { children: description }), _jsxs("div", { className: "flex items-center", children: [_jsxs("span", { children: [_jsx("code", { children: version }), " ", _jsx(Badge, { children: "version" })] }), !isPrint && properties != null && (_jsx(Button, { className: "ml-auto doom-btn", type: "button", text: _jsxs("span", { onClick: toggleExpandAll, children: [expandAll ? '-' : '+', ' ', t(expandAll ? 'collapse_all' : 'expand_all')] }), size: "medium", theme: "alt" }))] }), properties == null ? (_jsx(Directive, { type: "warning", children: t('crd_no_schema') })) : (_jsx("div", { className: "doom-collapse-group", children: Object.entries(properties).map(([name, subSchema]) => SKIPPED_PROPERTIES.includes(name) || (_jsx(K8sCrdSchemaPart, { name: name, parent: schema, schema: subSchema, expandAll: expandAll }, name))) }))] }));
54
+ return (_jsxs(_Fragment, { children: [_jsx(Markdown, { children: description }), _jsxs("div", { className: "rp-flex rp-items-center", children: [_jsxs("span", { children: [_jsx("code", { children: version }), " ", _jsx(Badge, { children: "version" })] }), !isPrint && properties != null && (_jsx(Button, { className: "rp-ml-auto doom-btn", type: "button", size: "medium", theme: "alt", children: _jsxs("span", { onClick: toggleExpandAll, children: [expandAll ? '-' : '+', ' ', t(expandAll ? 'collapse_all' : 'expand_all')] }) }))] }), properties == null ? (_jsx(Directive, { type: "warning", children: t('crd_no_schema') })) : (_jsx("div", { className: "doom-collapse-group", children: Object.entries(properties).map(([name, subSchema]) => SKIPPED_PROPERTIES.includes(name) || (_jsx(K8sCrdSchemaPart, { name: name, parent: schema, schema: subSchema, expandAll: expandAll }, name))) }))] }));
55
55
  };
56
56
  export const K8sCrd = ({ name, crdPath }) => {
57
57
  const [, crd] = useMemo(() => Object.entries(crdsMap).find(([pathname, crd]) => {
@@ -112,7 +112,7 @@ export function Overview(props) {
112
112
  return [];
113
113
  }, [getGroup, overviewSidebarGroups]);
114
114
  const groups = customGroups ?? defaultGroups;
115
- return (_jsxs("div", { className: "overview-index doom-overview-index 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", { children: 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: normalizeHref(item.link), children: renderInlineMarkdown(item.text) }) }), _jsx("div", { className: classes.overviewDescription, children: item.description }), _jsx("ul", { className: "list-none", children: item.headers?.map((header) => (_jsx("li", { className: `${classes.overviewGroupLi} ${classes[`level${header.depth}`]} first:mt-2`, children: _jsx(Link, { href: `${normalizeHref(item.link)}#${header.id}`, children: renderInlineMarkdown(header.text) }) }, header.id))) })] }, item.link))) })] }, group.name)))] }));
115
+ 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: normalizeHref(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: `${normalizeHref(item.link)}#${header.id}`, ...renderInlineMarkdown(header.text) }) }, header.id))) })] }, item.link))) })] }, group.name)))] }));
117
117
  }
118
118
  export default Overview;
@@ -17,7 +17,7 @@ export declare const X: {
17
17
  blockquote: (props: import("react").ComponentProps<"blockquote">) => import("react/jsx-runtime").JSX.Element;
18
18
  strong: (props: import("react").ComponentProps<"strong">) => import("react/jsx-runtime").JSX.Element;
19
19
  a: (props: import("react").ComponentProps<"a">) => import("react/jsx-runtime").JSX.Element;
20
- code: (props: import("react").HTMLProps<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
21
- pre: ({ containerElementClassName, children, className, title, codeButtonGroupProps, ...otherProps }: import("@rspress/theme-default").PreWithCodeButtonGroupProps) => import("react/jsx-runtime").JSX.Element | null;
20
+ code: typeof import("@rspress/theme-default").Code;
21
+ pre: typeof import("@rspress/theme-default").PreWithCodeButtonGroup;
22
22
  img: (props: import("react").ComponentProps<"img">) => import("react/jsx-runtime").JSX.Element;
23
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": "git+https://github.com/alauda/doom.git",
@@ -35,22 +35,24 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@cspell/eslint-plugin": "^8.19.4 || ^9.0.2",
38
- "@eslint-react/eslint-plugin": "^1.51.0",
38
+ "@eslint-react/eslint-plugin": "^1.51.1",
39
39
  "@inquirer/prompts": "^7.5.3",
40
40
  "@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
41
41
  "@playwright/browser-chromium": "^1.52.0",
42
+ "@rsbuild/plugin-react": "^1.3.2",
42
43
  "@rsbuild/plugin-sass": "^1.3.2",
44
+ "@rsbuild/plugin-svgr": "^1.2.0",
43
45
  "@rsbuild/plugin-yaml": "^1.0.2",
44
- "@rspress/core": "2.0.0-beta.10",
45
- "@rspress/plugin-algolia": "2.0.0-beta.10",
46
- "@rspress/plugin-llms": "^2.0.0-beta.10",
47
- "@shikijs/transformers": "^3.5.0",
46
+ "@rspress/core": "2.0.0-beta.11",
47
+ "@rspress/plugin-algolia": "2.0.0-beta.11",
48
+ "@rspress/plugin-llms": "^2.0.0-beta.11",
49
+ "@shikijs/transformers": "^3.6.0",
48
50
  "chokidar": "^4.0.3",
49
51
  "cli-progress": "^3.12.0",
50
52
  "clsx": "^2.1.1",
51
53
  "commander": "^13.1.0 || ^14.0.0",
52
54
  "ejs": "^3.1.10",
53
- "es-toolkit": "^1.39.0",
55
+ "es-toolkit": "^1.39.1",
54
56
  "eslint": "^9.28.0",
55
57
  "eslint-plugin-mdx": "^3.4.2",
56
58
  "html-tag-names": "^2.1.0",
@@ -71,7 +73,7 @@
71
73
  "remark-mdx": "^3.1.0",
72
74
  "remark-stringify": "^11.0.0",
73
75
  "shiki": "^3.6.0",
74
- "simple-git": "^3.27.0",
76
+ "simple-git": "^3.28.0",
75
77
  "swagger2openapi": "^7.0.8",
76
78
  "tinyglobby": "^0.2.14",
77
79
  "type-fest": "^4.41.0",