From 377a94cb9aa3542dc59e547cfc05f1eb189875bb Mon Sep 17 00:00:00 2001 From: 9aoy Date: Wed, 27 Nov 2024 17:58:04 +0800 Subject: [PATCH 01/40] feat: always write manifest to disk (#4074) Co-authored-by: neverland --- e2e/cases/output/manifest/index.test.ts | 35 +++++++++++++++++++- packages/core/src/plugins/manifest.ts | 4 ++- website/docs/en/guide/advanced/ssr.mdx | 43 +++++++++++++++++++++++++ website/docs/zh/guide/advanced/ssr.mdx | 43 +++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 2 deletions(-) diff --git a/e2e/cases/output/manifest/index.test.ts b/e2e/cases/output/manifest/index.test.ts index 61c65cc156..2af039acc9 100644 --- a/e2e/cases/output/manifest/index.test.ts +++ b/e2e/cases/output/manifest/index.test.ts @@ -1,6 +1,6 @@ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; -import { build } from '@e2e/helper'; +import { build, dev } from '@e2e/helper'; import { expect, test } from '@playwright/test'; const fixtures = __dirname; @@ -108,3 +108,36 @@ test('output.manifest when target is node', async () => { }, }); }); + +test('output.manifest should always write to disk when dev', async ({ + page, +}) => { + const rsbuild = await dev({ + cwd: fixtures, + page, + rsbuildConfig: { + output: { + distPath: { + root: 'dist-dev', + }, + manifest: true, + legalComments: 'none', + filenameHash: false, + }, + performance: { + chunkSplit: { + strategy: 'all-in-one', + }, + }, + }, + }); + + const files = await rsbuild.unwrapOutputJSON(); + + const manifestContent = + files[Object.keys(files).find((file) => file.endsWith('manifest.json'))!]; + + expect(manifestContent).toBeDefined(); + + await rsbuild.close(); +}); diff --git a/packages/core/src/plugins/manifest.ts b/packages/core/src/plugins/manifest.ts index 29d86464fd..c76484213c 100644 --- a/packages/core/src/plugins/manifest.ts +++ b/packages/core/src/plugins/manifest.ts @@ -143,9 +143,10 @@ export const pluginManifest = (): RsbuildPlugin => ({ name: 'rsbuild:manifest', setup(api) { - api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => { + api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev }) => { const { output: { manifest }, + dev: { writeToDisk }, } = environment.config; if (manifest === false) { @@ -163,6 +164,7 @@ export const pluginManifest = (): RsbuildPlugin => ({ chain.plugin(CHAIN_ID.PLUGIN.MANIFEST).use(RspackManifestPlugin, [ { fileName, + writeToFileEmit: isDev && writeToDisk !== true, generate: generateManifest(htmlPaths), }, ]); diff --git a/website/docs/en/guide/advanced/ssr.mdx b/website/docs/en/guide/advanced/ssr.mdx index fa774c6740..3f5706e9cc 100644 --- a/website/docs/en/guide/advanced/ssr.mdx +++ b/website/docs/en/guide/advanced/ssr.mdx @@ -152,6 +152,49 @@ If you need to preview the online effect of SSR rendering, you also need to modi Now, you can run the `npm run dev` command to start the dev server with SSR rendering function, and visit `http://localhost:3000/` to see that the SSR content has been rendered to the HTML page. +## Get Manifest + +By default, scripts and links associated with the current page are automatically inserted into the HTML template. At this time, the compiled HTML template content can be obtained through [getTransformedHtml](/guide/advanced/environments#environment-api). + +When you need to dynamically generate HTML on the server side, you'll need to inject the URLs of JavaScript and CSS assets into the HTML. By configuring [output.manifest](/config/output/manifest), you can easily obtain the manifest information of these assets. Here's an example: + +```ts title=rsbuild.config.ts +export default { + output: { + manifest: true, + }, +}; +``` + +```ts title=server.ts +async function renderHtmlPage(): Promise { + const manifest = await fs.promises.readFile('./dist/manifest.json', 'utf-8'); + const { entries } = JSON.parse(manifest); + + const { js, css } = entries['index'].initial; + + const scriptTags = js + .map((url) => ``) + .join('\n'); + const styleTags = css + .map((file) => ``) + .join('\n'); + + return ` + + + + ${scriptTags} + ${styleTags} + + +
+ + `; +} +``` + ## Examples - [SSR + Express Example](https://github.com/rspack-contrib/rspack-examples/blob/main/rsbuild/ssr-express) +- [SSR + Express + Manifest Example](https://github.com/rspack-contrib/rspack-examples/blob/main/rsbuild/ssr-express-with-manifest) diff --git a/website/docs/zh/guide/advanced/ssr.mdx b/website/docs/zh/guide/advanced/ssr.mdx index cca934d7b4..f59f33834a 100644 --- a/website/docs/zh/guide/advanced/ssr.mdx +++ b/website/docs/zh/guide/advanced/ssr.mdx @@ -152,6 +152,49 @@ startDevServer(process.cwd()); 现在,执行 `npm run dev` 命令即可启动带有 SSR 渲染功能的开发服务器,访问 `http://localhost:3000/` 即可看到 SSR 内容已经渲染到了 HTML 页面上。 +## 获取资源清单 + +默认情况下,和当前页面关联的 scripts 和 links 会自动插入到 HTML 模版中,此时通过 [getTransformedHtml](/guide/advanced/environments#environment-api) 即可获取编译后的 HTML 模版内容。 + +当需要在服务器端动态生成 HTML 时,你需要将 JavaScript 和 CSS 资源的 URL 注入到 HTML 中。通过配置 [output.manifest](/config/output/manifest),你可以方便地获取这些资源的清单信息。示例如下: + +```ts title=rsbuild.config.ts +export default { + output: { + manifest: true, + }, +}; +``` + +```ts title=server.ts +async function renderHtmlPage(): Promise { + const manifest = await fs.promises.readFile('./dist/manifest.json', 'utf-8'); + + const { entries } = JSON.parse(manifest); + const { js, css } = entries['index'].initial; + + const scriptTags = js + .map((file) => ``) + .join('\n'); + const styleTags = css + .map((file) => ``) + .join('\n'); + + return ` + + + + ${scriptTags} + ${styleTags} + + +
+ + `; +} +``` + ## 示例项目 - [SSR + Express Example](https://github.com/rspack-contrib/rspack-examples/blob/main/rsbuild/ssr-express) +- [SSR + Express + Manifest Example](https://github.com/rspack-contrib/rspack-examples/blob/main/rsbuild/ssr-express-with-manifest) From b1930bd084a1ad707f4a1c80667276ced1da71c3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 14:01:39 +0000 Subject: [PATCH 02/40] chore(deps): update dependency @types/node to ^22.10.0 (#4077) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- e2e/package.json | 2 +- examples/node/package.json | 2 +- packages/compat/webpack/package.json | 2 +- packages/core/package.json | 2 +- packages/create-rsbuild/package.json | 2 +- packages/plugin-babel/package.json | 2 +- packages/plugin-preact/package.json | 2 +- packages/plugin-react/package.json | 2 +- packages/plugin-sass/package.json | 2 +- packages/plugin-stylus/package.json | 2 +- packages/plugin-svelte/package.json | 2 +- packages/plugin-svgr/package.json | 2 +- packages/plugin-vue/package.json | 2 +- pnpm-lock.yaml | 126 +++++++++++++-------------- scripts/config/package.json | 2 +- scripts/test-helper/package.json | 2 +- website/package.json | 2 +- 17 files changed, 79 insertions(+), 79 deletions(-) diff --git a/e2e/package.json b/e2e/package.json index 8789e67a84..cc5effb9cd 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -42,7 +42,7 @@ "@scripts/test-helper": "workspace:*", "@types/fs-extra": "^11.0.4", "@types/lodash": "^4.17.13", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "create-rsbuild": "workspace:*", diff --git a/examples/node/package.json b/examples/node/package.json index fc21d8e20e..6d3db4dc2e 100644 --- a/examples/node/package.json +++ b/examples/node/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "typescript": "^5.7.2" } } diff --git a/packages/compat/webpack/package.json b/packages/compat/webpack/package.json index f0f5d675ee..ea2bcc2396 100644 --- a/packages/compat/webpack/package.json +++ b/packages/compat/webpack/package.json @@ -38,7 +38,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "ansi-escapes": "4.3.2", "cli-truncate": "2.1.0", "patch-console": "1.0.0", diff --git a/packages/core/package.json b/packages/core/package.json index 3a87605158..92703801a9 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -60,7 +60,7 @@ "@rslib/core": "0.1.0", "@types/connect": "3.4.38", "@types/fs-extra": "^11.0.4", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "@types/on-finished": "2.3.4", "@types/webpack-bundle-analyzer": "4.7.0", "@types/ws": "^8.5.13", diff --git a/packages/create-rsbuild/package.json b/packages/create-rsbuild/package.json index 4102184c64..2f1c39ef6b 100644 --- a/packages/create-rsbuild/package.json +++ b/packages/create-rsbuild/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "@rslib/core": "0.1.0", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "typescript": "^5.7.2" }, "engines": { diff --git a/packages/plugin-babel/package.json b/packages/plugin-babel/package.json index 894bc1e956..3f13bdfbf5 100644 --- a/packages/plugin-babel/package.json +++ b/packages/plugin-babel/package.json @@ -41,7 +41,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "babel-loader": "9.2.1", "prebundle": "1.2.5", "typescript": "^5.7.2" diff --git a/packages/plugin-preact/package.json b/packages/plugin-preact/package.json index 23dc425b0f..3abf2da3e5 100644 --- a/packages/plugin-preact/package.json +++ b/packages/plugin-preact/package.json @@ -34,7 +34,7 @@ "devDependencies": { "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "preact": "^10.25.0", "typescript": "^5.7.2" }, diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index de6679921b..a29fc3d7df 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -33,7 +33,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "typescript": "^5.7.2" }, "peerDependencies": { diff --git a/packages/plugin-sass/package.json b/packages/plugin-sass/package.json index 3e9eefc558..bc0620c760 100644 --- a/packages/plugin-sass/package.json +++ b/packages/plugin-sass/package.json @@ -39,7 +39,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "@types/sass-loader": "^8.0.9", "prebundle": "1.2.5", "resolve-url-loader": "^5.0.0", diff --git a/packages/plugin-stylus/package.json b/packages/plugin-stylus/package.json index fb2ff8d01a..4f4fc54490 100644 --- a/packages/plugin-stylus/package.json +++ b/packages/plugin-stylus/package.json @@ -36,7 +36,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "typescript": "^5.7.2" }, "peerDependencies": { diff --git a/packages/plugin-svelte/package.json b/packages/plugin-svelte/package.json index 2fb9b8cb6d..4bda2b8d8b 100644 --- a/packages/plugin-svelte/package.json +++ b/packages/plugin-svelte/package.json @@ -33,7 +33,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "svelte": "^5.2.7", "typescript": "^5.7.2" }, diff --git a/packages/plugin-svgr/package.json b/packages/plugin-svgr/package.json index 769113590d..177e3ced8c 100644 --- a/packages/plugin-svgr/package.json +++ b/packages/plugin-svgr/package.json @@ -39,7 +39,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "file-loader": "6.2.0", "prebundle": "1.2.5", "svgo": "^3.3.2", diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 816ef96d9c..1db20c5f38 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -34,7 +34,7 @@ "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "typescript": "^5.7.2", "vue": "^3.5.13", "webpack": "^5.96.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 082aad6c5c..c511eb442d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,7 +43,7 @@ importers: version: 5.7.2 vitest: specifier: ^2.1.5 - version: 2.1.5(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + version: 2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) e2e: dependencies: @@ -145,8 +145,8 @@ importers: specifier: ^4.17.13 version: 4.17.13 '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 '@types/react': specifier: ^18.3.12 version: 18.3.12 @@ -353,8 +353,8 @@ importers: specifier: workspace:* version: link:../../packages/core '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -550,8 +550,8 @@ importers: specifier: workspace:* version: link:../../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 ansi-escapes: specifier: 4.3.2 version: 4.3.2 @@ -590,8 +590,8 @@ importers: specifier: ^11.0.4 version: 11.0.4 '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 '@types/on-finished': specifier: 2.3.4 version: 2.3.4 @@ -720,8 +720,8 @@ importers: specifier: 0.1.0 version: 0.1.0(typescript@5.7.2) '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -793,8 +793,8 @@ importers: specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 babel-loader: specifier: 9.2.1 version: 9.2.1(@babel/core@7.26.0)(webpack@5.96.1) @@ -861,8 +861,8 @@ importers: specifier: 0.1.0 version: 0.1.0(typescript@5.7.2) '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 preact: specifier: ^10.25.0 version: 10.25.0 @@ -889,8 +889,8 @@ importers: specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -923,8 +923,8 @@ importers: specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 '@types/sass-loader': specifier: ^8.0.9 version: 8.0.9 @@ -994,8 +994,8 @@ importers: specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -1019,8 +1019,8 @@ importers: specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 svelte: specifier: ^5.2.7 version: 5.2.7 @@ -1059,8 +1059,8 @@ importers: specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 file-loader: specifier: 6.2.0 version: 6.2.0(webpack@5.96.1) @@ -1096,8 +1096,8 @@ importers: specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -1114,8 +1114,8 @@ importers: specifier: 0.1.0 version: 0.1.0(typescript@5.7.2) '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -1126,8 +1126,8 @@ importers: specifier: workspace:* version: link:../../packages/core '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 path-serializer: specifier: 0.2.2 version: 0.2.2 @@ -1154,8 +1154,8 @@ importers: specifier: 1.5.4 version: 1.5.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/node': - specifier: ^22.9.3 - version: 22.9.3 + specifier: ^22.10.0 + version: 22.10.0 '@types/react': specifier: ^18.3.12 version: 18.3.12 @@ -2888,8 +2888,8 @@ packages: '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@22.9.3': - resolution: {integrity: sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==} + '@types/node@22.10.0': + resolution: {integrity: sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==} '@types/on-finished@2.3.4': resolution: {integrity: sha512-Ld4UQD3udYcKPaAWlI1EYXKhefkZcTlpqOLkQRmN3u5Ml/tUypMivUHbNH8LweP4H4FlhGGO+uBjJI1Y1dkE1g==} @@ -6297,8 +6297,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} unicode-canonical-property-names-ecmascript@2.0.1: resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==} @@ -8509,7 +8509,7 @@ snapshots: '@types/connect@3.4.38': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/cookie@0.6.0': {} @@ -8536,7 +8536,7 @@ snapshots: '@types/fs-extra@11.0.4': dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/hast@2.3.10': dependencies: @@ -8548,13 +8548,13 @@ snapshots: '@types/http-proxy@1.17.15': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/json-schema@7.0.15': {} '@types/jsonfile@6.1.4': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/less@3.0.7': {} @@ -8570,17 +8570,17 @@ snapshots: '@types/node-sass@4.11.8': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/node@12.20.55': {} - '@types/node@22.9.3': + '@types/node@22.10.0': dependencies: - undici-types: 6.19.8 + undici-types: 6.20.0 '@types/on-finished@2.3.4': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/prop-types@15.7.13': {} @@ -8595,7 +8595,7 @@ snapshots: '@types/sass-loader@8.0.9': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/node-sass': 4.11.8 '@types/webpack': 4.41.40 sass: 1.81.0 @@ -8620,7 +8620,7 @@ snapshots: '@types/webpack-bundle-analyzer@4.7.0': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 tapable: 2.2.1 webpack: 5.96.1 transitivePeerDependencies: @@ -8631,13 +8631,13 @@ snapshots: '@types/webpack-sources@3.2.3': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/source-list-map': 0.1.6 source-map: 0.7.4 '@types/webpack@4.41.40': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@types/tapable': 1.0.12 '@types/uglify-js': 3.17.5 '@types/webpack-sources': 3.2.3 @@ -8646,7 +8646,7 @@ snapshots: '@types/ws@8.5.13': dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 '@vercel/ncc@0.38.1': {} @@ -8657,13 +8657,13 @@ snapshots: chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.5(vite@5.4.10(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0))': + '@vitest/mocker@2.1.5(vite@5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0))': dependencies: '@vitest/spy': 2.1.5 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - vite: 5.4.10(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite: 5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) '@vitest/pretty-format@2.1.5': dependencies: @@ -10275,7 +10275,7 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -12311,7 +12311,7 @@ snapshots: typescript@5.7.2: {} - undici-types@6.19.8: {} + undici-types@6.20.0: {} unicode-canonical-property-names-ecmascript@2.0.1: {} @@ -12447,13 +12447,13 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.5(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): + vite-node@2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): dependencies: cac: 6.7.14 debug: 4.3.7 es-module-lexer: 1.5.4 pathe: 1.1.2 - vite: 5.4.10(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite: 5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) transitivePeerDependencies: - '@types/node' - less @@ -12465,13 +12465,13 @@ snapshots: - supports-color - terser - vite@5.4.10(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): + vite@5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): dependencies: esbuild: 0.21.5 postcss: 8.4.49 rollup: 4.24.3 optionalDependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 fsevents: 2.3.3 less: 4.2.0 sass: 1.81.0 @@ -12479,10 +12479,10 @@ snapshots: stylus: 0.64.0 terser: 5.36.0 - vitest@2.1.5(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): + vitest@2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): dependencies: '@vitest/expect': 2.1.5 - '@vitest/mocker': 2.1.5(vite@5.4.10(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0)) + '@vitest/mocker': 2.1.5(vite@5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0)) '@vitest/pretty-format': 2.1.5 '@vitest/runner': 2.1.5 '@vitest/snapshot': 2.1.5 @@ -12498,11 +12498,11 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.10(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) - vite-node: 2.1.5(@types/node@22.9.3)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite: 5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite-node: 2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.9.3 + '@types/node': 22.10.0 transitivePeerDependencies: - less - lightningcss diff --git a/scripts/config/package.json b/scripts/config/package.json index bbe1ebcf99..a14199b580 100644 --- a/scripts/config/package.json +++ b/scripts/config/package.json @@ -5,7 +5,7 @@ "devDependencies": { "@rsbuild/core": "workspace:*", "@rslib/core": "0.1.0", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "typescript": "^5.7.2" } } diff --git a/scripts/test-helper/package.json b/scripts/test-helper/package.json index 70984ae455..84edbc15a2 100644 --- a/scripts/test-helper/package.json +++ b/scripts/test-helper/package.json @@ -26,7 +26,7 @@ }, "dependencies": { "@rsbuild/core": "workspace:*", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "path-serializer": "0.2.2", "typescript": "^5.7.2", "upath": "2.0.1" diff --git a/website/package.json b/website/package.json index c2e973c044..7fd322d366 100644 --- a/website/package.json +++ b/website/package.json @@ -11,7 +11,7 @@ "devDependencies": { "@rsbuild/core": "workspace:*", "@rspress/plugin-rss": "1.37.2", - "@types/node": "^22.9.3", + "@types/node": "^22.10.0", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "fast-glob": "^3.3.2", From 29ba24c81539ddebe89edadb50f5b34767a3f6c9 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 27 Nov 2024 22:18:19 +0800 Subject: [PATCH 03/40] chore(deps): remove unused rimraf and fs-extra (#4079) --- packages/core/package.json | 3 - pnpm-lock.yaml | 129 ++----------------------------------- 2 files changed, 4 insertions(+), 128 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 92703801a9..b3bafd5da4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -59,7 +59,6 @@ "devDependencies": { "@rslib/core": "0.1.0", "@types/connect": "3.4.38", - "@types/fs-extra": "^11.0.4", "@types/node": "^22.10.0", "@types/on-finished": "2.3.4", "@types/webpack-bundle-analyzer": "4.7.0", @@ -73,7 +72,6 @@ "deepmerge": "^4.3.1", "dotenv": "16.4.5", "dotenv-expand": "11.0.7", - "fs-extra": "^11.2.0", "html-rspack-plugin": "6.0.2", "http-proxy-middleware": "^2.0.6", "jiti": "^1.21.6", @@ -87,7 +85,6 @@ "postcss-loader": "8.1.1", "prebundle": "1.2.5", "reduce-configs": "^1.1.0", - "rimraf": "^6.0.1", "rsbuild-dev-middleware": "0.1.2", "rslog": "^1.2.3", "rspack-chain": "^1.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c511eb442d..de371a206c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -586,9 +586,6 @@ importers: '@types/connect': specifier: 3.4.38 version: 3.4.38 - '@types/fs-extra': - specifier: ^11.0.4 - version: 11.0.4 '@types/node': specifier: ^22.10.0 version: 22.10.0 @@ -628,9 +625,6 @@ importers: dotenv-expand: specifier: 11.0.7 version: 11.0.7 - fs-extra: - specifier: ^11.2.0 - version: 11.2.0 html-rspack-plugin: specifier: 6.0.2 version: 6.0.2(@rspack/core@1.1.4(@swc/helpers@0.5.15)) @@ -670,9 +664,6 @@ importers: reduce-configs: specifier: ^1.1.0 version: 1.1.0 - rimraf: - specifier: ^6.0.1 - version: 6.0.1 rsbuild-dev-middleware: specifier: 0.1.2 version: 0.1.2(webpack@5.96.1) @@ -2991,27 +2982,15 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@vue/compiler-core@3.5.12': - resolution: {integrity: sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw==} - '@vue/compiler-core@3.5.13': resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==} - '@vue/compiler-dom@3.5.12': - resolution: {integrity: sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg==} - '@vue/compiler-dom@3.5.13': resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==} - '@vue/compiler-sfc@3.5.12': - resolution: {integrity: sha512-2k973OGo2JuAa5+ZlekuQJtitI5CgLMOwgl94BzMCsKZCX/xiqzJYzapl4opFogKHqwJk34vfsaKpfEhd1k5nw==} - '@vue/compiler-sfc@3.5.13': resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==} - '@vue/compiler-ssr@3.5.12': - resolution: {integrity: sha512-eLwc7v6bfGBSM7wZOGPmRavSWzNFF6+PdRhE+VFJhNCgHiF8AM7ccoqcv5kBXA2eWUfigD7byekvf/JsOfKvPA==} - '@vue/compiler-ssr@3.5.13': resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==} @@ -3032,9 +3011,6 @@ packages: peerDependencies: vue: 3.5.13 - '@vue/shared@3.5.12': - resolution: {integrity: sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg==} - '@vue/shared@3.5.13': resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} @@ -3573,10 +3549,6 @@ packages: engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} hasBin: true - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} - engines: {node: '>= 8'} - cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -4124,11 +4096,6 @@ packages: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true - glob@11.0.0: - resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==} - engines: {node: 20 || >=22} - hasBin: true - global-modules@1.0.0: resolution: {integrity: sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==} engines: {node: '>=0.10.0'} @@ -4480,10 +4447,6 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} - jackspeak@4.0.2: - resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==} - engines: {node: 20 || >=22} - javascript-stringify@2.1.0: resolution: {integrity: sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==} @@ -4680,10 +4643,6 @@ packages: lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} - lru-cache@11.0.2: - resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==} - engines: {node: 20 || >=22} - lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} @@ -4916,10 +4875,6 @@ packages: peerDependencies: webpack: ^5.0.0 - minimatch@10.0.1: - resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} - engines: {node: 20 || >=22} - minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} @@ -5167,10 +5122,6 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} - path-scurry@2.0.0: - resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} - engines: {node: 20 || >=22} - path-serializer@0.2.2: resolution: {integrity: sha512-RKu4KZJCHV6QBMx19Ba59YRMPAMVfgyAGSaUk7RMlZgzihDgAwV1UIEhN6rQ6wcmqv42K6y7JSfWoU6JoBHeig==} @@ -5582,11 +5533,6 @@ packages: rfdc@1.4.1: resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} - rimraf@6.0.1: - resolution: {integrity: sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==} - engines: {node: 20 || >=22} - hasBin: true - rollup-plugin-dts@6.1.1: resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==} engines: {node: '>=16'} @@ -8716,18 +8662,10 @@ snapshots: '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/parser': 7.26.2 - '@vue/compiler-sfc': 3.5.12 + '@vue/compiler-sfc': 3.5.13 transitivePeerDependencies: - supports-color - '@vue/compiler-core@3.5.12': - dependencies: - '@babel/parser': 7.26.2 - '@vue/shared': 3.5.12 - entities: 4.5.0 - estree-walker: 2.0.2 - source-map-js: 1.2.1 - '@vue/compiler-core@3.5.13': dependencies: '@babel/parser': 7.26.2 @@ -8736,28 +8674,11 @@ snapshots: estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.5.12': - dependencies: - '@vue/compiler-core': 3.5.12 - '@vue/shared': 3.5.12 - '@vue/compiler-dom@3.5.13': dependencies: '@vue/compiler-core': 3.5.13 '@vue/shared': 3.5.13 - '@vue/compiler-sfc@3.5.12': - dependencies: - '@babel/parser': 7.26.2 - '@vue/compiler-core': 3.5.12 - '@vue/compiler-dom': 3.5.12 - '@vue/compiler-ssr': 3.5.12 - '@vue/shared': 3.5.12 - estree-walker: 2.0.2 - magic-string: 0.30.12 - postcss: 8.4.49 - source-map-js: 1.2.1 - '@vue/compiler-sfc@3.5.13': dependencies: '@babel/parser': 7.26.2 @@ -8770,11 +8691,6 @@ snapshots: postcss: 8.4.49 source-map-js: 1.2.1 - '@vue/compiler-ssr@3.5.12': - dependencies: - '@vue/compiler-dom': 3.5.12 - '@vue/shared': 3.5.12 - '@vue/compiler-ssr@3.5.13': dependencies: '@vue/compiler-dom': 3.5.13 @@ -8804,8 +8720,6 @@ snapshots: '@vue/shared': 3.5.13 vue: 3.5.13(typescript@5.7.2) - '@vue/shared@3.5.12': {} - '@vue/shared@3.5.13': {} '@webassemblyjs/ast@1.12.1': @@ -9339,13 +9253,7 @@ snapshots: cross-env@7.0.3: dependencies: - cross-spawn: 7.0.3 - - cross-spawn@7.0.3: - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 + cross-spawn: 7.0.6 cross-spawn@7.0.6: dependencies: @@ -9655,7 +9563,7 @@ snapshots: execa@5.1.1: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 get-stream: 6.0.1 human-signals: 2.1.0 is-stream: 2.0.1 @@ -9779,7 +9687,7 @@ snapshots: foreground-child@3.3.0: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 signal-exit: 4.1.0 form-data@4.0.1: @@ -9869,15 +9777,6 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 1.11.1 - glob@11.0.0: - dependencies: - foreground-child: 3.3.0 - jackspeak: 4.0.2 - minimatch: 10.0.1 - minipass: 7.1.2 - package-json-from-dist: 1.0.1 - path-scurry: 2.0.0 - global-modules@1.0.0: dependencies: global-prefix: 1.0.2 @@ -10258,10 +10157,6 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 - jackspeak@4.0.2: - dependencies: - '@isaacs/cliui': 8.0.2 - javascript-stringify@2.1.0: {} jest-diff@29.7.0: @@ -10477,8 +10372,6 @@ snapshots: lru-cache@10.4.3: {} - lru-cache@11.0.2: {} - lru-cache@5.1.1: dependencies: yallist: 3.1.1 @@ -10960,10 +10853,6 @@ snapshots: tapable: 2.2.1 webpack: 5.96.1 - minimatch@10.0.1: - dependencies: - brace-expansion: 2.0.1 - minimatch@9.0.3: dependencies: brace-expansion: 2.0.1 @@ -11238,11 +11127,6 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 - path-scurry@2.0.0: - dependencies: - lru-cache: 11.0.2 - minipass: 7.1.2 - path-serializer@0.2.2: {} path-type@4.0.0: {} @@ -11652,11 +11536,6 @@ snapshots: rfdc@1.4.1: {} - rimraf@6.0.1: - dependencies: - glob: 11.0.0 - package-json-from-dist: 1.0.1 - rollup-plugin-dts@6.1.1(rollup@4.24.3)(typescript@5.7.2): dependencies: magic-string: 0.30.12 From 9b3f824d17035fdead8facd1caf1fa5a54b5b688 Mon Sep 17 00:00:00 2001 From: Bharat Rawat <31788510+xettri@users.noreply.github.com> Date: Thu, 28 Nov 2024 08:34:38 +0545 Subject: [PATCH 04/40] [doc] Fix SSR Node Bundle Usage in Docs (#4076) --- website/docs/en/guide/advanced/ssr.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/en/guide/advanced/ssr.mdx b/website/docs/en/guide/advanced/ssr.mdx index 3f5706e9cc..7f0883a684 100644 --- a/website/docs/en/guide/advanced/ssr.mdx +++ b/website/docs/en/guide/advanced/ssr.mdx @@ -82,8 +82,8 @@ import { createRsbuild, loadConfig } from '@rsbuild/core'; // Implement SSR rendering function const serverRender = (serverAPI) => async (_req, res) => { - // Load SSR bundle - const indexModule = await serverAPI.environments.ssr.loadBundle('index'); + // Load Node bundle for SSR + const indexModule = await serverAPI.environments.node.loadBundle('index'); const markup = indexModule.render(); From ab5292347510dc94507ba2bc71c25d3dd79b51c7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:52:51 +0800 Subject: [PATCH 05/40] chore(deps): update dependency prettier to ^3.4.1 (#4078) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 9f8b9c3185..3670383424 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "cspell-ban-words": "^0.0.4", "nano-staged": "^0.8.0", "nx": "^20.1.3", - "prettier": "^3.3.3", + "prettier": "^3.4.1", "simple-git-hooks": "^2.11.1", "typescript": "^5.7.2", "vitest": "^2.1.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index de371a206c..d15f160617 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,8 +33,8 @@ importers: specifier: ^20.1.3 version: 20.1.3 prettier: - specifier: ^3.3.3 - version: 3.3.3 + specifier: ^3.4.1 + version: 3.4.1 simple-git-hooks: specifier: ^2.11.1 version: 2.11.1 @@ -5290,8 +5290,8 @@ packages: engines: {node: '>=10.13.0'} hasBin: true - prettier@3.3.3: - resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} + prettier@3.4.1: + resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==} engines: {node: '>=14'} hasBin: true @@ -11255,7 +11255,7 @@ snapshots: prebundle@1.2.5(typescript@5.7.2): dependencies: '@vercel/ncc': 0.38.1 - prettier: 3.3.3 + prettier: 3.4.1 rollup: 4.24.3 rollup-plugin-dts: 6.1.1(rollup@4.24.3)(typescript@5.7.2) terser: 5.36.0 @@ -11264,7 +11264,7 @@ snapshots: prettier@2.8.8: {} - prettier@3.3.3: {} + prettier@3.4.1: {} pretty-format@29.7.0: dependencies: From a3c7b54a65a3a996fd8f84402802d681e6dd6a61 Mon Sep 17 00:00:00 2001 From: 9aoy Date: Thu, 28 Nov 2024 11:10:44 +0800 Subject: [PATCH 06/40] docs: update ssr environment to node environment (#4080) --- e2e/cases/server/ssr/rsbuild.config.ts | 4 ++-- website/docs/en/guide/advanced/environments.mdx | 2 +- website/docs/zh/guide/advanced/environments.mdx | 2 +- website/docs/zh/guide/advanced/ssr.mdx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/cases/server/ssr/rsbuild.config.ts b/e2e/cases/server/ssr/rsbuild.config.ts index 988e43a05e..2beed82f9e 100644 --- a/e2e/cases/server/ssr/rsbuild.config.ts +++ b/e2e/cases/server/ssr/rsbuild.config.ts @@ -9,7 +9,7 @@ import { pluginReact } from '@rsbuild/plugin-react'; export const serverRender = (serverAPI: SetupMiddlewaresServer): RequestHandler => async (_req, res, _next) => { - const indexModule = await serverAPI.environments.ssr.loadBundle<{ + const indexModule = await serverAPI.environments.node.loadBundle<{ render: () => string; }>('index'); @@ -59,7 +59,7 @@ export default defineConfig({ }, }, }, - ssr: { + node: { output: { target: 'node', }, diff --git a/website/docs/en/guide/advanced/environments.mdx b/website/docs/en/guide/advanced/environments.mdx index a739e7788e..3c4b3289fc 100644 --- a/website/docs/en/guide/advanced/environments.mdx +++ b/website/docs/en/guide/advanced/environments.mdx @@ -249,7 +249,7 @@ import express from 'express'; import { createRsbuild, loadConfig } from '@rsbuild/core'; const serverRender = (serverAPI) => async (_req, res) => { - const indexModule = await serverAPI.environments.ssr.loadBundle('index'); + const indexModule = await serverAPI.environments.node.loadBundle('index'); const markup = indexModule.render(); diff --git a/website/docs/zh/guide/advanced/environments.mdx b/website/docs/zh/guide/advanced/environments.mdx index 27309812ba..8cc2a1b858 100644 --- a/website/docs/zh/guide/advanced/environments.mdx +++ b/website/docs/zh/guide/advanced/environments.mdx @@ -249,7 +249,7 @@ import express from 'express'; import { createRsbuild, loadConfig } from '@rsbuild/core'; const serverRender = (serverAPI) => async (_req, res) => { - const indexModule = await serverAPI.environments.ssr.loadBundle('index'); + const indexModule = await serverAPI.environments.node.loadBundle('index'); const markup = indexModule.render(); diff --git a/website/docs/zh/guide/advanced/ssr.mdx b/website/docs/zh/guide/advanced/ssr.mdx index f59f33834a..3ca626159f 100644 --- a/website/docs/zh/guide/advanced/ssr.mdx +++ b/website/docs/zh/guide/advanced/ssr.mdx @@ -83,7 +83,7 @@ import { createRsbuild, loadConfig } from '@rsbuild/core'; // 实现 SSR 渲染功能 const serverRender = (serverAPI) => async (_req, res) => { // 加载 SSR bundle - const indexModule = await serverAPI.environments.ssr.loadBundle('index'); + const indexModule = await serverAPI.environments.node.loadBundle('index'); const markup = indexModule.render(); From 440cdbfa4226be0592792f7eaf992f1744188ea1 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 28 Nov 2024 16:14:29 +0800 Subject: [PATCH 07/40] test: add e2e case for build API (#4081) --- e2e/cases/javascript-api/build/index.test.ts | 17 +++++++++++++++++ e2e/cases/javascript-api/build/src/index.js | 1 + 2 files changed, 18 insertions(+) create mode 100644 e2e/cases/javascript-api/build/index.test.ts create mode 100644 e2e/cases/javascript-api/build/src/index.js diff --git a/e2e/cases/javascript-api/build/index.test.ts b/e2e/cases/javascript-api/build/index.test.ts new file mode 100644 index 0000000000..b08638a084 --- /dev/null +++ b/e2e/cases/javascript-api/build/index.test.ts @@ -0,0 +1,17 @@ +import { expect, test } from '@playwright/test'; +import { createRsbuild } from '@rsbuild/core'; + +test('should allow to call `build` and get stats object', async () => { + const rsbuild = await createRsbuild({ + cwd: __dirname, + }); + + const { stats, close } = await rsbuild.build(); + + await close(); + + const result = stats?.toJson({ all: true })!; + + expect(result.name).toBe('web'); + expect(result.assets?.length).toBeGreaterThan(0); +}); diff --git a/e2e/cases/javascript-api/build/src/index.js b/e2e/cases/javascript-api/build/src/index.js new file mode 100644 index 0000000000..e921523b1b --- /dev/null +++ b/e2e/cases/javascript-api/build/src/index.js @@ -0,0 +1 @@ +console.log('hello'); From 5d7bc92e6309216890e3d8549e42a47d4aa2e08a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:42:27 +0000 Subject: [PATCH 08/40] chore(deps): update dependency vue-router to ^4.5.0 (#4082) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- e2e/package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/e2e/package.json b/e2e/package.json index cc5effb9cd..24096c01aa 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -16,7 +16,7 @@ "react-router-dom": "^7.0.1", "solid-js": "^1.9.3", "vue": "^3.5.13", - "vue-router": "^4.4.5" + "vue-router": "^4.5.0" }, "devDependencies": { "@e2e/helper": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d15f160617..ac89ebcdf3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,8 +72,8 @@ importers: specifier: ^3.5.13 version: 3.5.13(typescript@5.7.2) vue-router: - specifier: ^4.4.5 - version: 4.4.5(vue@3.5.13(typescript@5.7.2)) + specifier: ^4.5.0 + version: 4.5.0(vue@3.5.13(typescript@5.7.2)) devDependencies: '@e2e/helper': specifier: workspace:* @@ -6440,8 +6440,8 @@ packages: vue: optional: true - vue-router@4.4.5: - resolution: {integrity: sha512-4fKZygS8cH1yCyuabAXGUAsyi1b2/o/OKgu/RUb+znIYOxPRxdkytJEx+0wGcpBE1pX6vUgh5jwWOKRGvuA/7Q==} + vue-router@4.5.0: + resolution: {integrity: sha512-HDuk+PuH5monfNuY+ct49mNmkCRK4xJAV9Ts4z9UFc4rzdDnxQLyCMGGc8pKhZhHTVzfanpNwB/lwqevcBwI4w==} peerDependencies: vue: ^3.2.0 @@ -12402,7 +12402,7 @@ snapshots: optionalDependencies: vue: 3.5.13(typescript@5.7.2) - vue-router@4.4.5(vue@3.5.13(typescript@5.7.2)): + vue-router@4.5.0(vue@3.5.13(typescript@5.7.2)): dependencies: '@vue/devtools-api': 6.6.4 vue: 3.5.13(typescript@5.7.2) From 7b1e71ec136bca44b6b56a0a7e88b46944a22be5 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 28 Nov 2024 21:39:03 +0800 Subject: [PATCH 09/40] feat(CLI): set default `process.title` (#4083) --- packages/core/src/cli/prepare.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/cli/prepare.ts b/packages/core/src/cli/prepare.ts index bbd6f8ad58..865fd1d2ec 100644 --- a/packages/core/src/cli/prepare.ts +++ b/packages/core/src/cli/prepare.ts @@ -12,6 +12,9 @@ function initNodeEnv() { export function prepareCli(): void { initNodeEnv(); + // make it easier to identify the process via activity monitor or other tools + process.title = 'rsbuild-node'; + // Print a blank line to keep the greet log nice. // Some package managers automatically output a blank line, some do not. const { npm_execpath } = process.env; From 2bbc854cf8ba340e1ace7de97a814f53ee62ac77 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 29 Nov 2024 09:41:50 +0800 Subject: [PATCH 10/40] feat: complete the error message prefix (#4084) --- .../config/rspack-config-validate/index.test.ts | 2 +- packages/compat/plugin-webpack-swc/src/binding.ts | 4 +++- packages/compat/plugin-webpack-swc/src/utils.ts | 4 +++- packages/core/src/config.ts | 6 ++++-- packages/core/src/createRsbuild.ts | 4 ++-- packages/core/src/helpers/index.ts | 4 +++- packages/core/src/initPlugins.ts | 8 ++++---- packages/core/src/loadEnv.ts | 2 +- packages/core/src/pluginManager.ts | 12 ++++++------ packages/core/src/plugins/css.ts | 2 +- packages/core/src/plugins/entry.ts | 2 +- packages/core/src/plugins/html.ts | 2 +- packages/core/src/plugins/nodeAddons.ts | 4 +++- packages/core/src/plugins/swc.ts | 2 +- packages/core/src/provider/createCompiler.ts | 2 +- packages/core/src/provider/initConfigs.ts | 4 ++-- packages/core/src/provider/rspackConfig.ts | 2 +- packages/core/src/rspack/RsbuildHtmlPlugin.ts | 4 ++-- packages/core/src/server/cliShortcuts.ts | 4 +++- packages/core/src/server/devServer.ts | 6 ++++-- packages/core/src/server/environment.ts | 12 ++++++++---- packages/core/src/server/helper.ts | 4 ++-- packages/core/src/server/runner/basic.ts | 2 +- packages/core/src/server/runner/esm.ts | 2 +- packages/core/src/server/runner/index.ts | 2 +- packages/core/tests/pluginDagSort.test.ts | 2 +- packages/plugin-svelte/src/index.ts | 2 +- 27 files changed, 62 insertions(+), 44 deletions(-) diff --git a/e2e/cases/config/rspack-config-validate/index.test.ts b/e2e/cases/config/rspack-config-validate/index.test.ts index 68546c4856..ead03aeb0f 100644 --- a/e2e/cases/config/rspack-config-validate/index.test.ts +++ b/e2e/cases/config/rspack-config-validate/index.test.ts @@ -86,7 +86,7 @@ rspackOnlyTest( } catch (e) { expect(e).toBeTruthy(); expect(stripAnsi((e as Error).message)).toContain( - 'rsbuild:react appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.', + '[rsbuild:plugin] "rsbuild:react" appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.', ); } }, diff --git a/packages/compat/plugin-webpack-swc/src/binding.ts b/packages/compat/plugin-webpack-swc/src/binding.ts index a2b58e5619..dfca240197 100644 --- a/packages/compat/plugin-webpack-swc/src/binding.ts +++ b/packages/compat/plugin-webpack-swc/src/binding.ts @@ -38,7 +38,9 @@ export function transform( try { compiler = new Compiler(config); } catch (e) { - throw new Error(`[plugin-webpack-swc] Failed to initialize config: \n${e}`); + throw new Error( + `[rsbuild:plugin-webpack-swc] Failed to initialize config: \n${e}`, + ); } return compiler.transform(filename, code, map); } diff --git a/packages/compat/plugin-webpack-swc/src/utils.ts b/packages/compat/plugin-webpack-swc/src/utils.ts index 35a867facb..4f0a5d8f1a 100644 --- a/packages/compat/plugin-webpack-swc/src/utils.ts +++ b/packages/compat/plugin-webpack-swc/src/utils.ts @@ -38,7 +38,9 @@ export function applySwcDecoratorConfig( swcConfig.jsc.transform.decoratorVersion = '2022-03'; break; default: - throw new Error(`Unknown decorators version: ${version}`); + throw new Error( + `[rsbuild:plugin-webpack-swc] Unknown decorators version: ${version}`, + ); } } diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 2a52d8dbcc..9ffc17d087 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -482,7 +482,9 @@ export async function loadConfig({ const result = await configExport(configParams); if (result === undefined) { - throw new Error('The config function must return a config object.'); + throw new Error( + '[rsbuild:loadConfig] The config function must return a config object.', + ); } return { @@ -493,7 +495,7 @@ export async function loadConfig({ if (!isObject(configExport)) { throw new Error( - `The config must be an object or a function that returns an object, get ${color.yellow( + `[rsbuild:loadConfig] The config must be an object or a function that returns an object, get ${color.yellow( configExport, )}`, ); diff --git a/packages/core/src/createRsbuild.ts b/packages/core/src/createRsbuild.ts index b60b39e11f..bb8f77200e 100644 --- a/packages/core/src/createRsbuild.ts +++ b/packages/core/src/createRsbuild.ts @@ -155,7 +155,7 @@ export async function createRsbuild( if (checkDistDir) { if (!existsSync(distPath)) { throw new Error( - `The output directory ${color.yellow( + `[rsbuild:preview] The output directory ${color.yellow( distPath, )} does not exist, please build the project before previewing.`, ); @@ -163,7 +163,7 @@ export async function createRsbuild( if (isEmptyDir(distPath)) { throw new Error( - `The output directory ${color.yellow( + `[rsbuild:preview] The output directory ${color.yellow( distPath, )} is empty, please build the project before previewing.`, ); diff --git a/packages/core/src/helpers/index.ts b/packages/core/src/helpers/index.ts index 665f3f954b..ce0631259e 100644 --- a/packages/core/src/helpers/index.ts +++ b/packages/core/src/helpers/index.ts @@ -251,7 +251,9 @@ export function getFilename( case 'assets': return filename.assets ?? `[name]${hash}[ext]`; default: - throw new Error(`unknown key ${type} in "output.filename"`); + throw new Error( + `[rsbuild:config] unknown key ${type} in "output.filename"`, + ); } } diff --git a/packages/core/src/initPlugins.ts b/packages/core/src/initPlugins.ts index 80d54b5e8b..871a150571 100644 --- a/packages/core/src/initPlugins.ts +++ b/packages/core/src/initPlugins.ts @@ -87,7 +87,7 @@ const mapProcessAssetsStage = ( case 'report': return Compilation.PROCESS_ASSETS_STAGE_REPORT; default: - throw new Error(`Invalid process assets stage: ${stage}`); + throw new Error(`[rsbuild] Invalid process assets stage: ${stage}`); } }; @@ -113,7 +113,7 @@ export function initPluginAPI({ if (!config) { throw new Error( - `Cannot find normalized config by environment: ${options.environment}.`, + `[rsbuild] Cannot find normalized config by environment: ${options.environment}.`, ); } return config; @@ -121,7 +121,7 @@ export function initPluginAPI({ return context.normalizedConfig; } throw new Error( - 'Cannot access normalized config until modifyRsbuildConfig is called.', + '[rsbuild] Cannot access normalized config until modifyRsbuildConfig is called.', ); } @@ -134,7 +134,7 @@ export function initPluginAPI({ case 'normalized': return getNormalizedConfig(); } - throw new Error('`getRsbuildConfig` get an invalid type param.'); + throw new Error('[rsbuild] `getRsbuildConfig` get an invalid type param.'); }) as GetRsbuildConfig; const exposed: Array<{ id: string | symbol; api: any }> = []; diff --git a/packages/core/src/loadEnv.ts b/packages/core/src/loadEnv.ts index 65cde5c467..ce9ce6ec95 100644 --- a/packages/core/src/loadEnv.ts +++ b/packages/core/src/loadEnv.ts @@ -61,7 +61,7 @@ export function loadEnv({ } { if (mode === 'local') { throw new Error( - `'local' cannot be used as a value for env mode, because ".env.local" represents a temporary local file. Please use another value.`, + `[rsbuild:loadEnv] 'local' cannot be used as a value for env mode, because ".env.local" represents a temporary local file. Please use another value.`, ); } diff --git a/packages/core/src/pluginManager.ts b/packages/core/src/pluginManager.ts index 2fd078eb10..7b6fcb372b 100644 --- a/packages/core/src/pluginManager.ts +++ b/packages/core/src/pluginManager.ts @@ -14,7 +14,7 @@ function validatePlugin(plugin: unknown) { if (type !== 'object' || plugin === null) { throw new Error( - `Expect Rsbuild plugin instance to be an object, but got ${type}.`, + `[rsbuild:plugin] Expect Rsbuild plugin instance to be an object, but got ${type}.`, ); } @@ -48,7 +48,7 @@ function validatePlugin(plugin: unknown) { } throw new Error( - `Expect Rsbuild plugin.setup to be a function, but got ${type}.`, + `[rsbuild:plugin] Expect the setup function of Rsbuild plugin to be a function, but got ${type}.`, ); } @@ -156,7 +156,7 @@ export const pluginDagSort = (plugins: PluginMeta[]): PluginMeta[] => { function getPlugin(name: string) { const targets = plugins.filter((item) => item.instance.name === name); if (!targets.length) { - throw new Error(`plugin ${name} not existed`); + throw new Error(`[rsbuild:plugin] Plugin "${name}" not existed`); } return targets; } @@ -211,9 +211,9 @@ export const pluginDagSort = (plugins: PluginMeta[]): PluginMeta[] => { } throw new Error( - `plugins dependencies has loop: ${Object.keys(restInRingPoints).join( - ',', - )}`, + `[rsbuild:plugin] Plugins dependencies has loop: ${Object.keys( + restInRingPoints, + ).join(',')}`, ); } diff --git a/packages/core/src/plugins/css.ts b/packages/core/src/plugins/css.ts index 2307f1ab01..cae8f7ec08 100644 --- a/packages/core/src/plugins/css.ts +++ b/packages/core/src/plugins/css.ts @@ -170,7 +170,7 @@ const getPostcssLoaderOptions = async ({ if (typeof options !== 'object' || options === null) { throw new Error( - `\`postcssOptions\` function must return a PostCSSOptions object, got "${typeof options}".`, + `[rsbuild:css] \`postcssOptions\` function must return a PostCSSOptions object, got "${typeof options}".`, ); } diff --git a/packages/core/src/plugins/entry.ts b/packages/core/src/plugins/entry.ts index 9e4d1085f9..060a702c5f 100644 --- a/packages/core/src/plugins/entry.ts +++ b/packages/core/src/plugins/entry.ts @@ -35,7 +35,7 @@ export const pluginEntry = (): RsbuildPlugin => ({ api.onBeforeCreateCompiler(({ bundlerConfigs }) => { if (bundlerConfigs.every((config) => !config.entry)) { throw new Error( - `Could not find any entry module, please make sure that ${color.cyan( + `[rsbuild:config] Could not find any entry module, please make sure that ${color.cyan( 'src/index.(ts|js|tsx|jsx|mjs|cjs)', )} exists, or customize entry through the ${color.cyan( 'source.entry', diff --git a/packages/core/src/plugins/html.ts b/packages/core/src/plugins/html.ts index 9182c547ad..c4863b4017 100644 --- a/packages/core/src/plugins/html.ts +++ b/packages/core/src/plugins/html.ts @@ -75,7 +75,7 @@ export async function getTemplate( // Check if custom template exists if (!(await isFileExists(absolutePath))) { throw new Error( - `Failed to resolve HTML template, please check if the file exists: ${color.cyan( + `[rsbuild:html] Failed to resolve HTML template, please check if the file exists: ${color.cyan( absolutePath, )}`, ); diff --git a/packages/core/src/plugins/nodeAddons.ts b/packages/core/src/plugins/nodeAddons.ts index 2b33d9f56b..dc3ffdc41d 100644 --- a/packages/core/src/plugins/nodeAddons.ts +++ b/packages/core/src/plugins/nodeAddons.ts @@ -28,7 +28,9 @@ export const pluginNodeAddons = (): RsbuildPlugin => ({ const name = getFilename(resourcePath); if (name === null) { - throw new Error(`Failed to load Node.js addon: "${resourcePath}"`); + throw new Error( + `[rsbuild:node-addons] Failed to load Node.js addon: "${resourcePath}"`, + ); } emitFile(name, code); diff --git a/packages/core/src/plugins/swc.ts b/packages/core/src/plugins/swc.ts index eba37db702..b7298dbf6c 100644 --- a/packages/core/src/plugins/swc.ts +++ b/packages/core/src/plugins/swc.ts @@ -262,6 +262,6 @@ export function applySwcDecoratorConfig( swcConfig.jsc.transform.decoratorVersion = '2022-03'; break; default: - throw new Error(`Unknown decorators version: ${version}`); + throw new Error(`[rsbuild:swc] Unknown decorators version: ${version}`); } } diff --git a/packages/core/src/provider/createCompiler.ts b/packages/core/src/provider/createCompiler.ts index 1ffb4cb456..6d48d465f7 100644 --- a/packages/core/src/provider/createCompiler.ts +++ b/packages/core/src/provider/createCompiler.ts @@ -28,7 +28,7 @@ export async function createCompiler(options: InitConfigsOptions): Promise<{ if (!(await isSatisfyRspackVersion(rspack.rspackVersion))) { throw new Error( - `The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${color.green( + `[rsbuild] The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${color.green( rspackMinVersion, )}`, ); diff --git a/packages/core/src/provider/initConfigs.ts b/packages/core/src/provider/initConfigs.ts index 483ff09909..dac36f671d 100644 --- a/packages/core/src/provider/initConfigs.ts +++ b/packages/core/src/provider/initConfigs.ts @@ -123,7 +123,7 @@ const initEnvironmentConfigs = ( if (!Object.keys(resolvedEnvironments).length) { throw new Error( - `The current build is specified to run only in the ${color.yellow(specifiedEnvironments?.join(','))} environment, but the configuration of the specified environment was not found.`, + `[rsbuild:config] The current build is specified to run only in the ${color.yellow(specifiedEnvironments?.join(','))} environment, but the configuration of the specified environment was not found.`, ); } return resolvedEnvironments; @@ -133,7 +133,7 @@ const initEnvironmentConfigs = ( if (!isEnvironmentEnabled(defaultEnvironmentName)) { throw new Error( - `The current build is specified to run only in the ${color.yellow(specifiedEnvironments?.join(','))} environment, but the configuration of the specified environment was not found.`, + `[rsbuild:config] The current build is specified to run only in the ${color.yellow(specifiedEnvironments?.join(','))} environment, but the configuration of the specified environment was not found.`, ); } diff --git a/packages/core/src/provider/rspackConfig.ts b/packages/core/src/provider/rspackConfig.ts index 34e3bf80a0..e8d384ddee 100644 --- a/packages/core/src/provider/rspackConfig.ts +++ b/packages/core/src/provider/rspackConfig.ts @@ -171,7 +171,7 @@ export async function generateRspackConfig({ ) { const name = color.bold(color.yellow(plugin.name)); throw new Error( - `${name} appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`, + `[rsbuild:plugin] "${name}" appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`, ); } } diff --git a/packages/core/src/rspack/RsbuildHtmlPlugin.ts b/packages/core/src/rspack/RsbuildHtmlPlugin.ts index 7c614c4679..ba00a201ed 100644 --- a/packages/core/src/rspack/RsbuildHtmlPlugin.ts +++ b/packages/core/src/rspack/RsbuildHtmlPlugin.ts @@ -257,7 +257,7 @@ export class RsbuildHtmlPlugin { if (!compilation.inputFileSystem) { throw new Error( - `[RsbuildHtmlPlugin] 'compilation.inputFileSystem' is not available.`, + `[rsbuild:html] 'compilation.inputFileSystem' is not available.`, ); } @@ -268,7 +268,7 @@ export class RsbuildHtmlPlugin { if (!buf) { throw new Error( - `[RsbuildHtmlPlugin] Failed to read the favicon, please check if the '${filename}' file exists'.`, + `[rsbuild:html] Failed to read the favicon, please check if the '${filename}' file exists'.`, ); } diff --git a/packages/core/src/server/cliShortcuts.ts b/packages/core/src/server/cliShortcuts.ts index 61c31a2530..d0f80e8398 100644 --- a/packages/core/src/server/cliShortcuts.ts +++ b/packages/core/src/server/cliShortcuts.ts @@ -65,7 +65,9 @@ export function setupCliShortcuts({ shortcuts = customShortcuts(shortcuts); if (!Array.isArray(shortcuts)) { - throw new Error('`dev.cliShortcuts` must return an array of shortcuts.'); + throw new Error( + '[rsbuild:config] `dev.cliShortcuts` must return an array of shortcuts.', + ); } } diff --git a/packages/core/src/server/devServer.ts b/packages/core/src/server/devServer.ts index 7eac4b74d8..cdae83d805 100644 --- a/packages/core/src/server/devServer.ts +++ b/packages/core/src/server/devServer.ts @@ -150,7 +150,7 @@ export async function createDevServer< const compiler = customCompiler || (await createCompiler()); if (!compiler) { - throw new Error('Failed to get compiler instance.'); + throw new Error('[rsbuild:server] Failed to get compiler instance.'); } const publicPaths = isMultiCompiler(compiler) @@ -274,7 +274,9 @@ export async function createDevServer< { getStats: async () => { if (!runCompile) { - throw new Error("can't get stats info when runCompile is false"); + throw new Error( + '[rsbuild:server] Can not get stats info when "runCompile" is false', + ); } await waitFirstCompileDone; return lastStats[environment.index]; diff --git a/packages/core/src/server/environment.ts b/packages/core/src/server/environment.ts index bcae4ce0d7..5900cd5888 100644 --- a/packages/core/src/server/environment.ts +++ b/packages/core/src/server/environment.ts @@ -20,7 +20,7 @@ export const loadBundle = async ( }); if (!entrypoints?.[entryName]) { - throw new Error(`can't find entry(${entryName})`); + throw new Error(`[rsbuild:loadBundle] Can't find entry: "${entryName}"`); } const { chunks: entryChunks = [] } = entrypoints[entryName]; @@ -37,13 +37,15 @@ export const loadBundle = async ( }, []); if (files.length === 0) { - throw new Error(`can't get bundle by entryName(${entryName})`); + throw new Error( + `[rsbuild:loadBundle] Failed to get bundle by entryName: "${entryName}"`, + ); } // An entrypoint should have only one entryChunk, but there may be some boundary cases if (files.length > 1) { throw new Error( - `only support load single entry chunk, but got ${files.length}: ${files.join(',')}`, + `[rsbuild:loadBundle] Only support load single entry chunk, but got ${files.length}: ${files.join(',')}`, ); } @@ -65,7 +67,9 @@ export const getTransformedHtml = async ( const htmlPath = htmlPaths[entryName]; if (!htmlPath) { - throw new Error(`can't get html file by entryName(${entryName})`); + throw new Error( + `[rsbuild:getTransformedHtml] Failed to get HTML file by entryName: "${entryName}"`, + ); } const fileName = join(distPath, htmlPath); diff --git a/packages/core/src/server/helper.ts b/packages/core/src/server/helper.ts index 02b50f30d8..1d72c8d298 100644 --- a/packages/core/src/server/helper.ts +++ b/packages/core/src/server/helper.ts @@ -198,7 +198,7 @@ export function printServerURLs({ if (!Array.isArray(newUrls)) { throw new Error( - `"server.printUrls" must return an array, but got ${typeof newUrls}.`, + `[rsbuild:config] "server.printUrls" must return an array, but got ${typeof newUrls}.`, ); } @@ -282,7 +282,7 @@ export const getPort = async ({ if (port !== original) { if (strictPort) { throw new Error( - `Port "${original}" is occupied, please choose another one.`, + `[rsbuild:server] Port "${original}" is occupied, please choose another one.`, ); } } diff --git a/packages/core/src/server/runner/basic.ts b/packages/core/src/server/runner/basic.ts index 498f5be0d5..f2fe54a8eb 100644 --- a/packages/core/src/server/runner/basic.ts +++ b/packages/core/src/server/runner/basic.ts @@ -116,7 +116,7 @@ export abstract class BasicRunner implements Runner { this.requirers.set( 'entry', (_currentDirectory, _modulePath, _context = {}) => { - throw new Error('Not implement'); + throw new Error('[rsbuild:runner] Not implement'); }, ); } diff --git a/packages/core/src/server/runner/esm.ts b/packages/core/src/server/runner/esm.ts index 16092d7137..6ba8d6da40 100644 --- a/packages/core/src/server/runner/esm.ts +++ b/packages/core/src/server/runner/esm.ts @@ -42,7 +42,7 @@ export class EsmRunner extends CommonJsRunner { return (currentDirectory, modulePath, context = {}) => { if (!vm.SourceTextModule) { throw new Error( - "Running esm bundle needs add Node.js option '--experimental-vm-modules'.", + '[rsbuild:runner] Running ESM bundle needs add Node.js option "--experimental-vm-modules".', ); } const _require = this.getRequire(); diff --git a/packages/core/src/server/runner/index.ts b/packages/core/src/server/runner/index.ts index 22791d5886..3e7e6fbde1 100644 --- a/packages/core/src/server/runner/index.ts +++ b/packages/core/src/server/runner/index.ts @@ -34,7 +34,7 @@ export class BasicRunnerFactory implements RunnerFactory { compilerOptions.target === 'webworker' ) { throw new Error( - `not support run ${compilerOptions.target} resource in rsbuild server`, + `[rsbuild:runner] Not support run "${compilerOptions.target}" resource in Rsbuild server`, ); } return new EsmRunner(runnerOptions); diff --git a/packages/core/tests/pluginDagSort.test.ts b/packages/core/tests/pluginDagSort.test.ts index db6a1f5b48..8d83fe1839 100644 --- a/packages/core/tests/pluginDagSort.test.ts +++ b/packages/core/tests/pluginDagSort.test.ts @@ -138,6 +138,6 @@ describe('sort plugins', () => { environment: '', })), ); - }).toThrow(/plugins dependencies has loop: 2,3,5/); + }).toThrow(/Plugins dependencies has loop: 2,3,5/); }); }); diff --git a/packages/plugin-svelte/src/index.ts b/packages/plugin-svelte/src/index.ts index 1d402c172b..aec1d03633 100644 --- a/packages/plugin-svelte/src/index.ts +++ b/packages/plugin-svelte/src/index.ts @@ -66,7 +66,7 @@ export function pluginSvelte(options: PluginSvelteOptions = {}): RsbuildPlugin { logger.error( 'Cannot resolve `svelte` package under the project directory, did you forget to install it?', ); - throw new Error('Cannot resolve `svelte` package', { + throw new Error('[rsbuild:svelte] Failed to resolve `svelte` package', { cause: err, }); } From 648d789c3ef41d8860b87508afec04d985fa774a Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 29 Nov 2024 15:31:44 +0800 Subject: [PATCH 11/40] docs: tip for gzip compression (#4086) --- website/docs/en/config/performance/print-file-size.mdx | 4 ++++ website/docs/zh/config/performance/print-file-size.mdx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/website/docs/en/config/performance/print-file-size.mdx b/website/docs/en/config/performance/print-file-size.mdx index b132590bf5..1229cbd8a7 100644 --- a/website/docs/en/config/performance/print-file-size.mdx +++ b/website/docs/en/config/performance/print-file-size.mdx @@ -106,6 +106,10 @@ export default { }; ``` +:::tip +This data is only for reference to the size after gzip compression. Rsbuild does not enable gzip compression for static assets. Usually, you need to enable gzip compression on the server side, for example, using the [gzip module](https://nginx.org/en/docs/http/ngx_http_gzip_module.html) of nginx. +::: + ### include - **Type:** diff --git a/website/docs/zh/config/performance/print-file-size.mdx b/website/docs/zh/config/performance/print-file-size.mdx index 3219c36356..9e2f331197 100644 --- a/website/docs/zh/config/performance/print-file-size.mdx +++ b/website/docs/zh/config/performance/print-file-size.mdx @@ -106,6 +106,10 @@ export default { }; ``` +:::tip +该数据仅用于参考 gzip 压缩后的体积,Rsbuild 并不会对静态资源开启 gzip 压缩。通常,你需要在服务器端开启 gzip 压缩,例如使用 [nginx 的 gzip 模块](https://nginx.org/en/docs/http/ngx_http_gzip_module.html)。 +::: + ### include - **类型:** From 1d21f67efdeed8ebc0d13f20390d37b3298911a2 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 29 Nov 2024 15:53:25 +0800 Subject: [PATCH 12/40] docs: update MF guides to @module-federation/rsbuild-plugin (#4087) --- .../en/guide/advanced/module-federation.mdx | 20 ++++++++----------- .../zh/guide/advanced/module-federation.mdx | 18 +++++++---------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/website/docs/en/guide/advanced/module-federation.mdx b/website/docs/en/guide/advanced/module-federation.mdx index 068de566bb..cc46223795 100644 --- a/website/docs/en/guide/advanced/module-federation.mdx +++ b/website/docs/en/guide/advanced/module-federation.mdx @@ -34,26 +34,22 @@ Here are the characteristics of several versions: [Module Federation 2.0](https://module-federation.io/blog/announcement.html) provides some additional out-of-the-box features based on Module Federation, such as dynamic TS type hints, Chrome devtools, Runtime plugins, preloading, making Module Federation more suitable for micro-frontend architecture supporting large-scale Web applications. Module Federation v2.0 is implemented based on v1.5. -You need to install the additional `@module-federation/enhanced` plugin to use Module Federation v2.0. +You need to install the additional [@module-federation/rsbuild-plugin](https://www.npmjs.com/package/@module-federation/rsbuild-plugin) plugin to use Module Federation v2.0. ```ts title="rsbuild.config.ts" -import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack'; +import { pluginModuleFederation } from '@module-federation/rsbuild-plugin'; export default defineConfig({ - tools: { - rspack: { - plugins: [ - new ModuleFederationPlugin({ - name: 'provider', - // other options - }), - ], - }, + plugins: { + pluginModuleFederation({ + name: 'remote', + // other options + }), }, }); ``` -Please refer to the [Module Federation v2.0 official documentation](https://module-federation.io/) for specific usage details. +Please refer to the [Module Federation v2.0 official documentation](https://module-federation.io/) for detailed usage. ### Module Federation v1.5 diff --git a/website/docs/zh/guide/advanced/module-federation.mdx b/website/docs/zh/guide/advanced/module-federation.mdx index d4f6cc0755..b5f6ff4ad3 100644 --- a/website/docs/zh/guide/advanced/module-federation.mdx +++ b/website/docs/zh/guide/advanced/module-federation.mdx @@ -34,21 +34,17 @@ Module Federation(MF) 目前有多个主要版本,你可以根据你的需 [Module Federation 2.0](https://module-federation.io/blog/announcement.html) 在 Module Federation 的基础上,开箱即用的提供了一些额外的功能,比如动态 TS 类型提示、Chrome devtool、Runtime plugin、预加载,这些功能让 Module Federation 更适用于支持大型 Web 应用的微前端架构,Module Federation v2.0 在 v1.5 的基础上实现。 -你需要安装额外的 `@module-federation/enhanced` 插件,才能使用 Module Federation v2.0。 +你需要安装额外的 [@module-federation/rsbuild-plugin](https://www.npmjs.com/package/@module-federation/rsbuild-plugin) 插件,才能使用 Module Federation v2.0。 ```ts title="rsbuild.config.ts" -import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack'; +import { pluginModuleFederation } from '@module-federation/rsbuild-plugin'; export default defineConfig({ - tools: { - rspack: { - plugins: [ - new ModuleFederationPlugin({ - name: 'provider', - // other options - }), - ], - }, + plugins: { + pluginModuleFederation({ + name: 'remote', + // other options + }), }, }); ``` From d0c6e11a83adcf752456654aa64fd8532349ea37 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 29 Nov 2024 20:24:48 +0800 Subject: [PATCH 13/40] docs: clarify chunk-split behavior for different targets (#4088) --- .../en/config/performance/chunk-split.mdx | 20 ++++++++++++++++++- .../zh/config/performance/chunk-split.mdx | 20 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/website/docs/en/config/performance/chunk-split.mdx b/website/docs/en/config/performance/chunk-split.mdx index 88d6834046..040531a5b3 100644 --- a/website/docs/en/config/performance/chunk-split.mdx +++ b/website/docs/en/config/performance/chunk-split.mdx @@ -172,4 +172,22 @@ export default { }; ``` -> When the Rsbuild target is "node", since Node Bundles do not need to be split to optimize loading performance, the chunkSplit rule will not take effect. +## Targets + +`performance.chunkSplit` only works when [output.target](/config/output/target) is `web`. This means that when `output.target` is `node` or `web-worker`, `performance.chunkSplit` will not take effect. + +Typically, Node bundles do not need to be split to optimize loading performance, if you need to split Node bundles, you can use the [tools.rspack](/config/tools/rspack) configuration to configure Rspack's [optimization.splitChunks](https://rspack.dev/plugins/webpack/split-chunks-plugin#optimizationsplitchunks) option: + +```ts +export default { + tools: { + rspack: { + optimization: { + splitChunks: { + // options + }, + }, + }, + }, +}; +``` diff --git a/website/docs/zh/config/performance/chunk-split.mdx b/website/docs/zh/config/performance/chunk-split.mdx index 720a873a7d..51527a531e 100644 --- a/website/docs/zh/config/performance/chunk-split.mdx +++ b/website/docs/zh/config/performance/chunk-split.mdx @@ -172,4 +172,22 @@ export default { }; ``` -> 当 Rsbuild 构建 "node" 类型的产物时,由于 Node Bundles 不需要通过拆包来优化加载性能,因此 chunkSplit 规则不会生效。 +## 产物类型 + +`performance.chunkSplit` 仅在 [output.target](/config/output/target) 为 `web` 时生效。这意味着,当 `output.target` 为 `node` 或 `web-worker` 时,`performance.chunkSplit` 配置项不会生效。 + +通常 Node bundles 不需要通过 split chunks 来优化加载性能,如果你需要对 Node bundles 进行拆包,可以使用 [tools.rspack](/config/tools/rspack) 来配置 Rspack 的 [optimization.splitChunks](https://rspack.dev/plugins/webpack/split-chunks-plugin#optimizationsplitchunks) 选项: + +```ts +export default { + tools: { + rspack: { + optimization: { + splitChunks: { + // options + }, + }, + }, + }, +}; +``` From adcbde11365cd095d6927a02b84f91f3b81449bb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 30 Nov 2024 12:14:44 +0000 Subject: [PATCH 14/40] chore(deps): update dependency path-serializer to v0.3.4 (#4091) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pnpm-lock.yaml | 10 +++++----- scripts/test-helper/package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac89ebcdf3..e2e0f72d0e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1120,8 +1120,8 @@ importers: specifier: ^22.10.0 version: 22.10.0 path-serializer: - specifier: 0.2.2 - version: 0.2.2 + specifier: 0.3.4 + version: 0.3.4 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -5122,8 +5122,8 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} - path-serializer@0.2.2: - resolution: {integrity: sha512-RKu4KZJCHV6QBMx19Ba59YRMPAMVfgyAGSaUk7RMlZgzihDgAwV1UIEhN6rQ6wcmqv42K6y7JSfWoU6JoBHeig==} + path-serializer@0.3.4: + resolution: {integrity: sha512-bqNF6KKbFn2hrTgybBTqAqjKOneLvpFmvYx43ppm8IcmfgYLh4aMmR35+GnnKYdd0l6gtBlaok+aRR0PSwtGaQ==} path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} @@ -11127,7 +11127,7 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 - path-serializer@0.2.2: {} + path-serializer@0.3.4: {} path-type@4.0.0: {} diff --git a/scripts/test-helper/package.json b/scripts/test-helper/package.json index 84edbc15a2..949327b8ca 100644 --- a/scripts/test-helper/package.json +++ b/scripts/test-helper/package.json @@ -27,7 +27,7 @@ "dependencies": { "@rsbuild/core": "workspace:*", "@types/node": "^22.10.0", - "path-serializer": "0.2.2", + "path-serializer": "0.3.4", "typescript": "^5.7.2", "upath": "2.0.1" }, From 9712dd045fcc50a17366a09c157fbcd72d38d79d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 30 Nov 2024 12:15:09 +0000 Subject: [PATCH 15/40] chore(deps): update dependency @module-federation/rsbuild-plugin to v0.8.0 (#4090) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- e2e/package.json | 2 +- .../module-federation-v2/host/package.json | 2 +- .../module-federation-v2/remote/package.json | 2 +- pnpm-lock.yaml | 29 ++++++++++++------- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/e2e/package.json b/e2e/package.json index 24096c01aa..5555ce7680 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -38,7 +38,7 @@ "@rsbuild/plugin-vue": "workspace:*", "@rsbuild/plugin-vue-jsx": "^1.0.1", "@rsbuild/webpack": "workspace:*", - "@module-federation/rsbuild-plugin": "0.7.6", + "@module-federation/rsbuild-plugin": "0.8.0", "@scripts/test-helper": "workspace:*", "@types/fs-extra": "^11.0.4", "@types/lodash": "^4.17.13", diff --git a/examples/module-federation-v2/host/package.json b/examples/module-federation-v2/host/package.json index 46f9b3f3a5..bc96a3ca33 100644 --- a/examples/module-federation-v2/host/package.json +++ b/examples/module-federation-v2/host/package.json @@ -10,7 +10,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { - "@module-federation/rsbuild-plugin": "0.7.6", + "@module-federation/rsbuild-plugin": "0.8.0", "@rsbuild/core": "workspace:*", "@rsbuild/plugin-react": "workspace:*" } diff --git a/examples/module-federation-v2/remote/package.json b/examples/module-federation-v2/remote/package.json index 8614e4ad98..81d9b308e9 100644 --- a/examples/module-federation-v2/remote/package.json +++ b/examples/module-federation-v2/remote/package.json @@ -10,7 +10,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { - "@module-federation/rsbuild-plugin": "0.7.6", + "@module-federation/rsbuild-plugin": "0.8.0", "@rsbuild/core": "workspace:*", "@rsbuild/plugin-react": "workspace:*" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e2e0f72d0e..e2e4154ad7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,8 +79,8 @@ importers: specifier: workspace:* version: link:scripts '@module-federation/rsbuild-plugin': - specifier: 0.7.6 - version: 0.7.6(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core) + specifier: 0.8.0 + version: 0.8.0(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core) '@playwright/test': specifier: 1.44.1 version: 1.44.1 @@ -287,8 +287,8 @@ importers: version: 18.3.1(react@18.3.1) devDependencies: '@module-federation/rsbuild-plugin': - specifier: 0.7.6 - version: 0.7.6(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core) + specifier: 0.8.0 + version: 0.8.0(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core) '@rsbuild/core': specifier: workspace:* version: link:../../../packages/core @@ -306,8 +306,8 @@ importers: version: 18.3.1(react@18.3.1) devDependencies: '@module-federation/rsbuild-plugin': - specifier: 0.7.6 - version: 0.7.6(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core) + specifier: 0.8.0 + version: 0.8.0(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core) '@rsbuild/core': specifier: workspace:* version: link:../../../packages/core @@ -2160,11 +2160,11 @@ packages: '@module-federation/manifest@0.7.6': resolution: {integrity: sha512-xBrFwLjDMUjKRnp+P4X29ZNyhgXSsp+SfrBxVsKJpEESOHalDoNClbo6gXvZAvkBZyo9sY3SJhAwduDwNkg04w==} - '@module-federation/rsbuild-plugin@0.7.6': - resolution: {integrity: sha512-aptyTzo6UCBLWlyfNZacqsmhTy9r+JmPb8x12mQjdvfL4TiW4azax41Ux5rl2o9uhU2+etwntmBXBbfW8CGa2Q==} + '@module-federation/rsbuild-plugin@0.8.0': + resolution: {integrity: sha512-/CbaSRrpNtt6c5S3TuaQQ3CiUY7QfvaU0J33CyWkv8h0xKfYN6A0aMoxQvYi3z5qyTPth2V49YnlRUlQnaecPA==} engines: {node: '>=16.0.0'} peerDependencies: - '@module-federation/enhanced': 0.7.6 + '@module-federation/enhanced': 0.8.0 '@rsbuild/core': 1.x '@module-federation/rspack@0.7.6': @@ -2196,6 +2196,9 @@ packages: '@module-federation/sdk@0.7.6': resolution: {integrity: sha512-MFE+RtsHnutZOCp2eKpa3A/yzZ8tOPmjX7QRdVnB2qqR9JA2SH3ZP5+cYq76tzFQZvU1BCWAQVNMvqGOW2yVZQ==} + '@module-federation/sdk@0.8.0': + resolution: {integrity: sha512-V2cNGO//sWCyHTaQ0iTcoslolqVgdBIBOkZVLyk9AkZ4B3CO49pe/TmIIaVs9jVg3GO+ZmmazBFKRkqdn2PdRg==} + '@module-federation/third-party-dts-extractor@0.7.6': resolution: {integrity: sha512-JME76/rgr41AKXG6kUTQXdQJiMCypN3qHOgPv4VuIag10UdLo/0gdeN6PYronvYmvPOQMfYev80GcEwl4l531A==} @@ -7797,10 +7800,10 @@ snapshots: - utf-8-validate - vue-tsc - '@module-federation/rsbuild-plugin@0.7.6(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core)': + '@module-federation/rsbuild-plugin@0.8.0(@module-federation/enhanced@0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1))(@rsbuild/core@packages+core)': dependencies: '@module-federation/enhanced': 0.7.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.2)(webpack@5.96.1) - '@module-federation/sdk': 0.7.6 + '@module-federation/sdk': 0.8.0 '@rsbuild/core': link:packages/core '@module-federation/rspack@0.7.6(typescript@5.7.2)': @@ -7844,6 +7847,10 @@ snapshots: dependencies: isomorphic-rslog: 0.0.6 + '@module-federation/sdk@0.8.0': + dependencies: + isomorphic-rslog: 0.0.6 + '@module-federation/third-party-dts-extractor@0.7.6': dependencies: find-pkg: 2.0.0 From 1c0a9278b540dd06e0207c3f6278710923593ae8 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 30 Nov 2024 22:33:31 +0800 Subject: [PATCH 16/40] feat: add `resolve.dedupe` config (#4092) --- e2e/cases/resolve/dedupe/index.test.ts | 36 +++++++++++++ e2e/cases/resolve/dedupe/rsbuild.config.ts | 12 +++++ e2e/cases/resolve/dedupe/src/index.js | 5 ++ packages/core/src/config.ts | 1 + packages/core/src/plugins/resolve.ts | 50 +++++++++++++++++++ packages/core/src/types/config.ts | 15 ++++++ .../__snapshots__/environments.test.ts.snap | 9 ++++ 7 files changed, 128 insertions(+) create mode 100644 e2e/cases/resolve/dedupe/index.test.ts create mode 100644 e2e/cases/resolve/dedupe/rsbuild.config.ts create mode 100644 e2e/cases/resolve/dedupe/src/index.js diff --git a/e2e/cases/resolve/dedupe/index.test.ts b/e2e/cases/resolve/dedupe/index.test.ts new file mode 100644 index 0000000000..02010f2812 --- /dev/null +++ b/e2e/cases/resolve/dedupe/index.test.ts @@ -0,0 +1,36 @@ +import { join } from 'node:path'; +import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { outputFileSync } from 'fs-extra'; + +function writeDuplicatedPackage(flag: string) { + const fooPath = join(__dirname, 'node_modules', 'foo'); + outputFileSync( + join(fooPath, 'package.json'), + JSON.stringify({ name: 'foo', version: '1.0.0' }), + ); + outputFileSync( + join(fooPath, 'index.js'), + 'import React from "react";export default React;', + ); + outputFileSync( + join(fooPath, 'node_modules', 'react', 'package.json'), + JSON.stringify({ name: 'react', version: '1.0.0' }), + ); + outputFileSync( + join(fooPath, 'node_modules', 'react', 'index.js'), + `console.log("${flag}");`, + ); +} + +test('should dedupe specified packages as expected', async () => { + const flag = 'This is fake React'; + writeDuplicatedPackage(flag); + + const rsbuild = await build({ + cwd: __dirname, + }); + + const { content } = await rsbuild.getIndexFile(); + expect(content).not.toContain(flag); +}); diff --git a/e2e/cases/resolve/dedupe/rsbuild.config.ts b/e2e/cases/resolve/dedupe/rsbuild.config.ts new file mode 100644 index 0000000000..e1ce392eb5 --- /dev/null +++ b/e2e/cases/resolve/dedupe/rsbuild.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from '@rsbuild/core'; + +export default defineConfig({ + resolve: { + dedupe: ['react', 'react-dom'], + }, + performance: { + chunkSplit: { + strategy: 'all-in-one', + }, + }, +}); diff --git a/e2e/cases/resolve/dedupe/src/index.js b/e2e/cases/resolve/dedupe/src/index.js new file mode 100644 index 0000000000..bb385dda07 --- /dev/null +++ b/e2e/cases/resolve/dedupe/src/index.js @@ -0,0 +1,5 @@ +import foo from 'foo'; +import React from 'react'; +import ReactDOM from 'react-dom'; + +console.log(React, ReactDOM, foo); diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 9ffc17d087..788c09abf1 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -196,6 +196,7 @@ const createDefaultConfig = (): RsbuildConfig => ({ dev: getDefaultDevConfig(), server: getDefaultServerConfig(), html: getDefaultHtmlConfig(), + resolve: {}, source: getDefaultSourceConfig(), output: getDefaultOutputConfig(), tools: getDefaultToolsConfig(), diff --git a/packages/core/src/plugins/resolve.ts b/packages/core/src/plugins/resolve.ts index cb9d449fa8..5d3b562b8c 100644 --- a/packages/core/src/plugins/resolve.ts +++ b/packages/core/src/plugins/resolve.ts @@ -1,13 +1,18 @@ +import { createRequire } from 'node:module'; +import { dirname, sep } from 'node:path'; import { reduceConfigs } from 'reduce-configs'; import type { ChainIdentifier } from '../configChain'; import { castArray } from '../helpers'; import { ensureAbsolutePath } from '../helpers/path'; +import { logger } from '../logger'; import type { NormalizedEnvironmentConfig, RsbuildPlugin, RspackChain, } from '../types'; +const require = createRequire(import.meta.url); + // compatible with legacy packages with type="module" // https://github.com/webpack/webpack/issues/11467 function applyFullySpecified({ @@ -73,6 +78,51 @@ function applyAlias({ config: alias, }); + if (config.resolve.dedupe) { + for (const pkgName of config.resolve.dedupe) { + if (mergedAlias[pkgName]) { + logger.debug( + `[rsbuild:resolve] The package "${pkgName}" is already in the alias config, dedupe option for "${pkgName}" will be ignored.`, + ); + continue; + } + + let pkgPath: string | undefined; + try { + pkgPath = dirname( + require.resolve(`${pkgName}/package.json`, { + paths: [rootPath], + }), + ); + } catch (e) {} + + // some package does not export `package.json`, + // so we try to resolve the package by its name + if (!pkgPath) { + try { + pkgPath = require.resolve(pkgName, { + paths: [rootPath], + }); + + const trailing = sep === '/' ? pkgName : pkgName.split('/').join(sep); + while ( + !pkgPath.endsWith(trailing) && + pkgPath.includes('node_modules') + ) { + pkgPath = dirname(pkgPath); + } + } catch (e) { + logger.debug( + `[rsbuild:resolve] The package "${pkgName}" is not resolved in the project, dedupe option for "${pkgName}" will be ignored.`, + ); + continue; + } + } + + mergedAlias[pkgName] = pkgPath; + } + } + /** * Format alias value: * - Relative paths need to be turned into absolute paths. diff --git a/packages/core/src/types/config.ts b/packages/core/src/types/config.ts index 0cde32008e..e6eeb5e556 100644 --- a/packages/core/src/types/config.ts +++ b/packages/core/src/types/config.ts @@ -1395,6 +1395,16 @@ export type NormalizedDevConfig = DevConfig & client: NormalizedClientConfig; }; +export interface ResolveConfig { + /** + * Force Rsbuild to resolve the specified packages from project root, + * which is useful for deduplicating packages and reducing the bundle size. + */ + dedupe?: string[]; +} + +export type NormalizedResolveConfig = ResolveConfig; + export type ModuleFederationConfig = { options: ModuleFederationPluginOptions; }; @@ -1427,6 +1437,10 @@ export interface EnvironmentConfig { * Options for the low-level tools. */ tools?: ToolsConfig; + /** + * Options for configuring module resolving. + */ + resolve?: ResolveConfig; /** * Options for source code parsing and compilation. */ @@ -1500,6 +1514,7 @@ export type MergedEnvironmentConfig = { >; html: NormalizedHtmlConfig; tools: NormalizedToolsConfig; + resolve: NormalizedResolveConfig; source: NormalizedSourceConfig; output: Omit & { distPath: Omit, 'jsAsync' | 'cssAsync'> & { diff --git a/packages/core/tests/__snapshots__/environments.test.ts.snap b/packages/core/tests/__snapshots__/environments.test.ts.snap index 50d33b5862..6bce8f3b76 100644 --- a/packages/core/tests/__snapshots__/environments.test.ts.snap +++ b/packages/core/tests/__snapshots__/environments.test.ts.snap @@ -87,6 +87,7 @@ exports[`environment config > should normalize environment config correctly 1`] "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -217,6 +218,7 @@ exports[`environment config > should normalize environment config correctly 2`] "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -347,6 +349,7 @@ exports[`environment config > should print environment config when inspect confi "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -473,6 +476,7 @@ exports[`environment config > should print environment config when inspect confi "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -619,6 +623,7 @@ exports[`environment config > should support modify environment config by api.mo "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -745,6 +750,7 @@ exports[`environment config > should support modify environment config by api.mo "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -872,6 +878,7 @@ exports[`environment config > should support modify environment config by api.mo "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -1002,6 +1009,7 @@ exports[`environment config > should support modify single environment config by "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", @@ -1128,6 +1136,7 @@ exports[`environment config > should support modify single environment config by "removeConsole": false, "removeMomentLocale": false, }, + "resolve": {}, "root": "", "security": { "nonce": "", From d326de0306e7d90308ab9cbc823aa899d8fdc8df Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 1 Dec 2024 07:28:07 +0800 Subject: [PATCH 17/40] docs: add `resolve.dedupe` config (#4093) --- website/docs/en/config/_meta.json | 5 +++ website/docs/en/config/resolve/dedupe.mdx | 48 +++++++++++++++++++++++ website/docs/zh/config/_meta.json | 5 +++ website/docs/zh/config/resolve/dedupe.mdx | 48 +++++++++++++++++++++++ website/theme/rsbuildPluginOverview.ts | 1 + 5 files changed, 107 insertions(+) create mode 100644 website/docs/en/config/resolve/dedupe.mdx create mode 100644 website/docs/zh/config/resolve/dedupe.mdx diff --git a/website/docs/en/config/_meta.json b/website/docs/en/config/_meta.json index 1613e543e9..0d50ee31a3 100644 --- a/website/docs/en/config/_meta.json +++ b/website/docs/en/config/_meta.json @@ -13,6 +13,11 @@ "name": "dev", "label": "dev" }, + { + "type": "dir", + "name": "resolve", + "label": "resolve" + }, { "type": "dir", "name": "source", diff --git a/website/docs/en/config/resolve/dedupe.mdx b/website/docs/en/config/resolve/dedupe.mdx new file mode 100644 index 0000000000..7cd34f81a3 --- /dev/null +++ b/website/docs/en/config/resolve/dedupe.mdx @@ -0,0 +1,48 @@ +# resolve.dedupe + +- **Type:** `string[]` +- **Default:** `undefined` +- **Version:** `>= 1.1.7` + +Force Rsbuild to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size. + +## Example + +For example, assume your project is based on React 18, and you are using the `foo` package that depends on React 17, then your project will have two different versions of the React: + +``` +app/ +├── src/ +└── node_modules/ + ├── foo/ + │ └── node_modules/ + │ ├── react (v17) + │ └── react-dom (v17) + ├── react (v18) + └── react-dom (v18) +``` + +In this case, you can use the `resolve.dedupe` config to remove the duplicate React packages, and resolve all `react` and `react-dom` packages to `/node_modules/react` and `/node_modules/react-dom`: + +```ts title="rsbuild.config.ts" +export default defineConfig({ + resolve: { + dedupe: ['react', 'react-dom'], + }, +}); +``` + +## How it works + +`resolve.dedupe` is implemented based on [source.alias](/config/source/alias), it will get the path of the specified package through `require.resolve` in the project root directory and set it to the alias. + +In the above example, `resolve.dedupe` will be converted to the following alias config: + +```ts +const alias = { + react: '/app/node_modules/react', + 'react-dom': '/app/node_modules/react-dom', +}; +``` + +The alias generated by `resolve.dedupe` will be merged with the configured `source.alias` in the project, and the `source.alias` config will take precedence when the keys are the same. diff --git a/website/docs/zh/config/_meta.json b/website/docs/zh/config/_meta.json index 1613e543e9..0d50ee31a3 100644 --- a/website/docs/zh/config/_meta.json +++ b/website/docs/zh/config/_meta.json @@ -13,6 +13,11 @@ "name": "dev", "label": "dev" }, + { + "type": "dir", + "name": "resolve", + "label": "resolve" + }, { "type": "dir", "name": "source", diff --git a/website/docs/zh/config/resolve/dedupe.mdx b/website/docs/zh/config/resolve/dedupe.mdx new file mode 100644 index 0000000000..2b10c32934 --- /dev/null +++ b/website/docs/zh/config/resolve/dedupe.mdx @@ -0,0 +1,48 @@ +# resolve.dedupe + +- **类型:** `string[]` +- **默认值:** `undefined` +- **版本:** `>= 1.1.7` + +强制 Rsbuild 从项目根目录解析指定的包,这可以用于移除重复包和减少包大小。 + +## 示例 + +例如,假设你的项目是基于 React 18 开发的,而你正在使用的 `foo` 包依赖了 React 17,那么你的项目中就会存在两个不同版本的 React: + +``` +app/ +├── src/ +└── node_modules/ + ├── foo/ + │ └── node_modules/ + │ ├── react (v17) + │ └── react-dom (v17) + ├── react (v18) + └── react-dom (v18) +``` + +在这种情况下,你可以使用 `resolve.dedupe` 配置项来移除重复的 React 包,将所有 `react` 和 `react-dom` 包都解析到 `/node_modules/react` 和 `/node_modules/react-dom`: + +```ts title="rsbuild.config.ts" +export default defineConfig({ + resolve: { + dedupe: ['react', 'react-dom'], + }, +}); +``` + +## 实现原理 + +`resolve.dedupe` 是基于 [source.alias](/config/source/alias) 实现的,它会在当前项目的根目录下通过 `require.resolve` 获取指定包的路径,并设置到 alias 中。 + +在上述的例子中,`resolve.dedupe` 会被转换为以下 alias 配置: + +```ts +const alias = { + react: '/app/node_modules/react', + 'react-dom': '/app/node_modules/react-dom', +}; +``` + +`resolve.dedupe` 生成的 alias 会与项目中配置的 `source.alias` 合并,当两者配置了相同的 key 时,`source.alias` 的优先级更高。 diff --git a/website/theme/rsbuildPluginOverview.ts b/website/theme/rsbuildPluginOverview.ts index e4d79de6a2..f9ced9fbf0 100644 --- a/website/theme/rsbuildPluginOverview.ts +++ b/website/theme/rsbuildPluginOverview.ts @@ -69,6 +69,7 @@ export const rsbuildPluginOverview: RsbuildPlugin = { 'server', 'security', 'moduleFederation', + 'resolve', 'dev', 'tools', 'performance', From 837fd48ec52319d3477aa117b4e279cd49fd0514 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 1 Dec 2024 09:30:11 +0800 Subject: [PATCH 18/40] docs: improve dedupe guides (#4095) --- website/docs/en/config/resolve/dedupe.mdx | 4 ++++ website/docs/en/guide/migration/vite.mdx | 1 + website/docs/en/guide/optimization/optimize-bundle.mdx | 2 ++ website/docs/zh/config/resolve/dedupe.mdx | 4 ++++ website/docs/zh/guide/migration/vite.mdx | 1 + website/docs/zh/guide/optimization/optimize-bundle.mdx | 4 +++- 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/website/docs/en/config/resolve/dedupe.mdx b/website/docs/en/config/resolve/dedupe.mdx index 7cd34f81a3..e970adbdc1 100644 --- a/website/docs/en/config/resolve/dedupe.mdx +++ b/website/docs/en/config/resolve/dedupe.mdx @@ -32,6 +32,10 @@ export default defineConfig({ }); ``` +Note that using `resolve.dedupe` to unify different major versions of a package, it may cause some packages to fail because they may depend on specific versions of APIs or features. + +For example, if `foo` depends on a React 17-specific API or feature, then unifying React 17 and React 18 with React 18 using `resolve.dedupe` may cause `foo` to fail. + ## How it works `resolve.dedupe` is implemented based on [source.alias](/config/source/alias), it will get the path of the specified package through `require.resolve` in the project root directory and set it to the alias. diff --git a/website/docs/en/guide/migration/vite.mdx b/website/docs/en/guide/migration/vite.mdx index c3e88f301d..e1ccd61c81 100644 --- a/website/docs/en/guide/migration/vite.mdx +++ b/website/docs/en/guide/migration/vite.mdx @@ -115,6 +115,7 @@ Here is the corresponding Rsbuild configuration for Vite configuration: | publicDir | [server.publicDir](/config/server/public-dir) | | assetsInclude | [source.assetsInclude](/config/source/assets-include) | | resolve.alias | [source.alias](/config/source/alias) | +| resolve.dedupe | [resolve.dedupe](/config/resolve/dedupe) | | resolve.conditions | [tools.rspack.resolve.conditionNames](/config/tools/rspack) | | resolve.mainFields | [tools.rspack.resolve.mainFields](/config/tools/rspack) | | resolve.extensions | [tools.rspack.resolve.extensions](/config/tools/rspack) | diff --git a/website/docs/en/guide/optimization/optimize-bundle.mdx b/website/docs/en/guide/optimization/optimize-bundle.mdx index e70455b011..bee36baafa 100644 --- a/website/docs/en/guide/optimization/optimize-bundle.mdx +++ b/website/docs/en/guide/optimization/optimize-bundle.mdx @@ -18,6 +18,8 @@ For more details, see [Rsdoctor - Duplicate Dependency Problem](https://rsdoctor We can eliminate duplicate dependencies with the package manager. +- Rsbuild provides the [resolve.dedupe](/config/resolve/dedupe) config, which allows you to force the specified packages to be resolved from the project root directory, thereby removing duplicate packages. + - If you are using `pnpm >= 7.26.0`, you can use the [pnpm dedupe](https://pnpm.io/cli/dedupe) command to upgrade and eliminate duplicate dependencies. ```bash diff --git a/website/docs/zh/config/resolve/dedupe.mdx b/website/docs/zh/config/resolve/dedupe.mdx index 2b10c32934..619992c6a9 100644 --- a/website/docs/zh/config/resolve/dedupe.mdx +++ b/website/docs/zh/config/resolve/dedupe.mdx @@ -32,6 +32,10 @@ export default defineConfig({ }); ``` +注意,如果使用 `resolve.dedupe` 将一个包的不同 major 版本统一为同一个,可能导致一些包无法正常工作,因为它们可能依赖于特定版本的 API 或功能。 + +例如,如果 `foo` 依赖了一个 React 17 特有的 API 或功能,此时将 React 17 和 React 18 统一为 React 18,就可能会导致 `foo` 无法正常工作。 + ## 实现原理 `resolve.dedupe` 是基于 [source.alias](/config/source/alias) 实现的,它会在当前项目的根目录下通过 `require.resolve` 获取指定包的路径,并设置到 alias 中。 diff --git a/website/docs/zh/guide/migration/vite.mdx b/website/docs/zh/guide/migration/vite.mdx index ec9d0c63fe..a54f68146f 100644 --- a/website/docs/zh/guide/migration/vite.mdx +++ b/website/docs/zh/guide/migration/vite.mdx @@ -115,6 +115,7 @@ Rsbuild 会在构建时自动注入 ` ``` -### Function Usage +## Function Usage - **Type:** diff --git a/website/docs/zh/config/environments.mdx b/website/docs/zh/config/environments.mdx index 9e67b27c92..e882b91ef1 100644 --- a/website/docs/zh/config/environments.mdx +++ b/website/docs/zh/config/environments.mdx @@ -8,6 +8,7 @@ Rsbuild 支持同时为多个环境构建产物。你可以使用 `environments` ```ts interface EnvironmentConfig { + plugins?: RsbuildPlugins; dev?: Pick< DevConfig, 'hmr' | 'assetPrefix' | 'progressBar' | 'lazyCompilation' | 'writeToDisk' @@ -16,10 +17,10 @@ interface EnvironmentConfig { tools?: ToolsConfig; source?: SourceConfig; output?: OutputConfig; + resolve?: ResolveConfig; security?: SecurityConfig; performance?: PerformanceConfig; moduleFederation?: ModuleFederationConfig; - plugins?: RsbuildPlugins[]; } type Environments = { diff --git a/website/docs/zh/config/html/template-parameters.mdx b/website/docs/zh/config/html/template-parameters.mdx index 9efa4e4702..b02c47cf9c 100644 --- a/website/docs/zh/config/html/template-parameters.mdx +++ b/website/docs/zh/config/html/template-parameters.mdx @@ -26,9 +26,9 @@ type DefaultParameters = { }; ``` -定义 HTML 模板中的参数,对应 [html-rspack-plugin](https://github.com/rspack-contrib/html-rspack-plugin) 的 `templateParameters` 配置项。 +定义 HTML 模板中的参数,详细用法请参考 [配置 HTML 模板 - 模板参数](/guide/basic/html-template#模板参数)。 -### 对象用法 +## 对象用法 如果 `templateParameters` 的值是一个对象,它会和默认参数通过 `Object.assign` 合并。 @@ -60,7 +60,7 @@ export default { ``` -### 函数用法 +## 函数用法 - **类型:** From 87e200315fe01dfaa2a141b581f0236bd1d88064 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 1 Dec 2024 22:00:02 +0800 Subject: [PATCH 23/40] feat: add `resolve.aliasStrategy` and deprecate `source.aliasStrategy` (#4101) --- e2e/cases/alias/jsconfig-paths/index.test.ts | 2 +- e2e/cases/alias/tsconfig-paths/index.test.ts | 2 -- packages/compat/webpack/src/plugin.ts | 4 +++- packages/core/src/config.ts | 2 +- packages/core/src/plugins/resolve.ts | 5 ++++- packages/core/src/types/config.ts | 13 +++++++++---- .../__snapshots__/environments.test.ts.snap | 18 +++++++++--------- packages/core/tests/resolve.test.ts | 2 +- .../docs/en/config/source/alias-strategy.mdx | 2 +- .../docs/zh/config/source/alias-strategy.mdx | 2 +- 10 files changed, 30 insertions(+), 22 deletions(-) diff --git a/e2e/cases/alias/jsconfig-paths/index.test.ts b/e2e/cases/alias/jsconfig-paths/index.test.ts index ad9205befc..ea65d47d58 100644 --- a/e2e/cases/alias/jsconfig-paths/index.test.ts +++ b/e2e/cases/alias/jsconfig-paths/index.test.ts @@ -37,9 +37,9 @@ rspackOnlyTest( alias: { '@/common': './src/common2', }, + aliasStrategy: 'prefer-alias', }, source: { - aliasStrategy: 'prefer-alias', tsconfigPath: './jsconfig.json', }, }, diff --git a/e2e/cases/alias/tsconfig-paths/index.test.ts b/e2e/cases/alias/tsconfig-paths/index.test.ts index 72c811cc9e..81fa0f6d05 100644 --- a/e2e/cases/alias/tsconfig-paths/index.test.ts +++ b/e2e/cases/alias/tsconfig-paths/index.test.ts @@ -33,8 +33,6 @@ test('tsconfig paths should not work when aliasStrategy is "prefer-alias"', asyn alias: { '@/common': './src/common2', }, - }, - source: { aliasStrategy: 'prefer-alias', }, }, diff --git a/packages/compat/webpack/src/plugin.ts b/packages/compat/webpack/src/plugin.ts index 53ea50affd..c4789474b1 100644 --- a/packages/compat/webpack/src/plugin.ts +++ b/packages/compat/webpack/src/plugin.ts @@ -66,8 +66,10 @@ export const pluginAdaptor = ( setup(api) { api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target }) => { const { config, tsconfigPath } = environment; + const aliasStrategy = + config.source.aliasStrategy ?? config.resolve.aliasStrategy; - if (tsconfigPath && config.source.aliasStrategy === 'prefer-tsconfig') { + if (tsconfigPath && aliasStrategy === 'prefer-tsconfig') { await applyTsConfigPathsPlugin({ chain, CHAIN_ID, diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 9f98c8ec1b..60724b1b2c 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -99,7 +99,6 @@ const getDefaultSourceConfig = (): NormalizedSourceConfig => { '@swc/helpers': swcHelpersPath, }, define: {}, - aliasStrategy: 'prefer-tsconfig', preEntry: [], decorators: { version: '2022-03', @@ -195,6 +194,7 @@ const getDefaultOutputConfig = (): NormalizedOutputConfig => ({ const getDefaultResolveConfig = (): NormalizedResolveConfig => ({ alias: {}, + aliasStrategy: 'prefer-tsconfig', }); const createDefaultConfig = (): RsbuildConfig => ({ diff --git a/packages/core/src/plugins/resolve.ts b/packages/core/src/plugins/resolve.ts index e3abc04812..cddfdab1fc 100644 --- a/packages/core/src/plugins/resolve.ts +++ b/packages/core/src/plugins/resolve.ts @@ -175,11 +175,14 @@ export const pluginResolve = (): RsbuildPlugin => ({ // In some cases (modern.js), there is an error if the fullySpecified rule is after the js rule applyFullySpecified({ chain, config, CHAIN_ID }); + const aliasStrategy = + config.source.aliasStrategy ?? config.resolve.aliasStrategy; + if ( tsconfigPath && // Only Rspack has the tsConfig option api.context.bundlerType === 'rspack' && - config.source.aliasStrategy === 'prefer-tsconfig' + aliasStrategy === 'prefer-tsconfig' ) { chain.resolve.tsConfig({ configFile: tsconfigPath, diff --git a/packages/core/src/types/config.ts b/packages/core/src/types/config.ts index 75c99f1cc3..926d96dfc4 100644 --- a/packages/core/src/types/config.ts +++ b/packages/core/src/types/config.ts @@ -179,8 +179,8 @@ export interface SourceConfig { */ alias?: ConfigChain; /** - * Used to control the priority between the `paths` option in `tsconfig.json` - * and the `alias` option in the bundler. + * @deprecated Use `resolve.aliasStrategy` instead. + * `source.aliasStrategy` will be removed in v2.0.0. */ aliasStrategy?: AliasStrategy; /** @@ -253,7 +253,6 @@ export interface NormalizedSourceConfig extends SourceConfig { * `source.alias` will be removed in v2.0.0. */ alias: ConfigChain; - aliasStrategy: AliasStrategy; preEntry: string[]; decorators: Required; } @@ -1410,10 +1409,16 @@ export interface ResolveConfig { * same as the [resolve.alias](https://rspack.dev/config/resolve) config of Rspack. */ alias?: ConfigChain; + /** + * Control the priority between the `paths` option in `tsconfig.json` + * and the `resolve.alias` option of Rsbuild. + * @default 'prefer-tsconfig' + */ + aliasStrategy?: AliasStrategy; } export type NormalizedResolveConfig = ResolveConfig & - Pick, 'alias'>; + Pick, 'alias' | 'aliasStrategy'>; export type ModuleFederationConfig = { options: ModuleFederationPluginOptions; diff --git a/packages/core/tests/__snapshots__/environments.test.ts.snap b/packages/core/tests/__snapshots__/environments.test.ts.snap index d1730f4bf2..32aee30b70 100644 --- a/packages/core/tests/__snapshots__/environments.test.ts.snap +++ b/packages/core/tests/__snapshots__/environments.test.ts.snap @@ -89,6 +89,7 @@ exports[`environment config > should normalize environment config correctly 1`] }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -112,7 +113,6 @@ exports[`environment config > should normalize environment config correctly 1`] "@common": "./src/common", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -222,6 +222,7 @@ exports[`environment config > should normalize environment config correctly 2`] }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -245,7 +246,6 @@ exports[`environment config > should normalize environment config correctly 2`] "@common": "./src/common", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -355,6 +355,7 @@ exports[`environment config > should print environment config when inspect confi }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -378,7 +379,6 @@ exports[`environment config > should print environment config when inspect confi "@common": "./src/common", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -484,6 +484,7 @@ exports[`environment config > should print environment config when inspect confi }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -507,7 +508,6 @@ exports[`environment config > should print environment config when inspect confi "@common": "./src/common", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -633,6 +633,7 @@ exports[`environment config > should support modify environment config by api.mo }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -656,7 +657,6 @@ exports[`environment config > should support modify environment config by api.mo "@common": "./src/common", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -762,6 +762,7 @@ exports[`environment config > should support modify environment config by api.mo }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -786,7 +787,6 @@ exports[`environment config > should support modify environment config by api.mo "@common1": "./src/common1", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -892,6 +892,7 @@ exports[`environment config > should support modify environment config by api.mo }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -916,7 +917,6 @@ exports[`environment config > should support modify environment config by api.mo "@common1": "./src/common1", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -1025,6 +1025,7 @@ exports[`environment config > should support modify single environment config by }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -1048,7 +1049,6 @@ exports[`environment config > should support modify single environment config by "@common": "./src/common", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, @@ -1154,6 +1154,7 @@ exports[`environment config > should support modify single environment config by }, "resolve": { "alias": {}, + "aliasStrategy": "prefer-tsconfig", }, "root": "", "security": { @@ -1178,7 +1179,6 @@ exports[`environment config > should support modify single environment config by "@common1": "./src/common1", "@swc/helpers": "/node_modules//@swc/helpers", }, - "aliasStrategy": "prefer-tsconfig", "decorators": { "version": "2022-03", }, diff --git a/packages/core/tests/resolve.test.ts b/packages/core/tests/resolve.test.ts index c1c5e5a61b..abc4f2b7f5 100644 --- a/packages/core/tests/resolve.test.ts +++ b/packages/core/tests/resolve.test.ts @@ -27,7 +27,7 @@ describe('plugin-resolve', () => { const rsbuild = await createStubRsbuild({ plugins: [pluginResolve()], rsbuildConfig: { - source: { + resolve: { aliasStrategy: 'prefer-alias', }, }, diff --git a/website/docs/en/config/source/alias-strategy.mdx b/website/docs/en/config/source/alias-strategy.mdx index 69bff99123..e4f7fa5c55 100644 --- a/website/docs/en/config/source/alias-strategy.mdx +++ b/website/docs/en/config/source/alias-strategy.mdx @@ -3,7 +3,7 @@ - **Type:** `'prefer-tsconfig' | 'prefer-alias'` - **Default:** `'prefer-tsconfig'` -`source.aliasStrategy` is used to control the priority between the `paths` option in `tsconfig.json` and the `alias` option in the bundler. +Control the priority between the `paths` option in `tsconfig.json` and the [resolve.alias](/config/source/alias) option of Rsbuild. ### prefer-tsconfig diff --git a/website/docs/zh/config/source/alias-strategy.mdx b/website/docs/zh/config/source/alias-strategy.mdx index bbc6eeded8..fd7bd1576f 100644 --- a/website/docs/zh/config/source/alias-strategy.mdx +++ b/website/docs/zh/config/source/alias-strategy.mdx @@ -3,7 +3,7 @@ - **类型:** `'prefer-tsconfig' | 'prefer-alias'` - **默认值:** `'prefer-tsconfig'` -`source.aliasStrategy` 用于控制 `tsconfig.json` 中的 `paths` 选项与打包工具的 `alias` 选项的优先级。 +控制 `tsconfig.json` 中的 `paths` 选项与 Rsbuild 的 [resolve.alias](/config/source/alias) 选项的优先级。 ### prefer-tsconfig From e64762407008547139b510506d271588511b293d Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 1 Dec 2024 22:57:40 +0800 Subject: [PATCH 24/40] release: 1.1.7 (#4102) --- packages/compat/plugin-webpack-swc/package.json | 2 +- packages/compat/webpack/package.json | 2 +- packages/core/package.json | 2 +- packages/create-rsbuild/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/compat/plugin-webpack-swc/package.json b/packages/compat/plugin-webpack-swc/package.json index 61fe366e72..42c46113e6 100644 --- a/packages/compat/plugin-webpack-swc/package.json +++ b/packages/compat/plugin-webpack-swc/package.json @@ -1,6 +1,6 @@ { "name": "@rsbuild/plugin-webpack-swc", - "version": "1.0.8", + "version": "1.0.9", "description": "SWC plugin for Rsbuild webpack provider", "repository": { "type": "git", diff --git a/packages/compat/webpack/package.json b/packages/compat/webpack/package.json index ea2bcc2396..5368abaf2b 100644 --- a/packages/compat/webpack/package.json +++ b/packages/compat/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@rsbuild/webpack", - "version": "1.1.3", + "version": "1.1.4", "homepage": "https://rsbuild.dev", "repository": { "type": "git", diff --git a/packages/core/package.json b/packages/core/package.json index b3bafd5da4..8940f3b09d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@rsbuild/core", - "version": "1.1.6", + "version": "1.1.7", "description": "The Rspack-based build tool.", "homepage": "https://rsbuild.dev", "bugs": { diff --git a/packages/create-rsbuild/package.json b/packages/create-rsbuild/package.json index 2f1c39ef6b..64ecddae27 100644 --- a/packages/create-rsbuild/package.json +++ b/packages/create-rsbuild/package.json @@ -1,6 +1,6 @@ { "name": "create-rsbuild", - "version": "1.1.0", + "version": "1.1.1", "description": "Create a new Rsbuild project", "homepage": "https://rsbuild.dev", "repository": { From 0eb2e52cd6aa41a830ea427a576161be0a05945a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:12:35 +0800 Subject: [PATCH 25/40] chore(deps): update all patch dependencies (#4104) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- e2e/cases/svelte/package.json | 2 +- e2e/package.json | 2 +- examples/node/package.json | 2 +- package.json | 4 +- .../compat/plugin-webpack-swc/package.json | 2 +- packages/compat/webpack/package.json | 4 +- packages/core/package.json | 4 +- packages/create-rsbuild/package.json | 4 +- .../template-lit-js/package.json | 2 +- .../template-lit-ts/package.json | 2 +- .../template-preact-js/package.json | 2 +- .../template-preact-ts/package.json | 2 +- .../template-react-js/package.json | 2 +- .../template-react-ts/package.json | 2 +- .../template-solid-js/package.json | 2 +- .../template-solid-ts/package.json | 2 +- .../template-svelte-js/package.json | 2 +- .../template-svelte-ts/package.json | 2 +- .../template-svelte4-js/package.json | 2 +- .../template-svelte4-ts/package.json | 2 +- .../template-vanilla-js/package.json | 2 +- .../template-vanilla-ts/package.json | 2 +- .../template-vue2-js/package.json | 2 +- .../template-vue2-ts/package.json | 2 +- .../template-vue3-js/package.json | 2 +- .../template-vue3-ts/package.json | 2 +- packages/plugin-assets-retry/package.json | 2 +- packages/plugin-babel/package.json | 4 +- packages/plugin-less/package.json | 4 +- packages/plugin-preact/package.json | 4 +- packages/plugin-react/package.json | 4 +- packages/plugin-sass/package.json | 4 +- packages/plugin-solid/package.json | 2 +- packages/plugin-stylus/package.json | 4 +- packages/plugin-svelte/package.json | 4 +- packages/plugin-svgr/package.json | 4 +- packages/plugin-vue/package.json | 4 +- pnpm-lock.yaml | 595 ++++++++++-------- scripts/config/package.json | 4 +- scripts/test-helper/package.json | 4 +- website/package.json | 6 +- 41 files changed, 377 insertions(+), 332 deletions(-) diff --git a/e2e/cases/svelte/package.json b/e2e/cases/svelte/package.json index 883a942dde..a2878d6d50 100644 --- a/e2e/cases/svelte/package.json +++ b/e2e/cases/svelte/package.json @@ -6,7 +6,7 @@ "svelte": "^5.2.7" }, "devDependencies": { - "less": "^4.2.0", + "less": "^4.2.1", "sass": "^1.81.0", "stylus": "0.64.0" } diff --git a/e2e/package.json b/e2e/package.json index 5555ce7680..7f878daebc 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -42,7 +42,7 @@ "@scripts/test-helper": "workspace:*", "@types/fs-extra": "^11.0.4", "@types/lodash": "^4.17.13", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "create-rsbuild": "workspace:*", diff --git a/examples/node/package.json b/examples/node/package.json index 6d3db4dc2e..6c96bc9167 100644 --- a/examples/node/package.json +++ b/examples/node/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "typescript": "^5.7.2" } } diff --git a/package.json b/package.json index 3670383424..69f398a20e 100644 --- a/package.json +++ b/package.json @@ -46,11 +46,11 @@ "cross-env": "^7.0.3", "cspell-ban-words": "^0.0.4", "nano-staged": "^0.8.0", - "nx": "^20.1.3", + "nx": "^20.1.4", "prettier": "^3.4.1", "simple-git-hooks": "^2.11.1", "typescript": "^5.7.2", - "vitest": "^2.1.5" + "vitest": "^2.1.6" }, "packageManager": "pnpm@9.11.0", "engines": { diff --git a/packages/compat/plugin-webpack-swc/package.json b/packages/compat/plugin-webpack-swc/package.json index 42c46113e6..c84fa3c123 100644 --- a/packages/compat/plugin-webpack-swc/package.json +++ b/packages/compat/plugin-webpack-swc/package.json @@ -37,7 +37,7 @@ "devDependencies": { "@rsbuild/core": "workspace:*", "@rsbuild/webpack": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@types/lodash": "^4.17.13", "@types/semver": "^7.5.8", "typescript": "^5.7.2", diff --git a/packages/compat/webpack/package.json b/packages/compat/webpack/package.json index 5368abaf2b..aad684ab42 100644 --- a/packages/compat/webpack/package.json +++ b/packages/compat/webpack/package.json @@ -36,9 +36,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "ansi-escapes": "4.3.2", "cli-truncate": "2.1.0", "patch-console": "1.0.0", diff --git a/packages/core/package.json b/packages/core/package.json index 8940f3b09d..08feeefca5 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -57,9 +57,9 @@ "core-js": "~3.39.0" }, "devDependencies": { - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@types/connect": "3.4.38", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "@types/on-finished": "2.3.4", "@types/webpack-bundle-analyzer": "4.7.0", "@types/ws": "^8.5.13", diff --git a/packages/create-rsbuild/package.json b/packages/create-rsbuild/package.json index 64ecddae27..fe1683cec3 100644 --- a/packages/create-rsbuild/package.json +++ b/packages/create-rsbuild/package.json @@ -31,8 +31,8 @@ "create-rstack": "1.0.9" }, "devDependencies": { - "@rslib/core": "0.1.0", - "@types/node": "^22.10.0", + "@rslib/core": "0.1.1", + "@types/node": "^22.10.1", "typescript": "^5.7.2" }, "engines": { diff --git a/packages/create-rsbuild/template-lit-js/package.json b/packages/create-rsbuild/template-lit-js/package.json index a89dfeec33..1c98875783 100644 --- a/packages/create-rsbuild/template-lit-js/package.json +++ b/packages/create-rsbuild/template-lit-js/package.json @@ -11,6 +11,6 @@ "lit": "^3.2.1" }, "devDependencies": { - "@rsbuild/core": "^1.1.4" + "@rsbuild/core": "^1.1.7" } } diff --git a/packages/create-rsbuild/template-lit-ts/package.json b/packages/create-rsbuild/template-lit-ts/package.json index 9bde2c35b7..8a0780272b 100644 --- a/packages/create-rsbuild/template-lit-ts/package.json +++ b/packages/create-rsbuild/template-lit-ts/package.json @@ -11,7 +11,7 @@ "lit": "^3.2.1" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "typescript": "^5.7.2" } } diff --git a/packages/create-rsbuild/template-preact-js/package.json b/packages/create-rsbuild/template-preact-js/package.json index b130fdc7c6..273f076b58 100644 --- a/packages/create-rsbuild/template-preact-js/package.json +++ b/packages/create-rsbuild/template-preact-js/package.json @@ -11,7 +11,7 @@ "preact": "^10.25.0" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-preact": "^1.2.0" } } diff --git a/packages/create-rsbuild/template-preact-ts/package.json b/packages/create-rsbuild/template-preact-ts/package.json index 8a2645158e..2568581773 100644 --- a/packages/create-rsbuild/template-preact-ts/package.json +++ b/packages/create-rsbuild/template-preact-ts/package.json @@ -11,7 +11,7 @@ "preact": "^10.25.0" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-preact": "^1.2.0", "typescript": "^5.7.2" } diff --git a/packages/create-rsbuild/template-react-js/package.json b/packages/create-rsbuild/template-react-js/package.json index 6d3942db8a..47927ca2f4 100644 --- a/packages/create-rsbuild/template-react-js/package.json +++ b/packages/create-rsbuild/template-react-js/package.json @@ -12,7 +12,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-react": "^1.0.7" } } diff --git a/packages/create-rsbuild/template-react-ts/package.json b/packages/create-rsbuild/template-react-ts/package.json index 43ff5ad472..9c0d28e07a 100644 --- a/packages/create-rsbuild/template-react-ts/package.json +++ b/packages/create-rsbuild/template-react-ts/package.json @@ -12,7 +12,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-react": "^1.0.7", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", diff --git a/packages/create-rsbuild/template-solid-js/package.json b/packages/create-rsbuild/template-solid-js/package.json index b11c237b24..2a6fe10d54 100644 --- a/packages/create-rsbuild/template-solid-js/package.json +++ b/packages/create-rsbuild/template-solid-js/package.json @@ -11,7 +11,7 @@ "solid-js": "^1.9.3" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-babel": "^1.0.3", "@rsbuild/plugin-solid": "^1.0.4" } diff --git a/packages/create-rsbuild/template-solid-ts/package.json b/packages/create-rsbuild/template-solid-ts/package.json index 29c7a431fd..58484053fb 100644 --- a/packages/create-rsbuild/template-solid-ts/package.json +++ b/packages/create-rsbuild/template-solid-ts/package.json @@ -11,7 +11,7 @@ "solid-js": "^1.9.3" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-babel": "^1.0.3", "@rsbuild/plugin-solid": "^1.0.4", "typescript": "^5.7.2" diff --git a/packages/create-rsbuild/template-svelte-js/package.json b/packages/create-rsbuild/template-svelte-js/package.json index 427fd7aed2..57795ff9a8 100644 --- a/packages/create-rsbuild/template-svelte-js/package.json +++ b/packages/create-rsbuild/template-svelte-js/package.json @@ -11,7 +11,7 @@ "svelte": "^5.2.7" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-svelte": "^1.0.5" } } diff --git a/packages/create-rsbuild/template-svelte-ts/package.json b/packages/create-rsbuild/template-svelte-ts/package.json index d31dae9933..6bd0b813ee 100644 --- a/packages/create-rsbuild/template-svelte-ts/package.json +++ b/packages/create-rsbuild/template-svelte-ts/package.json @@ -12,7 +12,7 @@ "svelte": "^5.2.7" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-svelte": "^1.0.5", "svelte-check": "^4.1.0", "typescript": "^5.7.2" diff --git a/packages/create-rsbuild/template-svelte4-js/package.json b/packages/create-rsbuild/template-svelte4-js/package.json index 7bc9434037..06fd56baa2 100644 --- a/packages/create-rsbuild/template-svelte4-js/package.json +++ b/packages/create-rsbuild/template-svelte4-js/package.json @@ -11,7 +11,7 @@ "svelte": "^5.2.7" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-svelte": "^1.0.5" } } diff --git a/packages/create-rsbuild/template-svelte4-ts/package.json b/packages/create-rsbuild/template-svelte4-ts/package.json index 81a7b85d3a..24552b21fe 100644 --- a/packages/create-rsbuild/template-svelte4-ts/package.json +++ b/packages/create-rsbuild/template-svelte4-ts/package.json @@ -12,7 +12,7 @@ "svelte": "^5.2.7" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-svelte": "^1.0.5", "svelte-check": "^4.1.0", "typescript": "^5.7.2" diff --git a/packages/create-rsbuild/template-vanilla-js/package.json b/packages/create-rsbuild/template-vanilla-js/package.json index d50a8c52b1..6a3e0c679f 100644 --- a/packages/create-rsbuild/template-vanilla-js/package.json +++ b/packages/create-rsbuild/template-vanilla-js/package.json @@ -8,6 +8,6 @@ "preview": "rsbuild preview" }, "devDependencies": { - "@rsbuild/core": "^1.1.4" + "@rsbuild/core": "^1.1.7" } } diff --git a/packages/create-rsbuild/template-vanilla-ts/package.json b/packages/create-rsbuild/template-vanilla-ts/package.json index b20db91b63..d0be68ef6e 100644 --- a/packages/create-rsbuild/template-vanilla-ts/package.json +++ b/packages/create-rsbuild/template-vanilla-ts/package.json @@ -8,7 +8,7 @@ "preview": "rsbuild preview" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "typescript": "^5.7.2" } } diff --git a/packages/create-rsbuild/template-vue2-js/package.json b/packages/create-rsbuild/template-vue2-js/package.json index e808ee5bd8..36821be094 100644 --- a/packages/create-rsbuild/template-vue2-js/package.json +++ b/packages/create-rsbuild/template-vue2-js/package.json @@ -11,7 +11,7 @@ "vue": "^2.7.16" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-vue2": "^1.0.2" } } diff --git a/packages/create-rsbuild/template-vue2-ts/package.json b/packages/create-rsbuild/template-vue2-ts/package.json index 4b5647e4fa..e40851e974 100644 --- a/packages/create-rsbuild/template-vue2-ts/package.json +++ b/packages/create-rsbuild/template-vue2-ts/package.json @@ -11,7 +11,7 @@ "vue": "^2.7.16" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-vue2": "^1.0.2", "typescript": "^5.7.2" } diff --git a/packages/create-rsbuild/template-vue3-js/package.json b/packages/create-rsbuild/template-vue3-js/package.json index e6bcb4567b..e8329050bc 100644 --- a/packages/create-rsbuild/template-vue3-js/package.json +++ b/packages/create-rsbuild/template-vue3-js/package.json @@ -11,7 +11,7 @@ "vue": "^3.5.13" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-vue": "^1.0.5" } } diff --git a/packages/create-rsbuild/template-vue3-ts/package.json b/packages/create-rsbuild/template-vue3-ts/package.json index d381356731..694a800c9d 100644 --- a/packages/create-rsbuild/template-vue3-ts/package.json +++ b/packages/create-rsbuild/template-vue3-ts/package.json @@ -11,7 +11,7 @@ "vue": "^3.5.13" }, "devDependencies": { - "@rsbuild/core": "^1.1.4", + "@rsbuild/core": "^1.1.7", "@rsbuild/plugin-vue": "^1.0.5", "typescript": "^5.7.2" } diff --git a/packages/plugin-assets-retry/package.json b/packages/plugin-assets-retry/package.json index 1008760ef2..386e9a79c4 100644 --- a/packages/plugin-assets-retry/package.json +++ b/packages/plugin-assets-retry/package.json @@ -31,7 +31,7 @@ "@babel/preset-env": "^7.26.0", "@babel/preset-typescript": "^7.26.0", "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@types/serialize-javascript": "^5.0.4", "serialize-javascript": "^6.0.2", "terser": "5.36.0", diff --git a/packages/plugin-babel/package.json b/packages/plugin-babel/package.json index 3f13bdfbf5..a2aa8db151 100644 --- a/packages/plugin-babel/package.json +++ b/packages/plugin-babel/package.json @@ -39,9 +39,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "babel-loader": "9.2.1", "prebundle": "1.2.5", "typescript": "^5.7.2" diff --git a/packages/plugin-less/package.json b/packages/plugin-less/package.json index d241491c9a..91f84f9beb 100644 --- a/packages/plugin-less/package.json +++ b/packages/plugin-less/package.json @@ -34,10 +34,10 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", "@types/less": "^3.0.7", - "less": "^4.2.0", + "less": "^4.2.1", "less-loader": "^12.2.0", "prebundle": "1.2.5", "typescript": "^5.7.2" diff --git a/packages/plugin-preact/package.json b/packages/plugin-preact/package.json index 3abf2da3e5..7b2e9dd99d 100644 --- a/packages/plugin-preact/package.json +++ b/packages/plugin-preact/package.json @@ -33,8 +33,8 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", - "@types/node": "^22.10.0", + "@rslib/core": "0.1.1", + "@types/node": "^22.10.1", "preact": "^10.25.0", "typescript": "^5.7.2" }, diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index a29fc3d7df..66d653fa93 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -31,9 +31,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "typescript": "^5.7.2" }, "peerDependencies": { diff --git a/packages/plugin-sass/package.json b/packages/plugin-sass/package.json index bc0620c760..4906b63ee8 100644 --- a/packages/plugin-sass/package.json +++ b/packages/plugin-sass/package.json @@ -37,9 +37,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "@types/sass-loader": "^8.0.9", "prebundle": "1.2.5", "resolve-url-loader": "^5.0.0", diff --git a/packages/plugin-solid/package.json b/packages/plugin-solid/package.json index 91314448a7..e179dc852e 100644 --- a/packages/plugin-solid/package.json +++ b/packages/plugin-solid/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", "@types/babel__core": "^7.20.5", "typescript": "^5.7.2" diff --git a/packages/plugin-stylus/package.json b/packages/plugin-stylus/package.json index 4f4fc54490..85f55ade59 100644 --- a/packages/plugin-stylus/package.json +++ b/packages/plugin-stylus/package.json @@ -34,9 +34,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "typescript": "^5.7.2" }, "peerDependencies": { diff --git a/packages/plugin-svelte/package.json b/packages/plugin-svelte/package.json index 4bda2b8d8b..52b995da7b 100644 --- a/packages/plugin-svelte/package.json +++ b/packages/plugin-svelte/package.json @@ -31,9 +31,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "svelte": "^5.2.7", "typescript": "^5.7.2" }, diff --git a/packages/plugin-svgr/package.json b/packages/plugin-svgr/package.json index 177e3ced8c..324f042947 100644 --- a/packages/plugin-svgr/package.json +++ b/packages/plugin-svgr/package.json @@ -37,9 +37,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "file-loader": "6.2.0", "prebundle": "1.2.5", "svgo": "^3.3.2", diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 1db20c5f38..9143ad3c8c 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -32,9 +32,9 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", + "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "typescript": "^5.7.2", "vue": "^3.5.13", "webpack": "^5.96.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e2e4154ad7..39d2003438 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,8 +30,8 @@ importers: specifier: ^0.8.0 version: 0.8.0 nx: - specifier: ^20.1.3 - version: 20.1.3 + specifier: ^20.1.4 + version: 20.1.4 prettier: specifier: ^3.4.1 version: 3.4.1 @@ -42,8 +42,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 vitest: - specifier: ^2.1.5 - version: 2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + specifier: ^2.1.6 + version: 2.1.6(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) e2e: dependencies: @@ -145,8 +145,8 @@ importers: specifier: ^4.17.13 version: 4.17.13 '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 '@types/react': specifier: ^18.3.12 version: 18.3.12 @@ -242,8 +242,8 @@ importers: version: 5.2.7 devDependencies: less: - specifier: ^4.2.0 - version: 4.2.0 + specifier: ^4.2.1 + version: 4.2.1 sass: specifier: ^1.81.0 version: 1.81.0 @@ -353,8 +353,8 @@ importers: specifier: workspace:* version: link:../../packages/core '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -504,8 +504,8 @@ importers: specifier: workspace:* version: link:../webpack '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@types/lodash': specifier: ^4.17.13 version: 4.17.13 @@ -544,14 +544,14 @@ importers: specifier: workspace:* version: link:../../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 ansi-escapes: specifier: 4.3.2 version: 4.3.2 @@ -581,14 +581,14 @@ importers: version: 3.39.0 devDependencies: '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@types/connect': specifier: 3.4.38 version: 3.4.38 '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 '@types/on-finished': specifier: 2.3.4 version: 2.3.4 @@ -708,11 +708,11 @@ importers: version: 1.0.9 devDependencies: '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -732,8 +732,8 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@types/serialize-javascript': specifier: ^5.0.4 version: 5.0.4 @@ -778,14 +778,14 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 babel-loader: specifier: 9.2.1 version: 9.2.1(@babel/core@7.26.0)(webpack@5.96.1) @@ -809,8 +809,8 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper @@ -818,11 +818,11 @@ importers: specifier: ^3.0.7 version: 3.0.7 less: - specifier: ^4.2.0 - version: 4.2.0 + specifier: ^4.2.1 + version: 4.2.1 less-loader: specifier: ^12.2.0 - version: 12.2.0(@rspack/core@1.1.4(@swc/helpers@0.5.15))(less@4.2.0)(webpack@5.96.1) + version: 12.2.0(@rspack/core@1.1.4(@swc/helpers@0.5.15))(less@4.2.1)(webpack@5.96.1) prebundle: specifier: 1.2.5 version: 1.2.5(typescript@5.7.2) @@ -849,11 +849,11 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 preact: specifier: ^10.25.0 version: 10.25.0 @@ -874,14 +874,14 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -908,14 +908,14 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 '@types/sass-loader': specifier: ^8.0.9 version: 8.0.9 @@ -948,8 +948,8 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper @@ -979,14 +979,14 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -998,20 +998,20 @@ importers: version: 3.2.4(svelte@5.2.7) svelte-preprocess: specifier: ^6.0.3 - version: 6.0.3(@babel/core@7.26.0)(less@4.2.0)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.2.7)(typescript@5.7.2) + version: 6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.2.7)(typescript@5.7.2) devDependencies: '@rsbuild/core': specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 svelte: specifier: ^5.2.7 version: 5.2.7 @@ -1044,14 +1044,14 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 file-loader: specifier: 6.2.0 version: 6.2.0(webpack@5.96.1) @@ -1081,14 +1081,14 @@ importers: specifier: workspace:* version: link:../core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@scripts/test-helper': specifier: workspace:* version: link:../../scripts/test-helper '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -1102,11 +1102,11 @@ importers: specifier: workspace:* version: link:../../packages/core '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -1117,8 +1117,8 @@ importers: specifier: workspace:* version: link:../../packages/core '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 path-serializer: specifier: 0.3.4 version: 0.3.4 @@ -1130,8 +1130,8 @@ importers: version: 2.0.1 devDependencies: '@rslib/core': - specifier: 0.1.0 - version: 0.1.0(typescript@5.7.2) + specifier: 0.1.1 + version: 0.1.1(typescript@5.7.2) website: devDependencies: @@ -1139,14 +1139,14 @@ importers: specifier: workspace:* version: link:../packages/core '@rspress/plugin-rss': - specifier: 1.37.2 - version: 1.37.2(react@18.3.1)(rspress@1.37.2(webpack@5.96.1)) + specifier: 1.37.3 + version: 1.37.3(react@18.3.1)(rspress@1.37.3(webpack@5.96.1)) '@rstack-dev/doc-ui': specifier: 1.5.4 version: 1.5.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/node': - specifier: ^22.10.0 - version: 22.10.0 + specifier: ^22.10.1 + version: 22.10.1 '@types/react': specifier: ^18.3.12 version: 18.3.12 @@ -1169,8 +1169,8 @@ importers: specifier: 1.0.2 version: 1.0.2(@rsbuild/core@packages+core) rspress: - specifier: 1.37.2 - version: 1.37.2(webpack@5.96.1) + specifier: 1.37.3 + version: 1.37.3(webpack@5.96.1) rspress-plugin-font-open-sans: specifier: 1.0.0 version: 1.0.0 @@ -2223,62 +2223,62 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@nx/nx-darwin-arm64@20.1.3': - resolution: {integrity: sha512-m0Rwawht7Jwq6u2QPmAtsv+khFsTUIZUfiO1kXGcKOX3nQdJ7i82zLRd5yGbrDTAyRbAsgWO3v8zWQyhC1oGjw==} + '@nx/nx-darwin-arm64@20.1.4': + resolution: {integrity: sha512-afyDOZbIyHi6BgKk+Bb4RI1t8dZ6/oIbOY89z4mBPNNevZkbGqUfMwO2vjKnaOoThcjT93SEMJfCLGL8i857ww==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@nx/nx-darwin-x64@20.1.3': - resolution: {integrity: sha512-WsQK1sxOJFzD0vOtFqSHpLzWuFO4vG7G1PUyJ1Y5mPo4vbRslqoAUTqF7n42bBRPY/lE2aT7BqAAj8hm4PgcnQ==} + '@nx/nx-darwin-x64@20.1.4': + resolution: {integrity: sha512-aiYklAt95aX0EinepJRryMna8K53G52ngYOFuac1G8iLlguinJvg/YgSKCf7GOAzec8b7Hm7KauPjSJE/P3/iw==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@nx/nx-freebsd-x64@20.1.3': - resolution: {integrity: sha512-HV57XMtCVPy/0LZtifcEHbOpVNKLTOBFUoUXkmGYBmAKfw7lccfF600/tunTCZ4aijsD6+opEeGHzlDUK0Ir1w==} + '@nx/nx-freebsd-x64@20.1.4': + resolution: {integrity: sha512-WUh4bsLK+e7wuN3lE3ZQUj+xQKdWU4P4RymutfLQQnPYiilCMtFwITcvDmazmOHFWI2vPhzSyYJRbOu+YMIR3A==} engines: {node: '>= 10'} cpu: [x64] os: [freebsd] - '@nx/nx-linux-arm-gnueabihf@20.1.3': - resolution: {integrity: sha512-RzP0vc4yhXktKxz7iiwVYFkgpyb5TN/lLGcKLMM4kjuyYJ0IUX58Kk5FDoqCy+HMKiMfGyTOT4fP+/UEsgW6qQ==} + '@nx/nx-linux-arm-gnueabihf@20.1.4': + resolution: {integrity: sha512-9vPMw5s89v3od7aw3enTWjdMSCAmQ0tIA89Uz7xbbjB2kX2mAdihSzAKd9woi/cj+ROnY+ynNXzU9UjqhfxdBg==} engines: {node: '>= 10'} cpu: [arm] os: [linux] - '@nx/nx-linux-arm64-gnu@20.1.3': - resolution: {integrity: sha512-WCaU5AiGx21C3t3v4+d7nrA1r5Xc5Wk7yVxZFWh+mKHdcqk1JebDIr1qj/7yoKHD2R9k2Vp5x5Kd0pzAGS8AyA==} + '@nx/nx-linux-arm64-gnu@20.1.4': + resolution: {integrity: sha512-JUE4l8utr9KmQSG9tO2Qw5R5i/bZ16s1+J5xnEar7UfcSOfOLqxGHS7HCBUZcfr46dmtv6KjIC83uHMs19AwDQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@nx/nx-linux-arm64-musl@20.1.3': - resolution: {integrity: sha512-lKAvR9jNyx/qvk3UZGYNJAoK5mkZc+rDD4gA23tOGYPjNrWHJEgbWycCk5A9tQ4QX4CskCNmkgQx0lOMdLeXsw==} + '@nx/nx-linux-arm64-musl@20.1.4': + resolution: {integrity: sha512-EaPUDqXvnPc/ure0x7N+5lRYvk5zqOQ3LzFOTRPWdqnFXejyTkGjZEYWbLFIJTFrvyEdpfaPTHyNmCHUrEz9TQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@nx/nx-linux-x64-gnu@20.1.3': - resolution: {integrity: sha512-RKNm7RnTgCSl2HstDb/qMKO9r8o81EUe+UZB5fgjNR89PB757iHUX30kM0xbkiRZui1vIkMAvWcNsidxBnGGfg==} + '@nx/nx-linux-x64-gnu@20.1.4': + resolution: {integrity: sha512-vaWV37ZayfyckVI/faWdQWIV9XQb06ZT8jHQnwgSd9tKbGz37vN30eYtgZlFL0P4bHfhjtmMXnLvADmfyO/KOw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@nx/nx-linux-x64-musl@20.1.3': - resolution: {integrity: sha512-aCXEWt1WQDPLzgp5I+NfqaP0y4ZKi2aauZMnSO6KE54MnZmvB+B4HQMZvqHM3dfU0jluvLRBmVIPLeTHiCccrw==} + '@nx/nx-linux-x64-musl@20.1.4': + resolution: {integrity: sha512-wjq4Ea1oweBsIA9jq+jDT6BALxv/uac0aFykwoN23dOiwwSMFWMxbXUuBrxp0LjMFGV49S62kVDoRezukvkiZA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@nx/nx-win32-arm64-msvc@20.1.3': - resolution: {integrity: sha512-625rRYFfoCTu73bjDZ+jOLU0lvEN2heiiUGlErc6GchfcWuIcZy16oyYQzZX69UQqryGkkZVTaoyMXhGS5p7Tg==} + '@nx/nx-win32-arm64-msvc@20.1.4': + resolution: {integrity: sha512-d9jN8biyEJh4Mjdc3RU1j/+WIOjrO9mCDxYuERXP2ELaNsOk0tJgcXE1xsa9AF88AHGpOkCOS2rxy61DKBtFKg==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@nx/nx-win32-x64-msvc@20.1.3': - resolution: {integrity: sha512-XUbxSB6vUWoixNyCXkaXGkeUy/syqFOBXVh5Wbi6bqwTJ5o6EFUxCnzK/JsK55dfOz+I/jMXJzDWYEDAsikTSA==} + '@nx/nx-win32-x64-msvc@20.1.4': + resolution: {integrity: sha512-s3RwOkkWKzOflbTmc5MRc4EH2mk1AkJ/V8Gu3Qi2QncF9r1GrR7hDxROpu0MEoHfIhRG+d+n8OGX31nC9GZWUg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2481,6 +2481,11 @@ packages: engines: {node: '>=16.7.0'} hasBin: true + '@rsbuild/core@1.1.7': + resolution: {integrity: sha512-YI8qGKa37e5X3av4cB4i06MZv89URW39SrfNqTR6Td7VPznX+n4pHcrYqj86sEM2/XPX57/UL9Hi/Nhu+A003g==} + engines: {node: '>=16.7.0'} + hasBin: true + '@rsbuild/plugin-babel@1.0.3': resolution: {integrity: sha512-3S/ykXv7KRo0FxVpkjoHFUwB04nKINIET1kuv4xiRaDmeww1Tp0wl9h4u8a7d7gU/4FllyoUflY8TVhci/o05g==} peerDependencies: @@ -2525,8 +2530,8 @@ packages: '@rsbuild/core': optional: true - '@rslib/core@0.1.0': - resolution: {integrity: sha512-CGtHgTgj8BSWdQB7yCpGjr5dd37Y7jj/IH6rAtrYbTJR0/o7dm4QqygdwjR8MHBlD9fYTGu7uWbKRdh6qYXPTw==} + '@rslib/core@0.1.1': + resolution: {integrity: sha512-D/zCLzhNNM7DkuR/XNVFyB9er8OpmBpSJZQYeQgjuShg+JtXTWYX/DbmTniHpeO9B0ydMFS84WFO9ZAzGlDd6A==} engines: {node: '>=16.0.0'} hasBin: true peerDependencies: @@ -2613,8 +2618,8 @@ packages: react-refresh: optional: true - '@rspress/core@1.37.2': - resolution: {integrity: sha512-2hTPCNeTCnr+Mogz3Uq1QqqbLcAGa+dw7g6Mv4IIuVlSQU6mSVW8QupJg6jFZbHRToD6I3EHx0uCnhgqzi8n4g==} + '@rspress/core@1.37.3': + resolution: {integrity: sha512-uebqtPxwARA5ajKJlDs3+9B3bf33P8ErgRTjLebCZdAHUsKt2Fs+5riGUiGE6vuVHQLOt0OpgcNjU7Dl0dhjWw==} engines: {node: '>=14.17.6'} '@rspress/mdx-rs-darwin-arm64@0.6.4': @@ -2669,40 +2674,40 @@ packages: resolution: {integrity: sha512-uKAWxA8wY3iKKv+ZSN69iu4wJoa2ZNGOQmbnZskIHPejWa0lbkbbb85SlVhzKnPo04NKG675g6G6rT7REWDieQ==} engines: {node: '>= 10'} - '@rspress/plugin-auto-nav-sidebar@1.37.2': - resolution: {integrity: sha512-TVNwzsRkPY4laR5qODtjvQqHgUSI4URX4w3EXzXSQDzQ8WSRNKaqtU4LQugk64jYCsBOx5OJIVH3H4j9sh+bIg==} + '@rspress/plugin-auto-nav-sidebar@1.37.3': + resolution: {integrity: sha512-8PrfUitBCm6PFruMU969Wr5qA+wr0RisEM2iuHwdm2NBQnpwc9Ag73OagCMPwBUYyDod3kXXRyN4Yz/VuQIpDA==} engines: {node: '>=14.17.6'} - '@rspress/plugin-container-syntax@1.37.2': - resolution: {integrity: sha512-5pi+twU7TLYlnBPAPmwYiZmVWoY73VDgrKx7iqpm9nmgtWyXt6FyFNuarQSutt70XO06ZlH5H+LP6Kzs5p3gHQ==} + '@rspress/plugin-container-syntax@1.37.3': + resolution: {integrity: sha512-xiGjF2j4QPtD/s6Cmme1KEdr0mHRM/A5bDOmSXAqLssRiQyE7zunPjVIu78sfQndZxzAXWY51lQHbNT8IG5FdA==} engines: {node: '>=14.17.6'} - '@rspress/plugin-last-updated@1.37.2': - resolution: {integrity: sha512-btDsPcgxHZIKmIpdLeGsLN0KeKZDW6ppD3KFWIQLB4JevDzkqHYrbJ9crQUQbAUpjURtlo2wLbzxjOweJ427gA==} + '@rspress/plugin-last-updated@1.37.3': + resolution: {integrity: sha512-mKbTP5AF95AcxePye2x6Ssq2JuXApEsj8Kc/XKU35RJjgi2MpaUn8KXoG7b/YAiNnDAyGvmfDRjB94gi9vfBOA==} engines: {node: '>=14.17.6'} - '@rspress/plugin-medium-zoom@1.37.2': - resolution: {integrity: sha512-WtWXn7So/t+859QSEQYb/hwwJM8cmvjcky1cCfyR90ARjfk/TKWlDi1q+MZ4mWNII41E5qLjkBcKf+gmqbq7ww==} + '@rspress/plugin-medium-zoom@1.37.3': + resolution: {integrity: sha512-pnDXKvOMRUSwzrfKc27JAYmvMnTvGQpEMluuNPiWDFNqchfhFBTT1iDF2Rwwh/UfFn5x/A/6g/SwO9nEn1wtVw==} engines: {node: '>=14.17.6'} peerDependencies: - '@rspress/runtime': ^1.37.2 + '@rspress/runtime': ^1.37.3 - '@rspress/plugin-rss@1.37.2': - resolution: {integrity: sha512-gA6xeSG1aWneZlauEso65eC5MgMIoi/jhR+g/iadw8odQqgBYAKhHE0YpImwNoUNQnYgBbieD6FkrWt+0Wn/Fw==} + '@rspress/plugin-rss@1.37.3': + resolution: {integrity: sha512-2Y8fwns5nfYIThGXaY1J9Ny51KXiU/kzTFeTskXYTJklRsxuvO3orgOuRZdNdYEq/DysVeIKuuPTUqAX3dFkeQ==} engines: {node: '>=14.17.6'} peerDependencies: react: '>=17.0.0' - rspress: ^1.37.2 + rspress: ^1.37.3 - '@rspress/runtime@1.37.2': - resolution: {integrity: sha512-fhjp6xBunURhxeZWv/rmNVnXhLsSwbFSnZ6C96cRZyGkgHZILsR/jaHwDRyAuMyaZTkZZELW/UjQNcumXOL1WQ==} + '@rspress/runtime@1.37.3': + resolution: {integrity: sha512-6xIOQYihfHejy35m88n69nv7GSEHtJm3xm4YqAsAmAYRk5BH+BWmufzBr3DVnn0dNbv9gZFsqCABH4GD/mMBvg==} engines: {node: '>=14.17.6'} - '@rspress/shared@1.37.2': - resolution: {integrity: sha512-mUTvmOQn6D3uYcEJGNGnYY9sFAt3WxySmRZ4399M9bcrxtjP7gOQ+K7T17DfCBN5TW934scKsnyJc4ruMqIzXg==} + '@rspress/shared@1.37.3': + resolution: {integrity: sha512-EJV039UJu5fSuodfs7OzXdxKbMLKc3HjOwZOJzxBt1Ywky6AeBHAd9GtkVetE5ud8DI2TloTkSGbkh1lNbq/fw==} - '@rspress/theme-default@1.37.2': - resolution: {integrity: sha512-ZYFTGdEFKlubjsBqBserMU7OJ9Ar/++lTs6D52iJ5FreWqn4Fu+ydrjZ3vsMPL3PPOeAt3noHYGVOZGST9pN8A==} + '@rspress/theme-default@1.37.3': + resolution: {integrity: sha512-7Jc6g2bemOUab4Chd2rXgaEeuP6F2dGvhUbsoiWW+p8p8vChAmvRf0/Ku5DLLgM3mgV3WtsFDQeTOzgOwTnRzg==} engines: {node: '>=14.17.6'} '@rstack-dev/doc-ui@1.5.4': @@ -2882,8 +2887,8 @@ packages: '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@22.10.0': - resolution: {integrity: sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==} + '@types/node@22.10.1': + resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==} '@types/on-finished@2.3.4': resolution: {integrity: sha512-Ld4UQD3udYcKPaAWlI1EYXKhefkZcTlpqOLkQRmN3u5Ml/tUypMivUHbNH8LweP4H4FlhGGO+uBjJI1Y1dkE1g==} @@ -2936,38 +2941,41 @@ packages: '@types/ws@8.5.13': resolution: {integrity: sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==} + '@ungap/structured-clone@1.2.0': + resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@vercel/ncc@0.38.1': resolution: {integrity: sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==} hasBin: true - '@vitest/expect@2.1.5': - resolution: {integrity: sha512-nZSBTW1XIdpZvEJyoP/Sy8fUg0b8od7ZpGDkTUcfJ7wz/VoZAFzFfLyxVxGFhUjJzhYqSbIpfMtl/+k/dpWa3Q==} + '@vitest/expect@2.1.6': + resolution: {integrity: sha512-9M1UR9CAmrhJOMoSwVnPh2rELPKhYo0m/CSgqw9PyStpxtkwhmdM6XYlXGKeYyERY1N6EIuzkQ7e3Lm1WKCoUg==} - '@vitest/mocker@2.1.5': - resolution: {integrity: sha512-XYW6l3UuBmitWqSUXTNXcVBUCRytDogBsWuNXQijc00dtnU/9OqpXWp4OJroVrad/gLIomAq9aW8yWDBtMthhQ==} + '@vitest/mocker@2.1.6': + resolution: {integrity: sha512-MHZp2Z+Q/A3am5oD4WSH04f9B0T7UvwEb+v5W0kCYMhtXGYbdyl2NUk1wdSMqGthmhpiThPDp/hEoVwu16+u1A==} peerDependencies: msw: ^2.4.9 - vite: ^5.0.0 + vite: ^5.0.0 || ^6.0.0 peerDependenciesMeta: msw: optional: true vite: optional: true - '@vitest/pretty-format@2.1.5': - resolution: {integrity: sha512-4ZOwtk2bqG5Y6xRGHcveZVr+6txkH7M2e+nPFd6guSoN638v/1XQ0K06eOpi0ptVU/2tW/pIU4IoPotY/GZ9fw==} + '@vitest/pretty-format@2.1.6': + resolution: {integrity: sha512-exZyLcEnHgDMKc54TtHca4McV4sKT+NKAe9ix/yhd/qkYb/TP8HTyXRFDijV19qKqTZM0hPL4753zU/U8L/gAA==} - '@vitest/runner@2.1.5': - resolution: {integrity: sha512-pKHKy3uaUdh7X6p1pxOkgkVAFW7r2I818vHDthYLvUyjRfkKOU6P45PztOch4DZarWQne+VOaIMwA/erSSpB9g==} + '@vitest/runner@2.1.6': + resolution: {integrity: sha512-SjkRGSFyrA82m5nz7To4CkRSEVWn/rwQISHoia/DB8c6IHIhaE/UNAo+7UfeaeJRE979XceGl00LNkIz09RFsA==} - '@vitest/snapshot@2.1.5': - resolution: {integrity: sha512-zmYw47mhfdfnYbuhkQvkkzYroXUumrwWDGlMjpdUr4jBd3HZiV2w7CQHj+z7AAS4VOtWxI4Zt4bWt4/sKcoIjg==} + '@vitest/snapshot@2.1.6': + resolution: {integrity: sha512-5JTWHw8iS9l3v4/VSuthCndw1lN/hpPB+mlgn1BUhFbobeIUj1J1V/Bj2t2ovGEmkXLTckFjQddsxS5T6LuVWw==} - '@vitest/spy@2.1.5': - resolution: {integrity: sha512-aWZF3P0r3w6DiYTVskOYuhBc7EMc3jvn1TkBg8ttylFFRqNN2XGD7V5a4aQdk6QiUzZQ4klNBSpCLJgWNdIiNw==} + '@vitest/spy@2.1.6': + resolution: {integrity: sha512-oTFObV8bd4SDdRka5O+mSh5w9irgx5IetrD5i+OsUUsk/shsBoHifwCzy45SAORzAhtNiprUVaK3hSCCzZh1jQ==} - '@vitest/utils@2.1.5': - resolution: {integrity: sha512-yfj6Yrp0Vesw2cwJbP+cl04OC+IHFsuQsrsJBL9pyGeQXE56v1UAOQco+SR55Vf1nQzfV0QJg1Qum7AaWUwwYg==} + '@vitest/utils@2.1.6': + resolution: {integrity: sha512-ixNkFy3k4vokOUTU2blIUvOgKq/N2PW8vKIjZZYsGJCMX69MRa9J2sKqX5hY/k5O5Gty3YJChepkqZ3KM9LyIQ==} '@vue/babel-helper-vue-transform-on@1.2.5': resolution: {integrity: sha512-lOz4t39ZdmU4DJAa2hwPYmKc8EsuGa2U0L9KaZaOJUt0UwQNjNA3AZTq6uEivhOKhhG1Wvy96SvYBoFmCg3uuw==} @@ -4158,8 +4166,8 @@ packages: hast-util-heading-rank@3.0.0: resolution: {integrity: sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA==} - hast-util-is-element@2.1.3: - resolution: {integrity: sha512-O1bKah6mhgEq2WtVMk+Ta5K7pPMqsBBlmzysLdcwKVrqzZQ0CHqUPiIVspNhAG1rvxpvJjtGee17XfauZYKqVA==} + hast-util-is-element@3.0.0: + resolution: {integrity: sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==} hast-util-parse-selector@2.2.5: resolution: {integrity: sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==} @@ -4553,8 +4561,8 @@ packages: webpack: optional: true - less@4.2.0: - resolution: {integrity: sha512-P3b3HJDBtSzsXUl0im2L7gTO5Ubg8mEN6G8qoTS77iXxXX4Hvu4Qj540PZDvQ8V6DmX6iXo98k7Md0Cm1PrLaA==} + less@4.2.1: + resolution: {integrity: sha512-CasaJidTIhWmjcqv0Uj5vccMI7pJgfD9lMkKtlnTHAdJdYK/7l8pM9tumLyJ0zhbD4KJLo/YvTj+xznQd5NBhg==} engines: {node: '>=6'} hasBin: true @@ -4656,6 +4664,9 @@ packages: magic-string@0.30.12: resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} + magic-string@0.30.14: + resolution: {integrity: sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==} + make-dir@2.1.0: resolution: {integrity: sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==} engines: {node: '>=6'} @@ -4973,8 +4984,8 @@ packages: nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} - nx@20.1.3: - resolution: {integrity: sha512-mipsacEpn0gLd/4NSlOgyHW6Ozl++8ZIfuv42RtZEnS3BaGnnW+L2dkt85h4zffq+zBILoudd/VDFzaLY7Yrfw==} + nx@20.1.4: + resolution: {integrity: sha512-hyvGYxTzBkPxSXAB2tuqdv9TpVde5xOdGalsIdhF7j7PI3nwPpqtc3y28YTgRgpxtOE1Y6BfDNkXMO1SW0xu2w==} hasBin: true peerDependencies: '@swc-node/register': ^1.8.0 @@ -5469,8 +5480,8 @@ packages: resolution: {integrity: sha512-3OGZZ4HoLJkkAZx/48mTXJNlmqTGOzc0o9OWQPuWpkOlXXPbyN6OafCcoXUnBqE2D3f/T5L+pWc1kdEmnfnRsA==} hasBin: true - rehype-external-links@2.1.0: - resolution: {integrity: sha512-2YMJZVM1hxZnwl9IPkbN5Pjn78kXkAX7lq9VEtlaGA29qIls25vZN+ucNIJdbQUe+9NNFck17BiOhGmsD6oLIg==} + rehype-external-links@3.0.0: + resolution: {integrity: sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw==} relateurl@0.2.7: resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==} @@ -5557,8 +5568,8 @@ packages: webpack: optional: true - rsbuild-plugin-dts@0.1.0: - resolution: {integrity: sha512-8HE2aGkseyrkNSPmJLVEgqIvaTDWGJYE5l6Hfrf94mFzAFcbtHOrYTr4aR/zw90x+BY3sMfE3bMBj/wR9AnxiA==} + rsbuild-plugin-dts@0.1.1: + resolution: {integrity: sha512-pm0tVPioQGaF8O50S9j51oAjIVfM0Sn0+BteZ1TIv5t3cBdQmI9dmd15YJERrwsZAAUPAtuwIWM1TmEGH2m4zQ==} engines: {node: '>=16.0.0'} peerDependencies: '@microsoft/api-extractor': ^7 @@ -5611,8 +5622,8 @@ packages: rspress-plugin-sitemap@1.1.1: resolution: {integrity: sha512-usb6zWoi5wFFmBeA9HKR6BhsnnsItudMBarc54GYpuRL55SWkLxyWyMijv14mUI04FI7J7lEmea08uZE0bVKxg==} - rspress@1.37.2: - resolution: {integrity: sha512-JigB9G4AvIyfkwYMP6+S/v0DzA5HpbAPx9wqkQmdkLJdPuV6BPESETbNZea7bVIJXhnUf+16LiHvJE8CKWmD7w==} + rspress@1.37.3: + resolution: {integrity: sha512-z3HZoEbMasACHisMOv118kDiKapYhdQgEqnZZWTRP2LvAaGQbb7ZRJRhamK+8twQrMjaV+P2O/Rez/a09EdViQ==} hasBin: true run-parallel@1.2.0: @@ -6274,6 +6285,9 @@ packages: unist-util-is@5.2.1: resolution: {integrity: sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==} + unist-util-is@6.0.0: + resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==} + unist-util-position-from-estree@1.1.2: resolution: {integrity: sha512-poZa0eXpS+/XpoQwGwl79UUdea4ol2ZuCYguVaJS4qzIOMDzbqz8a3erUCOmubSZkaOuGamb3tX790iwOIROww==} @@ -6295,9 +6309,15 @@ packages: unist-util-visit-parents@5.1.3: resolution: {integrity: sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==} + unist-util-visit-parents@6.0.1: + resolution: {integrity: sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==} + unist-util-visit@4.1.2: resolution: {integrity: sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==} + unist-util-visit@5.0.0: + resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} + universalify@0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} @@ -6370,9 +6390,9 @@ packages: vfile@6.0.3: resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} - vite-node@2.1.5: - resolution: {integrity: sha512-rd0QIgx74q4S1Rd56XIiL2cYEdyWn13cunYBIuqh9mpmQr7gGS0IxXoP8R6OaZtNQQLyXSWbd4rXKYUbhFpK5w==} - engines: {node: ^18.0.0 || >=20.0.0} + vite-node@2.1.6: + resolution: {integrity: sha512-DBfJY0n9JUwnyLxPSSUmEePT21j8JZp/sR9n+/gBwQU6DcQOioPdb8/pibWfXForbirSagZCilseYIwaL3f95A==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true vite@5.4.10: @@ -6406,15 +6426,15 @@ packages: terser: optional: true - vitest@2.1.5: - resolution: {integrity: sha512-P4ljsdpuzRTPI/kbND2sDZ4VmieerR2c9szEZpjc+98Z9ebvnXmM5+0tHEKqYZumXqlvnmfWsjeFOjXVriDG7A==} - engines: {node: ^18.0.0 || >=20.0.0} + vitest@2.1.6: + resolution: {integrity: sha512-isUCkvPL30J4c5O5hgONeFRsDmlw6kzFEdLQHLezmDdKQHy8Ke/B/dgdTMEgU0vm+iZ0TjW8GuK83DiahBoKWQ==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' - '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 2.1.5 - '@vitest/ui': 2.1.5 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 2.1.6 + '@vitest/ui': 2.1.6 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -7885,34 +7905,34 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@nx/nx-darwin-arm64@20.1.3': + '@nx/nx-darwin-arm64@20.1.4': optional: true - '@nx/nx-darwin-x64@20.1.3': + '@nx/nx-darwin-x64@20.1.4': optional: true - '@nx/nx-freebsd-x64@20.1.3': + '@nx/nx-freebsd-x64@20.1.4': optional: true - '@nx/nx-linux-arm-gnueabihf@20.1.3': + '@nx/nx-linux-arm-gnueabihf@20.1.4': optional: true - '@nx/nx-linux-arm64-gnu@20.1.3': + '@nx/nx-linux-arm64-gnu@20.1.4': optional: true - '@nx/nx-linux-arm64-musl@20.1.3': + '@nx/nx-linux-arm64-musl@20.1.4': optional: true - '@nx/nx-linux-x64-gnu@20.1.3': + '@nx/nx-linux-x64-gnu@20.1.4': optional: true - '@nx/nx-linux-x64-musl@20.1.3': + '@nx/nx-linux-x64-musl@20.1.4': optional: true - '@nx/nx-win32-arm64-msvc@20.1.3': + '@nx/nx-win32-arm64-msvc@20.1.4': optional: true - '@nx/nx-win32-x64-msvc@20.1.3': + '@nx/nx-win32-x64-msvc@20.1.4': optional: true '@parcel/watcher-android-arm64@2.4.1': @@ -8052,6 +8072,13 @@ snapshots: '@swc/helpers': 0.5.15 core-js: 3.39.0 + '@rsbuild/core@1.1.7': + dependencies: + '@rspack/core': 1.1.4(@swc/helpers@0.5.15) + '@rspack/lite-tapable': 1.0.1 + '@swc/helpers': 0.5.15 + core-js: 3.39.0 + '@rsbuild/plugin-babel@1.0.3(@rsbuild/core@packages+core)': dependencies: '@babel/core': 7.26.0 @@ -8115,10 +8142,10 @@ snapshots: - '@babel/core' - supports-color - '@rslib/core@0.1.0(typescript@5.7.2)': + '@rslib/core@0.1.1(typescript@5.7.2)': dependencies: - '@rsbuild/core': 1.1.4 - rsbuild-plugin-dts: 0.1.0(@rsbuild/core@1.1.4)(typescript@5.7.2) + '@rsbuild/core': 1.1.7 + rsbuild-plugin-dts: 0.1.1(@rsbuild/core@1.1.7)(typescript@5.7.2) tinyglobby: 0.2.10 optionalDependencies: typescript: 5.7.2 @@ -8185,7 +8212,7 @@ snapshots: optionalDependencies: react-refresh: 0.14.2 - '@rspress/core@1.37.2(webpack@5.96.1)': + '@rspress/core@1.37.3(webpack@5.96.1)': dependencies: '@mdx-js/loader': 2.3.0(webpack@5.96.1) '@mdx-js/mdx': 2.3.0 @@ -8195,14 +8222,13 @@ snapshots: '@rsbuild/plugin-react': 1.0.7(@rsbuild/core@1.1.4) '@rsbuild/plugin-sass': 1.1.1(@rsbuild/core@1.1.4) '@rspress/mdx-rs': 0.6.4 - '@rspress/plugin-auto-nav-sidebar': 1.37.2 - '@rspress/plugin-container-syntax': 1.37.2 - '@rspress/plugin-last-updated': 1.37.2 - '@rspress/plugin-medium-zoom': 1.37.2(@rspress/runtime@1.37.2) - '@rspress/runtime': 1.37.2 - '@rspress/shared': 1.37.2 - '@rspress/theme-default': 1.37.2 - copy-to-clipboard: 3.3.3 + '@rspress/plugin-auto-nav-sidebar': 1.37.3 + '@rspress/plugin-container-syntax': 1.37.3 + '@rspress/plugin-last-updated': 1.37.3 + '@rspress/plugin-medium-zoom': 1.37.3(@rspress/runtime@1.37.3) + '@rspress/runtime': 1.37.3 + '@rspress/shared': 1.37.3 + '@rspress/theme-default': 1.37.3 enhanced-resolve: 5.17.1 github-slugger: 2.0.0 hast-util-from-html: 2.0.3 @@ -8212,13 +8238,12 @@ snapshots: lodash-es: 4.17.21 mdast-util-mdxjs-esm: 1.3.1 node-fetch: 3.3.2 - nprogress: 0.2.0 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) react-helmet-async: 1.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-lazy-with-preload: 2.2.1 react-syntax-highlighter: 15.6.1(react@18.3.1) - rehype-external-links: 2.1.0 + rehype-external-links: 3.0.0 remark: 14.0.3 remark-gfm: 3.0.1 rspack-plugin-virtual-module: 0.1.13 @@ -8264,52 +8289,53 @@ snapshots: '@rspress/mdx-rs-win32-arm64-msvc': 0.6.4 '@rspress/mdx-rs-win32-x64-msvc': 0.6.4 - '@rspress/plugin-auto-nav-sidebar@1.37.2': + '@rspress/plugin-auto-nav-sidebar@1.37.3': dependencies: - '@rspress/shared': 1.37.2 + '@rspress/shared': 1.37.3 - '@rspress/plugin-container-syntax@1.37.2': + '@rspress/plugin-container-syntax@1.37.3': dependencies: - '@rspress/shared': 1.37.2 + '@rspress/shared': 1.37.3 - '@rspress/plugin-last-updated@1.37.2': + '@rspress/plugin-last-updated@1.37.3': dependencies: - '@rspress/shared': 1.37.2 + '@rspress/shared': 1.37.3 - '@rspress/plugin-medium-zoom@1.37.2(@rspress/runtime@1.37.2)': + '@rspress/plugin-medium-zoom@1.37.3(@rspress/runtime@1.37.3)': dependencies: - '@rspress/runtime': 1.37.2 + '@rspress/runtime': 1.37.3 medium-zoom: 1.1.0 - '@rspress/plugin-rss@1.37.2(react@18.3.1)(rspress@1.37.2(webpack@5.96.1))': + '@rspress/plugin-rss@1.37.3(react@18.3.1)(rspress@1.37.3(webpack@5.96.1))': dependencies: - '@rspress/shared': 1.37.2 + '@rspress/shared': 1.37.3 feed: 4.2.2 react: 18.3.1 - rspress: 1.37.2(webpack@5.96.1) + rspress: 1.37.3(webpack@5.96.1) - '@rspress/runtime@1.37.2': + '@rspress/runtime@1.37.3': dependencies: - '@rspress/shared': 1.37.2 + '@rspress/shared': 1.37.3 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) react-helmet-async: 1.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-router-dom: 6.28.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@rspress/shared@1.37.2': + '@rspress/shared@1.37.3': dependencies: '@rsbuild/core': 1.1.4 chalk: 5.3.0 execa: 5.1.1 fs-extra: 11.2.0 gray-matter: 4.0.3 + lodash-es: 4.17.21 unified: 10.1.2 - '@rspress/theme-default@1.37.2': + '@rspress/theme-default@1.37.3': dependencies: '@mdx-js/react': 2.3.0(react@18.3.1) - '@rspress/runtime': 1.37.2 - '@rspress/shared': 1.37.2 + '@rspress/runtime': 1.37.3 + '@rspress/shared': 1.37.3 body-scroll-lock: 4.0.0-beta.0 copy-to-clipboard: 3.3.3 flexsearch: 0.7.43 @@ -8462,7 +8488,7 @@ snapshots: '@types/connect@3.4.38': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/cookie@0.6.0': {} @@ -8489,7 +8515,7 @@ snapshots: '@types/fs-extra@11.0.4': dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/hast@2.3.10': dependencies: @@ -8501,13 +8527,13 @@ snapshots: '@types/http-proxy@1.17.15': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/json-schema@7.0.15': {} '@types/jsonfile@6.1.4': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/less@3.0.7': {} @@ -8523,17 +8549,17 @@ snapshots: '@types/node-sass@4.11.8': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/node@12.20.55': {} - '@types/node@22.10.0': + '@types/node@22.10.1': dependencies: undici-types: 6.20.0 '@types/on-finished@2.3.4': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/prop-types@15.7.13': {} @@ -8548,7 +8574,7 @@ snapshots: '@types/sass-loader@8.0.9': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/node-sass': 4.11.8 '@types/webpack': 4.41.40 sass: 1.81.0 @@ -8573,7 +8599,7 @@ snapshots: '@types/webpack-bundle-analyzer@4.7.0': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 tapable: 2.2.1 webpack: 5.96.1 transitivePeerDependencies: @@ -8584,13 +8610,13 @@ snapshots: '@types/webpack-sources@3.2.3': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/source-list-map': 0.1.6 source-map: 0.7.4 '@types/webpack@4.41.40': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 '@types/tapable': 1.0.12 '@types/uglify-js': 3.17.5 '@types/webpack-sources': 3.2.3 @@ -8599,47 +8625,49 @@ snapshots: '@types/ws@8.5.13': dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 + + '@ungap/structured-clone@1.2.0': {} '@vercel/ncc@0.38.1': {} - '@vitest/expect@2.1.5': + '@vitest/expect@2.1.6': dependencies: - '@vitest/spy': 2.1.5 - '@vitest/utils': 2.1.5 + '@vitest/spy': 2.1.6 + '@vitest/utils': 2.1.6 chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.5(vite@5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0))': + '@vitest/mocker@2.1.6(vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0))': dependencies: - '@vitest/spy': 2.1.5 + '@vitest/spy': 2.1.6 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - vite: 5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) - '@vitest/pretty-format@2.1.5': + '@vitest/pretty-format@2.1.6': dependencies: tinyrainbow: 1.2.0 - '@vitest/runner@2.1.5': + '@vitest/runner@2.1.6': dependencies: - '@vitest/utils': 2.1.5 + '@vitest/utils': 2.1.6 pathe: 1.1.2 - '@vitest/snapshot@2.1.5': + '@vitest/snapshot@2.1.6': dependencies: - '@vitest/pretty-format': 2.1.5 + '@vitest/pretty-format': 2.1.6 magic-string: 0.30.12 pathe: 1.1.2 - '@vitest/spy@2.1.5': + '@vitest/spy@2.1.6': dependencies: tinyspy: 3.0.2 - '@vitest/utils@2.1.5': + '@vitest/utils@2.1.6': dependencies: - '@vitest/pretty-format': 2.1.5 + '@vitest/pretty-format': 2.1.6 loupe: 3.1.2 tinyrainbow: 1.2.0 @@ -9868,10 +9896,9 @@ snapshots: dependencies: '@types/hast': 3.0.4 - hast-util-is-element@2.1.3: + hast-util-is-element@3.0.0: dependencies: - '@types/hast': 2.3.10 - '@types/unist': 2.0.11 + '@types/hast': 3.0.4 hast-util-parse-selector@2.2.5: {} @@ -10177,7 +10204,7 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -10270,14 +10297,14 @@ snapshots: leac@0.6.0: {} - less-loader@12.2.0(@rspack/core@1.1.4(@swc/helpers@0.5.15))(less@4.2.0)(webpack@5.96.1): + less-loader@12.2.0(@rspack/core@1.1.4(@swc/helpers@0.5.15))(less@4.2.1)(webpack@5.96.1): dependencies: - less: 4.2.0 + less: 4.2.1 optionalDependencies: '@rspack/core': 1.1.4(@swc/helpers@0.5.15) webpack: 5.96.1 - less@4.2.0: + less@4.2.1: dependencies: copy-anything: 2.0.6 parse-node-version: 1.0.1 @@ -10389,6 +10416,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 + magic-string@0.30.14: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + make-dir@2.1.0: dependencies: pify: 4.0.1 @@ -10942,7 +10973,7 @@ snapshots: dependencies: boolbase: 1.0.0 - nx@20.1.3: + nx@20.1.4: dependencies: '@napi-rs/wasm-runtime': 0.2.4 '@yarnpkg/lockfile': 1.1.0 @@ -10977,16 +11008,16 @@ snapshots: yargs: 17.7.2 yargs-parser: 21.1.1 optionalDependencies: - '@nx/nx-darwin-arm64': 20.1.3 - '@nx/nx-darwin-x64': 20.1.3 - '@nx/nx-freebsd-x64': 20.1.3 - '@nx/nx-linux-arm-gnueabihf': 20.1.3 - '@nx/nx-linux-arm64-gnu': 20.1.3 - '@nx/nx-linux-arm64-musl': 20.1.3 - '@nx/nx-linux-x64-gnu': 20.1.3 - '@nx/nx-linux-x64-musl': 20.1.3 - '@nx/nx-win32-arm64-msvc': 20.1.3 - '@nx/nx-win32-x64-msvc': 20.1.3 + '@nx/nx-darwin-arm64': 20.1.4 + '@nx/nx-darwin-x64': 20.1.4 + '@nx/nx-freebsd-x64': 20.1.4 + '@nx/nx-linux-arm-gnueabihf': 20.1.4 + '@nx/nx-linux-arm64-gnu': 20.1.4 + '@nx/nx-linux-arm64-musl': 20.1.4 + '@nx/nx-linux-x64-gnu': 20.1.4 + '@nx/nx-linux-x64-musl': 20.1.4 + '@nx/nx-win32-arm64-msvc': 20.1.4 + '@nx/nx-win32-x64-msvc': 20.1.4 transitivePeerDependencies: - debug @@ -11447,15 +11478,14 @@ snapshots: dependencies: jsesc: 3.0.2 - rehype-external-links@2.1.0: + rehype-external-links@3.0.0: dependencies: - '@types/hast': 2.3.10 - extend: 3.0.2 - hast-util-is-element: 2.1.3 + '@types/hast': 3.0.4 + '@ungap/structured-clone': 1.2.0 + hast-util-is-element: 3.0.0 is-absolute-url: 4.0.1 space-separated-tokens: 2.0.2 - unified: 10.1.2 - unist-util-visit: 4.1.2 + unist-util-visit: 5.0.0 relateurl@0.2.7: {} @@ -11584,10 +11614,10 @@ snapshots: optionalDependencies: webpack: 5.96.1 - rsbuild-plugin-dts@0.1.0(@rsbuild/core@1.1.4)(typescript@5.7.2): + rsbuild-plugin-dts@0.1.1(@rsbuild/core@1.1.7)(typescript@5.7.2): dependencies: - '@rsbuild/core': 1.1.4 - magic-string: 0.30.12 + '@rsbuild/core': 1.1.7 + magic-string: 0.30.14 picocolors: 1.1.1 tinyglobby: 0.2.10 optionalDependencies: @@ -11622,11 +11652,11 @@ snapshots: rspress-plugin-sitemap@1.1.1: {} - rspress@1.37.2(webpack@5.96.1): + rspress@1.37.3(webpack@5.96.1): dependencies: '@rsbuild/core': 1.1.4 - '@rspress/core': 1.37.2(webpack@5.96.1) - '@rspress/shared': 1.37.2 + '@rspress/core': 1.37.3(webpack@5.96.1) + '@rspress/shared': 1.37.3 cac: 6.7.14 chalk: 5.3.0 chokidar: 3.6.0 @@ -12009,12 +12039,12 @@ snapshots: svelte-dev-helper: 1.1.9 svelte-hmr: 0.14.12(svelte@5.2.7) - svelte-preprocess@6.0.3(@babel/core@7.26.0)(less@4.2.0)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.2.7)(typescript@5.7.2): + svelte-preprocess@6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.2.7)(typescript@5.7.2): dependencies: svelte: 5.2.7 optionalDependencies: '@babel/core': 7.26.0 - less: 4.2.0 + less: 4.2.1 postcss: 8.4.49 postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0) sass: 1.81.0 @@ -12226,6 +12256,10 @@ snapshots: dependencies: '@types/unist': 2.0.11 + unist-util-is@6.0.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-position-from-estree@1.1.2: dependencies: '@types/unist': 2.0.11 @@ -12256,12 +12290,23 @@ snapshots: '@types/unist': 2.0.11 unist-util-is: 5.2.1 + unist-util-visit-parents@6.0.1: + dependencies: + '@types/unist': 3.0.3 + unist-util-is: 6.0.0 + unist-util-visit@4.1.2: dependencies: '@types/unist': 2.0.11 unist-util-is: 5.2.1 unist-util-visit-parents: 5.1.3 + unist-util-visit@5.0.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-is: 6.0.0 + unist-util-visit-parents: 6.0.1 + universalify@0.1.2: {} universalify@2.0.1: {} @@ -12333,13 +12378,13 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): + vite-node@2.1.6(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): dependencies: cac: 6.7.14 debug: 4.3.7 es-module-lexer: 1.5.4 pathe: 1.1.2 - vite: 5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) transitivePeerDependencies: - '@types/node' - less @@ -12351,29 +12396,29 @@ snapshots: - supports-color - terser - vite@5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): + vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): dependencies: esbuild: 0.21.5 postcss: 8.4.49 rollup: 4.24.3 optionalDependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 fsevents: 2.3.3 - less: 4.2.0 + less: 4.2.1 sass: 1.81.0 sass-embedded: 1.81.0 stylus: 0.64.0 terser: 5.36.0 - vitest@2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): + vitest@2.1.6(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0): dependencies: - '@vitest/expect': 2.1.5 - '@vitest/mocker': 2.1.5(vite@5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0)) - '@vitest/pretty-format': 2.1.5 - '@vitest/runner': 2.1.5 - '@vitest/snapshot': 2.1.5 - '@vitest/spy': 2.1.5 - '@vitest/utils': 2.1.5 + '@vitest/expect': 2.1.6 + '@vitest/mocker': 2.1.6(vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0)) + '@vitest/pretty-format': 2.1.6 + '@vitest/runner': 2.1.6 + '@vitest/snapshot': 2.1.6 + '@vitest/spy': 2.1.6 + '@vitest/utils': 2.1.6 chai: 5.1.2 debug: 4.3.7 expect-type: 1.1.0 @@ -12384,11 +12429,11 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.10(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) - vite-node: 2.1.5(@types/node@22.10.0)(less@4.2.0)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) + vite-node: 2.1.6(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.10.0 + '@types/node': 22.10.1 transitivePeerDependencies: - less - lightningcss diff --git a/scripts/config/package.json b/scripts/config/package.json index a14199b580..9cea2b67ac 100644 --- a/scripts/config/package.json +++ b/scripts/config/package.json @@ -4,8 +4,8 @@ "private": true, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rslib/core": "0.1.0", - "@types/node": "^22.10.0", + "@rslib/core": "0.1.1", + "@types/node": "^22.10.1", "typescript": "^5.7.2" } } diff --git a/scripts/test-helper/package.json b/scripts/test-helper/package.json index 949327b8ca..70f27408b1 100644 --- a/scripts/test-helper/package.json +++ b/scripts/test-helper/package.json @@ -26,13 +26,13 @@ }, "dependencies": { "@rsbuild/core": "workspace:*", - "@types/node": "^22.10.0", + "@types/node": "^22.10.1", "path-serializer": "0.3.4", "typescript": "^5.7.2", "upath": "2.0.1" }, "devDependencies": { - "@rslib/core": "0.1.0" + "@rslib/core": "0.1.1" }, "publishConfig": { "access": "public", diff --git a/website/package.json b/website/package.json index 7fd322d366..bd6a3b9956 100644 --- a/website/package.json +++ b/website/package.json @@ -10,8 +10,8 @@ }, "devDependencies": { "@rsbuild/core": "workspace:*", - "@rspress/plugin-rss": "1.37.2", - "@types/node": "^22.10.0", + "@rspress/plugin-rss": "1.37.3", + "@types/node": "^22.10.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "fast-glob": "^3.3.2", @@ -20,7 +20,7 @@ "rsbuild-plugin-google-analytics": "1.0.3", "rsbuild-plugin-open-graph": "1.0.2", "@rstack-dev/doc-ui": "1.5.4", - "rspress": "1.37.2", + "rspress": "1.37.3", "rspress-plugin-font-open-sans": "1.0.0", "rspress-plugin-sitemap": "^1.1.1" } From ecc92d67e8373703e063e61c251d468206a6b018 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:45:18 +0800 Subject: [PATCH 26/40] chore(deps): update dependency svelte to ^5.3.1 (#4105) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- e2e/cases/svelte/package.json | 2 +- examples/svelte/package.json | 2 +- .../template-svelte-js/package.json | 2 +- .../template-svelte-ts/package.json | 2 +- .../template-svelte4-js/package.json | 2 +- .../template-svelte4-ts/package.json | 2 +- packages/plugin-svelte/package.json | 2 +- pnpm-lock.yaml | 60 +++++++++---------- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/e2e/cases/svelte/package.json b/e2e/cases/svelte/package.json index a2878d6d50..632bfb444b 100644 --- a/e2e/cases/svelte/package.json +++ b/e2e/cases/svelte/package.json @@ -3,7 +3,7 @@ "name": "@e2e/svelte", "version": "1.0.0", "dependencies": { - "svelte": "^5.2.7" + "svelte": "^5.3.1" }, "devDependencies": { "less": "^4.2.1", diff --git a/examples/svelte/package.json b/examples/svelte/package.json index 9dd1e86878..a0cf4b6a6a 100644 --- a/examples/svelte/package.json +++ b/examples/svelte/package.json @@ -7,7 +7,7 @@ "preview": "rsbuild preview" }, "dependencies": { - "svelte": "^5.2.7" + "svelte": "^5.3.1" }, "devDependencies": { "@rsbuild/core": "workspace:*", diff --git a/packages/create-rsbuild/template-svelte-js/package.json b/packages/create-rsbuild/template-svelte-js/package.json index 57795ff9a8..05638d4f14 100644 --- a/packages/create-rsbuild/template-svelte-js/package.json +++ b/packages/create-rsbuild/template-svelte-js/package.json @@ -8,7 +8,7 @@ "preview": "rsbuild preview" }, "dependencies": { - "svelte": "^5.2.7" + "svelte": "^5.3.1" }, "devDependencies": { "@rsbuild/core": "^1.1.7", diff --git a/packages/create-rsbuild/template-svelte-ts/package.json b/packages/create-rsbuild/template-svelte-ts/package.json index 6bd0b813ee..13411daf36 100644 --- a/packages/create-rsbuild/template-svelte-ts/package.json +++ b/packages/create-rsbuild/template-svelte-ts/package.json @@ -9,7 +9,7 @@ "svelte-check": "svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "svelte": "^5.2.7" + "svelte": "^5.3.1" }, "devDependencies": { "@rsbuild/core": "^1.1.7", diff --git a/packages/create-rsbuild/template-svelte4-js/package.json b/packages/create-rsbuild/template-svelte4-js/package.json index 06fd56baa2..009bd31e36 100644 --- a/packages/create-rsbuild/template-svelte4-js/package.json +++ b/packages/create-rsbuild/template-svelte4-js/package.json @@ -8,7 +8,7 @@ "preview": "rsbuild preview" }, "dependencies": { - "svelte": "^5.2.7" + "svelte": "^5.3.1" }, "devDependencies": { "@rsbuild/core": "^1.1.7", diff --git a/packages/create-rsbuild/template-svelte4-ts/package.json b/packages/create-rsbuild/template-svelte4-ts/package.json index 24552b21fe..e18d8a842f 100644 --- a/packages/create-rsbuild/template-svelte4-ts/package.json +++ b/packages/create-rsbuild/template-svelte4-ts/package.json @@ -9,7 +9,7 @@ "svelte-check": "svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "svelte": "^5.2.7" + "svelte": "^5.3.1" }, "devDependencies": { "@rsbuild/core": "^1.1.7", diff --git a/packages/plugin-svelte/package.json b/packages/plugin-svelte/package.json index 52b995da7b..4ff9fb9ed7 100644 --- a/packages/plugin-svelte/package.json +++ b/packages/plugin-svelte/package.json @@ -34,7 +34,7 @@ "@rslib/core": "0.1.1", "@scripts/test-helper": "workspace:*", "@types/node": "^22.10.1", - "svelte": "^5.2.7", + "svelte": "^5.3.1", "typescript": "^5.7.2" }, "peerDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 39d2003438..e64f860239 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -238,8 +238,8 @@ importers: e2e/cases/svelte: dependencies: svelte: - specifier: ^5.2.7 - version: 5.2.7 + specifier: ^5.3.1 + version: 5.3.1 devDependencies: less: specifier: ^4.2.1 @@ -419,8 +419,8 @@ importers: examples/svelte: dependencies: svelte: - specifier: ^5.2.7 - version: 5.2.7 + specifier: ^5.3.1 + version: 5.3.1 devDependencies: '@rsbuild/core': specifier: workspace:* @@ -995,10 +995,10 @@ importers: dependencies: svelte-loader: specifier: 3.2.4 - version: 3.2.4(svelte@5.2.7) + version: 3.2.4(svelte@5.3.1) svelte-preprocess: specifier: ^6.0.3 - version: 6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.2.7)(typescript@5.7.2) + version: 6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.3.1)(typescript@5.7.2) devDependencies: '@rsbuild/core': specifier: workspace:* @@ -1013,8 +1013,8 @@ importers: specifier: ^22.10.1 version: 22.10.1 svelte: - specifier: ^5.2.7 - version: 5.2.7 + specifier: ^5.3.1 + version: 5.3.1 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -3835,16 +3835,16 @@ packages: resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} engines: {node: '>=8.0.0'} - esm-env@1.1.4: - resolution: {integrity: sha512-oO82nKPHKkzIj/hbtuDYy/JHqBHFlMIW36SDiPCVsj87ntDLcWN+sJ1erdVryd4NxODacFTsdrIE3b7IamqbOg==} + esm-env@1.2.1: + resolution: {integrity: sha512-U9JedYYjCnadUlXk7e1Kr+aENQhtUaoaV9+gZm1T8LC/YBAPJx3NSPIAurFOC0U5vrdSevnUJS2/wUVxGwPhng==} esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} hasBin: true - esrap@1.2.2: - resolution: {integrity: sha512-F2pSJklxx1BlQIQgooczXCPHmcWpn6EsP5oo73LQfonG9fIlIENQ8vMmfGXeojP9MrkzUNAfyU5vdFlR9shHAw==} + esrap@1.2.3: + resolution: {integrity: sha512-ZlQmCCK+n7SGoqo7DnfKaP1sJZa49P01/dXzmjCASSo04p72w8EksT2NMK8CEX8DhKsfJXANioIw8VyHNsBfvQ==} esrecurse@4.3.0: resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} @@ -6088,8 +6088,8 @@ packages: typescript: optional: true - svelte@5.2.7: - resolution: {integrity: sha512-cEhPGuLHiH2+Z8B1FwQgiZJgA39uUmJR4516TKrM5zrp0/cuwJkfhUfcTxhAkznanAF5fXUKzvYR4o+Ksx3ZCQ==} + svelte@5.3.1: + resolution: {integrity: sha512-Y6PXppQhIZZ0HLZKj6UMV/VZPJbHiK98K8A5M7mJ+PGrz4erUmuDRUa8l7aw4La++Vl51YWzLUuuB0FZ7JPfnw==} engines: {node: '>=18'} svg-parser@2.0.4: @@ -8642,7 +8642,7 @@ snapshots: dependencies: '@vitest/spy': 2.1.6 estree-walker: 3.0.3 - magic-string: 0.30.12 + magic-string: 0.30.14 optionalDependencies: vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.81.0)(sass@1.81.0)(stylus@0.64.0)(terser@5.36.0) @@ -8658,7 +8658,7 @@ snapshots: '@vitest/snapshot@2.1.6': dependencies: '@vitest/pretty-format': 2.1.6 - magic-string: 0.30.12 + magic-string: 0.30.14 pathe: 1.1.2 '@vitest/spy@2.1.6': @@ -9544,11 +9544,11 @@ snapshots: esrecurse: 4.3.0 estraverse: 4.3.0 - esm-env@1.1.4: {} + esm-env@1.2.1: {} esprima@4.0.1: {} - esrap@1.2.2: + esrap@1.2.3: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 '@types/estree': 1.0.6 @@ -11575,7 +11575,7 @@ snapshots: rollup-plugin-dts@6.1.1(rollup@4.24.3)(typescript@5.7.2): dependencies: - magic-string: 0.30.12 + magic-string: 0.30.14 rollup: 4.24.3 typescript: 5.7.2 optionalDependencies: @@ -12028,20 +12028,20 @@ snapshots: svelte-dev-helper@1.1.9: {} - svelte-hmr@0.14.12(svelte@5.2.7): + svelte-hmr@0.14.12(svelte@5.3.1): dependencies: - svelte: 5.2.7 + svelte: 5.3.1 - svelte-loader@3.2.4(svelte@5.2.7): + svelte-loader@3.2.4(svelte@5.3.1): dependencies: loader-utils: 2.0.4 - svelte: 5.2.7 + svelte: 5.3.1 svelte-dev-helper: 1.1.9 - svelte-hmr: 0.14.12(svelte@5.2.7) + svelte-hmr: 0.14.12(svelte@5.3.1) - svelte-preprocess@6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.2.7)(typescript@5.7.2): + svelte-preprocess@6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.81.0)(stylus@0.64.0)(svelte@5.3.1)(typescript@5.7.2): dependencies: - svelte: 5.2.7 + svelte: 5.3.1 optionalDependencies: '@babel/core': 7.26.0 less: 4.2.1 @@ -12051,7 +12051,7 @@ snapshots: stylus: 0.64.0 typescript: 5.7.2 - svelte@5.2.7: + svelte@5.3.1: dependencies: '@ampproject/remapping': 2.3.0 '@jridgewell/sourcemap-codec': 1.5.0 @@ -12060,11 +12060,11 @@ snapshots: acorn-typescript: 1.4.13(acorn@8.14.0) aria-query: 5.3.2 axobject-query: 4.1.0 - esm-env: 1.1.4 - esrap: 1.2.2 + esm-env: 1.2.1 + esrap: 1.2.3 is-reference: 3.0.3 locate-character: 3.0.0 - magic-string: 0.30.12 + magic-string: 0.30.14 zimmerframe: 1.1.2 svg-parser@2.0.4: {} From cdfb5f5891ef10f827b0e52b6de4d39e3964597e Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 2 Dec 2024 14:37:45 +0800 Subject: [PATCH 27/40] fix: `resolve.dedupe` may set incorrect path (#4106) --- packages/core/src/plugins/resolve.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/plugins/resolve.ts b/packages/core/src/plugins/resolve.ts index cddfdab1fc..bd0285e189 100644 --- a/packages/core/src/plugins/resolve.ts +++ b/packages/core/src/plugins/resolve.ts @@ -113,7 +113,8 @@ function applyAlias({ paths: [rootPath], }); - const trailing = sep === '/' ? pkgName : pkgName.split('/').join(sep); + // Ensure the package path is `node_modules/@scope/package-name` + const trailing = ['node_modules', ...pkgName.split('/')].join(sep); while ( !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules') From 83a279076c7d8a9afb50bcb6c507ee96a99d4b6e Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 2 Dec 2024 16:39:56 +0800 Subject: [PATCH 28/40] chore(plugin-preact): use `resolve.alias` (#4107) --- packages/plugin-preact/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/plugin-preact/src/index.ts b/packages/plugin-preact/src/index.ts index 965e0ad9f5..1d628a8080 100644 --- a/packages/plugin-preact/src/index.ts +++ b/packages/plugin-preact/src/index.ts @@ -87,6 +87,7 @@ export const pluginPreact = ( }; extraConfig.source ||= {}; + extraConfig.resolve ||= {}; if (usePrefresh) { // transpile `@prefresh/core` and `@prefresh/utils` to ensure browser compatibility @@ -96,7 +97,7 @@ export const pluginPreact = ( } if (options.reactAliasesEnabled) { - extraConfig.source.alias = { + extraConfig.resolve.alias = { react: 'preact/compat', 'react-dom/test-utils': 'preact/test-utils', 'react-dom': 'preact/compat', From 87f4e293dc7c0d26b7dbbffaa2ae929052a9f8cd Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 2 Dec 2024 16:58:32 +0800 Subject: [PATCH 29/40] fix: improve compatibility of `source.alias` (#4108) --- packages/core/src/config.ts | 24 ++--- packages/core/src/plugins/resolve.ts | 27 ++---- .../__snapshots__/environments.test.ts.snap | 96 +++++++++---------- packages/core/tests/environments.test.ts | 18 ++-- packages/core/tests/mergeConfig.test.ts | 21 ++-- packages/core/tests/resolve.test.ts | 8 +- 6 files changed, 95 insertions(+), 99 deletions(-) diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 60724b1b2c..5f16243f5b 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -90,14 +90,8 @@ const getDefaultServerConfig = (): NormalizedServerConfig => ({ let swcHelpersPath: string; const getDefaultSourceConfig = (): NormalizedSourceConfig => { - if (!swcHelpersPath) { - swcHelpersPath = dirname(require.resolve('@swc/helpers/package.json')); - } - return { - alias: { - '@swc/helpers': swcHelpersPath, - }, + alias: {}, define: {}, preEntry: [], decorators: { @@ -192,10 +186,18 @@ const getDefaultOutputConfig = (): NormalizedOutputConfig => ({ emitAssets: true, }); -const getDefaultResolveConfig = (): NormalizedResolveConfig => ({ - alias: {}, - aliasStrategy: 'prefer-tsconfig', -}); +const getDefaultResolveConfig = (): NormalizedResolveConfig => { + if (!swcHelpersPath) { + swcHelpersPath = dirname(require.resolve('@swc/helpers/package.json')); + } + + return { + alias: { + '@swc/helpers': swcHelpersPath, + }, + aliasStrategy: 'prefer-tsconfig', + }; +}; const createDefaultConfig = (): RsbuildConfig => ({ dev: getDefaultDevConfig(), diff --git a/packages/core/src/plugins/resolve.ts b/packages/core/src/plugins/resolve.ts index bd0285e189..bff8b00767 100644 --- a/packages/core/src/plugins/resolve.ts +++ b/packages/core/src/plugins/resolve.ts @@ -67,25 +67,16 @@ function applyAlias({ config: NormalizedEnvironmentConfig; rootPath: string; }) { + let mergedAlias = reduceConfigs({ + initial: {}, + config: config.resolve.alias, + }); + // TODO: remove `source.alias` in the next major version - const mergedSourceAlias = config.source.alias - ? reduceConfigs({ - initial: {}, - config: config.source.alias, - }) - : {}; - - const mergedResolveAlias = config.resolve.alias - ? reduceConfigs({ - initial: {}, - config: config.resolve.alias, - }) - : {}; - - const mergedAlias = { - ...mergedSourceAlias, - ...mergedResolveAlias, - }; + mergedAlias = reduceConfigs({ + initial: mergedAlias, + config: config.source.alias, + }); if (config.resolve.dedupe) { for (const pkgName of config.resolve.dedupe) { diff --git a/packages/core/tests/__snapshots__/environments.test.ts.snap b/packages/core/tests/__snapshots__/environments.test.ts.snap index 32aee30b70..b41a180fbe 100644 --- a/packages/core/tests/__snapshots__/environments.test.ts.snap +++ b/packages/core/tests/__snapshots__/environments.test.ts.snap @@ -88,7 +88,10 @@ exports[`environment config > should normalize environment config correctly 1`] "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -109,10 +112,7 @@ exports[`environment config > should normalize environment config correctly 1`] "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -221,7 +221,10 @@ exports[`environment config > should normalize environment config correctly 2`] "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -242,10 +245,7 @@ exports[`environment config > should normalize environment config correctly 2`] "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -354,7 +354,10 @@ exports[`environment config > should print environment config when inspect confi "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -375,10 +378,7 @@ exports[`environment config > should print environment config when inspect confi "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -483,7 +483,10 @@ exports[`environment config > should print environment config when inspect confi "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -504,10 +507,7 @@ exports[`environment config > should print environment config when inspect confi "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -632,7 +632,10 @@ exports[`environment config > should support modify environment config by api.mo "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -653,10 +656,7 @@ exports[`environment config > should support modify environment config by api.mo "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -761,7 +761,11 @@ exports[`environment config > should support modify environment config by api.mo "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@common1": "./src/common1", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -782,11 +786,7 @@ exports[`environment config > should support modify environment config by api.mo "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@common1": "./src/common1", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -891,7 +891,11 @@ exports[`environment config > should support modify environment config by api.mo "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@common1": "./src/common1", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -912,11 +916,7 @@ exports[`environment config > should support modify environment config by api.mo "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@common1": "./src/common1", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -1024,7 +1024,10 @@ exports[`environment config > should support modify single environment config by "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -1045,10 +1048,7 @@ exports[`environment config > should support modify single environment config by "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, @@ -1153,7 +1153,11 @@ exports[`environment config > should support modify single environment config by "removeMomentLocale": false, }, "resolve": { - "alias": {}, + "alias": { + "@common": "./src/common", + "@common1": "./src/common1", + "@swc/helpers": "/node_modules//@swc/helpers", + }, "aliasStrategy": "prefer-tsconfig", }, "root": "", @@ -1174,11 +1178,7 @@ exports[`environment config > should support modify single environment config by "strictPort": false, }, "source": { - "alias": { - "@common": "./src/common", - "@common1": "./src/common1", - "@swc/helpers": "/node_modules//@swc/helpers", - }, + "alias": {}, "decorators": { "version": "2022-03", }, diff --git a/packages/core/tests/environments.test.ts b/packages/core/tests/environments.test.ts index fc5995897c..ecd4c41ddf 100644 --- a/packages/core/tests/environments.test.ts +++ b/packages/core/tests/environments.test.ts @@ -38,7 +38,7 @@ describe('environment config', () => { process.env.NODE_ENV = 'development'; const rsbuild = await createRsbuild({ rsbuildConfig: { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -70,14 +70,14 @@ describe('environment config', () => { return mergeRsbuildConfig(config, { environments: { web: { - source: { + resolve: { alias: { '@common1': './src/common1', }, }, }, web1: { - source: { + resolve: { alias: { '@common1': './src/common1', }, @@ -101,7 +101,7 @@ describe('environment config', () => { process.env.NODE_ENV = 'development'; const rsbuild = await createRsbuild({ rsbuildConfig: { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -136,7 +136,7 @@ describe('environment config', () => { } return mergeEnvironmentConfig(config, { - source: { + resolve: { alias: { '@common1': './src/common1', }, @@ -163,7 +163,7 @@ describe('environment config', () => { api.modifyEnvironmentConfig( (config, { name, mergeEnvironmentConfig }) => { return mergeEnvironmentConfig(config, { - source: { + resolve: { alias: { [pluginId]: name, }, @@ -196,7 +196,7 @@ describe('environment config', () => { Object.fromEntries( Object.entries(environmentConfigs).map(([name, config]) => [ name, - config.source.alias, + config.resolve.alias, ]), ), ).toMatchSnapshot(); @@ -242,7 +242,7 @@ describe('environment config', () => { process.env.NODE_ENV = 'development'; const rsbuild = await createRsbuild({ rsbuildConfig: { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -297,7 +297,7 @@ describe('environment config', () => { process.env.NODE_ENV = 'development'; const rsbuild = await createRsbuild({ rsbuildConfig: { - source: { + resolve: { alias: { '@common': './src/common', }, diff --git a/packages/core/tests/mergeConfig.test.ts b/packages/core/tests/mergeConfig.test.ts index 579fa57a1b..13b625e4bd 100644 --- a/packages/core/tests/mergeConfig.test.ts +++ b/packages/core/tests/mergeConfig.test.ts @@ -16,11 +16,11 @@ describe('mergeRsbuildConfig', () => { test('should set value when target value is not undefined', () => { expect( mergeRsbuildConfig( - { source: { alias: {} } }, + { resolve: { alias: {} } }, { output: { minify: false } }, ), ).toEqual({ - source: { + resolve: { alias: {}, }, output: { @@ -32,13 +32,13 @@ describe('mergeRsbuildConfig', () => { test('should ignore undefined property', () => { const noop = () => ({}); const config = mergeRsbuildConfig( - { source: { alias: {} } }, - { source: { alias: undefined } }, + { resolve: { alias: {} } }, + { resolve: { alias: undefined } }, { tools: { rspack: noop } }, { tools: { rspack: undefined } }, ); expect(config).toEqual({ - source: { + resolve: { alias: {}, }, tools: { @@ -162,7 +162,7 @@ describe('mergeRsbuildConfig', () => { it('should not modify the original objects when the merged config modified', () => { const obj: RsbuildConfig = { - source: { + resolve: { alias: {}, }, }; @@ -172,14 +172,17 @@ describe('mergeRsbuildConfig', () => { const res = mergeRsbuildConfig(obj, other); if (!res.source?.entry) { - res.source!.entry = { + res.source ||= {}; + res.source.entry = { index: './index', }; } expect(res).toEqual({ - source: { + resolve: { alias: {}, + }, + source: { entry: { index: './index', }, @@ -187,7 +190,7 @@ describe('mergeRsbuildConfig', () => { }); expect(obj).toEqual({ - source: { + resolve: { alias: {}, }, }); diff --git a/packages/core/tests/resolve.test.ts b/packages/core/tests/resolve.test.ts index abc4f2b7f5..761cc3dfad 100644 --- a/packages/core/tests/resolve.test.ts +++ b/packages/core/tests/resolve.test.ts @@ -38,11 +38,11 @@ describe('plugin-resolve', () => { expect(bundlerConfigs[0].resolve?.tsConfig).toBeUndefined(); }); - it('should allow to use source.alias to config alias', async () => { + it('should allow to use resolve.alias to configure alias', async () => { const rsbuild = await createStubRsbuild({ plugins: [pluginResolve()], rsbuildConfig: { - source: { + resolve: { alias: { foo: 'bar', }, @@ -54,11 +54,11 @@ describe('plugin-resolve', () => { expect(bundlerConfigs[0].resolve?.alias?.foo).toEqual('bar'); }); - it('should support source.alias to be a function', async () => { + it('should allow resolve.alias to be a function', async () => { const rsbuild = await createStubRsbuild({ plugins: [pluginResolve()], rsbuildConfig: { - source: { + resolve: { alias() { return { foo: 'bar', From 31ce3c54cbacc1e0f42b286da5162bf234099f11 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 2 Dec 2024 17:33:31 +0800 Subject: [PATCH 30/40] docs: move alias config to resolve (#4109) --- package.json | 9 +++++ pnpm-lock.yaml | 18 ++++++++- website/docs/en/config/environments.mdx | 38 +++++++++++-------- .../{source => resolve}/alias-strategy.mdx | 23 +++++------ .../en/config/{source => resolve}/alias.mdx | 30 ++++++++------- website/docs/en/config/resolve/dedupe.mdx | 4 +- website/docs/en/guide/advanced/alias.mdx | 20 +++++----- .../docs/en/guide/advanced/environments.mdx | 16 +++++--- .../docs/en/guide/basic/configure-rsbuild.mdx | 10 ++--- website/docs/en/guide/migration/cra.mdx | 2 +- website/docs/en/guide/migration/vite.mdx | 2 +- website/docs/en/guide/start/features.mdx | 2 +- website/docs/zh/config/environments.mdx | 38 +++++++++++-------- .../{source => resolve}/alias-strategy.mdx | 23 +++++------ .../zh/config/{source => resolve}/alias.mdx | 30 ++++++++------- website/docs/zh/config/resolve/dedupe.mdx | 4 +- website/docs/zh/guide/advanced/alias.mdx | 20 +++++----- .../docs/zh/guide/advanced/environments.mdx | 16 +++++--- .../docs/zh/guide/basic/configure-rsbuild.mdx | 10 ++--- website/docs/zh/guide/migration/cra.mdx | 2 +- website/docs/zh/guide/migration/vite.mdx | 2 +- website/docs/zh/guide/start/features.mdx | 2 +- website/package.json | 3 +- website/rspress.config.ts | 13 +++++++ 24 files changed, 205 insertions(+), 132 deletions(-) rename website/docs/en/config/{source => resolve}/alias-strategy.mdx (67%) rename website/docs/en/config/{source => resolve}/alias.mdx (86%) rename website/docs/zh/config/{source => resolve}/alias-strategy.mdx (67%) rename website/docs/zh/config/{source => resolve}/alias.mdx (85%) diff --git a/package.json b/package.json index 69f398a20e..0f1bdd4609 100644 --- a/package.json +++ b/package.json @@ -56,5 +56,14 @@ "engines": { "node": ">=18.0.0", "pnpm": ">=9.0.0" + }, + "pnpm": { + "packageExtensions": { + "@rspress/plugin-client-redirects": { + "dependencies": { + "@rspress/shared": "^1.37.3" + } + } + } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e64f860239..be6116daa3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,8 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +packageExtensionsChecksum: 242b46cb3413dd5fe1495d77579faef4 + importers: .: @@ -1138,6 +1140,9 @@ importers: '@rsbuild/core': specifier: workspace:* version: link:../packages/core + '@rspress/plugin-client-redirects': + specifier: ^1.37.3 + version: 1.37.3(@rspress/runtime@1.37.3) '@rspress/plugin-rss': specifier: 1.37.3 version: 1.37.3(react@18.3.1)(rspress@1.37.3(webpack@5.96.1)) @@ -2678,6 +2683,12 @@ packages: resolution: {integrity: sha512-8PrfUitBCm6PFruMU969Wr5qA+wr0RisEM2iuHwdm2NBQnpwc9Ag73OagCMPwBUYyDod3kXXRyN4Yz/VuQIpDA==} engines: {node: '>=14.17.6'} + '@rspress/plugin-client-redirects@1.37.3': + resolution: {integrity: sha512-SNlWpNWcV7+ngSK003GVgT74YAl18pv6PZlRVc1a6ozF8XO0fjN66y5AUhxMDSsx1g5jiVmPdL8RSR6fwp9JoA==} + engines: {node: '>=14.17.6'} + peerDependencies: + '@rspress/runtime': ^1.37.3 + '@rspress/plugin-container-syntax@1.37.3': resolution: {integrity: sha512-xiGjF2j4QPtD/s6Cmme1KEdr0mHRM/A5bDOmSXAqLssRiQyE7zunPjVIu78sfQndZxzAXWY51lQHbNT8IG5FdA==} engines: {node: '>=14.17.6'} @@ -8293,6 +8304,11 @@ snapshots: dependencies: '@rspress/shared': 1.37.3 + '@rspress/plugin-client-redirects@1.37.3(@rspress/runtime@1.37.3)': + dependencies: + '@rspress/runtime': 1.37.3 + '@rspress/shared': 1.37.3 + '@rspress/plugin-container-syntax@1.37.3': dependencies: '@rspress/shared': 1.37.3 @@ -8323,7 +8339,7 @@ snapshots: '@rspress/shared@1.37.3': dependencies: - '@rsbuild/core': 1.1.4 + '@rsbuild/core': 1.1.7 chalk: 5.3.0 execa: 5.1.1 fs-extra: 11.2.0 diff --git a/website/docs/en/config/environments.mdx b/website/docs/en/config/environments.mdx index 53cb6899a8..cae86aabbe 100644 --- a/website/docs/en/config/environments.mdx +++ b/website/docs/en/config/environments.mdx @@ -37,7 +37,7 @@ Configure Rsbuild configuration for `web` (client) and `node` (SSR) environments ```ts title="rsbuild.config.ts" export default { // Shared configuration for all environments - source: { + resolve: { alias: { '@common': './src/common', }, @@ -46,9 +46,6 @@ export default { // configuration for client web: { source: { - alias: { - '@common1': './src/web/common1', - }, entry: { index: './src/index.client.js', }, @@ -56,13 +53,15 @@ export default { output: { target: 'web', }, + resolve: { + alias: { + '@common1': './src/web/common1', + }, + }, }, // configuration for SSR node: { source: { - alias: { - '@common1': './src/ssr/common1', - }, entry: { index: './src/index.server.js', }, @@ -70,6 +69,11 @@ export default { output: { target: 'node', }, + resolve: { + alias: { + '@common1': './src/ssr/common1', + }, + }, }, }, }; @@ -80,10 +84,6 @@ For the `web` environment, the merged Rsbuild configuration is: ```js const webConfig = { source: { - alias: { - '@common': './src/common', - '@common1': './src/web/common1', - }, entry: { index: './src/index.client.js', }, @@ -91,6 +91,12 @@ const webConfig = { output: { target: 'web', }, + resolve: { + alias: { + '@common': './src/common', + '@common1': './src/web/common1', + }, + }, }; ``` @@ -99,10 +105,6 @@ For the `node` environment, the merged Rsbuild configuration is: ```js const nodeConfig = { source: { - alias: { - '@common': './src/common', - '@common1': './src/ssr/common1', - }, entry: { index: './src/index.server.js', }, @@ -110,5 +112,11 @@ const nodeConfig = { output: { target: 'node', }, + resolve: { + alias: { + '@common': './src/common', + '@common1': './src/ssr/common1', + }, + }, }; ``` diff --git a/website/docs/en/config/source/alias-strategy.mdx b/website/docs/en/config/resolve/alias-strategy.mdx similarity index 67% rename from website/docs/en/config/source/alias-strategy.mdx rename to website/docs/en/config/resolve/alias-strategy.mdx index e4f7fa5c55..f2b034c0e9 100644 --- a/website/docs/en/config/source/alias-strategy.mdx +++ b/website/docs/en/config/resolve/alias-strategy.mdx @@ -1,13 +1,14 @@ -# source.aliasStrategy +# resolve.aliasStrategy - **Type:** `'prefer-tsconfig' | 'prefer-alias'` - **Default:** `'prefer-tsconfig'` +- **Version:** `>=1.1.7` -Control the priority between the `paths` option in `tsconfig.json` and the [resolve.alias](/config/source/alias) option of Rsbuild. +Control the priority between the `paths` option in `tsconfig.json` and the [resolve.alias](/config/resolve/alias) option of Rsbuild. ### prefer-tsconfig -By default, `source.aliasStrategy` is set to `'prefer-tsconfig'`. In this case, both the `paths` option in `tsconfig.json` and the `alias` option in the bundler will take effect, but the `paths` option in tsconfig has a higher priority. +By default, `resolve.aliasStrategy` is set to `'prefer-tsconfig'`. In this case, both the `paths` option in `tsconfig.json` and the `alias` option in the bundler will take effect, but the `paths` option in tsconfig has a higher priority. For example, if the following configurations are set at the same time: @@ -23,11 +24,11 @@ For example, if the following configurations are set at the same time: } ``` -- `source.alias`: +- `resolve.alias`: ```ts export default { - source: { + resolve: { alias: { '@common': './src/common-2', '@utils': './src/utils', @@ -39,15 +40,15 @@ export default { Since the tsconfig paths have a higher priority, the following will happen: - `@common` will use the value defined in tsconfig paths, pointing to `./src/common-1` -- `@utils` will use the value defined in `source.alias`, pointing to `./src/utils` +- `@utils` will use the value defined in `resolve.alias`, pointing to `./src/utils` ### prefer-alias -If the value of `source.aliasStrategy` is set to `prefer-alias`, the `paths` option in `tsconfig.json` will only be used to provide TypeScript type definitions and will not affect the bundling result. In this case, the bundler will only read the `alias` option as the path alias. +If the value of `resolve.aliasStrategy` is set to `prefer-alias`, the `paths` option in `tsconfig.json` will only be used to provide TypeScript type definitions and will not affect the bundling result. In this case, the bundler will only read the `alias` option as the path alias. ```ts export default { - source: { + resolve: { aliasStrategy: 'prefer-alias', }, }; @@ -68,11 +69,11 @@ For example, if the following configurations are set at the same time: } ``` -- `source.alias`: +- `resolve.alias`: ```ts export default { - source: { + resolve: { alias: { '@common': './src/common-2', }, @@ -86,7 +87,7 @@ In most cases, you don't need to use `prefer-alias`, but you can consider using ```ts export default { - source: { + resolve: { alias: { '@common': process.env.NODE_ENV === 'production' diff --git a/website/docs/en/config/source/alias.mdx b/website/docs/en/config/resolve/alias.mdx similarity index 86% rename from website/docs/en/config/source/alias.mdx rename to website/docs/en/config/resolve/alias.mdx index 17a9e8cc78..1949680032 100644 --- a/website/docs/en/config/source/alias.mdx +++ b/website/docs/en/config/resolve/alias.mdx @@ -1,4 +1,4 @@ -# source.alias +# resolve.alias - **Type:** @@ -14,10 +14,14 @@ const defaultAlias = { }; ``` +- **Version:** `>=1.1.7` + Create aliases to import or require certain modules, same as the [resolve.alias](https://rspack.dev/config/resolve#resolvealias) config of Rspack. +For TypeScript projects, you only need to configure [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) in the `tsconfig.json` file. The Rsbuild will automatically recognize it, so there is no need to configure the `resolve.alias` option separately. For more details, please refer to [Path Aliases](/guide/advanced/alias). + :::tip -For TypeScript projects, you only need to configure [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) in the `tsconfig.json` file. The Rsbuild will automatically recognize it, so there is no need to configure the `source.alias` option separately. For more details, please refer to [Path Aliases](/guide/advanced/alias). +In versions prior to Rsbuild 1.1.7, you can use the `source.alias` to set alias, but it will be removed in the next major version. ::: ## Object Type @@ -26,7 +30,7 @@ The `alias` can be an Object, and the relative path will be automatically conver ```js export default { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -42,7 +46,7 @@ The `alias` can be a function, it will accept the previous alias object, and you ```js export default { - source: { + resolve: { alias: (alias) => { alias['@common'] = './src/common'; }, @@ -54,7 +58,7 @@ If you need to remove the built-in `@swc/helpers` alias, you can delete it in th ```js export default { - source: { + resolve: { alias: (alias) => { delete alias['@swc/helpers']; }, @@ -66,7 +70,7 @@ You can also return a new object as the final result in the function, which will ```js export default { - source: { + resolve: { alias: (alias) => { return { '@common': './src/common', @@ -86,7 +90,7 @@ For example, set different alias for `web` and `node` environments: export default { environments: { web: { - source: { + resolve: { alias: { '@common': './src/web/common', }, @@ -96,7 +100,7 @@ export default { }, }, node: { - source: { + resolve: { alias: { '@common': './src/node/common', }, @@ -111,13 +115,13 @@ export default { ## Exact Matching -By default, `source.alias` will automatically match sub-paths, for example, with the following configuration: +By default, `resolve.alias` will automatically match sub-paths, for example, with the following configuration: ```js import path from 'node:path'; export default { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -138,7 +142,7 @@ You can add the `$` symbol to enable exact matching, which will not automaticall import path from 'node:path'; export default { - source: { + resolve: { alias: { '@common$': './src/common', }, @@ -163,7 +167,7 @@ For example, if multiple versions of the `react` are installed in the project, y import path from 'node:path'; export default { - source: { + resolve: { alias: { react: path.resolve(__dirname, './node_modules/react'), }, @@ -177,7 +181,7 @@ For example, if a module or npm dependency in your project uses the React 18 API ## Handling Loader -`source.alias` does not support creating aliases for loaders. +`resolve.alias` does not support creating aliases for loaders. If you need to create aliases for loaders, you can use Rspack's [resolveLoader](https://rspack.dev/config/resolve-loader) configuration. diff --git a/website/docs/en/config/resolve/dedupe.mdx b/website/docs/en/config/resolve/dedupe.mdx index e970adbdc1..0f9b10d136 100644 --- a/website/docs/en/config/resolve/dedupe.mdx +++ b/website/docs/en/config/resolve/dedupe.mdx @@ -38,7 +38,7 @@ For example, if `foo` depends on a React 17-specific API or feature, then unifyi ## How it works -`resolve.dedupe` is implemented based on [source.alias](/config/source/alias), it will get the path of the specified package through `require.resolve` in the project root directory and set it to the alias. +`resolve.dedupe` is implemented based on [resolve.alias](/config/resolve/alias), it will get the path of the specified package through `require.resolve` in the project root directory and set it to the alias. In the above example, `resolve.dedupe` will be converted to the following alias config: @@ -49,4 +49,4 @@ const alias = { }; ``` -The alias generated by `resolve.dedupe` will be merged with the configured `source.alias` in the project, and the `source.alias` config will take precedence when the keys are the same. +The alias generated by `resolve.dedupe` will be merged with the configured `resolve.alias` in the project, and the `resolve.alias` config will take precedence when the keys are the same. diff --git a/website/docs/en/guide/advanced/alias.mdx b/website/docs/en/guide/advanced/alias.mdx index 1338532850..d95753e571 100644 --- a/website/docs/en/guide/advanced/alias.mdx +++ b/website/docs/en/guide/advanced/alias.mdx @@ -7,7 +7,7 @@ For example, if you frequently reference the `src/common/request.ts` module in y In Rsbuild, there are two ways to set up path aliases: - Through the `paths` configuration in `tsconfig.json`. -- Through the [source.alias](/config/source/alias) configuration. +- Through the [resolve.alias](/config/resolve/alias) configuration. ## Using `tsconfig.json`'s `paths` Configuration @@ -31,25 +31,25 @@ After configuring, if you reference `@common/Foo.tsx` in your code, it will be m You can refer to the [TypeScript - paths](https://typescriptlang.org/tsconfig#paths) documentation for more details. ::: -## Use `source.alias` Configuration +## Use `resolve.alias` Configuration -Rsbuild provides the [source.alias](/config/source/alias) configuration option, which corresponds to the webpack/Rspack native [resolve.alias](https://rspack.dev/config/resolve#resolvealias) configuration. You can configure this option using an object or a function. +Rsbuild provides the [resolve.alias](/config/resolve/alias) configuration option, which corresponds to the webpack/Rspack native [resolve.alias](https://rspack.dev/config/resolve#resolvealias) configuration. You can configure this option using an object or a function. ### Use Cases Since the `paths` configuration in `tsconfig.json` is written in a static JSON file, it lacks dynamism. -The `source.alias` configuration can address this limitation by allowing you to dynamically set the `source.alias` using JavaScript code, such as based on environment variables. +The `resolve.alias` configuration can address this limitation by allowing you to dynamically set the `resolve.alias` using JavaScript code, such as based on environment variables. ### Object Usage -You can configure `source.alias` using an object, where the relative paths will be automatically resolved to absolute paths. +You can configure `resolve.alias` using an object, where the relative paths will be automatically resolved to absolute paths. For example: ```js export default { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -61,13 +61,13 @@ After configuring, if you reference `@common/Foo.tsx` in your code, it will be m ### Function Usage -You can also configure `source.alias` as a function, which receives the built-in `alias` object and allows you to modify it. +You can also configure `resolve.alias` as a function, which receives the built-in `alias` object and allows you to modify it. For example: ```js export default { - source: { + resolve: { alias: (alias) => { alias['@common'] = './src/common'; return alias; @@ -78,6 +78,6 @@ export default { ### Priority -The `paths` configuration in `tsconfig.json` takes precedence over the `source.alias` configuration. When a path matches the rules defined in both `paths` and `source.alias`, the value defined in `paths` will be used. +The `paths` configuration in `tsconfig.json` takes precedence over the `resolve.alias` configuration. When a path matches the rules defined in both `paths` and `resolve.alias`, the value defined in `paths` will be used. -You can adjust the priority of these two options using [source.aliasStrategy](/config/source/alias-strategy). +You can adjust the priority of these two options using [resolve.aliasStrategy](/config/resolve/alias-strategy). diff --git a/website/docs/en/guide/advanced/environments.mdx b/website/docs/en/guide/advanced/environments.mdx index 3c4b3289fc..402542bc1c 100644 --- a/website/docs/en/guide/advanced/environments.mdx +++ b/website/docs/en/guide/advanced/environments.mdx @@ -32,14 +32,16 @@ export default { entry: { index: './src/index.client.js', }, - alias: { - '@common': './src/client/common', - }, }, output: { // Use 'web' target for the browser outputs target: 'web', }, + resolve: { + alias: { + '@common': './src/client/common', + }, + }, }, // Configure the node environment for SSR node: { @@ -47,14 +49,16 @@ export default { entry: { index: './src/index.server.js', }, - alias: { - '@common': './src/server/common', - }, }, output: { // Use 'node' target for the Node.js outputs target: 'node', }, + resolve: { + alias: { + '@common': './src/server/common', + }, + }, }, }, }; diff --git a/website/docs/en/guide/basic/configure-rsbuild.mdx b/website/docs/en/guide/basic/configure-rsbuild.mdx index 0a07872cec..3de5c72bb5 100644 --- a/website/docs/en/guide/basic/configure-rsbuild.mdx +++ b/website/docs/en/guide/basic/configure-rsbuild.mdx @@ -65,13 +65,13 @@ When you use the CLI of Rsbuild, Rsbuild will automatically read the configurati We recommend using the `.mjs` or `.ts` format for the configuration file and importing the `defineConfig` utility function from `@rsbuild/core`. It provides friendly TypeScript type hints and autocompletion, which can help you avoid errors in the configuration. -For example, in `rsbuild.config.ts`, you can define the Rsbuild [source.alias](/config/source/alias) configuration: +For example, in `rsbuild.config.ts`, you can define the Rsbuild [resolve.alias](/config/resolve/alias) configuration: ```ts title="rsbuild.config.ts" import { defineConfig } from '@rsbuild/core'; export default defineConfig({ - source: { + resolve: { alias: { '@common': './src/common', }, @@ -85,7 +85,7 @@ If you are developing a non-TypeScript project, you can use the `.mjs` format fo import { defineConfig } from '@rsbuild/core'; export default defineConfig({ - source: { + resolve: { alias: (opts) => { opts['@common'] = './src/common'; }, @@ -125,7 +125,7 @@ In the configuration file, you can use Node.js environment variables such as `pr import { defineConfig } from '@rsbuild/core'; export default defineConfig({ - source: { + resolve: { alias: { '@request': process.env.NODE_ENV === 'development' @@ -144,7 +144,7 @@ Rsbuild supports the export of a function in the config file, where you can dyna import { defineConfig } from '@rsbuild/core'; export default defineConfig(({ env, command, envMode }) => ({ - source: { + resolve: { alias: { '@foo': env === 'development' ? './src/foo.dev.ts' : './src/foo.prod.ts', }, diff --git a/website/docs/en/guide/migration/cra.mdx b/website/docs/en/guide/migration/cra.mdx index 107de63f72..4101c2882e 100644 --- a/website/docs/en/guide/migration/cra.mdx +++ b/website/docs/en/guide/migration/cra.mdx @@ -296,7 +296,7 @@ If your project is using [CRACO](https://craco.js.org) to override CRA configura | CRACO | Rsbuild | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | [webpack.configure](https://craco.js.org/docs/configuration/webpack/#webpackconfigure) | [tools.rspack](/config/tools/rspack) | -| [webpack.alias](https://craco.js.org/docs/configuration/webpack/#webpackalias) | [source.alias](/config/source/alias) | +| [webpack.alias](https://craco.js.org/docs/configuration/webpack/#webpackalias) | [resolve.alias](/config/resolve/alias) | | [webpack.plugins.add](https://craco.js.org/docs/configuration/webpack/#webpackplugins) | [appendPlugins of tools.rspack](/config/tools/rspack#appendplugins) | | [webpack.plugins.remove](https://craco.js.org/docs/configuration/webpack/#webpackpluginsremove) | [removePlugin of tools.rspack](/config/tools/rspack#removeplugin) | | [style.modules](https://craco.js.org/docs/configuration/style/#stylemodules) | [output.cssModules](/config/output/css-modules) | diff --git a/website/docs/en/guide/migration/vite.mdx b/website/docs/en/guide/migration/vite.mdx index e1ccd61c81..7acbdb673d 100644 --- a/website/docs/en/guide/migration/vite.mdx +++ b/website/docs/en/guide/migration/vite.mdx @@ -114,7 +114,7 @@ Here is the corresponding Rsbuild configuration for Vite configuration: | envDir | [Env Directory](/guide/advanced/env-vars#env-directory) | | publicDir | [server.publicDir](/config/server/public-dir) | | assetsInclude | [source.assetsInclude](/config/source/assets-include) | -| resolve.alias | [source.alias](/config/source/alias) | +| resolve.alias | [resolve.alias](/config/resolve/alias) | | resolve.dedupe | [resolve.dedupe](/config/resolve/dedupe) | | resolve.conditions | [tools.rspack.resolve.conditionNames](/config/tools/rspack) | | resolve.mainFields | [tools.rspack.resolve.mainFields](/config/tools/rspack) | diff --git a/website/docs/en/guide/start/features.mdx b/website/docs/en/guide/start/features.mdx index d6b440b385..fe78b1c886 100644 --- a/website/docs/en/guide/start/features.mdx +++ b/website/docs/en/guide/start/features.mdx @@ -12,7 +12,7 @@ Here are all the main features supported by Rsbuild. | Code minification | Code minification is enabled by default in production mode |
  • [output.minify](/config/output/minify)
| | Polyfill injection | core-js and other polyfills are injected by default |
  • [Browser Compatibility](/guide/advanced/browser-compatibility)
  • [output.polyfill](/config/output/polyfill)
| | SourceMap generation | Source maps are generated in development mode by default |
  • [output.sourceMap](/config/output/source-map)
| -| Alias | Optional feature, set import alias |
  • [source.alias](/config/source/alias)
| +| Alias | Optional feature, set import alias |
  • [resolve.alias](/config/resolve/alias)
| | Babel compilation | Optional feature, use Babel to transform JavaScript and TypeScript code |
  • [Babel Plugin](/plugins/list/plugin-babel)
| | Node outputs | Optional feature, support building bundles that run in Node.js environment |
  • [Node Target](/config/output/target#node-target)
| | Web Worker outputs | Optional feature, support building bundles that run in a Web Worker environment |
  • [Web Worker Target](/config/output/target#web-worker-target)
| diff --git a/website/docs/zh/config/environments.mdx b/website/docs/zh/config/environments.mdx index e882b91ef1..54c90e7ba0 100644 --- a/website/docs/zh/config/environments.mdx +++ b/website/docs/zh/config/environments.mdx @@ -37,7 +37,7 @@ type Environments = { ```ts title="rsbuild.config.ts" export default { // 所有环境共享配置 - source: { + resolve: { alias: { '@common': './src/common', }, @@ -46,9 +46,6 @@ export default { // client 环境配置 web: { source: { - alias: { - '@common1': './src/web/common1', - }, entry: { index: './src/index.client.js', }, @@ -56,13 +53,15 @@ export default { output: { target: 'web', }, + resolve: { + alias: { + '@common1': './src/web/common1', + }, + }, }, // SSR 环境配置 node: { source: { - alias: { - '@common1': './src/ssr/common1', - }, entry: { index: './src/index.server.js', }, @@ -70,6 +69,11 @@ export default { output: { target: 'node', }, + resolve: { + alias: { + '@common1': './src/ssr/common1', + }, + }, }, }, }; @@ -80,10 +84,6 @@ export default { ```js const webConfig = { source: { - alias: { - '@common': './src/common', - '@common1': './src/web/common1', - }, entry: { index: './src/index.client.js', }, @@ -91,6 +91,12 @@ const webConfig = { output: { target: 'web', }, + resolve: { + alias: { + '@common': './src/common', + '@common1': './src/web/common1', + }, + }, }; ``` @@ -99,10 +105,6 @@ const webConfig = { ```js const nodeConfig = { source: { - alias: { - '@common': './src/common', - '@common1': './src/ssr/common1', - }, entry: { index: './src/index.server.js', }, @@ -110,5 +112,11 @@ const nodeConfig = { output: { target: 'node', }, + resolve: { + alias: { + '@common': './src/common', + '@common1': './src/ssr/common1', + }, + }, }; ``` diff --git a/website/docs/zh/config/source/alias-strategy.mdx b/website/docs/zh/config/resolve/alias-strategy.mdx similarity index 67% rename from website/docs/zh/config/source/alias-strategy.mdx rename to website/docs/zh/config/resolve/alias-strategy.mdx index fd7bd1576f..5f1b58a0ea 100644 --- a/website/docs/zh/config/source/alias-strategy.mdx +++ b/website/docs/zh/config/resolve/alias-strategy.mdx @@ -1,13 +1,14 @@ -# source.aliasStrategy +# resolve.aliasStrategy - **类型:** `'prefer-tsconfig' | 'prefer-alias'` - **默认值:** `'prefer-tsconfig'` +- **版本:** `>=1.1.7` -控制 `tsconfig.json` 中的 `paths` 选项与 Rsbuild 的 [resolve.alias](/config/source/alias) 选项的优先级。 +控制 `tsconfig.json` 中的 `paths` 选项与 Rsbuild 的 [resolve.alias](/config/resolve/alias) 选项的优先级。 ### prefer-tsconfig -`source.aliasStrategy` 默认为 `'prefer-tsconfig'`,此时 `tsconfig.json` 中的 `paths` 选项和打包工具的 `alias` 选项都会生效,但 tsconfig paths 选项的优先级更高。 +`resolve.aliasStrategy` 默认为 `'prefer-tsconfig'`,此时 `tsconfig.json` 中的 `paths` 选项和打包工具的 `alias` 选项都会生效,但 tsconfig paths 选项的优先级更高。 比如同时配置以下内容: @@ -23,11 +24,11 @@ } ``` -- `source.alias`: +- `resolve.alias`: ```ts export default { - source: { + resolve: { alias: { '@common': './src/common-2', '@utils': './src/utils', @@ -39,15 +40,15 @@ export default { 由于 tsconfig paths 的优先级更高,所以: - `@common` 会使用 tsconfig paths 定义的值,指向 `./src/common-1` -- `@utils` 会使用 `source.alias` 定义的值,指向 `./src/utils` +- `@utils` 会使用 `resolve.alias` 定义的值,指向 `./src/utils` ### prefer-alias -当 `source.aliasStrategy` 的值为 `prefer-alias` 时,`tsconfig.json` 中的 `paths` 选项只用于提供 TypeScript 类型定义,而不会对打包结果产生任何影响。此时,构建工具只会读取 `alias` 选项作为路径别名。 +当 `resolve.aliasStrategy` 的值为 `prefer-alias` 时,`tsconfig.json` 中的 `paths` 选项只用于提供 TypeScript 类型定义,而不会对打包结果产生任何影响。此时,构建工具只会读取 `alias` 选项作为路径别名。 ```ts export default { - source: { + resolve: { aliasStrategy: 'prefer-alias', }, }; @@ -68,11 +69,11 @@ export default { } ``` -- `source.alias`: +- `resolve.alias`: ```ts export default { - source: { + resolve: { alias: { '@common': './src/common-2', }, @@ -86,7 +87,7 @@ export default { ```ts export default { - source: { + resolve: { alias: { '@common': process.env.NODE_ENV === 'production' diff --git a/website/docs/zh/config/source/alias.mdx b/website/docs/zh/config/resolve/alias.mdx similarity index 85% rename from website/docs/zh/config/source/alias.mdx rename to website/docs/zh/config/resolve/alias.mdx index eff2b4e5ba..bead4efbf8 100644 --- a/website/docs/zh/config/source/alias.mdx +++ b/website/docs/zh/config/resolve/alias.mdx @@ -1,4 +1,4 @@ -# source.alias +# resolve.alias - **类型:** @@ -14,10 +14,14 @@ const defaultAlias = { }; ``` +- **版本:** `>=1.1.7` + 设置文件引用的别名,对应 Rspack 的 [resolve.alias](https://rspack.dev/zh/config/resolve#resolvealias) 配置。 +对于 TypeScript 项目,你只需要在 `tsconfig.json` 中配置 [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) 即可,Rsbuild 会自动识别它,不需要额外配置 `resolve.alias` 字段,详见 [「路径别名」](/guide/advanced/alias)。 + :::tip -对于 TypeScript 项目,你只需要在 `tsconfig.json` 中配置 [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) 即可,Rsbuild 会自动识别它,不需要额外配置 `source.alias` 字段,详见 [「路径别名」](/guide/advanced/alias)。 +在 Rsbuild 1.1.7 之前的版本,你可以使用 `source.alias` 来设置 alias,但该字段将在下一个大版本中被移除。 ::: ## Object 类型 @@ -26,7 +30,7 @@ const defaultAlias = { ```js export default { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -42,7 +46,7 @@ export default { ```js export default { - source: { + resolve: { alias: (alias) => { alias['@common'] = './src/common'; }, @@ -54,7 +58,7 @@ export default { ```js export default { - source: { + resolve: { alias: (alias) => { delete alias['@swc/helpers']; }, @@ -66,7 +70,7 @@ export default { ```js export default { - source: { + resolve: { alias: (alias) => { return { '@common': './src/common', @@ -86,7 +90,7 @@ export default { export default { environments: { web: { - source: { + resolve: { alias: { '@common': './src/web/common', }, @@ -96,7 +100,7 @@ export default { }, }, node: { - source: { + resolve: { alias: { '@common': './src/node/common', }, @@ -111,13 +115,13 @@ export default { ## 精确匹配 -默认情况,`source.alias` 会自动匹配子路径,比如以下配置: +默认情况,`resolve.alias` 会自动匹配子路径,比如以下配置: ```js import path from 'node:path'; export default { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -138,7 +142,7 @@ import b from '@common/util'; // 解析为 `./src/common/util` import path from 'node:path'; export default { - source: { + resolve: { alias: { '@common$': './src/common', }, @@ -163,7 +167,7 @@ import b from '@common/util'; // 保持 `@common/util` 不变 import path from 'node:path'; export default { - source: { + resolve: { alias: { react: path.resolve(__dirname, './node_modules/react'), }, @@ -177,7 +181,7 @@ export default { ## 处理 Loader -`source.alias` 不支持为 loader 设置别名。如果你需要为 loader 设置别名,可以使用 Rspack 的 [resolveLoader](https://rspack.dev/zh/config/resolve-loader) 配置项。 +`resolve.alias` 不支持为 loader 设置别名。如果你需要为 loader 设置别名,可以使用 Rspack 的 [resolveLoader](https://rspack.dev/zh/config/resolve-loader) 配置项。 ```ts export default { diff --git a/website/docs/zh/config/resolve/dedupe.mdx b/website/docs/zh/config/resolve/dedupe.mdx index 619992c6a9..3a02df0e46 100644 --- a/website/docs/zh/config/resolve/dedupe.mdx +++ b/website/docs/zh/config/resolve/dedupe.mdx @@ -38,7 +38,7 @@ export default defineConfig({ ## 实现原理 -`resolve.dedupe` 是基于 [source.alias](/config/source/alias) 实现的,它会在当前项目的根目录下通过 `require.resolve` 获取指定包的路径,并设置到 alias 中。 +`resolve.dedupe` 是基于 [resolve.alias](/config/resolve/alias) 实现的,它会在当前项目的根目录下通过 `require.resolve` 获取指定包的路径,并设置到 alias 中。 在上述的例子中,`resolve.dedupe` 会被转换为以下 alias 配置: @@ -49,4 +49,4 @@ const alias = { }; ``` -`resolve.dedupe` 生成的 alias 会与项目中配置的 `source.alias` 合并,当两者配置了相同的 key 时,`source.alias` 的优先级更高。 +`resolve.dedupe` 生成的 alias 会与项目中配置的 `resolve.alias` 合并,当两者配置了相同的 key 时,`resolve.alias` 的优先级更高。 diff --git a/website/docs/zh/guide/advanced/alias.mdx b/website/docs/zh/guide/advanced/alias.mdx index 31916abea2..ace6845dec 100644 --- a/website/docs/zh/guide/advanced/alias.mdx +++ b/website/docs/zh/guide/advanced/alias.mdx @@ -7,7 +7,7 @@ 在 Rsbuild 中,你有两种方式可以设置路径别名: - 通过 `tsconfig.json` 中的 `paths` 配置。 -- 通过 [source.alias](/config/source/alias) 配置。 +- 通过 [resolve.alias](/config/resolve/alias) 配置。 ## 通过 `tsconfig.json` 的 `paths` 配置 @@ -31,25 +31,25 @@ 你可以阅读 [TypeScript - paths](https://typescriptlang.org/tsconfig#paths) 文档来了解更多用法。 ::: -## 通过 `source.alias` 配置 +## 通过 `resolve.alias` 配置 -Rsbuild 提供了 [source.alias](/config/source/alias) 配置项,对应 Rspack 原生的 [resolve.alias](https://rspack.dev/zh/config/resolve#resolvealias) 配置,你可以通过对象或者函数的方式来配置这个选项。 +Rsbuild 提供了 [resolve.alias](/config/resolve/alias) 配置项,对应 Rspack 原生的 [resolve.alias](https://rspack.dev/zh/config/resolve#resolvealias) 配置,你可以通过对象或者函数的方式来配置这个选项。 ### 使用场景 由于 `tsconfig.json` 的 `paths` 配置是写在静态 JSON 文件里的,因此它不具备动态性。 -而 `source.alias` 则可以弥补这一不足,你可以通过 JavaScript 代码来动态设置 `source.alias`(比如基于环境变量来设置)。 +而 `resolve.alias` 则可以弥补这一不足,你可以通过 JavaScript 代码来动态设置 `resolve.alias`(比如基于环境变量来设置)。 ### 对象用法 -你可以通过对象的方式来配置 `source.alias`,其中的相对路径会被自动补全为绝对路径。 +你可以通过对象的方式来配置 `resolve.alias`,其中的相对路径会被自动补全为绝对路径。 比如: ```js export default { - source: { + resolve: { alias: { '@common': './src/common', }, @@ -61,13 +61,13 @@ export default { ### 函数用法 -你也可以将 `source.alias` 配置为一个函数,拿到内置的 `alias` 对象,对其进行修改。 +你也可以将 `resolve.alias` 配置为一个函数,拿到内置的 `alias` 对象,对其进行修改。 比如: ```js export default { - source: { + resolve: { alias: (alias) => { alias['@common'] = './src/common'; return alias; @@ -78,6 +78,6 @@ export default { ### 优先级 -`tsconfig.json` 的 `paths` 配置的优先级高于 `source.alias`,当一个路径同时匹配到这两者定义的规则时,会优先使用 `tsconfig.json` 的 `paths` 定义的值。 +`tsconfig.json` 的 `paths` 配置的优先级高于 `resolve.alias`,当一个路径同时匹配到这两者定义的规则时,会优先使用 `tsconfig.json` 的 `paths` 定义的值。 -你可以通过 [source.aliasStrategy](/config/source/alias-strategy) 来调整这两个选项的优先级。 +你可以通过 [resolve.aliasStrategy](/config/resolve/alias-strategy) 来调整这两个选项的优先级。 diff --git a/website/docs/zh/guide/advanced/environments.mdx b/website/docs/zh/guide/advanced/environments.mdx index 8cc2a1b858..f8ae26d481 100644 --- a/website/docs/zh/guide/advanced/environments.mdx +++ b/website/docs/zh/guide/advanced/environments.mdx @@ -32,14 +32,16 @@ export default { entry: { index: './src/index.client.js', }, - alias: { - '@common': './src/client/common', - }, }, output: { // 浏览器产物的 target 类型为 'web' target: 'web', }, + resolve: { + alias: { + '@common': './src/client/common', + }, + }, }, // 配置 node 环境,用于 SSR node: { @@ -47,14 +49,16 @@ export default { entry: { index: './src/index.server.js', }, - alias: { - '@common': './src/server/common', - }, }, output: { // Node.js 产物的 target 类型为 'node' target: 'node', }, + resolve: { + alias: { + '@common': './src/server/common', + }, + }, }, }, }; diff --git a/website/docs/zh/guide/basic/configure-rsbuild.mdx b/website/docs/zh/guide/basic/configure-rsbuild.mdx index 6c1d1b0e33..a3e7e453f3 100644 --- a/website/docs/zh/guide/basic/configure-rsbuild.mdx +++ b/website/docs/zh/guide/basic/configure-rsbuild.mdx @@ -65,13 +65,13 @@ export default { 我们推荐使用 `.mjs` 或 `.ts` 格式的配置文件,并从 `@rsbuild/core` 中导入 `defineConfig` 工具函数, 它提供了友好的 TypeScript 类型推导和自动补全,可以帮助你避免配置中的错误。 -比如在 `rsbuild.config.ts` 中,你可以定义 Rsbuild 的 [source.alias](/config/source/alias) 配置: +比如在 `rsbuild.config.ts` 中,你可以定义 Rsbuild 的 [resolve.alias](/config/resolve/alias) 配置: ```ts title="rsbuild.config.ts" import { defineConfig } from '@rsbuild/core'; export default defineConfig({ - source: { + resolve: { alias: { '@common': './src/common', }, @@ -85,7 +85,7 @@ export default defineConfig({ import { defineConfig } from '@rsbuild/core'; export default defineConfig({ - source: { + resolve: { alias: (opts) => { opts['@common'] = './src/common'; }, @@ -125,7 +125,7 @@ rsbuild build -c rsbuild.prod.config.mjs import { defineConfig } from '@rsbuild/core'; export default defineConfig({ - source: { + resolve: { alias: { '@request': process.env.NODE_ENV === 'development' @@ -144,7 +144,7 @@ Rsbuild 支持在配置文件中导出一个函数,你可以在函数中动态 import { defineConfig } from '@rsbuild/core'; export default defineConfig(({ env, command, envMode }) => ({ - source: { + resolve: { alias: { '@foo': env === 'development' ? './src/foo.dev.ts' : './src/foo.prod.ts', }, diff --git a/website/docs/zh/guide/migration/cra.mdx b/website/docs/zh/guide/migration/cra.mdx index db65f5b32e..3aa2566523 100644 --- a/website/docs/zh/guide/migration/cra.mdx +++ b/website/docs/zh/guide/migration/cra.mdx @@ -296,7 +296,7 @@ export default { | CRACO | Rsbuild | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | [webpack.configure](https://craco.js.org/docs/configuration/webpack/#webpackconfigure) | [tools.rspack](/config/tools/rspack) | -| [webpack.alias](https://craco.js.org/docs/configuration/webpack/#webpackalias) | [source.alias](/config/source/alias) | +| [webpack.alias](https://craco.js.org/docs/configuration/webpack/#webpackalias) | [resolve.alias](/config/resolve/alias) | | [webpack.plugins.add](https://craco.js.org/docs/configuration/webpack/#webpackplugins) | [appendPlugins of tools.rspack](/config/tools/rspack#appendplugins) | | [webpack.plugins.remove](https://craco.js.org/docs/configuration/webpack/#webpackpluginsremove) | [removePlugin of tools.rspack](/config/tools/rspack#removeplugin) | | [style.modules](https://craco.js.org/docs/configuration/style/#stylemodules) | [output.cssModules](/config/output/css-modules) | diff --git a/website/docs/zh/guide/migration/vite.mdx b/website/docs/zh/guide/migration/vite.mdx index a54f68146f..73ed3b9c0b 100644 --- a/website/docs/zh/guide/migration/vite.mdx +++ b/website/docs/zh/guide/migration/vite.mdx @@ -114,7 +114,7 @@ Rsbuild 会在构建时自动注入 `