diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca41206dc..e4c8b48e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1123,12 +1123,21 @@ importers: website: devDependencies: + '@module-federation/rsbuild-plugin': + specifier: ^0.18.3 + version: 0.18.3(@rsbuild/core@1.5.3)(@rspack/core@1.5.2(@swc/helpers@0.5.17))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(typescript@5.9.2)(vue-tsc@3.0.6(typescript@5.9.2)) '@rsbuild/core': specifier: ~1.5.3 version: 1.5.3 + '@rsbuild/plugin-react': + specifier: ^1.4.0 + version: 1.4.0(@rsbuild/core@1.5.3) '@rsbuild/plugin-sass': specifier: ^1.4.0 version: 1.4.0(@rsbuild/core@1.5.3) + '@rslib/core': + specifier: workspace:* + version: link:../packages/core '@rslib/tsconfig': specifier: workspace:* version: link:../scripts/tsconfig @@ -1144,6 +1153,12 @@ importers: '@rspress/plugin-rss': specifier: 2.0.0-beta.30 version: 2.0.0-beta.30(@rspress/core@2.0.0-beta.30(@types/react@19.1.12)) + '@rspress/plugin-sitemap': + specifier: 2.0.0-beta.30 + version: 2.0.0-beta.30(@rspress/core@2.0.0-beta.30(@types/react@19.1.12)) + '@rspress/plugin-twoslash': + specifier: 2.0.0-beta.30 + version: 2.0.0-beta.30(@rspress/core@2.0.0-beta.30(@types/react@19.1.12))(react@19.1.1)(typescript@5.9.2) '@rstack-dev/doc-ui': specifier: 1.11.0 version: 1.11.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1) @@ -1174,9 +1189,6 @@ importers: rspress-plugin-font-open-sans: specifier: 1.0.3 version: 1.0.3(@rspress/core@2.0.0-beta.30(@types/react@19.1.12)) - rspress-plugin-sitemap: - specifier: ^1.2.1 - version: 1.2.1 packages: @@ -1850,6 +1862,15 @@ packages: cpu: [x64] os: [win32] + '@floating-ui/core@1.7.3': + resolution: {integrity: sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==} + + '@floating-ui/dom@1.7.4': + resolution: {integrity: sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==} + + '@floating-ui/utils@0.2.10': + resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==} + '@inquirer/external-editor@1.0.1': resolution: {integrity: sha512-Oau4yL24d2B5IL4ma4UpbQigkVhzPDXLoqy1ggK4gnHg/stmkffJE4oOXHXF3uz0UEpywG68KcyXsyYpA1Re/Q==} engines: {node: '>=18'} @@ -2779,6 +2800,19 @@ packages: peerDependencies: '@rspress/core': ^2.0.0-beta.30 + '@rspress/plugin-sitemap@2.0.0-beta.30': + resolution: {integrity: sha512-h7tPpPWUaqErNVfqqILoxP6xldX1e09+oJc//lCE8i9/6nKjIblul0I1dGl9JlM17YMm6keUKzcSa1CZT5cdgA==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@rspress/core': ^2.0.0-beta.30 + + '@rspress/plugin-twoslash@2.0.0-beta.30': + resolution: {integrity: sha512-JiwnLOUa/0m6+C7u7A7Sn/cClo/pzaUCDoubOBdEjjdTxFGMR06dZrkaapI21/P8NnuknOdCZP5Y4ML04bO7+g==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@rspress/core': ^2.0.0-beta.30 + react: '>=18.0.0' + '@rspress/runtime@2.0.0-beta.30': resolution: {integrity: sha512-MdaFVy85Ih7M7jL06m+K+tpbvQnE5g8lswdGE2Uf7VB+/ImdUErQM54zZ2+z9kJgp+2clD6pwAY9Mrkdj91K1w==} engines: {node: '>=18.0.0'} @@ -2852,6 +2886,11 @@ packages: '@shikijs/transformers@3.12.1': resolution: {integrity: sha512-crGh3cSZf6mwg3K2W8i79Ja+q4tVClRHdHLnUGi5arS58+cqdzsbkrEZBDMyevf9ehmjFUWDTEwCMEyp9I3z0g==} + '@shikijs/twoslash@3.12.1': + resolution: {integrity: sha512-hDELTuDBqOfBgGrltbw0f0DEe65hg5q0HZSMdWpYD4nsWd7WHYSdj+UkGZHqRlWxplgDrwJnLwOH3rf/M/Fmog==} + peerDependencies: + typescript: '>=5.5.0' + '@shikijs/types@3.12.1': resolution: {integrity: sha512-Is/p+1vTss22LIsGCJTmGrxu7ZC1iBL9doJFYLaZ4aI8d0VDXb7Mn0kBzhkc7pdsRpmUbQLQ5HXwNpa3H6F8og==} @@ -3246,6 +3285,11 @@ packages: '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} + '@typescript/vfs@1.6.1': + resolution: {integrity: sha512-JwoxboBh7Oz1v38tPbkrZ62ZXNHAk9bJ7c9x0eI5zBfBnBYGhURdbnh7Z4smN/MV48Y5OCcZb58n972UtbazsA==} + peerDependencies: + typescript: '*' + '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -6483,9 +6527,6 @@ packages: peerDependencies: '@rspress/core': ^2.0.0-beta.24 || ^2.0.0 - rspress-plugin-sitemap@1.2.1: - resolution: {integrity: sha512-JMf2/SKerX3oiFuNaRAnPJxOtBl5hOF0qupK63Fh9CaTb6Mn440iximV+1V0fd/XeOhHlN0oLJPFUDrrkgkcwg==} - run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} @@ -7229,6 +7270,14 @@ packages: tty-browserify@0.0.1: resolution: {integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==} + twoslash-protocol@0.3.4: + resolution: {integrity: sha512-HHd7lzZNLUvjPzG/IE6js502gEzLC1x7HaO1up/f72d8G8ScWAs9Yfa97igelQRDl5h9tGcdFsRp+lNVre1EeQ==} + + twoslash@0.3.4: + resolution: {integrity: sha512-RtJURJlGRxrkJmTcZMjpr7jdYly1rfgpujJr1sBM9ch7SKVht/SjFk23IOAyvwT1NLCk+SJiMrvW4rIAUM2Wug==} + peerDependencies: + typescript: ^5.5.0 + type-fest@2.19.0: resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==} engines: {node: '>=12.20'} @@ -8349,6 +8398,17 @@ snapshots: '@esbuild/win32-x64@0.25.5': optional: true + '@floating-ui/core@1.7.3': + dependencies: + '@floating-ui/utils': 0.2.10 + + '@floating-ui/dom@1.7.4': + dependencies: + '@floating-ui/core': 1.7.3 + '@floating-ui/utils': 0.2.10 + + '@floating-ui/utils@0.2.10': {} + '@inquirer/external-editor@1.0.1(@types/node@22.18.0)': dependencies: chardet: 2.1.0 @@ -9412,6 +9472,23 @@ snapshots: '@rspress/core': 2.0.0-beta.30(@types/react@19.1.12) feed: 4.2.2 + '@rspress/plugin-sitemap@2.0.0-beta.30(@rspress/core@2.0.0-beta.30(@types/react@19.1.12))': + dependencies: + '@rspress/core': 2.0.0-beta.30(@types/react@19.1.12) + + '@rspress/plugin-twoslash@2.0.0-beta.30(@rspress/core@2.0.0-beta.30(@types/react@19.1.12))(react@19.1.1)(typescript@5.9.2)': + dependencies: + '@floating-ui/dom': 1.7.4 + '@rspress/core': 2.0.0-beta.30(@types/react@19.1.12) + '@shikijs/twoslash': 3.12.1(typescript@5.9.2) + mdast-util-from-markdown: 2.0.2 + mdast-util-gfm: 3.1.0 + mdast-util-to-hast: 13.2.0 + react: 19.1.1 + transitivePeerDependencies: + - supports-color + - typescript + '@rspress/runtime@2.0.0-beta.30': dependencies: '@rspress/shared': 2.0.0-beta.30 @@ -9544,6 +9621,15 @@ snapshots: '@shikijs/core': 3.12.1 '@shikijs/types': 3.12.1 + '@shikijs/twoslash@3.12.1(typescript@5.9.2)': + dependencies: + '@shikijs/core': 3.12.1 + '@shikijs/types': 3.12.1 + twoslash: 0.3.4(typescript@5.9.2) + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + '@shikijs/types@3.12.1': dependencies: '@shikijs/vscode-textmate': 10.0.2 @@ -9994,6 +10080,13 @@ snapshots: '@types/unist@3.0.3': {} + '@typescript/vfs@1.6.1(typescript@5.9.2)': + dependencies: + debug: 4.4.1 + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + '@ungap/structured-clone@1.2.0': {} '@unhead/react@2.0.14(react@19.1.1)': @@ -13877,8 +13970,6 @@ snapshots: dependencies: '@rspress/core': 2.0.0-beta.30(@types/react@19.1.12) - rspress-plugin-sitemap@1.2.1: {} - run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 @@ -14715,6 +14806,16 @@ snapshots: tty-browserify@0.0.1: {} + twoslash-protocol@0.3.4: {} + + twoslash@0.3.4(typescript@5.9.2): + dependencies: + '@typescript/vfs': 1.6.1(typescript@5.9.2) + twoslash-protocol: 0.3.4 + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + type-fest@2.19.0: {} type-fest@4.30.0: {} diff --git a/scripts/dictionary.txt b/scripts/dictionary.txt index ec87b60b6..481c9b9ae 100644 --- a/scripts/dictionary.txt +++ b/scripts/dictionary.txt @@ -139,6 +139,7 @@ tsbuildinfo tsconfck tsdoc tsup +Twoslash unencapsulated unocss unpatch diff --git a/website/docs/en/guide/advanced/module-federation.mdx b/website/docs/en/guide/advanced/module-federation.mdx index 4224425ff..e93eaad7f 100644 --- a/website/docs/en/guide/advanced/module-federation.mdx +++ b/website/docs/en/guide/advanced/module-federation.mdx @@ -30,7 +30,7 @@ import { PackageManagerTabs } from '@theme'; Then register the plugin in the `rslib.config.ts` file: -```ts title='rslib.config.ts' +```ts title='rslib.config.ts' twoslash import { pluginModuleFederation } from '@module-federation/rsbuild-plugin'; import { pluginReact } from '@rsbuild/plugin-react'; import { defineConfig } from '@rslib/core'; diff --git a/website/docs/en/guide/solution/react.mdx b/website/docs/en/guide/solution/react.mdx index 3c2b9e306..b62cd1c40 100644 --- a/website/docs/en/guide/solution/react.mdx +++ b/website/docs/en/guide/solution/react.mdx @@ -27,7 +27,7 @@ To compile React (JSX and TSX), you need to register the Rsbuild [React Plugin]( For example, register in `rslib.config.ts`: -```ts title="rslib.config.ts" +```ts title="rslib.config.ts" twoslash import { defineConfig } from '@rslib/core'; import { pluginReact } from '@rsbuild/plugin-react'; // [!code highlight] @@ -54,7 +54,7 @@ By default, Rsbuild uses the new JSX transform, which is `runtime: 'automatic'`. To change the JSX transform, you can pass the [swcReactOptions](https://rsbuild.rs/plugins/list/plugin-react#swcreactoptionsruntime) option to the React plugin. For example, to use the classic runtime: -```ts title="rslib.config.ts" +```ts title="rslib.config.ts" twoslash import { pluginReact } from '@rsbuild/plugin-react'; import { defineConfig } from '@rslib/core'; @@ -85,7 +85,7 @@ When `runtime` is set to `'automatic'`, you can specify the import path of the J For example, when using [Emotion](https://emotion.sh/), you can set `importSource` to `'@emotion/react'`: -```ts title="rslib.config.ts" +```ts title="rslib.config.ts" twoslash import { pluginReact } from '@rsbuild/plugin-react'; import { defineConfig } from '@rslib/core'; diff --git a/website/docs/zh/guide/advanced/module-federation.mdx b/website/docs/zh/guide/advanced/module-federation.mdx index 467daee46..f5086037c 100644 --- a/website/docs/zh/guide/advanced/module-federation.mdx +++ b/website/docs/zh/guide/advanced/module-federation.mdx @@ -120,7 +120,7 @@ Rslib 支持宿主应用和 Rslib 模块联邦项目同时开发。 设置宿主应用消费 Rslib 的模块联邦库。查看[@module-federation/rsbuild-plugin ](https://www.npmjs.com/package/@module-federation/rsbuild-plugin) 获取更多信息。 -```ts title="rsbuild.config.ts" +```ts title="rsbuild.config.ts" twoslash import { pluginModuleFederation } from '@module-federation/rsbuild-plugin'; import { defineConfig } from '@rsbuild/core'; import { pluginReact } from '@rsbuild/plugin-react'; diff --git a/website/docs/zh/guide/solution/react.mdx b/website/docs/zh/guide/solution/react.mdx index 40ab11c22..624f1dc9b 100644 --- a/website/docs/zh/guide/solution/react.mdx +++ b/website/docs/zh/guide/solution/react.mdx @@ -27,7 +27,7 @@ import { PackageManagerTabs } from '@theme'; 例如,在 `rslib.config.ts` 中注册: -```ts title="rslib.config.ts" +```ts title="rslib.config.ts" twoslash import { defineConfig } from '@rslib/core'; import { pluginReact } from '@rsbuild/plugin-react'; // [!code highlight] @@ -54,7 +54,7 @@ React 引入了一个 [新的 JSX transform](https://legacy.reactjs.org/blog/202 要更改 JSX transform,可以传递 [swcReactOptions](https://rsbuild.rs/zh/plugins/list/plugin-react#swcreactoptionsruntime) 给 React plugin. 比如要使用 classic runtime 时: -```ts title="rslib.config.ts" +```ts title="rslib.config.ts" twoslash import { pluginReact } from '@rsbuild/plugin-react'; import { defineConfig } from '@rslib/core'; @@ -85,7 +85,7 @@ export default defineConfig({ 例如,当使用 [Emotion](https://emotion.sh/),你可以设置 `importSource` 为 `'@emotion/react'`: -```ts title="rslib.config.ts" +```ts title="rslib.config.ts" twoslash import { pluginReact } from '@rsbuild/plugin-react'; import { defineConfig } from '@rslib/core'; diff --git a/website/package.json b/website/package.json index 9fafbb5c0..32ecbf26e 100644 --- a/website/package.json +++ b/website/package.json @@ -9,13 +9,18 @@ "preview": "rspress preview" }, "devDependencies": { + "@module-federation/rsbuild-plugin": "^0.18.3", "@rsbuild/core": "~1.5.3", + "@rsbuild/plugin-react": "^1.4.0", "@rsbuild/plugin-sass": "^1.4.0", + "@rslib/core": "workspace:*", "@rslib/tsconfig": "workspace:*", "@rspress/core": "2.0.0-beta.30", "@rspress/plugin-algolia": "2.0.0-beta.30", "@rspress/plugin-llms": "2.0.0-beta.30", "@rspress/plugin-rss": "2.0.0-beta.30", + "@rspress/plugin-sitemap": "2.0.0-beta.30", + "@rspress/plugin-twoslash": "2.0.0-beta.30", "@rstack-dev/doc-ui": "1.11.0", "@shikijs/transformers": "^3.12.1", "@types/node": "^22.18.0", @@ -25,7 +30,6 @@ "react-dom": "^19.1.1", "rsbuild-plugin-google-analytics": "1.0.4", "rsbuild-plugin-open-graph": "^1.1.0", - "rspress-plugin-font-open-sans": "1.0.3", - "rspress-plugin-sitemap": "^1.2.1" + "rspress-plugin-font-open-sans": "1.0.3" } } diff --git a/website/rspress.config.ts b/website/rspress.config.ts index 5094ad859..5cb5a883b 100644 --- a/website/rspress.config.ts +++ b/website/rspress.config.ts @@ -4,6 +4,8 @@ import { defineConfig } from '@rspress/core'; import { pluginAlgolia } from '@rspress/plugin-algolia'; import { pluginLlms } from '@rspress/plugin-llms'; import { pluginRss } from '@rspress/plugin-rss'; +import { pluginSitemap } from '@rspress/plugin-sitemap'; +import { pluginTwoslash } from '@rspress/plugin-twoslash'; import { transformerNotationDiff, transformerNotationHighlight, @@ -11,7 +13,6 @@ import { import { pluginGoogleAnalytics } from 'rsbuild-plugin-google-analytics'; import { pluginOpenGraph } from 'rsbuild-plugin-open-graph'; import { pluginFontOpenSans } from 'rspress-plugin-font-open-sans'; -import pluginSitemap from 'rspress-plugin-sitemap'; const siteUrl = 'https://rslib.rs'; const description = 'The Rsbuild-based library development tool'; @@ -21,6 +22,7 @@ export default defineConfig({ pluginAlgolia(), pluginFontOpenSans(), pluginLlms(), + pluginTwoslash(), pluginRss({ siteUrl, feed: [ @@ -47,7 +49,7 @@ export default defineConfig({ ], }), pluginSitemap({ - domain: siteUrl, + siteUrl, }), ], root: path.join(__dirname, 'docs'), @@ -59,7 +61,6 @@ export default defineConfig({ logo: 'https://assets.rspack.rs/rslib/rslib-logo-192x192.png', logoText: 'Rslib', markdown: { - checkDeadLinks: true, shiki: { transformers: [transformerNotationHighlight(), transformerNotationDiff()], }, @@ -138,9 +139,6 @@ export default defineConfig({ ], }, builderConfig: { - dev: { - lazyCompilation: true, - }, resolve: { alias: { '@components': path.join(__dirname, '@components'),