diff --git a/e2e/cases/server/cors/index.test.ts b/e2e/cases/server/cors/index.test.ts index 9765657f93..b31c2433a6 100644 --- a/e2e/cases/server/cors/index.test.ts +++ b/e2e/cases/server/cors/index.test.ts @@ -10,7 +10,7 @@ test('should include CORS headers by default for dev server', async ({ page, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()['access-control-allow-origin']).toEqual('*'); await rsbuild.close(); @@ -25,7 +25,7 @@ test('should include CORS headers by default for preview server', async ({ page, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()['access-control-allow-origin']).toEqual('*'); await rsbuild.close(); @@ -42,7 +42,7 @@ test('should allow to disable CORS', async ({ page, request }) => { }, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()).not.toHaveProperty('access-control-allow-origin'); await rsbuild.close(); @@ -61,7 +61,7 @@ test('should allow to configure CORS', async ({ page, request }) => { }, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()['access-control-allow-origin']).toEqual( 'https://example.com', ); diff --git a/e2e/cases/svelte/package.json b/e2e/cases/svelte/package.json index 9df6a1f7f9..d6401242d8 100644 --- a/e2e/cases/svelte/package.json +++ b/e2e/cases/svelte/package.json @@ -7,7 +7,7 @@ }, "devDependencies": { "less": "^4.2.1", - "sass": "^1.82.0", + "sass": "^1.83.0", "stylus": "0.64.0" } } diff --git a/packages/plugin-sass/package.json b/packages/plugin-sass/package.json index 02094f528b..af2252c44e 100644 --- a/packages/plugin-sass/package.json +++ b/packages/plugin-sass/package.json @@ -33,7 +33,7 @@ "loader-utils": "^2.0.4", "postcss": "^8.4.49", "reduce-configs": "^1.1.0", - "sass-embedded": "^1.82.0" + "sass-embedded": "^1.83.0" }, "devDependencies": { "@rsbuild/core": "workspace:*", diff --git a/packages/plugin-svelte/package.json b/packages/plugin-svelte/package.json index 7a58dfdfac..00c4e3658d 100644 --- a/packages/plugin-svelte/package.json +++ b/packages/plugin-svelte/package.json @@ -1,6 +1,6 @@ { "name": "@rsbuild/plugin-svelte", - "version": "1.0.5", + "version": "1.0.6", "description": "Svelte plugin for Rsbuild", "repository": { "type": "git", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3acea9a836..f935f291b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,7 +43,7 @@ importers: version: 5.7.2 vitest: specifier: ^2.1.8 - version: 2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0) + version: 2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0) e2e: dependencies: @@ -248,8 +248,8 @@ importers: specifier: ^4.2.1 version: 4.2.1 sass: - specifier: ^1.82.0 - version: 1.82.0 + specifier: ^1.83.0 + version: 1.83.0 stylus: specifier: 0.64.0 version: 0.64.0 @@ -916,8 +916,8 @@ importers: specifier: ^1.1.0 version: 1.1.0 sass-embedded: - specifier: ^1.82.0 - version: 1.82.0 + specifier: ^1.83.0 + version: 1.83.0 devDependencies: '@rsbuild/core': specifier: workspace:* @@ -942,7 +942,7 @@ importers: version: 5.0.0 sass-loader: specifier: ^16.0.4 - version: 16.0.4(@rspack/core@1.1.6(@swc/helpers@0.5.15))(sass-embedded@1.82.0)(sass@1.82.0)(webpack@5.97.1) + version: 16.0.4(@rspack/core@1.1.6(@swc/helpers@0.5.15))(sass-embedded@1.83.0)(sass@1.83.0)(webpack@5.97.1) typescript: specifier: ^5.7.2 version: 5.7.2 @@ -1013,7 +1013,7 @@ importers: version: 3.2.4(svelte@5.9.0) 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@2.4.1)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.82.0)(stylus@0.64.0)(svelte@5.9.0)(typescript@5.7.2) + version: 6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@2.4.1)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.83.0)(stylus@0.64.0)(svelte@5.9.0)(typescript@5.7.2) devDependencies: '@rsbuild/core': specifier: workspace:* @@ -5715,128 +5715,128 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - sass-embedded-android-arm64@1.82.0: - resolution: {integrity: sha512-bldHMs02QQWXsgHUZRgolNnZdMjN6XHvmUYoRkzmFq7lsvtLU6SJg2S1Wa9IZJs9jRWdTmOgA6YibSf3pROyFQ==} + sass-embedded-android-arm64@1.83.0: + resolution: {integrity: sha512-GBiCvM4a2rkWBLdYDxI6XYnprfk5U5c81g69RC2X6kqPuzxzx8qTArQ9M6keFK4+iDQ5N9QTwFCr0KbZTn+ZNQ==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [android] - sass-embedded-android-arm@1.82.0: - resolution: {integrity: sha512-ttGMvWnA/5TYdZTjr5fWHDbb9nZgKipHKCc9zZQRF5HjUydOYWKNqmAJHQtbFWaq35kd5qn6yiE73IJN6eJ6wA==} + sass-embedded-android-arm@1.83.0: + resolution: {integrity: sha512-uwFSXzJlfbd4Px189xE5l+cxN8+TQpXdQgJec7TIrb4HEY7imabtpYufpVdqUVwT1/uiis5V4+qIEC4Vl5XObQ==} engines: {node: '>=14.0.0'} cpu: [arm] os: [android] - sass-embedded-android-ia32@1.82.0: - resolution: {integrity: sha512-FUJOnxw8IYKuYuxxiOkk6QXle8/yQFtKjnuSAJuZ5ZpLVMcSZzLc3SWOtuEXYx5iSAfJCO075o2ZoG/pPrJ9aw==} + sass-embedded-android-ia32@1.83.0: + resolution: {integrity: sha512-5ATPdGo2SICqAhiJl/Z8KQ23zH4sGgobGgux0TnrNtt83uHZ+r+To/ubVJ7xTkZxed+KJZnIpolGD8dQyQqoTg==} engines: {node: '>=14.0.0'} cpu: [ia32] os: [android] - sass-embedded-android-riscv64@1.82.0: - resolution: {integrity: sha512-rd+vc+sxJxNnbhaubiIJmnb1b3FvC9wxCIq8spstopbO7o1uufvBBDeRoFSJaN+7oNhamzjlYGdu6aQoQNs3+A==} + sass-embedded-android-riscv64@1.83.0: + resolution: {integrity: sha512-aveknUOB8GZewOzVn2Uwk+DKcncTR50Q6vtzslNMGbYnxtgQNHzy8A1qVEviNUruex+pHofppeMK4iMPFAbiEQ==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [android] - sass-embedded-android-x64@1.82.0: - resolution: {integrity: sha512-EVlybGTgJ8wNLyWj8RUatPXSnmIcvCsx3EfsRfBfhGihLbn4NNpavYO9QsvZzI2XWbJqHLBCd+CvkTcDw/TaSQ==} + sass-embedded-android-x64@1.83.0: + resolution: {integrity: sha512-WqIay/72ncyf9Ph4vS742J3a73wZihWmzFUwpn1OD6lme1Aj4eWzWIve5IVnlTEJgcZcDHu6ECID9IZgehJKoA==} engines: {node: '>=14.0.0'} cpu: [x64] os: [android] - sass-embedded-darwin-arm64@1.82.0: - resolution: {integrity: sha512-LvdJPojjKlNGYOB0nSUR/ZtMDuAF4puspHlwK42aA/qK292bfSkMUKZPPapB2aSRwccc/ieBq5fI7n/WHrOCVw==} + sass-embedded-darwin-arm64@1.83.0: + resolution: {integrity: sha512-XQl9QqgxFFIPm/CzHhmppse5o9ocxrbaAdC2/DAnlAqvYWBBtgFqPjGoYlej13h9SzfvNoogx+y9r+Ap+e+hYg==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [darwin] - sass-embedded-darwin-x64@1.82.0: - resolution: {integrity: sha512-6LfnD6YmG1aBfd3ReqMOJDb6Pg2Z/hmlJB7nU+Lb3E+hCNjAZAgeUHQxU/Pm1eIqJJTU/h4ib5QP0Pt9O8yVnw==} + sass-embedded-darwin-x64@1.83.0: + resolution: {integrity: sha512-ERQ7Tvp1kFOW3ux4VDFIxb7tkYXHYc+zJpcrbs0hzcIO5ilIRU2tIOK1OrNwrFO6Qxyf7AUuBwYKLAtIU/Nz7g==} engines: {node: '>=14.0.0'} cpu: [x64] os: [darwin] - sass-embedded-linux-arm64@1.82.0: - resolution: {integrity: sha512-590/y0HJr/JiyxaqgR7Xf9P20BIhJ+zhB/afAnVuZe/4lEfCpTyM5xMe2+sKLsqtrVyzs9Zm/M4S4ASUOPCggA==} + sass-embedded-linux-arm64@1.83.0: + resolution: {integrity: sha512-syEAVTJt4qhaMLxrSwOWa46zdqHJdnqJkLUK+t9aCr8xqBZLPxSUeIGji76uOehQZ1C+KGFj6n9xstHN6wzOJw==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - sass-embedded-linux-arm@1.82.0: - resolution: {integrity: sha512-ozjdC5rWzyi5Vo300I4tVZzneXOTQUiaxOr7DjtN26HuFaGAGCGmvThh2BRV4RvySg++5H9rdFu+VgyUQ5iukw==} + sass-embedded-linux-arm@1.83.0: + resolution: {integrity: sha512-baG9RYBJxUFmqwDNC9h9ZFElgJoyO3jgHGjzEZ1wHhIS9anpG+zZQvO8bHx3dBpKEImX+DBeLX+CxsFR9n81gQ==} engines: {node: '>=14.0.0'} cpu: [arm] os: [linux] - sass-embedded-linux-ia32@1.82.0: - resolution: {integrity: sha512-hpc4acZ3UTjjJ3Q/GUXqQOCSml6AFKaku0HMawra9bKyRmOpxn8V5hqgXeOWVjK2oQzCmCnJvwKoQUP+S/SIYQ==} + sass-embedded-linux-ia32@1.83.0: + resolution: {integrity: sha512-RRBxQxMpoxu5+XcSSc6QR/o9asEwUzR8AbCS83RaXcdTIHTa/CccQsiAoDDoPlRsMTLqnzs0LKL4CfOsf7zBbA==} engines: {node: '>=14.0.0'} cpu: [ia32] os: [linux] - sass-embedded-linux-musl-arm64@1.82.0: - resolution: {integrity: sha512-bc2MUSMv/jabnNGEyKP2jQAYZoEzTT/c633W6QoeSEWETGCuTNjaHvWWE6qSI6/UfRg1EpuV1LQA2jPMzZfv/w==} + sass-embedded-linux-musl-arm64@1.83.0: + resolution: {integrity: sha512-Y7juhPHClUO2H5O+u+StRy6SEAcwZ+hTEk5WJdEmo1Bb1gDtfHvJaWB/iFZJ2tW0W1e865AZeUrC4OcOFjyAQA==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - sass-embedded-linux-musl-arm@1.82.0: - resolution: {integrity: sha512-R5PQmY/I+GSoMtfLo8GgHkvF/q6x6y8VNM7yu/Ac1mJj86n48VFi29W1HfY2496+Q6cpAq7toobDj7YfldIdVA==} + sass-embedded-linux-musl-arm@1.83.0: + resolution: {integrity: sha512-Yc7u2TelCfBab+PRob9/MNJFh3EooMiz4urvhejXkihTiKSHGCv5YqDdtWzvyb9tY2Jb7YtYREVuHwfdVn3dTQ==} engines: {node: '>=14.0.0'} cpu: [arm] os: [linux] - sass-embedded-linux-musl-ia32@1.82.0: - resolution: {integrity: sha512-ZQKCFKm5TBcJ19UG6uUQmIKfVCJIWMb7e1a93lGeujSb9gyKF5Fb6MN3tuExoT7iFK8zU0Z9iyHqh93F58lcCw==} + sass-embedded-linux-musl-ia32@1.83.0: + resolution: {integrity: sha512-arQeYwGmwXV8byx5G1PtSzZWW1jbkfR5qrIHMEbTFSAvAxpqjgSvCvrHMOFd73FcMxVaYh4BX9LQNbKinkbEdg==} engines: {node: '>=14.0.0'} cpu: [ia32] os: [linux] - sass-embedded-linux-musl-riscv64@1.82.0: - resolution: {integrity: sha512-5meSU8BHFeaT09RWfkuUrikRlC+WZcYb9To7MpfV1d9nlD7CZ2xydPExK+mj3DqRuQvTbvhMPcr7f+pHlgHINQ==} + sass-embedded-linux-musl-riscv64@1.83.0: + resolution: {integrity: sha512-E6uzlIWz59rut+Z3XR6mLG915zNzv07ISvj3GUNZENdHM7dF8GQ//ANoIpl5PljMQKp89GnYdvo6kj2gnaBf/g==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - sass-embedded-linux-musl-x64@1.82.0: - resolution: {integrity: sha512-ASLAMfjWv7YEPBvEOVlb3zzHq8l4Y9Eh4x3m7B1dNauGVbO11Yng5cPCX/XbwGVf30BtE75pwqvV7oXxBtN15w==} + sass-embedded-linux-musl-x64@1.83.0: + resolution: {integrity: sha512-eAMK6tyGqvqr21r9g8BnR3fQc1rYFj85RGduSQ3xkITZ6jOAnOhuU94N5fwRS852Hpws0lXhET+7JHXgg3U18w==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - sass-embedded-linux-riscv64@1.82.0: - resolution: {integrity: sha512-qWvRDXCXH3GzD8OcP0ntd8gBTK3kZyUeyXmxQDZyEtMAM4STC2Tn7+5+2JYYHlppzqWnZPFBNESvpKeOtHaBBw==} + sass-embedded-linux-riscv64@1.83.0: + resolution: {integrity: sha512-Ojpi78pTv02sy2fUYirRGXHLY3fPnV/bvwuC2i5LwPQw2LpCcFyFTtN0c5h4LJDk9P6wr+/ZB/JXU8tHIOlK+Q==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - sass-embedded-linux-x64@1.82.0: - resolution: {integrity: sha512-AmRaHqShztwfep+M4NagdGaY7fTyWGSOM3k4Z/dd7q4nZclXbALLqNJtKx8xOM7A41LHYJ9zDpIBVRkrh0PzTA==} + sass-embedded-linux-x64@1.83.0: + resolution: {integrity: sha512-3iLjlXdoPfgZRtX4odhRvka1BQs5mAXqfCtDIQBgh/o0JnGPzJIWWl9bYLpHxK8qb+uyVBxXYgXpI0sCzArBOw==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - sass-embedded-win32-arm64@1.82.0: - resolution: {integrity: sha512-zL9JDQZHXHSGAZe5DqSrR86wMHbm9QPziU4/3hoIG+99StuS74CuV42+hw/+FXXBkXMWbjKWsyF/HZt+I/wJuw==} + sass-embedded-win32-arm64@1.83.0: + resolution: {integrity: sha512-iOHw/8/t2dlTW3lOFwG5eUbiwhEyGWawivlKWJ8lkXH7fjMpVx2VO9zCFAm8RvY9xOHJ9sf1L7g5bx3EnNP9BQ==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [win32] - sass-embedded-win32-ia32@1.82.0: - resolution: {integrity: sha512-xE+AzLquCkFPnnpo0NHjQdLRIhG1bVs42xIKx42aUbVLYKkBDvbBGpw6EtTscRMyvcjoOqGH5saRvSFComUQcw==} + sass-embedded-win32-ia32@1.83.0: + resolution: {integrity: sha512-2PxNXJ8Pad4geVcTXY4rkyTr5AwbF8nfrCTDv0ulbTvPhzX2mMKEGcBZUXWn5BeHZTBc6whNMfS7d5fQXR9dDQ==} engines: {node: '>=14.0.0'} cpu: [ia32] os: [win32] - sass-embedded-win32-x64@1.82.0: - resolution: {integrity: sha512-cEgfOQG5womOzzk16ReTv2dxPq5BG16LgLUold/LH9IZH86u4E/MN7Fspf4RWeEJ2EcLdew9QYSC2YWs1l98dQ==} + sass-embedded-win32-x64@1.83.0: + resolution: {integrity: sha512-muBXkFngM6eLTNqOV0FQi7Dv9s+YRQ42Yem26mosdan/GmJQc81deto6uDTgrYn+bzFNmiXcOdfm+0MkTWK3OQ==} engines: {node: '>=14.0.0'} cpu: [x64] os: [win32] - sass-embedded@1.82.0: - resolution: {integrity: sha512-v13sRVVZtWAQLpAGTz5D8hy+oyNKRHao5tKVc/P6AMqSP+jDM8X6GkEpL0jfbu3MaN2/hAQsd4Qx14GG1u0prQ==} + sass-embedded@1.83.0: + resolution: {integrity: sha512-/8cYZeL39evUqe0o//193na51Q1VWZ61qhxioQvLJwOtWIrX+PgNhCyD8RSuTtmzc4+6+waFZf899bfp/MCUwA==} engines: {node: '>=16.0.0'} hasBin: true @@ -5861,8 +5861,8 @@ packages: webpack: optional: true - sass@1.82.0: - resolution: {integrity: sha512-j4GMCTa8elGyN9A7x7bEglx0VgSpNUG4W4wNedQ33wSMdnkqQCT8HTwOaVSV4e6yQovcu/3Oc4coJP/l0xhL2Q==} + sass@1.83.0: + resolution: {integrity: sha512-qsSxlayzoOjdvXMVLkzF84DJFc2HZEL/rFyGIKbbilYtAvlCxyuzUeff9LawTn4btVnLKg75Z8MMr1lxU1lfGw==} engines: {node: '>=14.0.0'} hasBin: true @@ -8208,7 +8208,7 @@ snapshots: loader-utils: 2.0.4 postcss: 8.4.49 reduce-configs: 1.1.0 - sass-embedded: 1.82.0 + sass-embedded: 1.83.0 '@rsbuild/plugin-vue-jsx@1.0.1(@babel/core@7.26.0)(@rsbuild/core@packages+core)': dependencies: @@ -8660,7 +8660,7 @@ snapshots: '@types/node': 22.10.1 '@types/node-sass': 4.11.8 '@types/webpack': 4.41.40 - sass: 1.82.0 + sass: 1.83.0 '@types/semver@7.5.8': {} @@ -8721,13 +8721,13 @@ snapshots: chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.8(vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0))': + '@vitest/mocker@2.1.8(vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0))': dependencies: '@vitest/spy': 2.1.8 estree-walker: 3.0.3 magic-string: 0.30.14 optionalDependencies: - vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0) + vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0) '@vitest/pretty-format@2.1.8': dependencies: @@ -11827,67 +11827,67 @@ snapshots: safer-buffer@2.1.2: {} - sass-embedded-android-arm64@1.82.0: + sass-embedded-android-arm64@1.83.0: optional: true - sass-embedded-android-arm@1.82.0: + sass-embedded-android-arm@1.83.0: optional: true - sass-embedded-android-ia32@1.82.0: + sass-embedded-android-ia32@1.83.0: optional: true - sass-embedded-android-riscv64@1.82.0: + sass-embedded-android-riscv64@1.83.0: optional: true - sass-embedded-android-x64@1.82.0: + sass-embedded-android-x64@1.83.0: optional: true - sass-embedded-darwin-arm64@1.82.0: + sass-embedded-darwin-arm64@1.83.0: optional: true - sass-embedded-darwin-x64@1.82.0: + sass-embedded-darwin-x64@1.83.0: optional: true - sass-embedded-linux-arm64@1.82.0: + sass-embedded-linux-arm64@1.83.0: optional: true - sass-embedded-linux-arm@1.82.0: + sass-embedded-linux-arm@1.83.0: optional: true - sass-embedded-linux-ia32@1.82.0: + sass-embedded-linux-ia32@1.83.0: optional: true - sass-embedded-linux-musl-arm64@1.82.0: + sass-embedded-linux-musl-arm64@1.83.0: optional: true - sass-embedded-linux-musl-arm@1.82.0: + sass-embedded-linux-musl-arm@1.83.0: optional: true - sass-embedded-linux-musl-ia32@1.82.0: + sass-embedded-linux-musl-ia32@1.83.0: optional: true - sass-embedded-linux-musl-riscv64@1.82.0: + sass-embedded-linux-musl-riscv64@1.83.0: optional: true - sass-embedded-linux-musl-x64@1.82.0: + sass-embedded-linux-musl-x64@1.83.0: optional: true - sass-embedded-linux-riscv64@1.82.0: + sass-embedded-linux-riscv64@1.83.0: optional: true - sass-embedded-linux-x64@1.82.0: + sass-embedded-linux-x64@1.83.0: optional: true - sass-embedded-win32-arm64@1.82.0: + sass-embedded-win32-arm64@1.83.0: optional: true - sass-embedded-win32-ia32@1.82.0: + sass-embedded-win32-ia32@1.83.0: optional: true - sass-embedded-win32-x64@1.82.0: + sass-embedded-win32-x64@1.83.0: optional: true - sass-embedded@1.82.0: + sass-embedded@1.83.0: dependencies: '@bufbuild/protobuf': 2.2.1 buffer-builder: 0.2.0 @@ -11898,37 +11898,37 @@ snapshots: sync-child-process: 1.0.2 varint: 6.0.0 optionalDependencies: - sass-embedded-android-arm: 1.82.0 - sass-embedded-android-arm64: 1.82.0 - sass-embedded-android-ia32: 1.82.0 - sass-embedded-android-riscv64: 1.82.0 - sass-embedded-android-x64: 1.82.0 - sass-embedded-darwin-arm64: 1.82.0 - sass-embedded-darwin-x64: 1.82.0 - sass-embedded-linux-arm: 1.82.0 - sass-embedded-linux-arm64: 1.82.0 - sass-embedded-linux-ia32: 1.82.0 - sass-embedded-linux-musl-arm: 1.82.0 - sass-embedded-linux-musl-arm64: 1.82.0 - sass-embedded-linux-musl-ia32: 1.82.0 - sass-embedded-linux-musl-riscv64: 1.82.0 - sass-embedded-linux-musl-x64: 1.82.0 - sass-embedded-linux-riscv64: 1.82.0 - sass-embedded-linux-x64: 1.82.0 - sass-embedded-win32-arm64: 1.82.0 - sass-embedded-win32-ia32: 1.82.0 - sass-embedded-win32-x64: 1.82.0 - - sass-loader@16.0.4(@rspack/core@1.1.6(@swc/helpers@0.5.15))(sass-embedded@1.82.0)(sass@1.82.0)(webpack@5.97.1): + sass-embedded-android-arm: 1.83.0 + sass-embedded-android-arm64: 1.83.0 + sass-embedded-android-ia32: 1.83.0 + sass-embedded-android-riscv64: 1.83.0 + sass-embedded-android-x64: 1.83.0 + sass-embedded-darwin-arm64: 1.83.0 + sass-embedded-darwin-x64: 1.83.0 + sass-embedded-linux-arm: 1.83.0 + sass-embedded-linux-arm64: 1.83.0 + sass-embedded-linux-ia32: 1.83.0 + sass-embedded-linux-musl-arm: 1.83.0 + sass-embedded-linux-musl-arm64: 1.83.0 + sass-embedded-linux-musl-ia32: 1.83.0 + sass-embedded-linux-musl-riscv64: 1.83.0 + sass-embedded-linux-musl-x64: 1.83.0 + sass-embedded-linux-riscv64: 1.83.0 + sass-embedded-linux-x64: 1.83.0 + sass-embedded-win32-arm64: 1.83.0 + sass-embedded-win32-ia32: 1.83.0 + sass-embedded-win32-x64: 1.83.0 + + sass-loader@16.0.4(@rspack/core@1.1.6(@swc/helpers@0.5.15))(sass-embedded@1.83.0)(sass@1.83.0)(webpack@5.97.1): dependencies: neo-async: 2.6.2 optionalDependencies: '@rspack/core': 1.1.6(@swc/helpers@0.5.15) - sass: 1.82.0 - sass-embedded: 1.82.0 + sass: 1.83.0 + sass-embedded: 1.83.0 webpack: 5.97.1 - sass@1.82.0: + sass@1.83.0: dependencies: chokidar: 4.0.1 immutable: 5.0.2 @@ -12186,7 +12186,7 @@ snapshots: svelte-dev-helper: 1.1.9 svelte-hmr: 0.14.12(svelte@5.9.0) - svelte-preprocess@6.0.3(@babel/core@7.26.0)(less@4.2.1)(postcss-load-config@6.0.1(jiti@2.4.1)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.82.0)(stylus@0.64.0)(svelte@5.9.0)(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@2.4.1)(postcss@8.4.49)(yaml@2.6.0))(postcss@8.4.49)(sass@1.83.0)(stylus@0.64.0)(svelte@5.9.0)(typescript@5.7.2): dependencies: svelte: 5.9.0 optionalDependencies: @@ -12194,7 +12194,7 @@ snapshots: less: 4.2.1 postcss: 8.4.49 postcss-load-config: 6.0.1(jiti@2.4.1)(postcss@8.4.49)(yaml@2.6.0) - sass: 1.82.0 + sass: 1.83.0 stylus: 0.64.0 typescript: 5.7.2 @@ -12534,13 +12534,13 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0): + vite-node@2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.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.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0) + vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0) transitivePeerDependencies: - '@types/node' - less @@ -12552,7 +12552,7 @@ snapshots: - supports-color - terser - vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0): + vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0): dependencies: esbuild: 0.21.5 postcss: 8.4.49 @@ -12561,15 +12561,15 @@ snapshots: '@types/node': 22.10.1 fsevents: 2.3.3 less: 4.2.1 - sass: 1.82.0 - sass-embedded: 1.82.0 + sass: 1.83.0 + sass-embedded: 1.83.0 stylus: 0.64.0 terser: 5.37.0 - vitest@2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0): + vitest@2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0): dependencies: '@vitest/expect': 2.1.8 - '@vitest/mocker': 2.1.8(vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0)) + '@vitest/mocker': 2.1.8(vite@5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0)) '@vitest/pretty-format': 2.1.8 '@vitest/runner': 2.1.8 '@vitest/snapshot': 2.1.8 @@ -12585,8 +12585,8 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0) - vite-node: 2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.82.0)(sass@1.82.0)(stylus@0.64.0)(terser@5.37.0) + vite: 5.4.10(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0) + vite-node: 2.1.8(@types/node@22.10.1)(less@4.2.1)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.64.0)(terser@5.37.0) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 22.10.1 diff --git a/website/docs/en/api/javascript-api/environment-api.mdx b/website/docs/en/api/javascript-api/environment-api.mdx index 8167115850..4757378438 100644 --- a/website/docs/en/api/javascript-api/environment-api.mdx +++ b/website/docs/en/api/javascript-api/environment-api.mdx @@ -1,12 +1,14 @@ # Environment API -This section describes some type definitions related to Rsbuild environment API. +Here you can find all the environment related APIs. + +> See [Multi-Environment Builds](/guide/advanced/environments) for more details. ## Environment Context Environment context is a read-only object that provides some context information about the current environment. -In Rsbuild's hooks, you can get the environment context object through the `environment` or `environments` parameter. +In Rsbuild's [Plugin hooks](/plugins/dev/hooks#plugin-hooks), you can get the environment context object through the `environment` or `environments` parameter. ```ts type EnvironmentContext = { @@ -25,16 +27,34 @@ type EnvironmentContext = { The unique name of the current environment is used to distinguish and locate the environment, corresponds to the key in the [environments](/config/environments) configuration. - **Type:** `string` +- **Example:** + +```js +api.modifyRspackConfig((config, { environment }) => { + if (environment.name === 'node') { + // modify config for node environment + } + return config; +}); +``` ### browserslist -The range of target browsers that the project is compatible with. See details in [Browserslist](/guide/advanced/browserslist). +The browserslist configuration of the current environment. See [Browserslist](/guide/advanced/browserslist) for more details. - **Type:** `string[]` +- **Example:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.browserslist); + return config; +}); +``` ### config -The Rsbuild environment configuration after normalization. +The normalized Rsbuild config for the current environment. - **Type:** @@ -53,12 +73,31 @@ type NormalizedEnvironmentConfig = DeepReadonly<{ }>; ``` +- **Example:** + +```js +api.modifyRspackConfig((config, { environment }) => { + // Rspack config + console.log(config); + // Rsbuild config for current environment + console.log(environment.config); + return config; +}); +``` + ### distPath The absolute path of the output directory, corresponding to the [output.distPath.root](/config/output/dist-path) config in `RsbuildConfig`. - **Type:** `string` +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.distPath); + return config; +}); +``` + ### entry The entry object from the [source.entry](/config/source/entry) option. @@ -69,6 +108,15 @@ The entry object from the [source.entry](/config/source/entry) option. type RsbuildEntry = Record; ``` +- **Example:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.entry); + return config; +}); +``` + ### htmlPaths The path information for all HTML assets. @@ -81,6 +129,15 @@ This API will return an object, the key is the entry name and the value is the r type htmlPaths = Record; ``` +- **Example:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.htmlPaths); + return config; +}); +``` + ### tsconfigPath The absolute path of the tsconfig.json file, or `undefined` if the tsconfig.json file does not exist in current project. @@ -91,11 +148,20 @@ The absolute path of the tsconfig.json file, or `undefined` if the tsconfig.json type TsconfigPath = string | undefined; ``` +- **Example:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.tsconfigPath); + return config; +}); +``` + ## Environment API -Environment API provides a series of APIs related to the build environment. +Environment API provides some APIs related to the multi-environment build. -You can use environment API in [Rsbuild DevMiddleware](/config/dev/setup-middlewares) or [Custom Server](/api/javascript-api/instance#rsbuildcreatedevserver) to operate the build artifacts in a specific environment. +You can use environment API via [rsbuild.createDevServer()](/api/javascript-api/instance#rsbuildcreatedevserver) or [dev.setupMiddlewares](/config/dev/setup-middlewares), which allows you to get the build outputs information for a specific environment in the server side. ```ts type EnvironmentAPI = { @@ -127,7 +193,7 @@ console.log(webStats.toJson({ all: false })); ### loadBundle -Load and execute the build artifacts on the server side. This method returns the exports of the entry module. +Load and execute the bundles on the server side. This method returns the exports of the entry module. - **Type:** @@ -142,7 +208,7 @@ type LoadBundle = (entryName: string) => Promise; - **Example:** ```ts -// Load the build artifacts of main entry +// Load the bundle of `main` entry const result = await environments.node.loadBundle('main'); ``` diff --git a/website/docs/zh/api/javascript-api/environment-api.mdx b/website/docs/zh/api/javascript-api/environment-api.mdx index 1c08ab3794..7ba821f710 100644 --- a/website/docs/zh/api/javascript-api/environment-api.mdx +++ b/website/docs/zh/api/javascript-api/environment-api.mdx @@ -1,12 +1,14 @@ # Environment API -本章节描述了 Rsbuild environment API 相关的一些类型定义。 +在这里你可以找到所有与 environment 相关的 API。 + +> 参考 [多环境构建](/guide/advanced/environments) 了解更多。 ## Environment Context Environment context 是一个只读对象,提供一些和当前环境有关的上下文信息。 -在 Rsbuild 的 hooks 中,你可以通过 `environment` 或 `environments` 入参获取 environment context 对象。 +在 Rsbuild 的 [Plugin hooks](/plugins/dev/hooks#plugin-hooks) 中,你可以通过 `environment` 或 `environments` 入参获取 environment context 对象。 ```ts type EnvironmentContext = { @@ -25,16 +27,34 @@ type EnvironmentContext = { 当前环境的唯一名称,用于区分和定位环境,对应于 [environments](/config/environments) 配置中的 key。 - **类型:** `string` +- **示例:** + +```js +api.modifyRspackConfig((config, { environment }) => { + if (environment.name === 'node') { + // modify config for node environment + } + return config; +}); +``` ### browserslist -项目兼容的目标浏览器范围。详情可参考 [设置浏览器范围](/guide/advanced/browserslist). +当前环境设置的目标浏览器范围。详见 [设置浏览器范围](/guide/advanced/browserslist)。 - **类型:** `string[]` +- **示例:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.browserslist); + return config; +}); +``` ### config -归一化后当前环境的 Rsbuild 配置 +当前环境使用的 Rsbuild 配置(经过归一化处理)。 - **类型:** @@ -53,11 +73,31 @@ type NormalizedEnvironmentConfig = DeepReadonly<{ }>; ``` +- **示例:** + +```js +api.modifyRspackConfig((config, { environment }) => { + // Rspack + console.log(config); + // Rsbuild config for current environment + console.log(environment.config); + return config; +}); +``` + ### distPath 构建产物输出目录的绝对路径,对应 RsbuildConfig 中的 [output.distPath.root](/config/output/dist-path) 配置项。 - **类型:** `string` +- **示例:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.distPath); + return config; +}); +``` ### entry @@ -69,9 +109,20 @@ type NormalizedEnvironmentConfig = DeepReadonly<{ type RsbuildEntry = Record; ``` +- **示例:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.entry); + return config; +}); +``` + ### htmlPaths -HTML 产物的路径信息。该 API 会返回一个对象,对象的 key 为 entry 名称,value 为 HTML 文件在产物目录下的相对路径。 +HTML 产物的路径信息。 + +该 API 会返回一个对象,对象的 key 为 entry 名称,value 为 HTML 文件在产物目录下的相对路径。 - **类型:** @@ -79,9 +130,18 @@ HTML 产物的路径信息。该 API 会返回一个对象,对象的 key 为 e type htmlPaths = Record; ``` +- **示例:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.htmlPaths); + return config; +}); +``` + ### tsconfigPath -tsconfig.json 文件的绝对路径,若项目中不存在 tsconfig.json 文件,则为 undefined。 +tsconfig.json 文件的绝对路径,若项目中不存在 tsconfig.json 文件,则为 `undefined`。 - **类型:** @@ -89,11 +149,20 @@ tsconfig.json 文件的绝对路径,若项目中不存在 tsconfig.json 文件 type TsconfigPath = string | undefined; ``` +- **示例:** + +```js +api.modifyRspackConfig((config, { environment }) => { + console.log(environment.tsconfigPath); + return config; +}); +``` + ## Environment API -Environment API 提供了一系列和构建环境相关的 API。 +Environment API 包了一些与多环境构建相关的 API。 -你可以在 [Rsbuild DevMiddleware](/config/dev/setup-middlewares) 或[自定义 Server](/api/javascript-api/instance#rsbuildcreatedevserver) 中使用 environment API 对特定环境下的构建产物进行操作。 +你可以通过 [rsbuild.createDevServer()](/api/javascript-api/instance#rsbuildcreatedevserver) 或 [dev.setupMiddlewares](/config/dev/setup-middlewares) 使用 environment API,这允许你在服务端获取特定环境下的构建产物信息。 ```ts type EnvironmentAPI = { @@ -140,7 +209,7 @@ type LoadBundle = (entryName: string) => Promise; - **示例:** ```ts -// 加载 main 入口的构建产物 +// 加载 `main` 入口的 bundle const result = await environments.node.loadBundle('main'); ``` diff --git a/website/rspress.config.ts b/website/rspress.config.ts index c4687f4eab..52084edcaa 100644 --- a/website/rspress.config.ts +++ b/website/rspress.config.ts @@ -1,4 +1,3 @@ -import path from 'node:path'; import { pluginClientRedirects } from '@rspress/plugin-client-redirects'; import { pluginRss } from '@rspress/plugin-rss'; import { pluginGoogleAnalytics } from 'rsbuild-plugin-google-analytics'; @@ -72,9 +71,7 @@ export default defineConfig({ ], }), ], - root: path.join(__dirname, 'docs'), lang: 'en', - base: '/', title: 'Rsbuild', icon: 'https://assets.rspack.dev/rsbuild/favicon-128x128.png', logo: { @@ -114,7 +111,6 @@ export default defineConfig({ { lang: 'en', label: 'English', - title: 'Rsbuild', description: 'The Rspack-based build tool for the web', editLink: { docRepoBaseUrl: @@ -125,11 +121,10 @@ export default defineConfig({ { lang: 'zh', label: '简体中文', - title: 'Rsbuild', outlineTitle: '目录', prevPageText: '上一页', nextPageText: '下一页', - description: '基于 Rspack 的 Web 构建工具', + description: '由 Rspack 驱动的构建工具', editLink: { docRepoBaseUrl: 'https://github.com/web-infra-dev/rsbuild/tree/main/website/docs', @@ -158,15 +153,8 @@ export default defineConfig({ }, }), ], - source: { - alias: { - '@components': path.join(__dirname, '@components'), - '@en': path.join(__dirname, 'docs/en'), - '@zh': path.join(__dirname, 'docs/zh'), - }, - }, server: { - open: 'http://localhost:/', + open: true, }, html: { tags: [