From 22bfb4ce1101f8f798a0f1238516e6f4c2e12153 Mon Sep 17 00:00:00 2001 From: sunyiteng Date: Fri, 10 Jul 2026 14:40:12 +0800 Subject: [PATCH 1/3] feat: polish the Rspress site experience - fix the Playground custom page layout\n- replace install snippets with PackageManagerTabs\n- align the custom theme with the original Nextra site --- apps/website/docs/docs/getting-started.mdx | 20 +- .../docs/docs/references/wasm-typescript.mdx | 6 +- apps/website/docs/docs/usage/bundling.mdx | 20 +- apps/website/docs/docs/usage/cli.mdx | 24 +- apps/website/docs/docs/usage/html.mdx | 20 +- apps/website/docs/docs/usage/jest.mdx | 20 +- apps/website/docs/docs/usage/swc-loader.mdx | 20 +- apps/website/docs/playground/index.mdx | 3 +- apps/website/theme/index.css | 694 ++++++++++++++++-- 9 files changed, 653 insertions(+), 174 deletions(-) diff --git a/apps/website/docs/docs/getting-started.mdx b/apps/website/docs/docs/getting-started.mdx index f8933a6b..e221408b 100644 --- a/apps/website/docs/docs/getting-started.mdx +++ b/apps/website/docs/docs/getting-started.mdx @@ -1,4 +1,4 @@ -import { Tab, Tabs } from '@rspress/core/theme'; +import { PackageManagerTabs } from '@rspress/core/theme'; # Getting Started @@ -8,23 +8,7 @@ The easiest way to try SWC is using the [Playground](/playground/). Otherwise, run the following to download pre-built binaries: - - - ```bash - pnpm add -D @swc/cli @swc/core - ``` - - - ```bash - npm i -D @swc/cli @swc/core - ``` - - - ```bash - yarn add -D @swc/cli @swc/core - ``` - - + Then, you can transpile your first file and emit to `stdout`: diff --git a/apps/website/docs/docs/references/wasm-typescript.mdx b/apps/website/docs/docs/references/wasm-typescript.mdx index 84edfd13..2186a366 100644 --- a/apps/website/docs/docs/references/wasm-typescript.mdx +++ b/apps/website/docs/docs/references/wasm-typescript.mdx @@ -1,10 +1,10 @@ +import { PackageManagerTabs } from '@rspress/core/theme'; + # @swc/wasm-typescript ## Installation -```bash -npm install @swc/wasm-typescript -``` + ### Usage diff --git a/apps/website/docs/docs/usage/bundling.mdx b/apps/website/docs/docs/usage/bundling.mdx index 5025b661..8e6072ee 100644 --- a/apps/website/docs/docs/usage/bundling.mdx +++ b/apps/website/docs/docs/usage/bundling.mdx @@ -1,4 +1,4 @@ -import { Tab, Tabs } from '@rspress/core/theme'; +import { PackageManagerTabs } from '@rspress/core/theme'; import Callout from '@components/Callout'; # Bundling (swcpack) @@ -18,23 +18,7 @@ View a [basic example of bundling](https://github.com/swc-project/pkgs/tree/main ## Usage - - - ```bash - pnpm add -D @swc/cli @swc/core - ``` - - - ```bash - npm i -D @swc/cli @swc/core - ``` - - - ```bash - yarn add -D @swc/cli @swc/core - ``` - - + Create a `spack.config.js` file and run: diff --git a/apps/website/docs/docs/usage/cli.mdx b/apps/website/docs/docs/usage/cli.mdx index 53bf20cf..0ad89b42 100644 --- a/apps/website/docs/docs/usage/cli.mdx +++ b/apps/website/docs/docs/usage/cli.mdx @@ -1,4 +1,4 @@ -import { Tab, Tabs } from '@rspress/core/theme'; +import { PackageManagerTabs } from '@rspress/core/theme'; # @swc/cli @@ -6,23 +6,7 @@ import { Tab, Tabs } from '@rspress/core/theme'; Run the following to download pre-built binaries: - - - ```bash - pnpm add -D @swc/cli @swc/core - ``` - - - ```bash - npm i -D @swc/cli @swc/core - ``` - - - ```bash - yarn add -D @swc/cli @swc/core - ``` - - + Then, you can transpile your files: @@ -116,9 +100,7 @@ npx swc src --only **/*.js To automatically recompile files on changes, install `chokidar`: -```sh -npm i -D chokidar -``` + Then, add the `-w` flag: diff --git a/apps/website/docs/docs/usage/html.mdx b/apps/website/docs/docs/usage/html.mdx index 6fcaba7f..b432cebd 100644 --- a/apps/website/docs/docs/usage/html.mdx +++ b/apps/website/docs/docs/usage/html.mdx @@ -2,28 +2,12 @@ title: "@swc/html" --- -import { Tab, Tabs } from '@rspress/core/theme'; +import { PackageManagerTabs } from '@rspress/core/theme'; import TypeDeclarations from '@components/TypeDeclarations'; ## Installation - - - ```bash - pnpm add -D @swc/html - ``` - - - ```bash - npm i -D @swc/html - ``` - - - ```bash - yarn add -D @swc/html - ``` - - + ## Usage diff --git a/apps/website/docs/docs/usage/jest.mdx b/apps/website/docs/docs/usage/jest.mdx index 832bcec3..f120c565 100644 --- a/apps/website/docs/docs/usage/jest.mdx +++ b/apps/website/docs/docs/usage/jest.mdx @@ -1,4 +1,4 @@ -import { Tab, Tabs } from '@rspress/core/theme'; +import { PackageManagerTabs } from '@rspress/core/theme'; # @swc/jest @@ -6,23 +6,7 @@ To make your Jest tests run faster, you can swap out the default JavaScript-base ## Installation - - - ```bash - pnpm add -D jest @swc/core @swc/jest - ``` - - - ```bash - npm i -D jest @swc/core @swc/jest - ``` - - - ```bash - yarn add -D jest @swc/core @swc/jest - ``` - - + ## Usage diff --git a/apps/website/docs/docs/usage/swc-loader.mdx b/apps/website/docs/docs/usage/swc-loader.mdx index 6169e234..b2d7a6c3 100644 --- a/apps/website/docs/docs/usage/swc-loader.mdx +++ b/apps/website/docs/docs/usage/swc-loader.mdx @@ -1,4 +1,4 @@ -import { Tab, Tabs } from '@rspress/core/theme'; +import { PackageManagerTabs } from '@rspress/core/theme'; # swc-loader @@ -8,23 +8,7 @@ For Rspack users, you can use Rspack's [builtin:swc-loader](https://rspack.rs/gu ## Installation - - - ```bash - pnpm add -D @swc/core swc-loader - ``` - - - ```bash - npm i -D @swc/core swc-loader - ``` - - - ```bash - yarn add -D @swc/core swc-loader - ``` - - + ## Usage diff --git a/apps/website/docs/playground/index.mdx b/apps/website/docs/playground/index.mdx index 7d398b7c..c83021d4 100644 --- a/apps/website/docs/playground/index.mdx +++ b/apps/website/docs/playground/index.mdx @@ -1,7 +1,6 @@ --- title: SWC Playground -sidebar: false -outline: false +pageType: custom ---