create-rsbuild 2.0.15 → 2.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7,19 +7,6 @@ const tailwindcssPlugin = {
7
7
  source: '@rsbuild/plugin-tailwindcss',
8
8
  order: 20
9
9
  };
10
- const reactCompilerPlugin = {
11
- id: 'react-compiler',
12
- importName: 'pluginBabel',
13
- source: '@rsbuild/plugin-babel',
14
- call: `pluginBabel({
15
- include: /\\.[jt]sx?$/,
16
- exclude: [/[\\\\/]node_modules[\\\\/]/],
17
- babelLoaderOptions(opts) {
18
- opts.plugins?.unshift('babel-plugin-react-compiler');
19
- },
20
- })`,
21
- order: 10
22
- };
23
10
  const cache = new Map();
24
11
  const configFiles = [
25
12
  'rsbuild.config.ts',
@@ -51,6 +38,17 @@ const formatPlugins = (calls)=>{
51
38
  ];
52
39
  return lines.join('\n');
53
40
  };
41
+ const addReactCompilerOption = (code)=>{
42
+ if (code.includes('reactCompiler:')) return code;
43
+ const reactCompilerCall = `pluginReact({
44
+ reactCompiler: true,
45
+ })`;
46
+ const multiLineCall = `${indent}${indent}pluginReact(),`;
47
+ const replaceCall = (call)=>'pluginReact()' === call ? reactCompilerCall : call;
48
+ const next = code.replace(/^ {2}plugins: \[(.*pluginReact\(\).*)\],$/m, (_, calls)=>formatPlugins(calls.split(', ').map(replaceCall))).replace(multiLineCall, formatCall(reactCompilerCall));
49
+ if (next !== code) return next;
50
+ throw new Error('Failed to update rsbuild.config: pluginReact call not found.');
51
+ };
54
52
  const addPluginsField = (code, calls)=>{
55
53
  if (code.includes('defineConfig({});')) return code.replace('defineConfig({});', `defineConfig({\n${formatPlugins(calls)}\n});`);
56
54
  const next = code.replace('export default defineConfig({\n', `export default defineConfig({\n${formatPlugins(calls)}\n`);
@@ -100,6 +98,12 @@ const addPluginsToRsbuildConfig = async (dir, plugins)=>{
100
98
  ].sort((a, b)=>(a.order ?? 0) - (b.order ?? 0));
101
99
  await node_fs.promises.writeFile(state.file, applyPlugins(state.base, ordered));
102
100
  };
101
+ const enableReactCompilerInRsbuildConfig = async (dir)=>{
102
+ const file = findConfig(dir);
103
+ if (!file) return;
104
+ const code = normalize(await node_fs.promises.readFile(file, 'utf-8'));
105
+ await node_fs.promises.writeFile(file, addReactCompilerOption(code));
106
+ };
103
107
  const frameworkAlias = {
104
108
  vue3: 'vue',
105
109
  'solid-js': 'solid'
@@ -249,16 +253,8 @@ create({
249
253
  'react-js',
250
254
  'react-ts'
251
255
  ].includes(templateName),
252
- action: async ({ templateName, distFolder })=>{
253
- const toolFolder = node_path.join(root, 'template-react-compiler');
254
- copyFolder({
255
- from: node_path.join(toolFolder, templateName),
256
- to: distFolder,
257
- isMergePackageJson: true
258
- });
259
- await addPluginsToRsbuildConfig(distFolder, [
260
- reactCompilerPlugin
261
- ]);
256
+ action: async ({ distFolder })=>{
257
+ await enableReactCompilerInRsbuildConfig(distFolder);
262
258
  }
263
259
  },
264
260
  {
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "create-rsbuild",
3
- "version": "2.0.15",
3
+ "version": "2.1.0-rc.0",
4
4
  "description": "Create a new Rsbuild project",
5
5
  "homepage": "https://rsbuild.rs",
6
+ "bugs": {
7
+ "url": "https://github.com/web-infra-dev/rsbuild/issues"
8
+ },
6
9
  "license": "MIT",
7
10
  "repository": {
8
11
  "type": "git",
@@ -29,16 +32,16 @@
29
32
  "create-rstack": "2.1.3"
30
33
  },
31
34
  "devDependencies": {
32
- "@rslib/core": "0.22.1",
35
+ "@rslib/core": "0.23.0",
33
36
  "@types/node": "^24.13.2",
34
37
  "typescript": "^6.0.3",
35
- "@rsbuild/core": "2.0.15",
38
+ "@rsbuild/core": "2.1.0-rc.0",
39
+ "@rsbuild/plugin-babel": "2.0.0",
36
40
  "@rsbuild/plugin-preact": "2.0.0",
37
- "@rsbuild/plugin-react": "2.0.1",
38
- "@rsbuild/plugin-babel": "1.2.1",
41
+ "@rsbuild/plugin-react": "2.1.0",
39
42
  "@rsbuild/plugin-solid": "1.2.2",
40
- "@rsbuild/plugin-vue": "1.2.9",
41
- "@rsbuild/plugin-svelte": "2.0.0"
43
+ "@rsbuild/plugin-svelte": "2.0.0",
44
+ "@rsbuild/plugin-vue": "2.0.0"
42
45
  },
43
46
  "engines": {
44
47
  "node": "^20.19.0 || >=22.12.0"
@@ -12,6 +12,6 @@
12
12
  "lit": "^3.3.3"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14"
15
+ "@rsbuild/core": "^2.0.15"
16
16
  }
17
17
  }
@@ -12,7 +12,7 @@
12
12
  "lit": "^3.3.3"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
15
+ "@rsbuild/core": "^2.0.15",
16
16
  "@types/node": "^24.13.2",
17
17
  "typescript": "^6.0.3"
18
18
  }
@@ -12,7 +12,7 @@
12
12
  "preact": "^10.29.2"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
15
+ "@rsbuild/core": "^2.0.15",
16
16
  "@rsbuild/plugin-preact": "^2.0.0"
17
17
  }
18
18
  }
@@ -12,7 +12,7 @@
12
12
  "preact": "^10.29.2"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
15
+ "@rsbuild/core": "^2.0.15",
16
16
  "@rsbuild/plugin-preact": "^2.0.0",
17
17
  "@types/node": "^24.13.2",
18
18
  "typescript": "^6.0.3"
@@ -13,7 +13,7 @@
13
13
  "react-dom": "^19.2.7"
14
14
  },
15
15
  "devDependencies": {
16
- "@rsbuild/core": "^2.0.14",
17
- "@rsbuild/plugin-react": "^2.0.1"
16
+ "@rsbuild/core": "^2.0.15",
17
+ "@rsbuild/plugin-react": "^2.1.0"
18
18
  }
19
19
  }
@@ -13,8 +13,8 @@
13
13
  "react-dom": "^19.2.7"
14
14
  },
15
15
  "devDependencies": {
16
- "@rsbuild/core": "^2.0.14",
17
- "@rsbuild/plugin-react": "^2.0.1",
16
+ "@rsbuild/core": "^2.0.15",
17
+ "@rsbuild/plugin-react": "^2.1.0",
18
18
  "@types/node": "^24.13.2",
19
19
  "@types/react": "^19.2.17",
20
20
  "@types/react-dom": "^19.2.3",
@@ -4,11 +4,11 @@
4
4
  "test:watch": "rstest --watch"
5
5
  },
6
6
  "devDependencies": {
7
- "@rstest/adapter-rsbuild": "^0.10.4",
8
- "@rstest/core": "^0.10.4",
7
+ "@rstest/adapter-rsbuild": "^0.10.6",
8
+ "@rstest/core": "^0.10.6",
9
9
  "@testing-library/dom": "^10.4.1",
10
10
  "@testing-library/jest-dom": "^6.9.1",
11
11
  "@testing-library/react": "^16.3.2",
12
- "happy-dom": "^20.10.3"
12
+ "happy-dom": "^20.10.6"
13
13
  }
14
14
  }
@@ -4,11 +4,11 @@
4
4
  "test:watch": "rstest --watch"
5
5
  },
6
6
  "devDependencies": {
7
- "@rstest/adapter-rsbuild": "^0.10.4",
8
- "@rstest/core": "^0.10.4",
7
+ "@rstest/adapter-rsbuild": "^0.10.6",
8
+ "@rstest/core": "^0.10.6",
9
9
  "@testing-library/dom": "^10.4.1",
10
10
  "@testing-library/jest-dom": "^6.9.1",
11
11
  "@testing-library/react": "^16.3.2",
12
- "happy-dom": "^20.10.3"
12
+ "happy-dom": "^20.10.6"
13
13
  }
14
14
  }
@@ -4,10 +4,10 @@
4
4
  "test:watch": "rstest --watch"
5
5
  },
6
6
  "devDependencies": {
7
- "@rstest/adapter-rsbuild": "^0.10.4",
8
- "@rstest/core": "^0.10.4",
7
+ "@rstest/adapter-rsbuild": "^0.10.6",
8
+ "@rstest/core": "^0.10.6",
9
9
  "@testing-library/dom": "^10.4.1",
10
10
  "@testing-library/jest-dom": "^6.9.1",
11
- "happy-dom": "^20.10.3"
11
+ "happy-dom": "^20.10.6"
12
12
  }
13
13
  }
@@ -4,10 +4,10 @@
4
4
  "test:watch": "rstest --watch"
5
5
  },
6
6
  "devDependencies": {
7
- "@rstest/adapter-rsbuild": "^0.10.4",
8
- "@rstest/core": "^0.10.4",
7
+ "@rstest/adapter-rsbuild": "^0.10.6",
8
+ "@rstest/core": "^0.10.6",
9
9
  "@testing-library/dom": "^10.4.1",
10
10
  "@testing-library/jest-dom": "^6.9.1",
11
- "happy-dom": "^20.10.3"
11
+ "happy-dom": "^20.10.6"
12
12
  }
13
13
  }
@@ -4,11 +4,11 @@
4
4
  "test:watch": "rstest --watch"
5
5
  },
6
6
  "devDependencies": {
7
- "@rstest/adapter-rsbuild": "^0.10.4",
8
- "@rstest/core": "^0.10.4",
7
+ "@rstest/adapter-rsbuild": "^0.10.6",
8
+ "@rstest/core": "^0.10.6",
9
9
  "@testing-library/dom": "^10.4.1",
10
10
  "@testing-library/jest-dom": "^6.9.1",
11
11
  "@testing-library/vue": "^8.1.0",
12
- "happy-dom": "^20.10.3"
12
+ "happy-dom": "^20.10.6"
13
13
  }
14
14
  }
@@ -4,11 +4,11 @@
4
4
  "test:watch": "rstest --watch"
5
5
  },
6
6
  "devDependencies": {
7
- "@rstest/adapter-rsbuild": "^0.10.4",
8
- "@rstest/core": "^0.10.4",
7
+ "@rstest/adapter-rsbuild": "^0.10.6",
8
+ "@rstest/core": "^0.10.6",
9
9
  "@testing-library/dom": "^10.4.1",
10
10
  "@testing-library/jest-dom": "^6.9.1",
11
11
  "@testing-library/vue": "^8.1.0",
12
- "happy-dom": "^20.10.3"
12
+ "happy-dom": "^20.10.6"
13
13
  }
14
14
  }
@@ -12,8 +12,8 @@
12
12
  "solid-js": "^1.9.13"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
16
- "@rsbuild/plugin-babel": "^1.2.1",
15
+ "@rsbuild/core": "^2.0.15",
16
+ "@rsbuild/plugin-babel": "^2.0.0",
17
17
  "@rsbuild/plugin-solid": "^1.2.2"
18
18
  }
19
19
  }
@@ -12,8 +12,8 @@
12
12
  "solid-js": "^1.9.13"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
16
- "@rsbuild/plugin-babel": "^1.2.1",
15
+ "@rsbuild/core": "^2.0.15",
16
+ "@rsbuild/plugin-babel": "^2.0.0",
17
17
  "@rsbuild/plugin-solid": "^1.2.2",
18
18
  "@types/node": "^24.13.2",
19
19
  "typescript": "^6.0.3"
@@ -12,7 +12,7 @@
12
12
  "svelte": "^5.56.3"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
15
+ "@rsbuild/core": "^2.0.15",
16
16
  "@rsbuild/plugin-svelte": "^2.0.0"
17
17
  }
18
18
  }
@@ -13,7 +13,7 @@
13
13
  "svelte": "^5.56.3"
14
14
  },
15
15
  "devDependencies": {
16
- "@rsbuild/core": "^2.0.14",
16
+ "@rsbuild/core": "^2.0.15",
17
17
  "@rsbuild/plugin-svelte": "^2.0.0",
18
18
  "@types/node": "^24.13.2",
19
19
  "svelte-check": "^4.6.0",
@@ -9,6 +9,6 @@
9
9
  "preview": "rsbuild preview"
10
10
  },
11
11
  "devDependencies": {
12
- "@rsbuild/core": "^2.0.14"
12
+ "@rsbuild/core": "^2.0.15"
13
13
  }
14
14
  }
@@ -9,7 +9,7 @@
9
9
  "preview": "rsbuild preview"
10
10
  },
11
11
  "devDependencies": {
12
- "@rsbuild/core": "^2.0.14",
12
+ "@rsbuild/core": "^2.0.15",
13
13
  "@types/node": "^24.13.2",
14
14
  "typescript": "^6.0.3"
15
15
  }
@@ -12,7 +12,7 @@
12
12
  "vue": "^3.5.38"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
16
- "@rsbuild/plugin-vue": "^1.2.9"
15
+ "@rsbuild/core": "^2.0.15",
16
+ "@rsbuild/plugin-vue": "^2.0.0"
17
17
  }
18
18
  }
@@ -12,8 +12,8 @@
12
12
  "vue": "^3.5.38"
13
13
  },
14
14
  "devDependencies": {
15
- "@rsbuild/core": "^2.0.14",
16
- "@rsbuild/plugin-vue": "^1.2.9",
15
+ "@rsbuild/core": "^2.0.15",
16
+ "@rsbuild/plugin-vue": "^2.0.0",
17
17
  "@types/node": "^24.13.2",
18
18
  "typescript": "^6.0.3",
19
19
  "vue-tsc": "^3.3.5"
@@ -1,6 +0,0 @@
1
- {
2
- "devDependencies": {
3
- "@rsbuild/plugin-babel": "^1.2.1",
4
- "babel-plugin-react-compiler": "^1.0.0"
5
- }
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "devDependencies": {
3
- "@rsbuild/plugin-babel": "^1.2.1",
4
- "babel-plugin-react-compiler": "^1.0.0"
5
- }
6
- }