Skip to content

Commit d3d8409

Browse files
docs(deps): upgrade rspress 2.0.0-beta.5 (#973)
Co-authored-by: Timeless0911 <[email protected]> Co-authored-by: Timeless0911 <[email protected]>
1 parent 7f7295b commit d3d8409

24 files changed

+565
-353
lines changed

.vscode/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,11 @@
5353
"[less]": {
5454
"editor.defaultFormatter": "esbenp.prettier-vscode"
5555
},
56-
"typescript.tsdk": "node_modules/typescript/lib"
56+
"typescript.tsdk": "node_modules/typescript/lib",
57+
"json.schemas": [
58+
{
59+
"fileMatch": ["**/_meta.json"],
60+
"url": "./website/node_modules/rspress/meta-json-schema.json"
61+
}
62+
]
5763
}

biome.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"linter": {
5050
"enabled": true,
5151
"ignore": [
52+
"**/.rslib/*",
5253
"./tests/integration/**/*/src/*",
5354
"./tests/e2e/react-component/public/umd/*"
5455
],

pnpm-lock.yaml

Lines changed: 454 additions & 277 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ rspress
110110
rstack
111111
selfsign
112112
selfsigned
113+
shiki
114+
shikijs
113115
sirv
114116
sokra
115117
speedscope

tests/e2e/react-component/index.pw.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import assert from 'node:assert';
2-
import fs from 'node:fs';
3-
import path from 'node:path';
42
import { type Page, expect, test } from '@playwright/test';
53
import { dev } from 'test-helper/rsbuild';
64

7-
function getCwdByExample(exampleName: string) {
8-
return path.join(__dirname, '../../../examples', exampleName);
9-
}
10-
115
async function counterCompShouldWork(page: Page) {
126
const h2El = page.locator('h2');
137
await expect(h2El).toHaveText('Counter: 0');
@@ -101,14 +95,6 @@ test('should render example "react-component-bundle-false" successfully', async
10195
test('should render example "react-component-umd" successfully', async ({
10296
page,
10397
}) => {
104-
const umdPath = path.resolve(
105-
getCwdByExample('react-component-umd'),
106-
'./dist/umd/index.js',
107-
);
108-
fs.mkdirSync(path.resolve(__dirname, './public/umd'), { recursive: true });
109-
fs.copyFileSync(umdPath, path.resolve(__dirname, './public/umd/index.js'));
110-
fs.copyFileSync(umdPath, path.resolve(__dirname, './public/umd/index.css'));
111-
11298
const rsbuild = await dev({
11399
cwd: __dirname,
114100
page,

website/docs/en/config/lib/dts.mdx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ Configure the generation of the TypeScript declaration files.
2626

2727
Declaration files generation is an optional feature, you can set `dts: true` to enable [bundleless declaration files](/guide/advanced/dts#bundleless-declaration-files) generation.
2828

29-
```ts title="rslib.config.ts" {5}
29+
```ts title="rslib.config.ts"
3030
export default {
3131
lib: [
3232
{
3333
format: 'esm',
34-
dts: true,
34+
dts: true, // [!code highlight]
3535
},
3636
],
3737
};
3838
```
3939

4040
If you want to disable declaration files generation, you can set `dts: false` or do not specify the `dts` option.
4141

42-
```ts title="rslib.config.ts" {5}
42+
```ts title="rslib.config.ts"
4343
export default {
4444
lib: [
4545
{
4646
format: 'esm',
47-
dts: false,
47+
dts: false, // [!code highlight]
4848
},
4949
],
5050
};
@@ -73,11 +73,12 @@ import { PackageManagerTabs } from '@theme';
7373

7474
2. Set `dts.bundle` to `true`.
7575

76-
```ts title="rslib.config.ts" {5-7}
76+
```ts title="rslib.config.ts"
7777
export default {
7878
lib: [
7979
{
8080
format: 'esm',
81+
// [!code highlight:3]
8182
dts: {
8283
bundle: true,
8384
},
@@ -106,11 +107,12 @@ The default value follows the priority below:
106107

107108
#### Example
108109

109-
```ts title="rslib.config.ts" {5-7}
110+
```ts title="rslib.config.ts"
110111
export default {
111112
lib: [
112113
{
113114
format: 'esm',
115+
// [!code highlight:3]
114116
dts: {
115117
distPath: './dist-types',
116118
},
@@ -143,11 +145,12 @@ By default, type errors will cause the build to fail.
143145

144146
When `abortOnError` is set to `false` like below, the build will still succeed even if there are type issues in the code.
145147

146-
```ts title="rslib.config.ts" {5-7}
148+
```ts title="rslib.config.ts"
147149
export default {
148150
lib: [
149151
{
150152
format: 'esm',
153+
// [!code highlight:3]
151154
dts: {
152155
abortOnError: false,
153156
},

website/docs/en/config/lib/external-helpers.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,21 @@ export default class FOO {
2929

3030
When `externalHelpers` is disabled, the output JavaScript will inline helper functions.
3131

32-
```ts title="rslib.config.ts" {5}
32+
```ts title="rslib.config.ts"
3333
export default {
3434
lib: [
3535
{
3636
syntax: 'es5',
37-
externalHelpers: false,
37+
externalHelpers: false, // [!code highlight]
3838
},
3939
],
4040
};
4141
```
4242

4343
Below is the output JavaScript file, the highlighted code is the inlined helper functions:
4444

45-
```js title="index.js" {1-18}
45+
```js title="index.js"
46+
// [!code highlight:18]
4647
function _class_call_check(instance, Constructor) {
4748
if (!(instance instanceof Constructor))
4849
throw new TypeError('Cannot call a class as a function');
@@ -79,20 +80,21 @@ export { src_FOO as default };
7980

8081
When `externalHelpers` is enabled, the output JavaScript will import helper functions from the external module `@swc/helpers`.
8182

82-
```ts title="rslib.config.ts" {5}
83+
```ts title="rslib.config.ts"
8384
export default {
8485
lib: [
8586
{
8687
syntax: 'es5',
87-
externalHelpers: true,
88+
externalHelpers: true, // [!code highlight]
8889
},
8990
],
9091
};
9192
```
9293

9394
Below is the output JavaScript file, the highlighted code is importing helper functions:
9495

95-
```js title="index.js" {1-2}
96+
```js title="index.js"
97+
// [!code highlight:2]
9698
import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_class_call_check__ from '@swc/helpers/_/_class_call_check';
9799
import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_create_class__ from '@swc/helpers/_/_create_class';
98100
var src_FOO = /*#__PURE__*/ (function () {

website/docs/en/config/lib/umd-name.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ The module name of the UMD bundle must not conflict with the global variable nam
1515

1616
The UMD bundle will be mounted to `global.MyLibrary`.
1717

18-
```ts title="rslib.config.ts" {5}
18+
```ts title="rslib.config.ts"
1919
export default {
2020
lib: [
2121
{
2222
format: 'umd',
23-
umdName: 'MyLibrary',
23+
umdName: 'MyLibrary', // [!code highlight]
2424
},
2525
],
2626
};

website/docs/en/guide/advanced/json-files.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,18 @@ If you want JSON / YAML / TOML files to be output to the distribution directory
243243

244244
For example, the following configuration will output all JSON files in the `src` directory as-is:
245245

246-
```ts title="rslib.config.ts" {7,11-12}
246+
```ts title="rslib.config.ts"
247247
export default defineConfig({
248248
lib: [
249249
{
250250
bundle: false,
251251
source: {
252252
entry: {
253-
index: ['./src/**', '!./src/**/*.json'],
253+
index: ['./src/**', '!./src/**/*.json'], // [!code highlight]
254254
},
255255
},
256256
output: {
257+
// [!code highlight:2]
257258
copy: [{ from: './**/*.json', context: './src' }],
258259
externals: [/.*\.json$/],
259260
},

website/docs/en/guide/advanced/module-federation.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ import { PackageManagerTabs } from '@theme';
3030

3131
Then register the plugin in the `rslib.config.ts` file:
3232

33-
```ts title='rslib.config.ts' {8-43}
33+
```ts title='rslib.config.ts'
3434
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
3535
import { pluginReact } from '@rsbuild/plugin-react';
3636
import { defineConfig } from '@rslib/core';
3737

3838
export default defineConfig({
3939
lib: [
4040
// ... other format
41+
// [!code highlight:37]
4142
{
4243
format: 'mf',
4344
output: {
@@ -117,14 +118,15 @@ with Hot Module Replacement (HMR).
117118
Set up the host app to consume the Rslib Module Federation library. Check out the [@module-federation/rsbuild-plugin
118119
](https://www.npmjs.com/package/@module-federation/rsbuild-plugin) for more information.
119120

120-
```ts title="rsbuild.config.ts" {8-24}
121+
```ts title="rsbuild.config.ts"
121122
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
122123
import { defineConfig } from '@rsbuild/core';
123124
import { pluginReact } from '@rsbuild/plugin-react';
124125

125126
export default defineConfig({
126127
plugins: [
127128
pluginReact(),
129+
// [!code highlight:17]
128130
pluginModuleFederation({
129131
name: 'rsbuild_host',
130132
remotes: {
@@ -181,7 +183,7 @@ First, set up Storybook with the Rslib project. You can refer to the [Storybook
181183

182184
2. Then set up the Storybook configuration file `.storybook/main.ts`, specify the stories and addons, and set the framework with corresponding framework integration.
183185

184-
```ts title=".storybook/main.ts" {18-38}
186+
```ts title=".storybook/main.ts"
185187
import { dirname, join } from 'node:path';
186188
import type { StorybookConfig } from 'storybook-react-rsbuild';
187189

@@ -199,6 +201,7 @@ First, set up Storybook with the Rslib project. You can refer to the [Storybook
199201
options: {},
200202
},
201203
addons: [
204+
// [!code highlight:21]
202205
{
203206
name: getAbsolutePath('storybook-addon-rslib'),
204207
options: {
@@ -230,8 +233,9 @@ First, set up Storybook with the Rslib project. You can refer to the [Storybook
230233

231234
Import components from remote module.
232235

233-
```ts title="stories/index.stories.tsx" {2-3}
236+
```ts title="stories/index.stories.tsx"
234237
import React from 'react';
238+
// [!code highlight:2]
235239
// Load your remote module here, Storybook will act as the host app.
236240
import { Counter } from 'rslib-module';
237241

0 commit comments

Comments
 (0)