From 8c81084a0b1ac03c05ab10188317721e311e5a54 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 24 Mar 2024 10:12:54 +0800 Subject: [PATCH 01/21] docs: fix broken Rsbuild links (#852) --- packages/document/docs/en/guide/basic/ssg.mdx | 2 +- packages/document/docs/zh/guide/basic/ssg.mdx | 2 +- packages/plugin-playground/src/web/editor.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/document/docs/en/guide/basic/ssg.mdx b/packages/document/docs/en/guide/basic/ssg.mdx index 0f158ff1a..3cccad13c 100644 --- a/packages/document/docs/en/guide/basic/ssg.mdx +++ b/packages/document/docs/en/guide/basic/ssg.mdx @@ -58,7 +58,7 @@ export default defineConfig({ }); ``` -For more detailed config of `builderConfig.html.tags`, please refer to the [documentation](https://rsbuild.dev/config/options/html.html#htmltags). +For more detailed config of `builderConfig.html.tags`, please refer to the [documentation](https://rsbuild.dev/config/html/tags). ## Preview diff --git a/packages/document/docs/zh/guide/basic/ssg.mdx b/packages/document/docs/zh/guide/basic/ssg.mdx index deb09650f..f7fa516ed 100644 --- a/packages/document/docs/zh/guide/basic/ssg.mdx +++ b/packages/document/docs/zh/guide/basic/ssg.mdx @@ -58,7 +58,7 @@ export default defineConfig({ }); ``` -关于 `builderConfig.html.tags` 更详细的配置,请参考[文档](https://rsbuild.dev/zh/config/options/html.html#htmltags)。 +关于 `builderConfig.html.tags` 更详细的配置,请参考[文档](https://rsbuild.dev/zh/config/html/tags)。 ## 预览产物 diff --git a/packages/plugin-playground/src/web/editor.tsx b/packages/plugin-playground/src/web/editor.tsx index 2eb6a011c..3e8366823 100644 --- a/packages/plugin-playground/src/web/editor.tsx +++ b/packages/plugin-playground/src/web/editor.tsx @@ -7,7 +7,7 @@ import { useDark } from '@rspress/core/runtime'; import { DEFAULT_MONACO_URL } from './constant'; // inject by Rsbuild in cli/index.ts -// see: https://rsbuild.dev/zh/config/options/source.html#sourcedefine +// see: https://rsbuild.dev/config/source/define declare global { const __PLAYGROUND_MONACO_LOADER__: any; const __PLAYGROUND_MONACO_OPTIONS__: any; From 7e0d6aaf846e2cac52468553304bf6d57ad36392 Mon Sep 17 00:00:00 2001 From: Zhanghao Date: Sun, 24 Mar 2024 10:14:18 +0800 Subject: [PATCH 02/21] fix(doc): fix logo sidebar cannot be used properly. (#854) --- .changeset/metal-papayas-live.md | 5 +++++ packages/document/docs/en/api/config/config-basic.mdx | 2 +- packages/document/docs/zh/api/config/config-basic.mdx | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/metal-papayas-live.md diff --git a/.changeset/metal-papayas-live.md b/.changeset/metal-papayas-live.md new file mode 100644 index 000000000..dfbb3b757 --- /dev/null +++ b/.changeset/metal-papayas-live.md @@ -0,0 +1,5 @@ +--- +"@rspress/docs": patch +--- + +fix(doc): fix logo sidebar cannot be used properly. diff --git a/packages/document/docs/en/api/config/config-basic.mdx b/packages/document/docs/en/api/config/config-basic.mdx index 1273c1318..011f33aa2 100644 --- a/packages/document/docs/en/api/config/config-basic.mdx +++ b/packages/document/docs/en/api/config/config-basic.mdx @@ -86,7 +86,7 @@ export default defineConfig({ The framework will find your icon in the `public` directory, of course you can also set it to a CDN address. -## logo +## logo \{#logo-1} - Type: `string | { dark: string; light: string }` - Default: `""` diff --git a/packages/document/docs/zh/api/config/config-basic.mdx b/packages/document/docs/zh/api/config/config-basic.mdx index 11088bf3a..166eb58a9 100644 --- a/packages/document/docs/zh/api/config/config-basic.mdx +++ b/packages/document/docs/zh/api/config/config-basic.mdx @@ -86,7 +86,7 @@ export default defineConfig({ 框架会在 `public` 目录中找到你的图标,当然你也可以设置成一个 CDN 地址。 -## logo +## logo \{#logo-1} - Type: `string | { dark: string; light: string }` - Default: `""` From 145bb161943f536c50c28713ceb57e4db1cba125 Mon Sep 17 00:00:00 2001 From: Zhanghao Date: Sun, 24 Mar 2024 16:58:55 +0800 Subject: [PATCH 03/21] feat: support logo text config (#855) --- .changeset/wet-ears-suffer.md | 8 ++++++++ .../core/src/node/runtimeModule/siteData/index.ts | 1 + .../document/docs/en/api/config/config-basic.mdx | 15 +++++++++++++++ .../document/docs/zh/api/config/config-basic.mdx | 15 +++++++++++++++ packages/shared/src/types/index.ts | 5 +++++ .../src/components/Nav/NavBarTitle.tsx | 8 ++++---- 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 .changeset/wet-ears-suffer.md diff --git a/.changeset/wet-ears-suffer.md b/.changeset/wet-ears-suffer.md new file mode 100644 index 000000000..da2f49a83 --- /dev/null +++ b/.changeset/wet-ears-suffer.md @@ -0,0 +1,8 @@ +--- +"@rspress/theme-default": patch +"@rspress/docs": patch +"@rspress/shared": patch +"@rspress/core": patch +--- + +feat: support logo text config diff --git a/packages/core/src/node/runtimeModule/siteData/index.ts b/packages/core/src/node/runtimeModule/siteData/index.ts index 832def28c..491286c7c 100644 --- a/packages/core/src/node/runtimeModule/siteData/index.ts +++ b/packages/core/src/node/runtimeModule/siteData/index.ts @@ -96,6 +96,7 @@ export async function siteDataVMPlugin(context: FactoryContext) { lang: userConfig?.lang || '', locales: userConfig?.locales || userConfig.themeConfig?.locales || [], logo: userConfig?.logo || '', + logoText: userConfig?.logoText || '', ssg: userConfig?.ssg ?? true, multiVersion: { default: userConfig?.multiVersion?.default || '', diff --git a/packages/document/docs/en/api/config/config-basic.mdx b/packages/document/docs/en/api/config/config-basic.mdx index 011f33aa2..f9a193c71 100644 --- a/packages/document/docs/en/api/config/config-basic.mdx +++ b/packages/document/docs/en/api/config/config-basic.mdx @@ -116,6 +116,21 @@ export default defineConfig({ }); ``` +## logoText + +- Type: `string` +- Default: `""` + +Site logo Text. This text will be used as the logo text in the upper left corner of the navbar. For example: + +```ts title="rspress.config.ts" +import { defineConfig } from 'rspress/config'; + +export default defineConfig({ + logoText: 'rspress', +}); +``` + ## outDir - Type: `string` diff --git a/packages/document/docs/zh/api/config/config-basic.mdx b/packages/document/docs/zh/api/config/config-basic.mdx index 166eb58a9..3c3760ee2 100644 --- a/packages/document/docs/zh/api/config/config-basic.mdx +++ b/packages/document/docs/zh/api/config/config-basic.mdx @@ -116,6 +116,21 @@ export default defineConfig({ }); ``` +## logoText + +- Type: `string` +- Default: `""` + +站点 logo 文字。这个文字将用作导航栏左上角的 logo 文字。例如: + +```ts title="rspress.config.ts" +import { defineConfig } from 'rspress/config'; + +export default defineConfig({ + logoText: 'rspress', +}); +``` + ## outDir - Type: `string` diff --git a/packages/shared/src/types/index.ts b/packages/shared/src/types/index.ts index 564756c1c..b835b66c5 100644 --- a/packages/shared/src/types/index.ts +++ b/packages/shared/src/types/index.ts @@ -58,6 +58,10 @@ export interface UserConfig { * Path to the logo file in nav bar. */ logo?: string | { dark: string; light: string }; + /** + * The text of the logo in nav bar. + */ + logoText?: string; /** * Base path of the site. */ @@ -182,6 +186,7 @@ export interface SiteData { icon: string; themeConfig: ThemeConfig; logo: string | { dark: string; light: string }; + logoText: string; pages: BaseRuntimePageInfo[]; search: SearchOptions; ssg: boolean; diff --git a/packages/theme-default/src/components/Nav/NavBarTitle.tsx b/packages/theme-default/src/components/Nav/NavBarTitle.tsx index 1a3f717d2..c4a481ec1 100644 --- a/packages/theme-default/src/components/Nav/NavBarTitle.tsx +++ b/packages/theme-default/src/components/Nav/NavBarTitle.tsx @@ -11,7 +11,7 @@ import { getLogoUrl, useLocaleSiteData } from '../../logic'; export const NavBarTitle = () => { const { siteData } = usePageData(); const localeData = useLocaleSiteData(); - const { logo: rawLogo } = siteData; + const { logo: rawLogo, logoText } = siteData; const title = localeData.title ?? siteData.title; const { theme } = useContext(ThemeContext); const [logo, setLogo] = useState(getLogoUrl(rawLogo, theme)); @@ -26,16 +26,16 @@ export const NavBarTitle = () => { href={withBase(localeData.langRoutePrefix || '/')} className="flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60" > - {logo ? ( + {logo && ( - ) : ( - {title} )} + {logoText && {logoText}} + {!logo && !logoText && {title}} ); From 6ea2cbad7e22b9e62fdc3e3b335b946afe05c03b Mon Sep 17 00:00:00 2001 From: Antonio Date: Sun, 24 Mar 2024 10:07:31 +0100 Subject: [PATCH 04/21] docs: tailwind setup (#754) Co-authored-by: neverland --- .changeset/nine-hotels-sleep.md | 5 ++ .../docs/en/guide/basic/custom-page.mdx | 51 +++++++++++++++++-- 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 .changeset/nine-hotels-sleep.md diff --git a/.changeset/nine-hotels-sleep.md b/.changeset/nine-hotels-sleep.md new file mode 100644 index 000000000..038a02ad4 --- /dev/null +++ b/.changeset/nine-hotels-sleep.md @@ -0,0 +1,5 @@ +--- +"@rspress/docs": patch +--- + +Document setup steps for using Tailwind CSS with Rspress diff --git a/packages/document/docs/en/guide/basic/custom-page.mdx b/packages/document/docs/en/guide/basic/custom-page.mdx index 8abc8ab52..649510769 100644 --- a/packages/document/docs/en/guide/basic/custom-page.mdx +++ b/packages/document/docs/en/guide/basic/custom-page.mdx @@ -1,3 +1,5 @@ +import { PackageManagerTabs } from '@theme'; + # Customizing Page Rspress provides several ways for you to customize the content of your pages, including: @@ -63,8 +65,7 @@ export default defineConfig({ Then you can add the following code: -```css -/* styles/index.css */ +```css title="styles/index.css" :root { --rp-c-brand: #f00; } @@ -74,9 +75,7 @@ In this way, the framework will automatically collect all global styles and merg Here are some commonly used global styles: -```css -/* styles/index.css */ - +```css title="styles/index.css" :root { /* Modify theme color */ --rp-c-brand: #f00; @@ -97,6 +96,48 @@ Here are some commonly used global styles: > If you want to know more about the internal global styles, you can check [vars.css](https://github.com/web-infra-dev/rspress/blob/main/packages/theme-default/src/styles/vars.css) +### Tailwind CSS + +In order to get Tailwind CSS working with Rspress, you can use the following steps: + +1. Install Tailwind CSS and its dependencies: + + + +2. Create a `postcss.config.js` file containing `tailwindcss` and `autoprefixer` plugins: + +```js title="postcss.config.js" +module.exports = { + plugins: { + tailwindcss: {}, + }, +}; +``` + +3. Create a `tailwind.config.js` file and make sure all the content files are included: + +```js title="tailwind.config.js" +module.exports = { + content: ['./src/**/*.tsx'], + theme: { + extend: {}, + }, + plugins: [], +}; +``` + +> You can also include and style React component directly in the `.mdx` files by including those files in the `content` value, such as `content: ['./src/**/*.tsx', './docs/**/*.mdx']`. + +4. Include the Tailwind directives in your CSS styles file from [Custom Styles](#custom-styles): + +```css title=styles/index.css +@import 'tailwindcss/base'; +@import 'tailwindcss/components'; +@import 'tailwindcss/utilities'; +``` + +> For most up to date configuration, please refer to the official [Tailwind CSS documentation](https://tailwindcss.com/docs/installation/using-postcss). + ## Custom Layout Structure ### Using pageType From 2eb28ec49535ffd67fb8274d5eb4c68c7f3f7e47 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 24 Mar 2024 19:45:59 +0800 Subject: [PATCH 05/21] docs: translate Tailwind CSS setup (#856) --- .../docs/en/guide/basic/custom-page.mdx | 10 ++--- .../docs/zh/guide/basic/custom-page.mdx | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/packages/document/docs/en/guide/basic/custom-page.mdx b/packages/document/docs/en/guide/basic/custom-page.mdx index 649510769..bca9d10ca 100644 --- a/packages/document/docs/en/guide/basic/custom-page.mdx +++ b/packages/document/docs/en/guide/basic/custom-page.mdx @@ -100,11 +100,11 @@ Here are some commonly used global styles: In order to get Tailwind CSS working with Rspress, you can use the following steps: -1. Install Tailwind CSS and its dependencies: +1. Install Tailwind CSS: -2. Create a `postcss.config.js` file containing `tailwindcss` and `autoprefixer` plugins: +2. Create a `postcss.config.js` file containing `tailwindcss` plugin: ```js title="postcss.config.js" module.exports = { @@ -114,11 +114,11 @@ module.exports = { }; ``` -3. Create a `tailwind.config.js` file and make sure all the content files are included: +3. Create a `tailwind.config.js` file and make sure all the content files are included via `content`: ```js title="tailwind.config.js" module.exports = { - content: ['./src/**/*.tsx'], + content: ['./src/**/*.tsx', './docs/**/*.mdx'], theme: { extend: {}, }, @@ -126,8 +126,6 @@ module.exports = { }; ``` -> You can also include and style React component directly in the `.mdx` files by including those files in the `content` value, such as `content: ['./src/**/*.tsx', './docs/**/*.mdx']`. - 4. Include the Tailwind directives in your CSS styles file from [Custom Styles](#custom-styles): ```css title=styles/index.css diff --git a/packages/document/docs/zh/guide/basic/custom-page.mdx b/packages/document/docs/zh/guide/basic/custom-page.mdx index 78368a365..8e17f9aec 100644 --- a/packages/document/docs/zh/guide/basic/custom-page.mdx +++ b/packages/document/docs/zh/guide/basic/custom-page.mdx @@ -1,3 +1,5 @@ +import { PackageManagerTabs } from '@theme'; + # 自定义页面 Rspress 提供了多种方式能让你自定义页面的内容,包括: @@ -97,6 +99,46 @@ export default defineConfig({ > 如果想了解更多内部的全局样式,可以查看 [vars.css](https://github.com/web-infra-dev/rspress/blob/main/packages/theme-default/src/styles/vars.css) +### Tailwind CSS + +要在 Rspress 中使用 Tailwind CSS,你可以按照以下步骤操作: + +1. 安装 Tailwind CSS: + + + +2. 创建一个包含 `tailwindcss` 插件的 `postcss.config.js` 文件: + +```js title="postcss.config.js" +module.exports = { + plugins: { + tailwindcss: {}, + }, +}; +``` + +3. 创建一个 `tailwind.config.js` 文件,并确保 `content` 包含了所有使用 Tailwind CSS 的文件: + +```js title="tailwind.config.js" +module.exports = { + content: ['./src/**/*.tsx', './docs/**/*.mdx'], + theme: { + extend: {}, + }, + plugins: [], +}; +``` + +4. 在你的 CSS 样式文件中添加 Tailwind 指令,参考 [自定义样式](#自定义样式): + +```css title=styles/index.css +@import 'tailwindcss/base'; +@import 'tailwindcss/components'; +@import 'tailwindcss/utilities'; +``` + +> 请参考官方 [Tailwind CSS 文档](https://tailwindcss.com/docs/installation/using-postcss) 了解最新用法。 + ## 自定义布局结构 Rspress 提供了 `pageType` 配置来让你自定义页面的布局结构。 From fcdbcb76397f8ce6c4b3b63594d1d5fd58a38b60 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 25 Mar 2024 12:55:09 +0800 Subject: [PATCH 06/21] chore(workflow): let renovate bump package.json (#857) --- .github/renovate.json5 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 8ed49cc6f..0e206371b 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,11 +1,13 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:recommended"], + "extends": ["config:recommended", "schedule:weekly"], "packageRules": [ // Use chore as semantic commit type for commit messages { "matchPackagePatterns": ["*"], - "semanticCommitType": "chore" + "semanticCommitType": "chore", + // always bump package.json + "rangeStrategy": "bump" }, { "groupName": "rsbuild", @@ -33,6 +35,8 @@ // manually updating "typescript", // align Node.js version minimum requirements - "@types/node" + "@types/node", + "node", + "pnpm" ] } From 1a22fe0a30f559442bd08aceeaccbddb1ae42842 Mon Sep 17 00:00:00 2001 From: 10Derozan Date: Mon, 25 Mar 2024 13:40:56 +0800 Subject: [PATCH 07/21] fix(core): replace flattened mdx content by rules (#859) --- .changeset/chilly-pumpkins-remember.md | 5 ++++ e2e/fixtures/basic/doc/content.mdx | 1 + e2e/fixtures/basic/doc/index.mdx | 4 +++ e2e/fixtures/basic/rspress.config.ts | 6 +++++ e2e/tests/basic.test.ts | 5 +++- packages/core/package.json | 1 - packages/core/src/node/initRsbuild.ts | 7 +----- packages/core/src/node/mdx/loader.ts | 5 +++- packages/theme-default/package.json | 6 +---- pnpm-lock.yaml | 34 -------------------------- 10 files changed, 26 insertions(+), 48 deletions(-) create mode 100644 .changeset/chilly-pumpkins-remember.md create mode 100644 e2e/fixtures/basic/doc/content.mdx diff --git a/.changeset/chilly-pumpkins-remember.md b/.changeset/chilly-pumpkins-remember.md new file mode 100644 index 000000000..bd2e39d2f --- /dev/null +++ b/.changeset/chilly-pumpkins-remember.md @@ -0,0 +1,5 @@ +--- +'@rspress/core': patch +--- + +fix(core): replace flattened mdx content by rules diff --git a/e2e/fixtures/basic/doc/content.mdx b/e2e/fixtures/basic/doc/content.mdx new file mode 100644 index 000000000..52dd6243b --- /dev/null +++ b/e2e/fixtures/basic/doc/content.mdx @@ -0,0 +1 @@ +## content diff --git a/e2e/fixtures/basic/doc/index.mdx b/e2e/fixtures/basic/doc/index.mdx index 45b89db28..3dd4ca21f 100644 --- a/e2e/fixtures/basic/doc/index.mdx +++ b/e2e/fixtures/basic/doc/index.mdx @@ -5,3 +5,7 @@ This is a TIP. ::: + +import Content from './content.mdx'; + + diff --git a/e2e/fixtures/basic/rspress.config.ts b/e2e/fixtures/basic/rspress.config.ts index 85cca368c..57efb1140 100644 --- a/e2e/fixtures/basic/rspress.config.ts +++ b/e2e/fixtures/basic/rspress.config.ts @@ -3,4 +3,10 @@ import { defineConfig } from 'rspress/config'; export default defineConfig({ root: path.join(__dirname, 'doc'), + replaceRules: [ + { + search: /content/g, + replace: 'h2', + }, + ], }); diff --git a/e2e/tests/basic.test.ts b/e2e/tests/basic.test.ts index db4c29640..deb8d0e63 100644 --- a/e2e/tests/basic.test.ts +++ b/e2e/tests/basic.test.ts @@ -23,7 +23,7 @@ test.describe('basic test', async () => { await page.goto(`http://localhost:${appPort}`); const h1 = await page.$('h1'); const text = await page.evaluate(h1 => h1?.textContent, h1); - await expect(text).toContain('Hello World'); + expect(text).toContain('Hello World'); // expect the .header-anchor to be rendered and take the correct href const headerAnchor = await page.$('.header-anchor'); const href = await page.evaluate( @@ -31,6 +31,9 @@ test.describe('basic test', async () => { headerAnchor, ); expect(href).toBe('#hello-world'); + const h2 = await page.$('h2'); + const content = await page.evaluate(h2 => h2?.textContent, h2); + expect(content).toContain('h2') }); test('Guide page', async ({ page }) => { diff --git a/packages/core/package.json b/packages/core/package.json index 0892fba6e..6625ace1d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -93,7 +93,6 @@ "remark-rehype": "^10.1.0", "rspack-plugin-virtual-module": "0.1.12", "source-map": "0.7.4", - "string-replace-loader": "^3.1.0", "unified": "^10.1.2", "unist-util-visit": "^4.1.1", "unist-util-visit-children": "^2.0.1", diff --git a/packages/core/src/node/initRsbuild.ts b/packages/core/src/node/initRsbuild.ts index 4f8dca6bc..d009948a9 100644 --- a/packages/core/src/node/initRsbuild.ts +++ b/packages/core/src/node/initRsbuild.ts @@ -189,12 +189,7 @@ async function createInternalBuildConfig( routeService, pluginDriver, }) - .end() - .use('string-replace-loader') - .loader(require.resolve('string-replace-loader')) - .options({ - multiple: config?.replaceRules || [], - }); + .end(); if (chain.plugins.has(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH)) { chain.plugin(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH).tap(options => { diff --git a/packages/core/src/node/mdx/loader.ts b/packages/core/src/node/mdx/loader.ts index f05271120..0683e26eb 100644 --- a/packages/core/src/node/mdx/loader.ts +++ b/packages/core/src/node/mdx/loader.ts @@ -11,6 +11,7 @@ import { normalizePath, escapeMarkdownHeadingIds, flattenMdxContent, + applyReplaceRules, } from '../utils'; import { PluginDriver } from '../PluginDriver'; import { TEMP_DIR } from '../constants'; @@ -111,8 +112,10 @@ export default async function mdxLoader( filepath, alias as Record, ); + // replace content + const replacedContent = applyReplaceRules(flattenContent, config.replaceRules); // preprocessor - const preprocessedContent = escapeMarkdownHeadingIds(flattenContent); + const preprocessedContent = escapeMarkdownHeadingIds(replacedContent); deps.forEach(dep => context.addDependency(dep)); diff --git a/packages/theme-default/package.json b/packages/theme-default/package.json index 092ddee54..ece6ab5bb 100644 --- a/packages/theme-default/package.json +++ b/packages/theme-default/package.json @@ -63,7 +63,6 @@ "react-helmet-async": "^1.3.0", "react-syntax-highlighter": "^15.5.0", "rspack-plugin-virtual-module": "0.1.12", - "string-replace-loader": "^3.1.0", "react-transition-group": "4.4.5" }, "devDependencies": { @@ -96,10 +95,7 @@ "virtual-global-styles", "./src/styles/index.ts" ], - "files": [ - "dist", - "src" - ], + "files": ["dist", "src"], "publishConfig": { "access": "public", "provenance": true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fcd171322..aadee2a04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -439,9 +439,6 @@ importers: source-map: specifier: 0.7.4 version: 0.7.4 - string-replace-loader: - specifier: ^3.1.0 - version: 3.1.0(webpack@5.88.2) unified: specifier: ^10.1.2 version: 10.1.2 @@ -1174,9 +1171,6 @@ importers: rspack-plugin-virtual-module: specifier: 0.1.12 version: 0.1.12 - string-replace-loader: - specifier: ^3.1.0 - version: 3.1.0(webpack@5.88.2) devDependencies: '@modern-js/plugin-tailwindcss': specifier: 2.48.3 @@ -5093,10 +5087,6 @@ packages: is-windows: 1.0.2 dev: true - /big.js@5.2.2: - resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} - dev: false - /binary-extensions@2.2.0: resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} engines: {node: '>=8'} @@ -5891,11 +5881,6 @@ packages: /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - /emojis-list@3.0.0: - resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} - engines: {node: '>= 4'} - dev: false - /end-of-stream@1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} dependencies: @@ -7740,15 +7725,6 @@ packages: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} - /loader-utils@2.0.4: - resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==} - engines: {node: '>=8.9.0'} - dependencies: - big.js: 5.2.2 - emojis-list: 3.0.0 - json5: 2.2.3 - dev: false - /loader-utils@3.2.1: resolution: {integrity: sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==} engines: {node: '>= 12.13.0'} @@ -10794,16 +10770,6 @@ packages: resolution: {integrity: sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==} dev: true - /string-replace-loader@3.1.0(webpack@5.88.2): - resolution: {integrity: sha512-5AOMUZeX5HE/ylKDnEa/KKBqvlnFmRZudSOjVJHxhoJg9QYTwl1rECx7SLR8BBH7tfxb4Rp7EM2XVfQFxIhsbQ==} - peerDependencies: - webpack: ^5 - dependencies: - loader-utils: 2.0.4 - schema-utils: 3.3.0 - webpack: 5.88.2 - dev: false - /string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} From c7b0a43fa859e6acaa82376743e64081d0340756 Mon Sep 17 00:00:00 2001 From: 10Derozan Date: Mon, 25 Mar 2024 17:07:07 +0800 Subject: [PATCH 08/21] test: split base E2E tests (#860) --- e2e/fixtures/basic/doc/content.mdx | 1 - e2e/fixtures/basic/doc/index.mdx | 4 --- e2e/fixtures/basic/rspress.config.ts | 6 ---- .../{basic => custom-id}/doc/guide.mdx | 0 e2e/fixtures/custom-id/package.json | 16 +++++++++ e2e/fixtures/custom-id/rspress.config.ts | 6 ++++ e2e/fixtures/custom-id/tsconfig.json | 1 + e2e/fixtures/replace-rules/doc/content.mdx | 1 + e2e/fixtures/replace-rules/doc/index.mdx | 3 ++ e2e/fixtures/replace-rules/package.json | 16 +++++++++ e2e/fixtures/replace-rules/rspress.config.ts | 12 +++++++ e2e/fixtures/replace-rules/tsconfig.json | 1 + e2e/tests/basic.test.ts | 14 -------- e2e/tests/custom-id.test.ts | 33 +++++++++++++++++++ e2e/tests/replace-rules.test.ts | 28 ++++++++++++++++ pnpm-lock.yaml | 20 +++++++++++ 16 files changed, 137 insertions(+), 25 deletions(-) delete mode 100644 e2e/fixtures/basic/doc/content.mdx rename e2e/fixtures/{basic => custom-id}/doc/guide.mdx (100%) create mode 100644 e2e/fixtures/custom-id/package.json create mode 100644 e2e/fixtures/custom-id/rspress.config.ts create mode 100644 e2e/fixtures/custom-id/tsconfig.json create mode 100644 e2e/fixtures/replace-rules/doc/content.mdx create mode 100644 e2e/fixtures/replace-rules/doc/index.mdx create mode 100644 e2e/fixtures/replace-rules/package.json create mode 100644 e2e/fixtures/replace-rules/rspress.config.ts create mode 100644 e2e/fixtures/replace-rules/tsconfig.json create mode 100644 e2e/tests/custom-id.test.ts create mode 100644 e2e/tests/replace-rules.test.ts diff --git a/e2e/fixtures/basic/doc/content.mdx b/e2e/fixtures/basic/doc/content.mdx deleted file mode 100644 index 52dd6243b..000000000 --- a/e2e/fixtures/basic/doc/content.mdx +++ /dev/null @@ -1 +0,0 @@ -## content diff --git a/e2e/fixtures/basic/doc/index.mdx b/e2e/fixtures/basic/doc/index.mdx index 3dd4ca21f..45b89db28 100644 --- a/e2e/fixtures/basic/doc/index.mdx +++ b/e2e/fixtures/basic/doc/index.mdx @@ -5,7 +5,3 @@ This is a TIP. ::: - -import Content from './content.mdx'; - - diff --git a/e2e/fixtures/basic/rspress.config.ts b/e2e/fixtures/basic/rspress.config.ts index 57efb1140..85cca368c 100644 --- a/e2e/fixtures/basic/rspress.config.ts +++ b/e2e/fixtures/basic/rspress.config.ts @@ -3,10 +3,4 @@ import { defineConfig } from 'rspress/config'; export default defineConfig({ root: path.join(__dirname, 'doc'), - replaceRules: [ - { - search: /content/g, - replace: 'h2', - }, - ], }); diff --git a/e2e/fixtures/basic/doc/guide.mdx b/e2e/fixtures/custom-id/doc/guide.mdx similarity index 100% rename from e2e/fixtures/basic/doc/guide.mdx rename to e2e/fixtures/custom-id/doc/guide.mdx diff --git a/e2e/fixtures/custom-id/package.json b/e2e/fixtures/custom-id/package.json new file mode 100644 index 000000000..9f72a8c98 --- /dev/null +++ b/e2e/fixtures/custom-id/package.json @@ -0,0 +1,16 @@ +{ + "name": "@rspress-fixture/rspress-custom-id", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "rspress dev", + "build": "rspress build", + "preview": "rspress preview" + }, + "dependencies": { + "rspress": "workspace:*" + }, + "devDependencies": { + "@types/node": "^14" + } +} diff --git a/e2e/fixtures/custom-id/rspress.config.ts b/e2e/fixtures/custom-id/rspress.config.ts new file mode 100644 index 000000000..85cca368c --- /dev/null +++ b/e2e/fixtures/custom-id/rspress.config.ts @@ -0,0 +1,6 @@ +import * as path from 'path'; +import { defineConfig } from 'rspress/config'; + +export default defineConfig({ + root: path.join(__dirname, 'doc'), +}); diff --git a/e2e/fixtures/custom-id/tsconfig.json b/e2e/fixtures/custom-id/tsconfig.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/e2e/fixtures/custom-id/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/e2e/fixtures/replace-rules/doc/content.mdx b/e2e/fixtures/replace-rules/doc/content.mdx new file mode 100644 index 000000000..ccf35b2a1 --- /dev/null +++ b/e2e/fixtures/replace-rules/doc/content.mdx @@ -0,0 +1 @@ +# content diff --git a/e2e/fixtures/replace-rules/doc/index.mdx b/e2e/fixtures/replace-rules/doc/index.mdx new file mode 100644 index 000000000..03972c291 --- /dev/null +++ b/e2e/fixtures/replace-rules/doc/index.mdx @@ -0,0 +1,3 @@ +import Content from './content.mdx'; + + diff --git a/e2e/fixtures/replace-rules/package.json b/e2e/fixtures/replace-rules/package.json new file mode 100644 index 000000000..60df255d1 --- /dev/null +++ b/e2e/fixtures/replace-rules/package.json @@ -0,0 +1,16 @@ +{ + "name": "@rspress-fixture/rspress-replace-rules", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "rspress dev", + "build": "rspress build", + "preview": "rspress preview" + }, + "dependencies": { + "rspress": "workspace:*" + }, + "devDependencies": { + "@types/node": "^14" + } +} diff --git a/e2e/fixtures/replace-rules/rspress.config.ts b/e2e/fixtures/replace-rules/rspress.config.ts new file mode 100644 index 000000000..c957223b6 --- /dev/null +++ b/e2e/fixtures/replace-rules/rspress.config.ts @@ -0,0 +1,12 @@ +import * as path from 'path'; +import { defineConfig } from 'rspress/config'; + +export default defineConfig({ + root: path.join(__dirname, 'doc'), + replaceRules: [ + { + search: /content/g, + replace: 'h1', + }, + ], +}); diff --git a/e2e/fixtures/replace-rules/tsconfig.json b/e2e/fixtures/replace-rules/tsconfig.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/e2e/fixtures/replace-rules/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/e2e/tests/basic.test.ts b/e2e/tests/basic.test.ts index deb8d0e63..216d2dd73 100644 --- a/e2e/tests/basic.test.ts +++ b/e2e/tests/basic.test.ts @@ -31,20 +31,6 @@ test.describe('basic test', async () => { headerAnchor, ); expect(href).toBe('#hello-world'); - const h2 = await page.$('h2'); - const content = await page.evaluate(h2 => h2?.textContent, h2); - expect(content).toContain('h2') - }); - - test('Guide page', async ({ page }) => { - await page.goto(`http://localhost:${appPort}/guide`, { - waitUntil: 'networkidle', - }); - const h1 = await page.$('h1'); - const className = await page.evaluate(h1 => h1?.className, h1); - expect(className).toContain('title_3b154'); // hash in css module should stable - const text = await page.evaluate(h1 => h1?.textContent, h1); - expect(text).toContain('Guide'); }); test('404 page', async ({ page }) => { diff --git a/e2e/tests/custom-id.test.ts b/e2e/tests/custom-id.test.ts new file mode 100644 index 000000000..0802a99a0 --- /dev/null +++ b/e2e/tests/custom-id.test.ts @@ -0,0 +1,33 @@ +import { expect, test } from '@playwright/test'; +import path from 'path'; +import { getPort, killProcess, runDevCommand } from '../utils/runCommands'; + +const fixtureDir = path.resolve(__dirname, '../fixtures'); + +test.describe('custom-id test', async () => { + let appPort; + let app; + test.beforeAll(async () => { + const appDir = path.join(fixtureDir, 'custom-id'); + appPort = await getPort(); + app = await runDevCommand(appDir, appPort); + }); + + test.afterAll(async () => { + if (app) { + await killProcess(app); + } + }); + + test('Guide page', async ({ page }) => { + await page.goto(`http://localhost:${appPort}/guide`, { + waitUntil: 'networkidle', + }); + const h1 = await page.$('h1'); + const className = await page.evaluate(h1 => h1?.className, h1); + expect(className).toContain('title_3b154'); // hash in css module should stable + const text = await page.evaluate(h1 => h1?.textContent, h1); + expect(text).toContain('Guide'); + }); + +}); diff --git a/e2e/tests/replace-rules.test.ts b/e2e/tests/replace-rules.test.ts new file mode 100644 index 000000000..ba3c2f451 --- /dev/null +++ b/e2e/tests/replace-rules.test.ts @@ -0,0 +1,28 @@ +import { expect, test } from '@playwright/test'; +import path from 'path'; +import { getPort, killProcess, runDevCommand } from '../utils/runCommands'; + +const fixtureDir = path.resolve(__dirname, '../fixtures'); + +test.describe('replace-rules test', async () => { + let appPort; + let app; + test.beforeAll(async () => { + const appDir = path.join(fixtureDir, 'replace-rules'); + appPort = await getPort(); + app = await runDevCommand(appDir, appPort); + }); + + test.afterAll(async () => { + if (app) { + await killProcess(app); + } + }); + + test('Index page', async ({ page }) => { + await page.goto(`http://localhost:${appPort}`); + const h1 = await page.$('h1'); + const content = await page.evaluate(h1 => h1?.textContent, h1); + expect(content).toContain('h1') + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aadee2a04..62ab96624 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -105,6 +105,16 @@ importers: specifier: ^14 version: 14.0.0 + e2e/fixtures/custom-id: + dependencies: + rspress: + specifier: workspace:* + version: link:../../../packages/cli + devDependencies: + '@types/node': + specifier: ^14 + version: 14.0.0 + e2e/fixtures/i18n: dependencies: rspress: @@ -240,6 +250,16 @@ importers: specifier: ^14 version: 14.0.0 + e2e/fixtures/replace-rules: + dependencies: + rspress: + specifier: workspace:* + version: link:../../../packages/cli + devDependencies: + '@types/node': + specifier: ^14 + version: 14.0.0 + e2e/fixtures/view-transition: dependencies: rspress: From 609ef998bee6b7b24805fedb56c2e8b89b692bc9 Mon Sep 17 00:00:00 2001 From: 10Derozan Date: Mon, 25 Mar 2024 17:15:41 +0800 Subject: [PATCH 09/21] fix(preview): replace iframePosition with iframe.position (#861) --- .changeset/purple-flies-kiss.md | 5 +++++ packages/plugin-preview/src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/purple-flies-kiss.md diff --git a/.changeset/purple-flies-kiss.md b/.changeset/purple-flies-kiss.md new file mode 100644 index 000000000..8303e4b85 --- /dev/null +++ b/.changeset/purple-flies-kiss.md @@ -0,0 +1,5 @@ +--- +'@rspress/plugin-preview': patch +--- + +fix: replace iframePosition with iframe.position diff --git a/packages/plugin-preview/src/index.ts b/packages/plugin-preview/src/index.ts index fe93274bf..51f660f55 100644 --- a/packages/plugin-preview/src/index.ts +++ b/packages/plugin-preview/src/index.ts @@ -40,7 +40,7 @@ export function pluginPreview(options?: Options): RspressPlugin { builderConfig = {}, } = iframeOptions; const globalUIComponents = - iframePosition === 'fixed' + position === 'fixed' ? [join(staticPath, 'global-components', 'Device.tsx')] : []; const getRouteMeta = () => routeMeta; From ab822fee9325d72230b7bdeafd053308e5c2b282 Mon Sep 17 00:00:00 2001 From: 10Derozan Date: Mon, 25 Mar 2024 17:15:53 +0800 Subject: [PATCH 10/21] fix(core): remove searchHooks in siteData (#839) --- .changeset/lazy-timers-provide.md | 5 +++++ packages/core/src/node/runtimeModule/siteData/index.ts | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/lazy-timers-provide.md diff --git a/.changeset/lazy-timers-provide.md b/.changeset/lazy-timers-provide.md new file mode 100644 index 000000000..46898d0b8 --- /dev/null +++ b/.changeset/lazy-timers-provide.md @@ -0,0 +1,5 @@ +--- +'@rspress/core': patch +--- + +fix: remove searchHooks in siteData diff --git a/packages/core/src/node/runtimeModule/siteData/index.ts b/packages/core/src/node/runtimeModule/siteData/index.ts index 491286c7c..86e1bf594 100644 --- a/packages/core/src/node/runtimeModule/siteData/index.ts +++ b/packages/core/src/node/runtimeModule/siteData/index.ts @@ -115,6 +115,12 @@ export async function siteDataVMPlugin(context: FactoryContext) { }, }; + + // searchHooks is a absolute path which may leak information + if (siteData.search) { + siteData.search.searchHooks = undefined; + } + return { [`${RuntimeModuleID.SiteData}.mjs`]: `export default ${JSON.stringify( siteData, From 5a2e7af9d15064785190a482b2b7f56c16a92236 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:16:34 +0800 Subject: [PATCH 11/21] chore(deps): update dependency @mdx-js/mdx to v2.3.0 (#823) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/plugin-playground/package.json | 2 +- packages/plugin-preview/package.json | 2 +- pnpm-lock.yaml | 32 ++++--------------------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/packages/plugin-playground/package.json b/packages/plugin-playground/package.json index ac6ead55f..71c1fef47 100644 --- a/packages/plugin-playground/package.json +++ b/packages/plugin-playground/package.json @@ -43,7 +43,7 @@ "node": ">=14.17.6" }, "dependencies": { - "@mdx-js/mdx": "2.2.1", + "@mdx-js/mdx": "2.3.0", "@monaco-editor/react": "~4.4.6", "@oxidation-compiler/napi": "^0.2.0", "@rspress/shared": "workspace:*", diff --git a/packages/plugin-preview/package.json b/packages/plugin-preview/package.json index 2fc907586..7f726fe8e 100644 --- a/packages/plugin-preview/package.json +++ b/packages/plugin-preview/package.json @@ -31,7 +31,7 @@ "node": ">=14.17.6" }, "dependencies": { - "@mdx-js/mdx": "2.2.1", + "@mdx-js/mdx": "2.3.0", "@rsbuild/core": "0.5.1", "@rsbuild/plugin-solid": "0.5.1", "@rsbuild/plugin-babel": "0.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 62ab96624..3bbee87ca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -811,8 +811,8 @@ importers: packages/plugin-playground: dependencies: '@mdx-js/mdx': - specifier: 2.2.1 - version: 2.2.1 + specifier: 2.3.0 + version: 2.3.0 '@monaco-editor/react': specifier: ~4.4.6 version: 4.4.6(monaco-editor@0.47.0)(react-dom@18.2.0)(react@18.2.0) @@ -881,8 +881,8 @@ importers: packages/plugin-preview: dependencies: '@mdx-js/mdx': - specifier: 2.2.1 - version: 2.2.1 + specifier: 2.3.0 + version: 2.3.0 '@rsbuild/core': specifier: 0.5.1 version: 0.5.1 @@ -3107,30 +3107,6 @@ packages: - supports-color dev: false - /@mdx-js/mdx@2.2.1: - resolution: {integrity: sha512-hZ3ex7exYLJn6FfReq8yTvA6TE53uW9UHJQM9IlSauOuS55J9y8RtA7W+dzp6Yrzr00/U1sd7q+Wf61q6SfiTQ==} - dependencies: - '@types/estree-jsx': 1.0.0 - '@types/mdx': 2.0.6 - estree-util-build-jsx: 2.2.2 - estree-util-is-identifier-name: 2.1.0 - estree-util-to-js: 1.2.0 - estree-walker: 3.0.3 - hast-util-to-estree: 2.3.3 - markdown-extensions: 1.1.1 - periscopic: 3.1.0 - remark-mdx: 2.3.0 - remark-parse: 10.0.1 - remark-rehype: 10.1.0 - unified: 10.1.2 - unist-util-position-from-estree: 1.1.2 - unist-util-stringify-position: 3.0.3 - unist-util-visit: 4.1.1 - vfile: 5.3.7 - transitivePeerDependencies: - - supports-color - dev: false - /@mdx-js/mdx@2.3.0: resolution: {integrity: sha512-jLuwRlz8DQfQNiUCJR50Y09CGPq3fLtmtUQfVrj79E0JWu3dvsVcxVIcfhR5h0iXu+/z++zDrYeiJqifRynJkA==} dependencies: From 47a2d6ab0f453b8668e3b9e63f92cf2888ec1c8d Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 25 Mar 2024 18:24:45 +0800 Subject: [PATCH 12/21] test(e2e): add case for api-docgen plugin (#862) --- e2e/fixtures/api-docgen/doc/index.mdx | 7 +++ e2e/fixtures/api-docgen/package.json | 17 +++++++ e2e/fixtures/api-docgen/rspress.config.ts | 15 ++++++ e2e/fixtures/api-docgen/src/Button.ts | 13 +++++ e2e/tests/api-docgen.test.ts | 48 +++++++++++++++++++ .../en/plugin/official-plugins/api-docgen.mdx | 4 +- .../zh/plugin/official-plugins/api-docgen.mdx | 4 +- pnpm-lock.yaml | 13 +++++ 8 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 e2e/fixtures/api-docgen/doc/index.mdx create mode 100644 e2e/fixtures/api-docgen/package.json create mode 100644 e2e/fixtures/api-docgen/rspress.config.ts create mode 100644 e2e/fixtures/api-docgen/src/Button.ts create mode 100644 e2e/tests/api-docgen.test.ts diff --git a/e2e/fixtures/api-docgen/doc/index.mdx b/e2e/fixtures/api-docgen/doc/index.mdx new file mode 100644 index 000000000..2f4403453 --- /dev/null +++ b/e2e/fixtures/api-docgen/doc/index.mdx @@ -0,0 +1,7 @@ +# Hello World + +## API + +This is API Table + + diff --git a/e2e/fixtures/api-docgen/package.json b/e2e/fixtures/api-docgen/package.json new file mode 100644 index 000000000..9969e17bb --- /dev/null +++ b/e2e/fixtures/api-docgen/package.json @@ -0,0 +1,17 @@ +{ + "name": "@rspress-fixture/rspress-api-docgen", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "rspress dev", + "build": "rspress build", + "preview": "rspress preview" + }, + "dependencies": { + "@rspress/plugin-api-docgen": "workspace:*", + "rspress": "workspace:*" + }, + "devDependencies": { + "@types/node": "^14" + } +} diff --git a/e2e/fixtures/api-docgen/rspress.config.ts b/e2e/fixtures/api-docgen/rspress.config.ts new file mode 100644 index 000000000..aed2b8a87 --- /dev/null +++ b/e2e/fixtures/api-docgen/rspress.config.ts @@ -0,0 +1,15 @@ +import path from 'path'; +import { defineConfig } from 'rspress/config'; +import { pluginApiDocgen } from '@rspress/plugin-api-docgen'; + +export default defineConfig({ + root: path.join(__dirname, 'doc'), + plugins: [ + pluginApiDocgen({ + entries: { + button: './src/Button.ts', + }, + apiParseTool: 'react-docgen-typescript', + }), + ], +}); diff --git a/e2e/fixtures/api-docgen/src/Button.ts b/e2e/fixtures/api-docgen/src/Button.ts new file mode 100644 index 000000000..4933cb8f2 --- /dev/null +++ b/e2e/fixtures/api-docgen/src/Button.ts @@ -0,0 +1,13 @@ +export type ButtonProps = { + /** + * Whether to disable the button + */ + disabled?: boolean; + /** + * Type of Button + * @default 'default' + */ + size?: 'mini' | 'small' | 'default' | 'large'; +}; + +export const Button = (props?: ButtonProps) => {}; diff --git a/e2e/tests/api-docgen.test.ts b/e2e/tests/api-docgen.test.ts new file mode 100644 index 000000000..1755b6a1c --- /dev/null +++ b/e2e/tests/api-docgen.test.ts @@ -0,0 +1,48 @@ +import { expect, test } from '@playwright/test'; +import path from 'path'; +import { getPort, killProcess, runDevCommand } from '../utils/runCommands'; + +const fixtureDir = path.resolve(__dirname, '../fixtures'); + +test.describe('api-docgen test', async () => { + let appPort; + let app; + + test.beforeAll(async () => { + const appDir = path.join(fixtureDir, 'api-docgen'); + appPort = await getPort(); + app = await runDevCommand(appDir, appPort); + }); + + test.afterAll(async () => { + if (app) { + await killProcess(app); + } + }); + + test('Index page', async ({ page }) => { + await page.goto(`http://localhost:${appPort}`); + const table = await page.$('table'); + const tableContent = await page.evaluate(table => table?.innerHTML, table); + + // Property + expect(tableContent).toContain('Property'); + expect(tableContent).toContain('disabled'); + expect(tableContent).toContain('size'); + + // Description + expect(tableContent).toContain('Description'); + expect(tableContent).toContain('Whether to disable the button'); + expect(tableContent).toContain('Type of Button'); + + // Type + expect(tableContent).toContain('Type'); + expect(tableContent).toContain('boolean'); + expect(tableContent).toContain('"mini" | "small" | "default" | "large"'); + + // Default Value + expect(tableContent).toContain('Default Value'); + expect(tableContent).toContain('-'); + expect(tableContent).toContain("'default'"); + }); +}); diff --git a/packages/document/docs/en/plugin/official-plugins/api-docgen.mdx b/packages/document/docs/en/plugin/official-plugins/api-docgen.mdx index d48d7600f..902cf1d4e 100644 --- a/packages/document/docs/en/plugin/official-plugins/api-docgen.mdx +++ b/packages/document/docs/en/plugin/official-plugins/api-docgen.mdx @@ -30,12 +30,12 @@ export default defineConfig({ Then you can use API component to inject api documentation to your mdx file: -```md +```mdx ## API This is API Table - + ``` ## Config diff --git a/packages/document/docs/zh/plugin/official-plugins/api-docgen.mdx b/packages/document/docs/zh/plugin/official-plugins/api-docgen.mdx index db6a0ae30..b6c455269 100644 --- a/packages/document/docs/zh/plugin/official-plugins/api-docgen.mdx +++ b/packages/document/docs/zh/plugin/official-plugins/api-docgen.mdx @@ -30,12 +30,12 @@ export default defineConfig({ 然后你可以在 MDX 中使用 API 组件将 API 内容注入到文档中: -```md +```mdx ## API 这是 API 表格 - + ``` ## 配置 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3bbee87ca..c8a88babf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,6 +75,19 @@ importers: specifier: 0.34.1 version: 0.34.1(playwright@1.33.0) + e2e/fixtures/api-docgen: + dependencies: + '@rspress/plugin-api-docgen': + specifier: workspace:* + version: link:../../../packages/plugin-api-docgen + rspress: + specifier: workspace:* + version: link:../../../packages/cli + devDependencies: + '@types/node': + specifier: ^14 + version: 14.0.0 + e2e/fixtures/auto-nav-sidebar: dependencies: rspress: From 37e626d38b4f12aa74ca00ed4375118fd06240be Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 25 Mar 2024 20:37:25 +0800 Subject: [PATCH 13/21] fix(api-docgen): allow multiple lines description (#863) --- .changeset/pink-knives-compare.md | 5 +++++ e2e/fixtures/api-docgen/src/Button.ts | 2 ++ e2e/tests/api-docgen.test.ts | 2 ++ packages/plugin-api-docgen/src/docgen.ts | 7 ++++++- .../plugin-api-docgen/static/global-components/API.scss | 5 +++++ 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changeset/pink-knives-compare.md diff --git a/.changeset/pink-knives-compare.md b/.changeset/pink-knives-compare.md new file mode 100644 index 000000000..abd83dc30 --- /dev/null +++ b/.changeset/pink-knives-compare.md @@ -0,0 +1,5 @@ +--- +"@rspress/plugin-api-docgen": patch +--- + +fix(api-docgen): allow multiple lines description diff --git a/e2e/fixtures/api-docgen/src/Button.ts b/e2e/fixtures/api-docgen/src/Button.ts index 4933cb8f2..63cf5753f 100644 --- a/e2e/fixtures/api-docgen/src/Button.ts +++ b/e2e/fixtures/api-docgen/src/Button.ts @@ -1,6 +1,8 @@ export type ButtonProps = { /** * Whether to disable the button + * - This is extra line a + * - This is extra line b */ disabled?: boolean; /** diff --git a/e2e/tests/api-docgen.test.ts b/e2e/tests/api-docgen.test.ts index 1755b6a1c..130d2b470 100644 --- a/e2e/tests/api-docgen.test.ts +++ b/e2e/tests/api-docgen.test.ts @@ -33,6 +33,8 @@ test.describe('api-docgen test', async () => { // Description expect(tableContent).toContain('Description'); expect(tableContent).toContain('Whether to disable the button'); + expect(tableContent).toContain('- This is extra line a'); + expect(tableContent).toContain('- This is extra line b'); expect(tableContent).toContain('Type of Button'); // Type diff --git a/packages/plugin-api-docgen/src/docgen.ts b/packages/plugin-api-docgen/src/docgen.ts index 82ada36ae..686101177 100644 --- a/packages/plugin-api-docgen/src/docgen.ts +++ b/packages/plugin-api-docgen/src/docgen.ts @@ -196,7 +196,12 @@ function generateTable(componentDoc: ComponentDoc[], language: 'zh' | 'en') { return description; } }; - return `|${[name, getDescription(), getType(), getDefaultValue()] + + const formattedDescription = getDescription() + // allow newline + .replace(/\n/g, ' '); + + return `|${[name, formattedDescription, getType(), getDefaultValue()] .map(str => str.replace(/(? Date: Tue, 26 Mar 2024 14:01:07 +0800 Subject: [PATCH 14/21] fix: icon/logo display error in dark mode when refresh page (#866) --- .changeset/nice-sloths-invent.md | 6 ++++++ packages/core/src/runtime/clientEntry.tsx | 1 + .../src/components/Nav/NavBarTitle.tsx | 9 ++++++--- .../src/components/SvgWrapper/index.tsx | 3 +++ .../src/components/SwitchAppearance/index.tsx | 20 +++++++++++-------- 5 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 .changeset/nice-sloths-invent.md diff --git a/.changeset/nice-sloths-invent.md b/.changeset/nice-sloths-invent.md new file mode 100644 index 000000000..ef1a7fad9 --- /dev/null +++ b/.changeset/nice-sloths-invent.md @@ -0,0 +1,6 @@ +--- +"@rspress/theme-default": patch +"@rspress/core": patch +--- + +fix: icon/logo display error in dark mode when refresh page diff --git a/packages/core/src/runtime/clientEntry.tsx b/packages/core/src/runtime/clientEntry.tsx index 7d6ffe08e..e8235fbd0 100644 --- a/packages/core/src/runtime/clientEntry.tsx +++ b/packages/core/src/runtime/clientEntry.tsx @@ -16,6 +16,7 @@ const { default: Theme } = require('@theme'); export async function renderInBrowser() { const container = document.getElementById('root')!; + const enhancedApp = async () => { const initialPageData = await initPageData( normalizeRoutePath(window.location.pathname), diff --git a/packages/theme-default/src/components/Nav/NavBarTitle.tsx b/packages/theme-default/src/components/Nav/NavBarTitle.tsx index c4a481ec1..faeeb8ceb 100644 --- a/packages/theme-default/src/components/Nav/NavBarTitle.tsx +++ b/packages/theme-default/src/components/Nav/NavBarTitle.tsx @@ -15,10 +15,13 @@ export const NavBarTitle = () => { const title = localeData.title ?? siteData.title; const { theme } = useContext(ThemeContext); const [logo, setLogo] = useState(getLogoUrl(rawLogo, theme)); + const [logoVisible, setLogoVisible] = useState(false); useEffect(() => { - setLogo(getLogoUrl(rawLogo, theme)); - }, [theme]); + setLogoVisible(true); + const newLogoUrl = getLogoUrl(rawLogo, theme); + setLogo(newLogoUrl); + }, [theme, rawLogo]); return (
@@ -26,7 +29,7 @@ export const NavBarTitle = () => { href={withBase(localeData.langRoutePrefix || '/')} className="flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60" > - {logo && ( + {logo && logoVisible && ( logo>; } & React.SVGAttributes) { + if (!Icon) { + return null; + } if (typeof Icon === 'string') { return ; } diff --git a/packages/theme-default/src/components/SwitchAppearance/index.tsx b/packages/theme-default/src/components/SwitchAppearance/index.tsx index 5525c03f4..de766d536 100644 --- a/packages/theme-default/src/components/SwitchAppearance/index.tsx +++ b/packages/theme-default/src/components/SwitchAppearance/index.tsx @@ -1,4 +1,4 @@ -import { useContext, useEffect } from 'react'; +import { useContext, useEffect, useState } from 'react'; import { ThemeContext } from '@rspress/runtime'; import SunSvg from '@theme-assets/sun'; import MoonSvg from '@theme-assets/moon'; @@ -16,6 +16,7 @@ export function SwitchAppearance({ onClick }: { onClick?: () => void }) { const isDark = updateUserPreferenceFromStorage(); setTheme(isDark ? 'dark' : 'light'); }; + const [iconVisible, setIconVisible] = useState(false); useEffect(() => { if (isDarkMode()) { @@ -24,6 +25,7 @@ export function SwitchAppearance({ onClick }: { onClick?: () => void }) { if (typeof window !== 'undefined') { window.addEventListener('storage', updateAppearanceAndTheme); } + setIconVisible(true); return () => { if (typeof window !== 'undefined') { window.removeEventListener('storage', updateAppearanceAndTheme); @@ -40,13 +42,15 @@ export function SwitchAppearance({ onClick }: { onClick?: () => void }) { }} className="md:mr-2 rspress-nav-appearance" > -
- +
+ {iconVisible && ( + + )}
); From 6645267df0b2782a2f378ad2afaaa928e93e5615 Mon Sep 17 00:00:00 2001 From: yangxingyuan <39261479+sanyuan0704@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:29:02 +0800 Subject: [PATCH 15/21] Release v1.16.1 (#867) Co-authored-by: github-actions[bot] --- .changeset/chilly-pumpkins-remember.md | 5 ----- .changeset/lazy-timers-provide.md | 5 ----- .changeset/metal-papayas-live.md | 5 ----- .changeset/nice-sloths-invent.md | 6 ------ .changeset/nine-hotels-sleep.md | 5 ----- .changeset/pink-knives-compare.md | 5 ----- .changeset/purple-flies-kiss.md | 5 ----- .changeset/wet-ears-suffer.md | 8 -------- packages/cli/CHANGELOG.md | 11 +++++++++++ packages/cli/package.json | 2 +- packages/core/CHANGELOG.md | 18 ++++++++++++++++++ packages/core/package.json | 2 +- packages/create-rspress/CHANGELOG.md | 2 ++ packages/create-rspress/package.json | 2 +- packages/document/CHANGELOG.md | 8 ++++++++ packages/document/package.json | 2 +- packages/modern-plugin-rspress/CHANGELOG.md | 14 ++++++++++++++ packages/modern-plugin-rspress/package.json | 2 +- packages/plugin-api-docgen/CHANGELOG.md | 6 ++++++ packages/plugin-api-docgen/package.json | 2 +- packages/plugin-auto-nav-sidebar/CHANGELOG.md | 7 +++++++ packages/plugin-auto-nav-sidebar/package.json | 2 +- packages/plugin-container-syntax/CHANGELOG.md | 7 +++++++ packages/plugin-container-syntax/package.json | 2 +- packages/plugin-last-updated/CHANGELOG.md | 7 +++++++ packages/plugin-last-updated/package.json | 2 +- packages/plugin-medium-zoom/CHANGELOG.md | 2 ++ packages/plugin-medium-zoom/package.json | 2 +- packages/plugin-playground/CHANGELOG.md | 7 +++++++ packages/plugin-playground/package.json | 2 +- packages/plugin-preview/CHANGELOG.md | 10 ++++++++++ packages/plugin-preview/package.json | 2 +- packages/plugin-shiki/CHANGELOG.md | 7 +++++++ packages/plugin-shiki/package.json | 2 +- packages/plugin-typedoc/CHANGELOG.md | 7 +++++++ packages/plugin-typedoc/package.json | 2 +- packages/runtime/CHANGELOG.md | 7 +++++++ packages/runtime/package.json | 2 +- packages/shared/CHANGELOG.md | 6 ++++++ packages/shared/package.json | 2 +- packages/theme-default/CHANGELOG.md | 10 ++++++++++ packages/theme-default/package.json | 7 +++++-- 42 files changed, 157 insertions(+), 62 deletions(-) delete mode 100644 .changeset/chilly-pumpkins-remember.md delete mode 100644 .changeset/lazy-timers-provide.md delete mode 100644 .changeset/metal-papayas-live.md delete mode 100644 .changeset/nice-sloths-invent.md delete mode 100644 .changeset/nine-hotels-sleep.md delete mode 100644 .changeset/pink-knives-compare.md delete mode 100644 .changeset/purple-flies-kiss.md delete mode 100644 .changeset/wet-ears-suffer.md diff --git a/.changeset/chilly-pumpkins-remember.md b/.changeset/chilly-pumpkins-remember.md deleted file mode 100644 index bd2e39d2f..000000000 --- a/.changeset/chilly-pumpkins-remember.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@rspress/core': patch ---- - -fix(core): replace flattened mdx content by rules diff --git a/.changeset/lazy-timers-provide.md b/.changeset/lazy-timers-provide.md deleted file mode 100644 index 46898d0b8..000000000 --- a/.changeset/lazy-timers-provide.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@rspress/core': patch ---- - -fix: remove searchHooks in siteData diff --git a/.changeset/metal-papayas-live.md b/.changeset/metal-papayas-live.md deleted file mode 100644 index dfbb3b757..000000000 --- a/.changeset/metal-papayas-live.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@rspress/docs": patch ---- - -fix(doc): fix logo sidebar cannot be used properly. diff --git a/.changeset/nice-sloths-invent.md b/.changeset/nice-sloths-invent.md deleted file mode 100644 index ef1a7fad9..000000000 --- a/.changeset/nice-sloths-invent.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@rspress/theme-default": patch -"@rspress/core": patch ---- - -fix: icon/logo display error in dark mode when refresh page diff --git a/.changeset/nine-hotels-sleep.md b/.changeset/nine-hotels-sleep.md deleted file mode 100644 index 038a02ad4..000000000 --- a/.changeset/nine-hotels-sleep.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@rspress/docs": patch ---- - -Document setup steps for using Tailwind CSS with Rspress diff --git a/.changeset/pink-knives-compare.md b/.changeset/pink-knives-compare.md deleted file mode 100644 index abd83dc30..000000000 --- a/.changeset/pink-knives-compare.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@rspress/plugin-api-docgen": patch ---- - -fix(api-docgen): allow multiple lines description diff --git a/.changeset/purple-flies-kiss.md b/.changeset/purple-flies-kiss.md deleted file mode 100644 index 8303e4b85..000000000 --- a/.changeset/purple-flies-kiss.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@rspress/plugin-preview': patch ---- - -fix: replace iframePosition with iframe.position diff --git a/.changeset/wet-ears-suffer.md b/.changeset/wet-ears-suffer.md deleted file mode 100644 index da2f49a83..000000000 --- a/.changeset/wet-ears-suffer.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@rspress/theme-default": patch -"@rspress/docs": patch -"@rspress/shared": patch -"@rspress/core": patch ---- - -feat: support logo text config diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 6a2e9d01d..e32a019e7 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,16 @@ # rspress +## 1.16.1 + +### Patch Changes + +- Updated dependencies [1a22fe0] +- Updated dependencies [ab822fe] +- Updated dependencies [b872bd5] +- Updated dependencies [145bb16] + - @rspress/core@1.16.1 + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index c9829778c..a02d578e0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "rspress", - "version": "1.16.0", + "version": "1.16.1", "type": "module", "types": "./dist/index.d.ts", "main": "./dist/index.js", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index f686533bc..3df944c34 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,23 @@ # @rspress/core +## 1.16.1 + +### Patch Changes + +- 1a22fe0: fix(core): replace flattened mdx content by rules +- ab822fe: fix: remove searchHooks in siteData +- b872bd5: fix: icon/logo display error in dark mode when refresh page +- 145bb16: feat: support logo text config +- Updated dependencies [b872bd5] +- Updated dependencies [145bb16] + - @rspress/theme-default@1.16.1 + - @rspress/shared@1.16.1 + - @rspress/plugin-auto-nav-sidebar@1.16.1 + - @rspress/plugin-container-syntax@1.16.1 + - @rspress/plugin-last-updated@1.16.1 + - @rspress/plugin-medium-zoom@1.16.1 + - @rspress/runtime@1.16.1 + ## 1.16.0 ### Minor Changes diff --git a/packages/core/package.json b/packages/core/package.json index 6625ace1d..d18f285fa 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/core", - "version": "1.16.0", + "version": "1.16.1", "description": "The Rspress Documentation Framework", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/create-rspress/CHANGELOG.md b/packages/create-rspress/CHANGELOG.md index a36ceb5c6..0c4743b7d 100644 --- a/packages/create-rspress/CHANGELOG.md +++ b/packages/create-rspress/CHANGELOG.md @@ -1,5 +1,7 @@ # create-rspress +## 1.16.1 + ## 1.16.0 ## 1.15.1 diff --git a/packages/create-rspress/package.json b/packages/create-rspress/package.json index f1e0f6388..2dd9c47f6 100644 --- a/packages/create-rspress/package.json +++ b/packages/create-rspress/package.json @@ -1,6 +1,6 @@ { "name": "create-rspress", - "version": "1.16.0", + "version": "1.16.1", "types": "./dist/index.d.ts", "main": "./dist/index.js", "module": "./dist/index.js", diff --git a/packages/document/CHANGELOG.md b/packages/document/CHANGELOG.md index e28aae84e..68fe5b75a 100644 --- a/packages/document/CHANGELOG.md +++ b/packages/document/CHANGELOG.md @@ -1,5 +1,13 @@ # @rspress/docs +## 1.16.1 + +### Patch Changes + +- 7e0d6aa: fix(doc): fix logo sidebar cannot be used properly. +- 6ea2cba: Document setup steps for using Tailwind CSS with Rspress +- 145bb16: feat: support logo text config + ## 1.16.0 ## 1.15.1 diff --git a/packages/document/package.json b/packages/document/package.json index b47c2be48..8cca40ede 100644 --- a/packages/document/package.json +++ b/packages/document/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/docs", - "version": "1.16.0", + "version": "1.16.1", "description": "", "main": "index.js", "scripts": { diff --git a/packages/modern-plugin-rspress/CHANGELOG.md b/packages/modern-plugin-rspress/CHANGELOG.md index b0f1e4bbc..e9e60a9d0 100644 --- a/packages/modern-plugin-rspress/CHANGELOG.md +++ b/packages/modern-plugin-rspress/CHANGELOG.md @@ -1,5 +1,19 @@ # @modern-js/plugin-rspress +## 1.16.1 + +### Patch Changes + +- Updated dependencies [1a22fe0] +- Updated dependencies [ab822fe] +- Updated dependencies [b872bd5] +- Updated dependencies [37e626d] +- Updated dependencies [609ef99] +- Updated dependencies [145bb16] + - @rspress/core@1.16.1 + - @rspress/plugin-api-docgen@1.16.1 + - @rspress/plugin-preview@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/modern-plugin-rspress/package.json b/packages/modern-plugin-rspress/package.json index 74ab7b101..a189a1546 100644 --- a/packages/modern-plugin-rspress/package.json +++ b/packages/modern-plugin-rspress/package.json @@ -15,7 +15,7 @@ "modern", "modern.js" ], - "version": "1.16.0", + "version": "1.16.1", "jsnext:source": "./src/index.ts", "types": "./dist/index.d.ts", "main": "./dist/index.js", diff --git a/packages/plugin-api-docgen/CHANGELOG.md b/packages/plugin-api-docgen/CHANGELOG.md index b99f68684..f93c9298e 100644 --- a/packages/plugin-api-docgen/CHANGELOG.md +++ b/packages/plugin-api-docgen/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/plugin-api-docgen +## 1.16.1 + +### Patch Changes + +- 37e626d: fix(api-docgen): allow multiple lines description + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-api-docgen/package.json b/packages/plugin-api-docgen/package.json index c1ec62969..fdd57e182 100644 --- a/packages/plugin-api-docgen/package.json +++ b/packages/plugin-api-docgen/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-api-docgen", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to generate api doc.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-auto-nav-sidebar/CHANGELOG.md b/packages/plugin-auto-nav-sidebar/CHANGELOG.md index 7679a27b0..8916c2879 100644 --- a/packages/plugin-auto-nav-sidebar/CHANGELOG.md +++ b/packages/plugin-auto-nav-sidebar/CHANGELOG.md @@ -1,5 +1,12 @@ # @rspress/plugin-auto-sidebar +## 1.16.1 + +### Patch Changes + +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-auto-nav-sidebar/package.json b/packages/plugin-auto-nav-sidebar/package.json index ee8272e6a..107dee267 100644 --- a/packages/plugin-auto-nav-sidebar/package.json +++ b/packages/plugin-auto-nav-sidebar/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-auto-nav-sidebar", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to generate navbar and sidebar config automatically.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-container-syntax/CHANGELOG.md b/packages/plugin-container-syntax/CHANGELOG.md index 8c6db831e..3e9028937 100644 --- a/packages/plugin-container-syntax/CHANGELOG.md +++ b/packages/plugin-container-syntax/CHANGELOG.md @@ -1,5 +1,12 @@ # @rspress/remark-container +## 1.16.1 + +### Patch Changes + +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-container-syntax/package.json b/packages/plugin-container-syntax/package.json index 9fb756e02..2f7796ccc 100644 --- a/packages/plugin-container-syntax/package.json +++ b/packages/plugin-container-syntax/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-container-syntax", - "version": "1.16.0", + "version": "1.16.1", "description": "A remark plugin to support container syntax", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-last-updated/CHANGELOG.md b/packages/plugin-last-updated/CHANGELOG.md index 613697eb8..2aaaa367d 100644 --- a/packages/plugin-last-updated/CHANGELOG.md +++ b/packages/plugin-last-updated/CHANGELOG.md @@ -1,5 +1,12 @@ # @rspress/plugin-last-updated +## 1.16.1 + +### Patch Changes + +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-last-updated/package.json b/packages/plugin-last-updated/package.json index c229737b4..7bc82759b 100644 --- a/packages/plugin-last-updated/package.json +++ b/packages/plugin-last-updated/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-last-updated", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to record the last updated time of the doc.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-medium-zoom/CHANGELOG.md b/packages/plugin-medium-zoom/CHANGELOG.md index 9095157f9..4ecfc9c9f 100644 --- a/packages/plugin-medium-zoom/CHANGELOG.md +++ b/packages/plugin-medium-zoom/CHANGELOG.md @@ -1,5 +1,7 @@ # @rspress/plugin-medium-zoom +## 1.16.1 + ## 1.16.0 ## 1.15.1 diff --git a/packages/plugin-medium-zoom/package.json b/packages/plugin-medium-zoom/package.json index 61d24bcbf..fc2651b41 100644 --- a/packages/plugin-medium-zoom/package.json +++ b/packages/plugin-medium-zoom/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-medium-zoom", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to zoom images in docs.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-playground/CHANGELOG.md b/packages/plugin-playground/CHANGELOG.md index 865b5d936..1a8f24fea 100644 --- a/packages/plugin-playground/CHANGELOG.md +++ b/packages/plugin-playground/CHANGELOG.md @@ -1,5 +1,12 @@ # @rspress/plugin-playground +## 1.16.1 + +### Patch Changes + +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-playground/package.json b/packages/plugin-playground/package.json index 71c1fef47..c5c66bc2c 100644 --- a/packages/plugin-playground/package.json +++ b/packages/plugin-playground/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-playground", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to preview the code block in markdown/mdx file.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-preview/CHANGELOG.md b/packages/plugin-preview/CHANGELOG.md index 88adf578e..001866139 100644 --- a/packages/plugin-preview/CHANGELOG.md +++ b/packages/plugin-preview/CHANGELOG.md @@ -1,5 +1,15 @@ # @rspress/plugin-preview +## 1.16.1 + +### Patch Changes + +- 609ef99: fix: replace iframePosition with iframe.position +- Updated dependencies [b872bd5] +- Updated dependencies [145bb16] + - @rspress/theme-default@1.16.1 + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-preview/package.json b/packages/plugin-preview/package.json index 7f726fe8e..cfd752b11 100644 --- a/packages/plugin-preview/package.json +++ b/packages/plugin-preview/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-preview", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to preview the code block in markdown/mdx file.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-shiki/CHANGELOG.md b/packages/plugin-shiki/CHANGELOG.md index f1c34e4f8..e0eb0751d 100644 --- a/packages/plugin-shiki/CHANGELOG.md +++ b/packages/plugin-shiki/CHANGELOG.md @@ -1,5 +1,12 @@ # @rspress/plugin-shiki +## 1.16.1 + +### Patch Changes + +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-shiki/package.json b/packages/plugin-shiki/package.json index d710d9a43..f2fa85e6f 100644 --- a/packages/plugin-shiki/package.json +++ b/packages/plugin-shiki/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-shiki", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to record the last updated time of the doc.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-typedoc/CHANGELOG.md b/packages/plugin-typedoc/CHANGELOG.md index a52309212..a3d2d6a16 100644 --- a/packages/plugin-typedoc/CHANGELOG.md +++ b/packages/plugin-typedoc/CHANGELOG.md @@ -1,5 +1,12 @@ # @rspress/plugin-typedoc +## 1.16.1 + +### Patch Changes + +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/plugin-typedoc/package.json b/packages/plugin-typedoc/package.json index ac3d97177..e8582dcac 100644 --- a/packages/plugin-typedoc/package.json +++ b/packages/plugin-typedoc/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-typedoc", - "version": "1.16.0", + "version": "1.16.1", "description": "A plugin for rspress to integrate typedoc", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index ea28ededc..0a452884c 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,12 @@ # @rspress/runtime +## 1.16.1 + +### Patch Changes + +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + ## 1.16.0 ### Patch Changes diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 1041777be..5c39a083d 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/runtime", - "version": "1.16.0", + "version": "1.16.1", "description": "The Runtime of Rspress Documentation Framework", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/shared/CHANGELOG.md b/packages/shared/CHANGELOG.md index 1521c16c9..0e6a453cb 100644 --- a/packages/shared/CHANGELOG.md +++ b/packages/shared/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/shared +## 1.16.1 + +### Patch Changes + +- 145bb16: feat: support logo text config + ## 1.16.0 ### Patch Changes diff --git a/packages/shared/package.json b/packages/shared/package.json index 461cc31b1..f2c423869 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/shared", - "version": "1.16.0", + "version": "1.16.1", "types": "./dist/index.d.ts", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/packages/theme-default/CHANGELOG.md b/packages/theme-default/CHANGELOG.md index 72985226e..7613c51fe 100644 --- a/packages/theme-default/CHANGELOG.md +++ b/packages/theme-default/CHANGELOG.md @@ -1,5 +1,15 @@ # @rspress/theme-default +## 1.16.1 + +### Patch Changes + +- b872bd5: fix: icon/logo display error in dark mode when refresh page +- 145bb16: feat: support logo text config +- Updated dependencies [145bb16] + - @rspress/shared@1.16.1 + - @rspress/runtime@1.16.1 + ## 1.16.0 ### Minor Changes diff --git a/packages/theme-default/package.json b/packages/theme-default/package.json index ece6ab5bb..cc72f786b 100644 --- a/packages/theme-default/package.json +++ b/packages/theme-default/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/theme-default", - "version": "1.16.0", + "version": "1.16.1", "description": "The Default Theme of Rspress Documentation Framework", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -95,7 +95,10 @@ "virtual-global-styles", "./src/styles/index.ts" ], - "files": ["dist", "src"], + "files": [ + "dist", + "src" + ], "publishConfig": { "access": "public", "provenance": true, From 2c94c502874d634d1661a3d7c1b84e03a4f45da5 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 26 Mar 2024 21:22:16 +0800 Subject: [PATCH 16/21] chore(workflow): add GitHub release yaml config (#868) --- .github/release.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 000000000..c5b38062d --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,26 @@ +# .github/release.yml + +changelog: + exclude: + authors: + # Ignore the release PR created by github-actions + - github-actions + categories: + - title: Breaking Changes 🍭 + labels: + - "change: breaking" + - title: New Features 🎉 + labels: + - "change: feat" + - title: Performance 🚀 + labels: + - "change: perf" + - title: Bug Fixes 🐞 + labels: + - "change: fix" + - title: Document 📖 + labels: + - "change: docs" + - title: Other Changes + labels: + - "*" From 37b4ffe3f2396d32239d77d3c9ea0ea29bf8d061 Mon Sep 17 00:00:00 2001 From: dr2009 Date: Wed, 27 Mar 2024 17:05:47 +0800 Subject: [PATCH 17/21] fix(core): set ssg: false in plugin not work in build mode (#871) --- .changeset/swift-needles-tickle.md | 5 +++++ packages/core/src/node/build.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/swift-needles-tickle.md diff --git a/.changeset/swift-needles-tickle.md b/.changeset/swift-needles-tickle.md new file mode 100644 index 000000000..3791dd4fa --- /dev/null +++ b/.changeset/swift-needles-tickle.md @@ -0,0 +1,5 @@ +--- +"@rspress/core": patch +--- + +fix(core): set ssg:false in plugin not work in build mode diff --git a/packages/core/src/node/build.ts b/packages/core/src/node/build.ts index cb5c48781..8626d52c8 100644 --- a/packages/core/src/node/build.ts +++ b/packages/core/src/node/build.ts @@ -228,10 +228,10 @@ export async function renderPages( export async function build(options: BuildOptions) { const { docDirectory, appDirectory, config } = options; const pluginDriver = new PluginDriver(config, true); - const enableSSG = config.ssg ?? true; await pluginDriver.init(); const modifiedConfig = await pluginDriver.modifyConfig(); await pluginDriver.beforeBuild(); + const enableSSG = modifiedConfig.ssg ?? true; // empty temp dir before build await fs.emptyDir(TEMP_DIR); From 5d88d28fdd02c7531b7196342284457961ad51f6 Mon Sep 17 00:00:00 2001 From: Timeless0911 <50201324+Timeless0911@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:33:57 +0800 Subject: [PATCH 18/21] fix(core): section header text should return i18n result (#870) --- .changeset/tame-rivers-drop.md | 5 ++ e2e/fixtures/i18n/doc/en/guide/_meta.json | 14 ++++++ .../i18n/doc/en/guide/{ => basic}/install.mdx | 0 .../doc/en/guide/{ => basic}/quick-start.mdx | 2 +- e2e/fixtures/i18n/doc/zh/guide/_meta.json | 14 ++++++ .../i18n/doc/zh/guide/{ => basic}/install.mdx | 0 .../doc/zh/guide/{ => basic}/quick-start.mdx | 2 +- e2e/fixtures/i18n/i18n.json | 10 ++++ e2e/fixtures/i18n/rspress.config.ts | 26 ---------- e2e/tests/i18n.test.ts | 50 ++++++++++++++++--- .../siteData/normalizeThemeConfig.ts | 13 ++++- 11 files changed, 98 insertions(+), 38 deletions(-) create mode 100644 .changeset/tame-rivers-drop.md create mode 100644 e2e/fixtures/i18n/doc/en/guide/_meta.json rename e2e/fixtures/i18n/doc/en/guide/{ => basic}/install.mdx (100%) rename e2e/fixtures/i18n/doc/en/guide/{ => basic}/quick-start.mdx (52%) create mode 100644 e2e/fixtures/i18n/doc/zh/guide/_meta.json rename e2e/fixtures/i18n/doc/zh/guide/{ => basic}/install.mdx (100%) rename e2e/fixtures/i18n/doc/zh/guide/{ => basic}/quick-start.mdx (52%) create mode 100644 e2e/fixtures/i18n/i18n.json diff --git a/.changeset/tame-rivers-drop.md b/.changeset/tame-rivers-drop.md new file mode 100644 index 000000000..29aecc858 --- /dev/null +++ b/.changeset/tame-rivers-drop.md @@ -0,0 +1,5 @@ +--- +"@rspress/core": patch +--- + +fix(core): section header text should return i18n result diff --git a/e2e/fixtures/i18n/doc/en/guide/_meta.json b/e2e/fixtures/i18n/doc/en/guide/_meta.json new file mode 100644 index 000000000..e5168d53d --- /dev/null +++ b/e2e/fixtures/i18n/doc/en/guide/_meta.json @@ -0,0 +1,14 @@ +[ + { + "type": "dir", + "name": "basic", + "label": "basic" + }, + { + "type": "divider" + }, + { + "type": "section-header", + "label": "growth" + } +] diff --git a/e2e/fixtures/i18n/doc/en/guide/install.mdx b/e2e/fixtures/i18n/doc/en/guide/basic/install.mdx similarity index 100% rename from e2e/fixtures/i18n/doc/en/guide/install.mdx rename to e2e/fixtures/i18n/doc/en/guide/basic/install.mdx diff --git a/e2e/fixtures/i18n/doc/en/guide/quick-start.mdx b/e2e/fixtures/i18n/doc/en/guide/basic/quick-start.mdx similarity index 52% rename from e2e/fixtures/i18n/doc/en/guide/quick-start.mdx rename to e2e/fixtures/i18n/doc/en/guide/basic/quick-start.mdx index 30df48488..51f307de5 100644 --- a/e2e/fixtures/i18n/doc/en/guide/quick-start.mdx +++ b/e2e/fixtures/i18n/doc/en/guide/basic/quick-start.mdx @@ -1,5 +1,5 @@ # Quick Start -[click by absolute path](/guide/install) to go to install +[click by absolute path](/guide/basic/install) to go to install [click for relative path](./install) to go to install diff --git a/e2e/fixtures/i18n/doc/zh/guide/_meta.json b/e2e/fixtures/i18n/doc/zh/guide/_meta.json new file mode 100644 index 000000000..e5168d53d --- /dev/null +++ b/e2e/fixtures/i18n/doc/zh/guide/_meta.json @@ -0,0 +1,14 @@ +[ + { + "type": "dir", + "name": "basic", + "label": "basic" + }, + { + "type": "divider" + }, + { + "type": "section-header", + "label": "growth" + } +] diff --git a/e2e/fixtures/i18n/doc/zh/guide/install.mdx b/e2e/fixtures/i18n/doc/zh/guide/basic/install.mdx similarity index 100% rename from e2e/fixtures/i18n/doc/zh/guide/install.mdx rename to e2e/fixtures/i18n/doc/zh/guide/basic/install.mdx diff --git a/e2e/fixtures/i18n/doc/zh/guide/quick-start.mdx b/e2e/fixtures/i18n/doc/zh/guide/basic/quick-start.mdx similarity index 52% rename from e2e/fixtures/i18n/doc/zh/guide/quick-start.mdx rename to e2e/fixtures/i18n/doc/zh/guide/basic/quick-start.mdx index 9491f61f9..a97e266c6 100644 --- a/e2e/fixtures/i18n/doc/zh/guide/quick-start.mdx +++ b/e2e/fixtures/i18n/doc/zh/guide/basic/quick-start.mdx @@ -1,5 +1,5 @@ # 快速开始 -[点击通过绝对路径](/guide/install) 跳往安装 +[点击通过绝对路径](/guide/basic/install) 跳往安装 [点击通过相对路径](./install) 跳往安装 diff --git a/e2e/fixtures/i18n/i18n.json b/e2e/fixtures/i18n/i18n.json new file mode 100644 index 000000000..5ff45aa52 --- /dev/null +++ b/e2e/fixtures/i18n/i18n.json @@ -0,0 +1,10 @@ +{ + "basic": { + "zh": "基本", + "en": "Basic" + }, + "growth": { + "zh": "成长", + "en": "Growth" + } +} diff --git a/e2e/fixtures/i18n/rspress.config.ts b/e2e/fixtures/i18n/rspress.config.ts index 22152e69b..c6a57a2f4 100644 --- a/e2e/fixtures/i18n/rspress.config.ts +++ b/e2e/fixtures/i18n/rspress.config.ts @@ -14,19 +14,6 @@ export default defineConfig({ lang: 'zh', title: '一个很棒的项目', description: '一个很棒的项目描述', - sidebar: { - '/guide/': [ - { - text: '指南', - items: [ - { - text: '快速上手', - link: '/guide/quick-start', - }, - ], - }, - ], - }, // 语言切换按钮的文案 // Language switch button text label: '简体中文', @@ -35,19 +22,6 @@ export default defineConfig({ lang: 'en', title: 'A awesome project', description: 'A awesome project description', - sidebar: { - '/en/guide/': [ - { - text: 'Guide', - items: [ - { - text: 'Quick Start', - link: '/en/guide/quick-start', - }, - ], - }, - ], - }, label: 'English', }, ], diff --git a/e2e/tests/i18n.test.ts b/e2e/tests/i18n.test.ts index c0d70e734..801b41c65 100644 --- a/e2e/tests/i18n.test.ts +++ b/e2e/tests/i18n.test.ts @@ -47,7 +47,7 @@ test.describe('i18n test', async () => { test('Add language prefix in route automatically when current language is not default language', async ({ page, }) => { - await page.goto(`http://localhost:${appPort}/en/guide/quick-start`, { + await page.goto(`http://localhost:${appPort}/en/guide/basic/quick-start`, { waitUntil: 'networkidle', }); // take the `click` button @@ -56,20 +56,24 @@ test.describe('i18n test', async () => { }); expect(link).toBeTruthy(); // check the compile result of absolute link in doc content - expect(await link.getAttribute('href')).toBe('/en/guide/install.html'); + expect(await link.getAttribute('href')).toBe( + '/en/guide/basic/install.html', + ); link = await page.getByRole('link', { name: /relative/, }); // check the compile result of relative link in doc content expect(link).toBeTruthy(); - expect(await link.getAttribute('href')).toBe('/en/guide/install.html'); + expect(await link.getAttribute('href')).toBe( + '/en/guide/basic/install.html', + ); }); test('Should not add language prefix when current language is default language', async ({ page, }) => { - await page.goto(`http://localhost:${appPort}/guide/quick-start`, { + await page.goto(`http://localhost:${appPort}/guide/basic/quick-start`, { waitUntil: 'networkidle', }); // check the compile result of absolute link in doc content @@ -77,17 +81,17 @@ test.describe('i18n test', async () => { name: /绝对路径/, }); expect(link).toBeTruthy(); - expect(await link.getAttribute('href')).toBe('/guide/install.html'); + expect(await link.getAttribute('href')).toBe('/guide/basic/install.html'); // check the compile result of relative link in doc content link = await page.getByRole('link', { name: /相对路径/, }); expect(link).toBeTruthy(); - expect(await link.getAttribute('href')).toBe('/guide/install.html'); + expect(await link.getAttribute('href')).toBe('/guide/basic/install.html'); }); test('Should render sidebar correctly', async ({ page }) => { - await page.goto(`http://localhost:${appPort}/guide/quick-start`, { + await page.goto(`http://localhost:${appPort}/guide/basic/quick-start`, { waitUntil: 'networkidle', }); // take the sidebar @@ -98,7 +102,7 @@ test.describe('i18n test', async () => { }); test('Should not render appearance switch button', async ({ page }) => { - await page.goto(`http://localhost:${appPort}/guide/quick-start`, { + await page.goto(`http://localhost:${appPort}/guide/basic/quick-start`, { waitUntil: 'networkidle', }); // take the appearance switch button @@ -122,4 +126,34 @@ test.describe('i18n test', async () => { const content = await page.evaluate(() => document.body.textContent); expect(content?.includes('PAGE NOT FOUND')).toBe(false); }); + + test('Should render i18n sidebar - cn', async ({ page }) => { + await page.goto(`http://localhost:${appPort}/guide/basic/quick-start`, { + waitUntil: 'networkidle', + }); + const dirContent = await page.textContent( + '.rspress-sidebar .rspress-scrollbar nav section', + ); + expect(dirContent).toContain('基本'); + + const sectionHeaderContent = await page.textContent( + '.rspress-sidebar-section-header span', + ); + expect(sectionHeaderContent).toEqual('成长'); + }); + + test('Should render i18n sidebar - en', async ({ page }) => { + await page.goto(`http://localhost:${appPort}/en/guide/basic/quick-start`, { + waitUntil: 'networkidle', + }); + const dirContent = await page.textContent( + '.rspress-sidebar .rspress-scrollbar nav section', + ); + expect(dirContent).toContain('Basic'); + + const sectionHeaderContent = await page.textContent( + '.rspress-sidebar-section-header span', + ); + expect(sectionHeaderContent).toEqual('Growth'); + }); }); diff --git a/packages/core/src/node/runtimeModule/siteData/normalizeThemeConfig.ts b/packages/core/src/node/runtimeModule/siteData/normalizeThemeConfig.ts index ecdb1da2d..0b03e84bc 100644 --- a/packages/core/src/node/runtimeModule/siteData/normalizeThemeConfig.ts +++ b/packages/core/src/node/runtimeModule/siteData/normalizeThemeConfig.ts @@ -73,8 +73,17 @@ export function normalizeThemeConfig( const normalizeSidebarItem = ( item: SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader | string, ): NormalizedSidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader => { - // Meet the divider or section header, return directly - if (typeof item === 'object' && ('dividerType' in item || 'sectionHeaderText' in item)) { + // Meet the divider, return directly + if (typeof item === 'object' && 'dividerType' in item) { + return item; + } + + // Meet the section header, return i18n text + if (typeof item === 'object' && 'sectionHeaderText' in item) { + item.sectionHeaderText = applyReplaceRules( + getI18nText(item.sectionHeaderText, currentLang), + replaceRules, + ); return item; } From 5376e705feffebb03218f7b2d126d58f7cc4fec5 Mon Sep 17 00:00:00 2001 From: 10Derozan Date: Wed, 27 Mar 2024 21:51:58 +0800 Subject: [PATCH 19/21] feat(theme): render code in overview component (#873) --- .changeset/ninety-tables-begin.md | 5 +++++ .../theme-default/src/components/Overview/index.tsx | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/ninety-tables-begin.md diff --git a/.changeset/ninety-tables-begin.md b/.changeset/ninety-tables-begin.md new file mode 100644 index 000000000..f0bfe7c45 --- /dev/null +++ b/.changeset/ninety-tables-begin.md @@ -0,0 +1,5 @@ +--- +'@rspress/theme-default': patch +--- + +feat: render code in overview component diff --git a/packages/theme-default/src/components/Overview/index.tsx b/packages/theme-default/src/components/Overview/index.tsx index 911145e36..701fe398d 100644 --- a/packages/theme-default/src/components/Overview/index.tsx +++ b/packages/theme-default/src/components/Overview/index.tsx @@ -11,7 +11,7 @@ import { withBase, isEqualPath, } from '@rspress/runtime'; -import { useSidebarData } from '../../logic'; +import { renderInlineMarkdown, useSidebarData } from '../../logic'; import { Link } from '@theme'; import styles from './index.module.scss'; @@ -122,7 +122,7 @@ export function Overview(props: { {group.name === defaultGroupTitle && groups.length === 1 ? (

) : ( -

{group.name}

+

{renderInlineMarkdown(group.name)}

)}
@@ -130,7 +130,9 @@ export function Overview(props: {

- {item.text} + + {renderInlineMarkdown(item.text)} +

    @@ -142,7 +144,7 @@ export function Overview(props: { } first:mt-2`} > - {header.text} + {renderInlineMarkdown(header.text)} ))} From 5b98eaa584b4134d0dc5a691adb61d7f25d225a3 Mon Sep 17 00:00:00 2001 From: 10Derozan Date: Wed, 27 Mar 2024 21:54:34 +0800 Subject: [PATCH 20/21] chore(theme): optimize code style in sidebar (#872) --- .changeset/metal-onions-hammer.md | 5 +++++ packages/theme-default/src/styles/code.css | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changeset/metal-onions-hammer.md diff --git a/.changeset/metal-onions-hammer.md b/.changeset/metal-onions-hammer.md new file mode 100644 index 000000000..b2a320d94 --- /dev/null +++ b/.changeset/metal-onions-hammer.md @@ -0,0 +1,5 @@ +--- +'@rspress/theme-default': patch +--- + +chore: optimize code style in sidebar diff --git a/packages/theme-default/src/styles/code.css b/packages/theme-default/src/styles/code.css index 6fdfbff21..437ff90c6 100644 --- a/packages/theme-default/src/styles/code.css +++ b/packages/theme-default/src/styles/code.css @@ -20,14 +20,12 @@ --rp-code-line-number-color: rgba(60, 60, 60, 0.33); } -.rspress-doc :not(pre, h1, h2, h3, h4, h5, h6) > code, -.rspress-sidebar code +.rspress-doc :not(pre, h1, h2, h3, h4, h5, h6) > code { font-size: var(--rp-code-font-size); } -.rspress-doc :not(pre, div, a) > code, -.rspress-sidebar code +.rspress-doc :not(pre, div, a) > code { border-radius: var(--rp-radius-small); padding: 4px 8px; From ead0d0af708db08ce1099c7637203960708d50ab Mon Sep 17 00:00:00 2001 From: yangxingyuan <39261479+sanyuan0704@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:49:39 +0800 Subject: [PATCH 21/21] Release v1.16.2 (#874) Co-authored-by: github-actions[bot] --- .changeset/metal-onions-hammer.md | 5 - .changeset/ninety-tables-begin.md | 5 - .changeset/swift-needles-tickle.md | 5 - .changeset/tame-rivers-drop.md | 5 - package.json | 8 +- packages/cli/CHANGELOG.md | 9 + packages/cli/package.json | 2 +- packages/core/CHANGELOG.md | 16 ++ packages/core/package.json | 8 +- packages/create-rspress/CHANGELOG.md | 2 + packages/create-rspress/package.json | 2 +- packages/document/CHANGELOG.md | 2 + packages/document/package.json | 2 +- packages/modern-plugin-rspress/CHANGELOG.md | 10 + packages/modern-plugin-rspress/package.json | 4 +- packages/plugin-api-docgen/CHANGELOG.md | 2 + packages/plugin-api-docgen/package.json | 4 +- packages/plugin-auto-nav-sidebar/CHANGELOG.md | 6 + packages/plugin-auto-nav-sidebar/package.json | 4 +- packages/plugin-container-syntax/CHANGELOG.md | 6 + packages/plugin-container-syntax/package.json | 2 +- packages/plugin-last-updated/CHANGELOG.md | 6 + packages/plugin-last-updated/package.json | 4 +- packages/plugin-medium-zoom/CHANGELOG.md | 2 + packages/plugin-medium-zoom/package.json | 4 +- packages/plugin-playground/CHANGELOG.md | 6 + packages/plugin-playground/package.json | 2 +- packages/plugin-preview/CHANGELOG.md | 9 + packages/plugin-preview/package.json | 2 +- packages/plugin-shiki/CHANGELOG.md | 6 + packages/plugin-shiki/package.json | 4 +- packages/plugin-typedoc/CHANGELOG.md | 6 + packages/plugin-typedoc/package.json | 4 +- packages/runtime/CHANGELOG.md | 6 + packages/runtime/package.json | 4 +- packages/shared/CHANGELOG.md | 2 + packages/shared/package.json | 2 +- packages/theme-default/CHANGELOG.md | 9 + packages/theme-default/package.json | 6 +- pnpm-lock.yaml | 188 +++++++++--------- 40 files changed, 233 insertions(+), 148 deletions(-) delete mode 100644 .changeset/metal-onions-hammer.md delete mode 100644 .changeset/ninety-tables-begin.md delete mode 100644 .changeset/swift-needles-tickle.md delete mode 100644 .changeset/tame-rivers-drop.md diff --git a/.changeset/metal-onions-hammer.md b/.changeset/metal-onions-hammer.md deleted file mode 100644 index b2a320d94..000000000 --- a/.changeset/metal-onions-hammer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@rspress/theme-default': patch ---- - -chore: optimize code style in sidebar diff --git a/.changeset/ninety-tables-begin.md b/.changeset/ninety-tables-begin.md deleted file mode 100644 index f0bfe7c45..000000000 --- a/.changeset/ninety-tables-begin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@rspress/theme-default': patch ---- - -feat: render code in overview component diff --git a/.changeset/swift-needles-tickle.md b/.changeset/swift-needles-tickle.md deleted file mode 100644 index 3791dd4fa..000000000 --- a/.changeset/swift-needles-tickle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@rspress/core": patch ---- - -fix(core): set ssg:false in plugin not work in build mode diff --git a/.changeset/tame-rivers-drop.md b/.changeset/tame-rivers-drop.md deleted file mode 100644 index 29aecc858..000000000 --- a/.changeset/tame-rivers-drop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@rspress/core": patch ---- - -fix(core): section header text should return i18n result diff --git a/package.json b/package.json index a4504a1c0..8c9a4cdf7 100644 --- a/package.json +++ b/package.json @@ -45,10 +45,10 @@ "devDependencies": { "@biomejs/biome": "1.5.3", "@manypkg/get-packages": "^2.2.0", - "@modern-js/generator-utils": "3.3.14", - "@modern-js/module-tools": "2.48.3", - "@modern-js/monorepo-tools": "2.48.3", - "@modern-js/tsconfig": "2.48.3", + "@modern-js/generator-utils": "3.3.15", + "@modern-js/module-tools": "2.48.4", + "@modern-js/monorepo-tools": "2.48.4", + "@modern-js/tsconfig": "2.48.4", "@playwright/test": "1.33.0", "@types/cross-spawn": "^6.0.2", "@types/fs-extra": "^11.0.1", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index e32a019e7..78866885e 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,14 @@ # rspress +## 1.16.2 + +### Patch Changes + +- Updated dependencies [37b4ffe] +- Updated dependencies [5d88d28] + - @rspress/core@1.16.2 + - @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index a02d578e0..0b5d05d01 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "rspress", - "version": "1.16.1", + "version": "1.16.2", "type": "module", "types": "./dist/index.d.ts", "main": "./dist/index.js", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 3df944c34..0a12e6697 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,21 @@ # @rspress/core +## 1.16.2 + +### Patch Changes + +- 37b4ffe: fix(core): set ssg:false in plugin not work in build mode +- 5d88d28: fix(core): section header text should return i18n result +- Updated dependencies [5b98eaa] +- Updated dependencies [5376e70] + - @rspress/theme-default@1.16.2 + - @rspress/plugin-auto-nav-sidebar@1.16.2 + - @rspress/plugin-container-syntax@1.16.2 + - @rspress/plugin-last-updated@1.16.2 + - @rspress/plugin-medium-zoom@1.16.2 + - @rspress/runtime@1.16.2 + - @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index d18f285fa..5779d44e9 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/core", - "version": "1.16.1", + "version": "1.16.2", "description": "The Rspress Documentation Framework", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -52,7 +52,7 @@ "@mdx-js/loader": "2.3.0", "@mdx-js/mdx": "2.3.0", "@mdx-js/react": "2.3.0", - "@modern-js/utils": "2.48.3", + "@modern-js/utils": "2.48.4", "@rsbuild/core": "0.5.1", "@rsbuild/plugin-react": "0.5.1", "@rspress/theme-default": "workspace:*", @@ -100,8 +100,8 @@ }, "devDependencies": { "tailwindcss": "^3.2.7", - "@modern-js/plugin-tailwindcss": "2.48.3", - "@modern-js/tsconfig": "2.48.3", + "@modern-js/plugin-tailwindcss": "2.48.4", + "@modern-js/tsconfig": "2.48.4", "@types/body-scroll-lock": "^3.1.0", "@types/fs-extra": "^9.0.13", "@types/hast": "^2.3.4", diff --git a/packages/create-rspress/CHANGELOG.md b/packages/create-rspress/CHANGELOG.md index 0c4743b7d..bb7a17ad4 100644 --- a/packages/create-rspress/CHANGELOG.md +++ b/packages/create-rspress/CHANGELOG.md @@ -1,5 +1,7 @@ # create-rspress +## 1.16.2 + ## 1.16.1 ## 1.16.0 diff --git a/packages/create-rspress/package.json b/packages/create-rspress/package.json index 2dd9c47f6..05c1920bc 100644 --- a/packages/create-rspress/package.json +++ b/packages/create-rspress/package.json @@ -1,6 +1,6 @@ { "name": "create-rspress", - "version": "1.16.1", + "version": "1.16.2", "types": "./dist/index.d.ts", "main": "./dist/index.js", "module": "./dist/index.js", diff --git a/packages/document/CHANGELOG.md b/packages/document/CHANGELOG.md index 68fe5b75a..566844e3e 100644 --- a/packages/document/CHANGELOG.md +++ b/packages/document/CHANGELOG.md @@ -1,5 +1,7 @@ # @rspress/docs +## 1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/document/package.json b/packages/document/package.json index 8cca40ede..447a4df8e 100644 --- a/packages/document/package.json +++ b/packages/document/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/docs", - "version": "1.16.1", + "version": "1.16.2", "description": "", "main": "index.js", "scripts": { diff --git a/packages/modern-plugin-rspress/CHANGELOG.md b/packages/modern-plugin-rspress/CHANGELOG.md index e9e60a9d0..6c2153d28 100644 --- a/packages/modern-plugin-rspress/CHANGELOG.md +++ b/packages/modern-plugin-rspress/CHANGELOG.md @@ -1,5 +1,15 @@ # @modern-js/plugin-rspress +## 1.16.2 + +### Patch Changes + +- Updated dependencies [37b4ffe] +- Updated dependencies [5d88d28] + - @rspress/core@1.16.2 + - @rspress/plugin-preview@1.16.2 + - @rspress/plugin-api-docgen@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/modern-plugin-rspress/package.json b/packages/modern-plugin-rspress/package.json index a189a1546..106d8a4bd 100644 --- a/packages/modern-plugin-rspress/package.json +++ b/packages/modern-plugin-rspress/package.json @@ -15,7 +15,7 @@ "modern", "modern.js" ], - "version": "1.16.1", + "version": "1.16.2", "jsnext:source": "./src/index.ts", "types": "./dist/index.d.ts", "main": "./dist/index.js", @@ -39,7 +39,7 @@ "@rspress/plugin-api-docgen": "workspace:*" }, "devDependencies": { - "@modern-js/utils": "2.48.3", + "@modern-js/utils": "2.48.4", "@types/node": "^14", "@types/react": "^18", "react": "^18.2.0", diff --git a/packages/plugin-api-docgen/CHANGELOG.md b/packages/plugin-api-docgen/CHANGELOG.md index f93c9298e..670fc16cb 100644 --- a/packages/plugin-api-docgen/CHANGELOG.md +++ b/packages/plugin-api-docgen/CHANGELOG.md @@ -1,5 +1,7 @@ # @rspress/plugin-api-docgen +## 1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-api-docgen/package.json b/packages/plugin-api-docgen/package.json index fdd57e182..52fe7a766 100644 --- a/packages/plugin-api-docgen/package.json +++ b/packages/plugin-api-docgen/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-api-docgen", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to generate api doc.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -31,7 +31,7 @@ "node": ">=14.17.6" }, "dependencies": { - "@modern-js/utils": "2.48.3", + "@modern-js/utils": "2.48.4", "react-markdown": "8.0.7", "react-docgen-typescript": "2.2.2", "documentation": "14.0.2", diff --git a/packages/plugin-auto-nav-sidebar/CHANGELOG.md b/packages/plugin-auto-nav-sidebar/CHANGELOG.md index 8916c2879..c863f322a 100644 --- a/packages/plugin-auto-nav-sidebar/CHANGELOG.md +++ b/packages/plugin-auto-nav-sidebar/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/plugin-auto-sidebar +## 1.16.2 + +### Patch Changes + +- @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-auto-nav-sidebar/package.json b/packages/plugin-auto-nav-sidebar/package.json index 107dee267..f2de78c14 100644 --- a/packages/plugin-auto-nav-sidebar/package.json +++ b/packages/plugin-auto-nav-sidebar/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-auto-nav-sidebar", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to generate navbar and sidebar config automatically.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -33,7 +33,7 @@ "node": ">=14.17.6" }, "devDependencies": { - "@modern-js/tsconfig": "2.48.3", + "@modern-js/tsconfig": "2.48.4", "@types/node": "^18.11.17", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/packages/plugin-container-syntax/CHANGELOG.md b/packages/plugin-container-syntax/CHANGELOG.md index 3e9028937..fa4d74831 100644 --- a/packages/plugin-container-syntax/CHANGELOG.md +++ b/packages/plugin-container-syntax/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/remark-container +## 1.16.2 + +### Patch Changes + +- @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-container-syntax/package.json b/packages/plugin-container-syntax/package.json index 2f7796ccc..e0ee78640 100644 --- a/packages/plugin-container-syntax/package.json +++ b/packages/plugin-container-syntax/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-container-syntax", - "version": "1.16.1", + "version": "1.16.2", "description": "A remark plugin to support container syntax", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-last-updated/CHANGELOG.md b/packages/plugin-last-updated/CHANGELOG.md index 2aaaa367d..bc5e1cfd4 100644 --- a/packages/plugin-last-updated/CHANGELOG.md +++ b/packages/plugin-last-updated/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/plugin-last-updated +## 1.16.2 + +### Patch Changes + +- @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-last-updated/package.json b/packages/plugin-last-updated/package.json index 7bc82759b..386963b40 100644 --- a/packages/plugin-last-updated/package.json +++ b/packages/plugin-last-updated/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-last-updated", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to record the last updated time of the doc.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -33,7 +33,7 @@ "node": ">=14.17.6" }, "devDependencies": { - "@modern-js/tsconfig": "2.48.3", + "@modern-js/tsconfig": "2.48.4", "@types/node": "^18.11.17", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/packages/plugin-medium-zoom/CHANGELOG.md b/packages/plugin-medium-zoom/CHANGELOG.md index 4ecfc9c9f..5d58602f8 100644 --- a/packages/plugin-medium-zoom/CHANGELOG.md +++ b/packages/plugin-medium-zoom/CHANGELOG.md @@ -1,5 +1,7 @@ # @rspress/plugin-medium-zoom +## 1.16.2 + ## 1.16.1 ## 1.16.0 diff --git a/packages/plugin-medium-zoom/package.json b/packages/plugin-medium-zoom/package.json index fc2651b41..42e23c6b5 100644 --- a/packages/plugin-medium-zoom/package.json +++ b/packages/plugin-medium-zoom/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-medium-zoom", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to zoom images in docs.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -33,7 +33,7 @@ "node": ">=14.17.6" }, "devDependencies": { - "@modern-js/tsconfig": "2.48.3", + "@modern-js/tsconfig": "2.48.4", "@types/node": "^18.11.17", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/packages/plugin-playground/CHANGELOG.md b/packages/plugin-playground/CHANGELOG.md index 1a8f24fea..780553c33 100644 --- a/packages/plugin-playground/CHANGELOG.md +++ b/packages/plugin-playground/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/plugin-playground +## 1.16.2 + +### Patch Changes + +- @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-playground/package.json b/packages/plugin-playground/package.json index c5c66bc2c..400a27ca6 100644 --- a/packages/plugin-playground/package.json +++ b/packages/plugin-playground/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-playground", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to preview the code block in markdown/mdx file.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-preview/CHANGELOG.md b/packages/plugin-preview/CHANGELOG.md index 001866139..bb37feeda 100644 --- a/packages/plugin-preview/CHANGELOG.md +++ b/packages/plugin-preview/CHANGELOG.md @@ -1,5 +1,14 @@ # @rspress/plugin-preview +## 1.16.2 + +### Patch Changes + +- Updated dependencies [5b98eaa] +- Updated dependencies [5376e70] + - @rspress/theme-default@1.16.2 + - @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-preview/package.json b/packages/plugin-preview/package.json index cfd752b11..f8a08a226 100644 --- a/packages/plugin-preview/package.json +++ b/packages/plugin-preview/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-preview", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to preview the code block in markdown/mdx file.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { diff --git a/packages/plugin-shiki/CHANGELOG.md b/packages/plugin-shiki/CHANGELOG.md index e0eb0751d..92bd45cf3 100644 --- a/packages/plugin-shiki/CHANGELOG.md +++ b/packages/plugin-shiki/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/plugin-shiki +## 1.16.2 + +### Patch Changes + +- @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-shiki/package.json b/packages/plugin-shiki/package.json index f2fa85e6f..db7702035 100644 --- a/packages/plugin-shiki/package.json +++ b/packages/plugin-shiki/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-shiki", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to record the last updated time of the doc.", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -33,7 +33,7 @@ "node": ">=14.17.6" }, "devDependencies": { - "@modern-js/tsconfig": "2.48.3", + "@modern-js/tsconfig": "2.48.4", "@types/node": "^18.11.17", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/packages/plugin-typedoc/CHANGELOG.md b/packages/plugin-typedoc/CHANGELOG.md index a3d2d6a16..fb61fb3c5 100644 --- a/packages/plugin-typedoc/CHANGELOG.md +++ b/packages/plugin-typedoc/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/plugin-typedoc +## 1.16.2 + +### Patch Changes + +- @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/plugin-typedoc/package.json b/packages/plugin-typedoc/package.json index e8582dcac..b60ee2a6f 100644 --- a/packages/plugin-typedoc/package.json +++ b/packages/plugin-typedoc/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/plugin-typedoc", - "version": "1.16.1", + "version": "1.16.2", "description": "A plugin for rspress to integrate typedoc", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -32,7 +32,7 @@ "node": ">=14.17.6" }, "devDependencies": { - "@modern-js/tsconfig": "2.48.3", + "@modern-js/tsconfig": "2.48.4", "@types/node": "^18.11.17", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index 0a452884c..eac024449 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,11 @@ # @rspress/runtime +## 1.16.2 + +### Patch Changes + +- @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 5c39a083d..69f625ad1 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/runtime", - "version": "1.16.1", + "version": "1.16.2", "description": "The Runtime of Rspress Documentation Framework", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -47,7 +47,7 @@ "react-router-dom": "^6.8.1" }, "devDependencies": { - "@modern-js/tsconfig": "2.48.3", + "@modern-js/tsconfig": "2.48.4", "@types/jest": "^26.0.9", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/packages/shared/CHANGELOG.md b/packages/shared/CHANGELOG.md index 0e6a453cb..3ee9f6443 100644 --- a/packages/shared/CHANGELOG.md +++ b/packages/shared/CHANGELOG.md @@ -1,5 +1,7 @@ # @rspress/shared +## 1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/shared/package.json b/packages/shared/package.json index f2c423869..ce35bd156 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/shared", - "version": "1.16.1", + "version": "1.16.2", "types": "./dist/index.d.ts", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/packages/theme-default/CHANGELOG.md b/packages/theme-default/CHANGELOG.md index 7613c51fe..6c5a91234 100644 --- a/packages/theme-default/CHANGELOG.md +++ b/packages/theme-default/CHANGELOG.md @@ -1,5 +1,14 @@ # @rspress/theme-default +## 1.16.2 + +### Patch Changes + +- 5b98eaa: chore: optimize code style in sidebar +- 5376e70: feat: render code in overview component + - @rspress/runtime@1.16.2 + - @rspress/shared@1.16.2 + ## 1.16.1 ### Patch Changes diff --git a/packages/theme-default/package.json b/packages/theme-default/package.json index cc72f786b..acdf4f09e 100644 --- a/packages/theme-default/package.json +++ b/packages/theme-default/package.json @@ -1,6 +1,6 @@ { "name": "@rspress/theme-default", - "version": "1.16.1", + "version": "1.16.2", "description": "The Default Theme of Rspress Documentation Framework", "bugs": "https://github.com/web-infra-dev/rspress/issues", "repository": { @@ -66,8 +66,8 @@ "react-transition-group": "4.4.5" }, "devDependencies": { - "@modern-js/plugin-tailwindcss": "2.48.3", - "@modern-js/tsconfig": "2.48.3", + "@modern-js/plugin-tailwindcss": "2.48.4", + "@modern-js/tsconfig": "2.48.4", "@types/body-scroll-lock": "^3.1.0", "@types/hast": "^2.3.4", "@types/html-to-text": "^8.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c8a88babf..171c25106 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,17 +15,17 @@ importers: specifier: ^2.2.0 version: 2.2.0 '@modern-js/generator-utils': - specifier: 3.3.14 - version: 3.3.14(@modern-js/codesmith@2.3.5)(typescript@5.0.4) + specifier: 3.3.15 + version: 3.3.15(@modern-js/codesmith@2.3.5)(typescript@5.0.4) '@modern-js/module-tools': - specifier: 2.48.3 - version: 2.48.3(typescript@5.0.4) + specifier: 2.48.4 + version: 2.48.4(typescript@5.0.4) '@modern-js/monorepo-tools': - specifier: 2.48.3 - version: 2.48.3(@types/node@18.11.17) + specifier: 2.48.4 + version: 2.48.4(@types/node@18.11.17) '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@playwright/test': specifier: 1.33.0 version: 1.33.0 @@ -350,8 +350,8 @@ importers: specifier: 2.3.0 version: 2.3.0(react@18.2.0) '@modern-js/utils': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@rsbuild/core': specifier: 0.5.1 version: 0.5.1 @@ -486,11 +486,11 @@ importers: version: 4.1.1 devDependencies: '@modern-js/plugin-tailwindcss': - specifier: 2.48.3 - version: 2.48.3(tailwindcss@3.2.7) + specifier: 2.48.4 + version: 2.48.4(tailwindcss@3.2.7) '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/body-scroll-lock': specifier: ^3.1.0 version: 3.1.0 @@ -630,8 +630,8 @@ importers: version: link:../plugin-preview devDependencies: '@modern-js/utils': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/node': specifier: ^14 version: 14.0.0 @@ -654,8 +654,8 @@ importers: packages/plugin-api-docgen: dependencies: '@modern-js/utils': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@rspress/core': specifier: ^1.0.2 version: link:../core @@ -716,8 +716,8 @@ importers: version: link:../shared devDependencies: '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/node': specifier: ^18.11.17 version: 18.11.17 @@ -766,8 +766,8 @@ importers: version: link:../shared devDependencies: '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/node': specifier: ^18.11.17 version: 18.11.17 @@ -797,8 +797,8 @@ importers: version: 1.0.8 devDependencies: '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@rspress/shared': specifier: workspace:* version: link:../shared @@ -983,8 +983,8 @@ importers: version: 5.0.0 devDependencies: '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/hast': specifier: 3.0.3 version: 3.0.3 @@ -1026,8 +1026,8 @@ importers: version: 3.15.3(typedoc@0.24.8) devDependencies: '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/node': specifier: ^18.11.17 version: 18.11.17 @@ -1066,8 +1066,8 @@ importers: version: 6.11.1(react-dom@18.2.0)(react@18.2.0) devDependencies: '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/jest': specifier: ^26.0.9 version: 26.0.9 @@ -1206,11 +1206,11 @@ importers: version: 0.1.12 devDependencies: '@modern-js/plugin-tailwindcss': - specifier: 2.48.3 - version: 2.48.3(tailwindcss@3.2.7) + specifier: 2.48.4 + version: 2.48.4(tailwindcss@3.2.7) '@modern-js/tsconfig': - specifier: 2.48.3 - version: 2.48.3 + specifier: 2.48.4 + version: 2.48.4 '@types/body-scroll-lock': specifier: ^3.1.0 version: 3.1.0 @@ -3162,7 +3162,7 @@ packages: '@formily/json-schema': 2.2.29(typescript@5.0.4) '@formily/validator': 2.2.29 '@modern-js/codesmith': 2.3.5 - '@modern-js/utils': 2.48.3 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.1 inquirer: 8.2.6 transitivePeerDependencies: @@ -3172,7 +3172,7 @@ packages: /@modern-js/codesmith@2.3.5: resolution: {integrity: sha512-B55big7ceKnCW/9t8mk57uru43RLAyWT7PmaqLEqlaxAq6u+oPDmlii32hHp8n4tg8dbn4bZuAq7Rddv+iepjw==} dependencies: - '@modern-js/utils': 2.48.3 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.1 axios: 1.6.8 tar: 6.2.0 @@ -3180,40 +3180,40 @@ packages: - debug dev: true - /@modern-js/core@2.48.3: - resolution: {integrity: sha512-lcgOiehvto5vPtsbAbbKoWS+os38SSDnakxj6oxGAxxQW++Cihx2sk3qrvWWOgdK8FP1W44bYWExahSOaT57Ig==} + /@modern-js/core@2.48.4: + resolution: {integrity: sha512-ortR+vqU6hAG6hbrWag9I45x0xiGM5bV7OgcDEvmjqi6t/Pe/hihSqax3dsHqS/WZt3MWfpwX5lP+hr6tSvZFA==} dependencies: - '@modern-js/node-bundle-require': 2.48.3 - '@modern-js/plugin': 2.48.3 - '@modern-js/utils': 2.48.3 + '@modern-js/node-bundle-require': 2.48.4 + '@modern-js/plugin': 2.48.4 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 dev: true - /@modern-js/generator-common@3.3.14(@modern-js/codesmith@2.3.5)(typescript@5.0.4): - resolution: {integrity: sha512-fM8paTZyTnq6+0XKY4JtftbamVJOoFw80hZxYMrpZUe1/cjGTDFjz6aBybotD72d25MxZlYWRAW9Ip8zP3dh+Q==} + /@modern-js/generator-common@3.3.15(@modern-js/codesmith@2.3.5)(typescript@5.0.4): + resolution: {integrity: sha512-ymI6cxS31l1Nc+PhJyviY4IYZpV7jJ+GaczfrmUrdnLNwDVsVhpHKkLaCHVTs3KPM2mNkFDrZMNIAXZBe4iPCw==} dependencies: '@modern-js/codesmith-formily': 2.3.5(@modern-js/codesmith@2.3.5)(typescript@5.0.4) - '@modern-js/plugin-i18n': 2.48.3 + '@modern-js/plugin-i18n': 2.48.4 '@swc/helpers': 0.5.3 transitivePeerDependencies: - '@modern-js/codesmith' - typescript dev: true - /@modern-js/generator-utils@3.3.14(@modern-js/codesmith@2.3.5)(typescript@5.0.4): - resolution: {integrity: sha512-D890lDzod1GD8mdo/F2Bqb+noHrWb0zqJbMayeWu/AOLdsJp6ULqDr+2BUnFV3yzZHSTPa6iPay50PwKkC0YaQ==} + /@modern-js/generator-utils@3.3.15(@modern-js/codesmith@2.3.5)(typescript@5.0.4): + resolution: {integrity: sha512-d9c33h58Exh2bDsCxXEt7iTs9ferKyx6RqoTjC8dHMuqTOpHrDwXFN8Zrfwk7LfHXbLCYNw/xkUGsVyhbRnelA==} dependencies: - '@modern-js/generator-common': 3.3.14(@modern-js/codesmith@2.3.5)(typescript@5.0.4) - '@modern-js/plugin-i18n': 2.48.3 - '@modern-js/utils': 2.48.3 + '@modern-js/generator-common': 3.3.15(@modern-js/codesmith@2.3.5)(typescript@5.0.4) + '@modern-js/plugin-i18n': 2.48.4 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 transitivePeerDependencies: - '@modern-js/codesmith' - typescript dev: true - /@modern-js/module-tools@2.48.3(typescript@5.0.4): - resolution: {integrity: sha512-dw228AS8Y6Lh3s3XuD8GF79T0IryhXjHr6iO6+Dd7/RHyT/qcbOUbfbSV4lDJo3pIl9xA8vRI/I62vG2832rUQ==} + /@modern-js/module-tools@2.48.4(typescript@5.0.4): + resolution: {integrity: sha512-Y2LNx7z0/Hr53J0daK1CawjDJR+gFR7l+tX8W+2JdWrh/5T4FE9lM0+PqAZ3XXrtWJwcm2O2OffM9AeSUTII9g==} engines: {node: '>=16.0.0'} hasBin: true peerDependencies: @@ -3226,14 +3226,14 @@ packages: '@ast-grep/napi': 0.16.0 '@babel/core': 7.24.1 '@babel/types': 7.24.0 - '@modern-js/core': 2.48.3 - '@modern-js/plugin': 2.48.3 - '@modern-js/plugin-changeset': 2.48.3 - '@modern-js/plugin-i18n': 2.48.3 - '@modern-js/plugin-lint': 2.48.3 + '@modern-js/core': 2.48.4 + '@modern-js/plugin': 2.48.4 + '@modern-js/plugin-changeset': 2.48.4 + '@modern-js/plugin-i18n': 2.48.4 + '@modern-js/plugin-lint': 2.48.4 '@modern-js/swc-plugins': 0.6.6(@swc/helpers@0.5.3) - '@modern-js/types': 2.48.3 - '@modern-js/utils': 2.48.3 + '@modern-js/types': 2.48.4 + '@modern-js/utils': 2.48.4 '@rollup/pluginutils': 4.1.1 '@swc/helpers': 0.5.3 convert-source-map: 1.8.0 @@ -3256,16 +3256,16 @@ packages: - supports-color dev: true - /@modern-js/monorepo-tools@2.48.3(@types/node@18.11.17): - resolution: {integrity: sha512-IHvZMyS9AoD9TTy1rP3JdhpLqswKzhYspZ4lifitka/13KdoARhuRotBtlPri3e6huM3OiJiTlf5MNzxaqoSgg==} + /@modern-js/monorepo-tools@2.48.4(@types/node@18.11.17): + resolution: {integrity: sha512-cttAzAKZZy5Ws8nKK77ZWGtJ9/iYz11zidJlcYinsDiyJrVQxzPNMzL5j2/JI+jFU7ZK104+VqXUEmzFIw6hrQ==} hasBin: true dependencies: - '@modern-js/core': 2.48.3 - '@modern-js/plugin': 2.48.3 - '@modern-js/plugin-changeset': 2.48.3 - '@modern-js/plugin-i18n': 2.48.3 - '@modern-js/plugin-lint': 2.48.3 - '@modern-js/utils': 2.48.3 + '@modern-js/core': 2.48.4 + '@modern-js/plugin': 2.48.4 + '@modern-js/plugin-changeset': 2.48.4 + '@modern-js/plugin-i18n': 2.48.4 + '@modern-js/plugin-lint': 2.48.4 + '@modern-js/utils': 2.48.4 '@rushstack/node-core-library': 3.59.7(@types/node@18.11.17) '@rushstack/package-deps-hash': 3.2.67 '@swc/helpers': 0.5.3 @@ -3278,22 +3278,22 @@ packages: - eslint dev: true - /@modern-js/node-bundle-require@2.48.3: - resolution: {integrity: sha512-RMkgwZnPB92kyF9+foRASFLYhKGwjDo66cfDaS2qOoIL9Kp50TbWK+XhSNzTDzYj3OfwQiAKQWkPeKxIwXt5Lg==} + /@modern-js/node-bundle-require@2.48.4: + resolution: {integrity: sha512-5wC+76elKGWwehAbiU/SlSItZrmRm5TqLCMTyJXs2+NOeMHw1lrejPhTDsATjkiOSRZyzzWZSmFWZBNU/yDmGw==} dependencies: - '@modern-js/utils': 2.48.3 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 esbuild: 0.17.19 dev: true - /@modern-js/plugin-changeset@2.48.3: - resolution: {integrity: sha512-FpRPfivEKLjRC4SVbgn7UFA+3dV7DhhlwkK+B8DXeQZh0//nXebbfjdjUEjvEtIV1OXL8ani5+sfpCjRRKypkg==} + /@modern-js/plugin-changeset@2.48.4: + resolution: {integrity: sha512-CvIdlVxSYRgrToRKHA813jaeXCwhJt0MLL1ZBBJ+VikXbcGDgRyFgbYYHG1uAWtp2mvY/q5raeKqQEGI0BDwVg==} dependencies: '@changesets/cli': 2.26.2 '@changesets/git': 2.0.0 '@changesets/read': 0.5.9 - '@modern-js/plugin-i18n': 2.48.3 - '@modern-js/utils': 2.48.3 + '@modern-js/plugin-i18n': 2.48.4 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 axios: 1.6.8 resolve-from: 5.0.0 @@ -3301,49 +3301,49 @@ packages: - debug dev: true - /@modern-js/plugin-i18n@2.48.3: - resolution: {integrity: sha512-bgQFzfmbDSPwdWT6W1jyGjiy4X+G9towW+v1rEv0/eSlDu2JJ285QYntjtrx9xoe4gkGDe2Ng25Cok9HkrjFPA==} + /@modern-js/plugin-i18n@2.48.4: + resolution: {integrity: sha512-fTAtM2/56OA01jnWvjYVIxEVko7cHSKwJTQjI1KjN2AwAXbYcMFbbCQbJXCLjweriFx8X1d32rCfCbsDl5EW7g==} dependencies: - '@modern-js/utils': 2.48.3 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 dev: true - /@modern-js/plugin-lint@2.48.3: - resolution: {integrity: sha512-YYAp3wf9h1nHFnLXTx952YzzxBHC0U9+qjekj2djnE5vJZ12X/LF+Zbva25QUS2gERkuxa5LKqYl+udqZBha0A==} + /@modern-js/plugin-lint@2.48.4: + resolution: {integrity: sha512-BHY6lpJUeVnmMkTf+XymM9sq9Dsu4+oSZfnjqw8xxHwMZ36RT4rXpACbad/McZxMQbacYJ3j/GoU6GqYKQzvnw==} peerDependencies: eslint: ^8.28.0 peerDependenciesMeta: eslint: optional: true dependencies: - '@modern-js/tsconfig': 2.48.3 - '@modern-js/utils': 2.48.3 + '@modern-js/tsconfig': 2.48.4 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 cross-spawn: 7.0.3 husky: 8.0.1 dev: true - /@modern-js/plugin-tailwindcss@2.48.3(tailwindcss@3.2.7): - resolution: {integrity: sha512-0iJ1iJmfNZRZl3noPZx4xy7izHuiWjLBNIek1zQrabjctNMuFoTvvdY8ZTntENrh13cbMkDMqOUghueH0cOwmQ==} + /@modern-js/plugin-tailwindcss@2.48.4(tailwindcss@3.2.7): + resolution: {integrity: sha512-ZSS9wfFwCAz4SY9Slap7cCxcRYu2jQCWmAwxJ+stWXZAgy5lrF8cNabOy6+MZJp3GewibQvb5lukXIgms56ueA==} peerDependencies: - '@modern-js/runtime': ^2.48.3 + '@modern-js/runtime': ^2.48.4 tailwindcss: '>= 2.0.0 || >= 3.0.0' peerDependenciesMeta: '@modern-js/runtime': optional: true dependencies: - '@modern-js/node-bundle-require': 2.48.3 - '@modern-js/utils': 2.48.3 + '@modern-js/node-bundle-require': 2.48.4 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 babel-plugin-macros: 3.1.0 hoist-non-react-statics: 3.3.2 tailwindcss: 3.2.7(postcss@8.4.31)(ts-node@10.9.1) dev: true - /@modern-js/plugin@2.48.3: - resolution: {integrity: sha512-eEkyua75/7yQvfn6ChdBYr/M36PBQnaRInH8mik0RKFvZLdxP/q98mAyM9NnJ5QuqxfdhEqP6ACaw72PGFvWBA==} + /@modern-js/plugin@2.48.4: + resolution: {integrity: sha512-3BgZP0bwBouGd33H3k3cogR7rtzFwAqvsWEUOqg4VchjT8dpbN+v8KuwCPMVHAvd+kns9bF7RqYKGua2urcRUg==} dependencies: - '@modern-js/utils': 2.48.3 + '@modern-js/utils': 2.48.4 '@swc/helpers': 0.5.3 dev: true @@ -3437,16 +3437,16 @@ packages: '@modern-js/swc-plugins-win32-x64-msvc': 0.6.6 dev: true - /@modern-js/tsconfig@2.48.3: - resolution: {integrity: sha512-S1STfvJHSUPNXUKuFB15t1CQSqsafzw8yKY+PnGsbXGcz1i+TIuO8420fUcrY7zP7miePrx9TfHEXHbloOqJmg==} + /@modern-js/tsconfig@2.48.4: + resolution: {integrity: sha512-9XESp5lHMVYdZE+BcBN2LhDaQxZ4FWhDZlX4HdBTHHvlosf4lwYoDPc5VlIYXAsXIpdI6xwzKWEHeEKcdcbz9A==} dev: true - /@modern-js/types@2.48.3: - resolution: {integrity: sha512-nbUmBI1V+gT9A5p0FM8ya1Mdqwcc9OFa/v9cGNLmL4aqcgxgLSVbFunnGqfhfOFT6kLf+nViD/ZHCmm2EvEgFQ==} + /@modern-js/types@2.48.4: + resolution: {integrity: sha512-RGu9ixO5ROADBx5UXFZVcbUtkvJqTPt3pKUFVQcbYhqBvWXUAtCM/S6IgACc5VHR4y4TdR8OvsXYQXSoaopJtA==} dev: true - /@modern-js/utils@2.48.3: - resolution: {integrity: sha512-J2+HWrWXakmRrCujjUPUUuYzesjSrTb/zD3jPCJaB03Y0qyM6UXZOeE7vGpP4CUX8zWRtXX5t2hiaDWKlvmA4Q==} + /@modern-js/utils@2.48.4: + resolution: {integrity: sha512-ummxga/VKrQjh8TdWtxckx9hefMKfe6cxY1fpDmn5wOkJbNpLS2GIlEFPDhlN451JyeMDD9kbxRedq4ETE+NqQ==} dependencies: '@swc/helpers': 0.5.3 caniuse-lite: 1.0.30001599