From 4a48baad77cb2ddca7f192e9aae2268258aa96b7 Mon Sep 17 00:00:00 2001 From: fi3ework Date: Sat, 10 Aug 2024 23:08:44 +0800 Subject: [PATCH] fix: rsbuild breaking changes --- package.json | 2 +- packages/core/src/build.ts | 1 - packages/core/src/cli/commands.ts | 4 +- packages/core/src/config.ts | 1 + .../tests/__snapshots__/config.test.ts.snap | 3 + pnpm-lock.yaml | 100 +++++++++--------- 6 files changed, 57 insertions(+), 54 deletions(-) diff --git a/package.json b/package.json index d45365427..6f45ec69f 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ }, "pnpm": { "overrides": { - "@rspack/core": "npm:@rspack/core-canary@1.0.0-canary-fca07da-20240704070545" + "@rspack/core": "npm:@rspack/core-canary@1.0.0-canary-af0452f-20240808052639" } } } diff --git a/packages/core/src/build.ts b/packages/core/src/build.ts index 5fb3d22ff..a4894f95b 100644 --- a/packages/core/src/build.ts +++ b/packages/core/src/build.ts @@ -10,7 +10,6 @@ export async function build( const rsbuildInstance = await initRsbuild(config); await rsbuildInstance.build({ - mode: 'production', watch: options?.watch, }); diff --git a/packages/core/src/cli/commands.ts b/packages/core/src/cli/commands.ts index 40997e4a6..751df47a0 100644 --- a/packages/core/src/cli/commands.ts +++ b/packages/core/src/cli/commands.ts @@ -14,7 +14,7 @@ export type BuildOptions = CommonOptions & { }; export type InspectOptions = CommonOptions & { - env: RsbuildMode; + mode: RsbuildMode; output: string; verbose?: boolean; }; @@ -64,7 +64,7 @@ export function runCli(): void { const rslibConfig = await loadConfig(options.config, options.envMode); const rsbuildInstance = await initRsbuild(rslibConfig); await rsbuildInstance.inspectConfig({ - env: options.env, + mode: options.mode, verbose: options.verbose, outputPath: options.output, writeToDisk: true, diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 98fa4e3a1..d1ee498d0 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -142,6 +142,7 @@ export const composeAutoExternalConfig = (options: { export async function createInternalRsbuildConfig(): Promise { return defineRsbuildConfig({ + mode: 'production', dev: { progressBar: false, }, diff --git a/packages/core/tests/__snapshots__/config.test.ts.snap b/packages/core/tests/__snapshots__/config.test.ts.snap index e7ac347d6..6ac80bb70 100644 --- a/packages/core/tests/__snapshots__/config.test.ts.snap +++ b/packages/core/tests/__snapshots__/config.test.ts.snap @@ -7,6 +7,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1 "dev": { "progressBar": false, }, + "mode": "none", "output": { "distPath": { "js": "./", @@ -81,6 +82,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1 "dev": { "progressBar": false, }, + "mode": "none", "output": { "distPath": { "js": "./", @@ -153,6 +155,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1 "dev": { "progressBar": false, }, + "mode": "none", "output": { "distPath": { "js": "./", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f28ea6c2e..efb464638 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,7 +5,7 @@ settings: excludeLinksFromLockfile: false overrides: - '@rspack/core': npm:@rspack/core-canary@1.0.0-canary-fca07da-20240704070545 + '@rspack/core': npm:@rspack/core-canary@1.0.0-canary-af0452f-20240808052639 importers: @@ -1273,56 +1273,56 @@ packages: peerDependencies: '@rsbuild/core': ^1.0.1-beta.11 - '@rspack/binding-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-haDv3Ed3TPfikBJBxytgYAet2SJHplqdWwftKiplcgEfl0r5BdlZJbGoWUoFi8UGhAMS7evMJTlek39gKYaBUw==} + '@rspack/binding-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-VayW6Eytqn7TzoKvTeVR8k29JgEPOmnUFPRyoaf+QlATDR0pht4vwHeHCEYL587yxMw7pZ+DxfXgB1ReIViesA==} - '@rspack/binding-darwin-arm64-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-SgGBtT1tEISvyYfLw8UanT07jG09vWG34+6AS36ZWAHeeWCUJmqUERg5N58GLHK3DQNhRJBTV961LMa1NcuIhw==} + '@rspack/binding-darwin-arm64-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-rPS4GCOHbgXSociPieE5X2i2IXeADA+/1RD4grg+vvgKYzoZa8oVP4Nz6n67tj8jR7P6/eXjmbGwg8tXShFpyQ==} cpu: [arm64] os: [darwin] - '@rspack/binding-darwin-x64-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-KRIP5MvxYRKPUYW6V458q1+ioLw9vjQwjnx5EUJJQyzN/RhpviydtejPs/NrCihYGq++O3fPot7mAHes+uSf3Q==} + '@rspack/binding-darwin-x64-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-p7D2y7tYPReV6SNPB2FYv3OZeMnwU0WwlIinSDC0YJYZLwo5303zAnVY09s3R9t1Il86Du5wd9wRusSJKGN1/Q==} cpu: [x64] os: [darwin] - '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-rB/WcSWnvQ29ajc0LJYSwi2egZYsK/3EhyPrOWCW8i1KknFs7zaFvFJNC76pd5r47EiKTjjT3oidD4qlD8JCpA==} + '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-91KjddUlW5cFgE/Xy+l/KUkK/nMoKJjldeYvxUk7AyWpPW19vpP1kUpdpFmbjfinaAeXHCl0CiwIEMR3aVL1vw==} cpu: [arm64] os: [linux] - '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-KoaEAx/rW3mlaOI4CnN4MJGu9Ym9wD2PsW/UXUXKMwTtmqmWZyOWxMP4zvzHlmhlaD0/6ZywNGAUvKNjb7mXrw==} + '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-BT8PmQiCtEVTDWjZFur4ju7QoLhULZ2Qqfk7ZMA42TBFv2qpKpN0+Xpz/ZbiO+PEsjUrk2wib+MKppTGXOg2AA==} cpu: [arm64] os: [linux] - '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-mW9MqCKmVqL3+usYcW+rgP6Ku1B/TwgaPpwoI4vPq/7+5ZCPdWw4Z8VwEDSsgfOrflZrbdth92rvHAWDX4v7yg==} + '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-S9kb1X/xhPmyuNWr+VOW8gOZP0UKD0pyDOF/scaqdTxIsdq8x2Udpk9NG+GpJqsfJQq6qOnbN/4o/POi9dK3Bw==} cpu: [x64] os: [linux] - '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-svyuRd02G4Tj1+06mM6LFDLjonn2UbIJ94uOCyTq7VXVjNRE7owRZ6KPhXJEfE8v1g03i22pFWWOfvliLb9WSg==} + '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-JzzFQHKnXMEz5pC8fMYNK2w3v+WagOQGZ2cgeQzofa3DxCGFBN8xkcjTByTITXHK9FxIkP5AxbmDwruEPr1ovw==} cpu: [x64] os: [linux] - '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-dSAwyfVN8pFAwrJWr6uflcpgPqzFedNdgBLsAlXfxeufeFZ3Md5FyTfuPT8GXRSTPkTJsSCH+GAepEVpCc/Nuw==} + '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-QKYbZ7g1GeTn2HU+mK4UL9cMb1HZXsS2Bvp2Tkwqp4bXq+XYWVEtEy1t3veOhz+tx0NRvZ4R9F+XByE/eGRHHg==} cpu: [arm64] os: [win32] - '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-Gt6RSy1Cx+5noHILC5/LlxdUCk5lqPr6GKF5VIi3pCKJJmI/l8x+ChZJaF9luuBZB/z/AM9gJV4z51fiGc83Xg==} + '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-efyygQRoZ1ZDfKNn54DVAPtf4FFg6O3pkPlUUI9nj4HJd1S3NIjeMeKSCH77O6Ypqrs0uAILoalRnbGrh+oeZw==} cpu: [ia32] os: [win32] - '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-0AJfKWc1D+WSqutHQczPCZwLZScWX7Rghek2hgfPUTeHeULEijKFZ37oP0dbGXL1vva8JvIz4zu+zCN/qJ+D1Q==} + '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-9XMPNGDPYQRfL9fPiCZKuKnC9sXNV0xJ2SDGJ+XZ0VQcGZ9z6810jUHAQX2gHSg8p6kUAtSXh68HsNWsSBlF9w==} cpu: [x64] os: [win32] - '@rspack/core-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-ERU6s/3H29Yo0XajPPeDrcPZJpU510S+UT0lkI+ub7+mtvSAl4uf0IGKqXdIPkCrcpshx94H2/rXIn8WwSnbgg==} + '@rspack/core-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-zuZ2FEYZy6ePZv2YPyT71BUJr6h5ZG6W8/s6rUXzMUzEmT6wlF073QvM8AWk9xUAXyv3NPdh3Ql5Kvf1/2RaBw==} engines: {node: '>=16.0.0'} peerDependencies: '@swc/helpers': '>=0.5.1' @@ -1330,8 +1330,8 @@ packages: '@swc/helpers': optional: true - '@rspack/lite-tapable-canary@1.0.0-canary-fca07da-20240704070545': - resolution: {integrity: sha512-5NtM7IjFrUL7xCaoN6z9qJEHnUgSxPT++YPILnhrNNxVs0Zi3qdCa/uRC8pJPSk4eI/KY01zztq8d3buhtcFRg==} + '@rspack/lite-tapable-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-YpKLntATp0tML6ILrUmANCC6geUosgRK71xy78Vo1v2urSV1v2MB08VL6sbrjy99GnDWzf5f/bzrtmeC78GOVw==} engines: {node: '>=16.0.0'} '@rspack/lite-tapable@1.0.0-beta.3': @@ -4194,7 +4194,7 @@ snapshots: '@rsbuild/core@1.0.1-beta.11': dependencies: - '@rspack/core': '@rspack/core-canary@1.0.0-canary-fca07da-20240704070545(@swc/helpers@0.5.11)' + '@rspack/core': '@rspack/core-canary@1.0.0-canary-af0452f-20240808052639(@swc/helpers@0.5.11)' '@rspack/lite-tapable': 1.0.0-beta.3 '@swc/helpers': 0.5.11 caniuse-lite: 1.0.30001649 @@ -4208,55 +4208,55 @@ snapshots: '@rspack/plugin-react-refresh': 1.0.0-beta.3(react-refresh@0.14.2) react-refresh: 0.14.2 - '@rspack/binding-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-canary@1.0.0-canary-af0452f-20240808052639': optionalDependencies: - '@rspack/binding-darwin-arm64': '@rspack/binding-darwin-arm64-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-darwin-x64': '@rspack/binding-darwin-x64-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-linux-arm64-gnu': '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-linux-arm64-musl': '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-linux-x64-gnu': '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-linux-x64-musl': '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-win32-arm64-msvc': '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-win32-ia32-msvc': '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/binding-win32-x64-msvc': '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-fca07da-20240704070545' - - '@rspack/binding-darwin-arm64-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-darwin-arm64': '@rspack/binding-darwin-arm64-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-darwin-x64': '@rspack/binding-darwin-x64-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-arm64-gnu': '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-arm64-musl': '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-x64-gnu': '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-x64-musl': '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-win32-arm64-msvc': '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-win32-ia32-msvc': '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-win32-x64-msvc': '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-af0452f-20240808052639' + + '@rspack/binding-darwin-arm64-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-darwin-x64-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-darwin-x64-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-fca07da-20240704070545': + '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/core-canary@1.0.0-canary-fca07da-20240704070545(@swc/helpers@0.5.11)': + '@rspack/core-canary@1.0.0-canary-af0452f-20240808052639(@swc/helpers@0.5.11)': dependencies: '@module-federation/runtime-tools': 0.2.3 - '@rspack/binding': '@rspack/binding-canary@1.0.0-canary-fca07da-20240704070545' - '@rspack/lite-tapable': '@rspack/lite-tapable-canary@1.0.0-canary-fca07da-20240704070545' + '@rspack/binding': '@rspack/binding-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/lite-tapable': '@rspack/lite-tapable-canary@1.0.0-canary-af0452f-20240808052639' caniuse-lite: 1.0.30001649 optionalDependencies: '@swc/helpers': 0.5.11 - '@rspack/lite-tapable-canary@1.0.0-canary-fca07da-20240704070545': {} + '@rspack/lite-tapable-canary@1.0.0-canary-af0452f-20240808052639': {} '@rspack/lite-tapable@1.0.0-beta.3': {}