Skip to content

Commit c4f8dc4

Browse files
authored
Merge pull request #4593 from easyops-cn/steve/v3-prepear-react-19
Steve/v3-prepear-react-19
2 parents 74a5372 + 43aca44 commit c4f8dc4

File tree

28 files changed

+1487
-1549
lines changed

28 files changed

+1487
-1549
lines changed

bricks/e2e/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"inputs": [
2121
"prod",
2222
"^prod",
23-
"global",
24-
"{workspaceRoot}/shared/common-bricks/common-bricks.json"
23+
"global"
2524
],
2625
"outputs": [
2726
"{projectRoot}/dist",

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: "3.8"
22
services:
33
e2e:
4-
image: cypress/included:13.14.2
4+
image: cypress/included:13.15.2
55
working_dir: /app
66
volumes:
77
- '.:/app'

package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@
3737
"trailingComma": "es5"
3838
},
3939
"devDependencies": {
40-
"@babel/core": "^7.25.2",
41-
"@babel/types": "^7.25.6",
40+
"@babel/core": "^7.26.0",
41+
"@babel/types": "^7.26.5",
4242
"@cypress/browserify-preprocessor": "^3.0.2",
43-
"@next-core/brick-container": "*",
44-
"@next-core/brick-playground": "*",
45-
"@next-core/test-next": "*",
43+
"@next-shared/common-bricks": "^0.53.1",
4644
"@types/doctrine": "^0.0.9",
4745
"@types/fs-extra": "^9.0.13",
4846
"@types/history": "^4.7.11",
@@ -57,30 +55,30 @@
5755
"@types/react-dom": "^18.3.0",
5856
"@typescript-eslint/eslint-plugin": "^7.18.0",
5957
"babel-jest": "^29.7.0",
60-
"concurrently": "^9.0.1",
58+
"concurrently": "^9.1.0",
6159
"cross-env": "^7.0.3",
62-
"cypress": "^13.14.2",
60+
"cypress": "^13.15.2",
6361
"eslint": "^8.57.1",
64-
"eslint-plugin-react": "^7.36.1",
62+
"eslint-plugin-react": "^7.37.2",
6563
"eslint-plugin-react-hooks": "^4.6.2",
6664
"husky": "^9.1.6",
6765
"jest": "^29.7.0",
6866
"jest-environment-jsdom": "^29.7.0",
6967
"jest-websocket-mock": "^2.5.0",
7068
"lerna": "^8.1.8",
7169
"lint-staged": "^15.2.10",
72-
"prettier": "^3.3.3",
70+
"prettier": "^3.4.2",
7371
"rimraf": "^5.0.10",
7472
"ts-jest-resolver": "^2.0.1",
75-
"typescript": "^5.6.2"
73+
"typescript": "^5.7.3"
7674
},
7775
"workspaces": [
7876
"bricks/*",
7977
"packages/*"
8078
],
8179
"resolutions": {
82-
"@babel/parser": "^7.25.6",
83-
"@babel/runtime": "^7.25.6",
80+
"@babel/parser": "^7.26.5",
81+
"@babel/runtime": "^7.26.0",
8482
"@types/react": "^18.3.4",
8583
"lodash": "^4.17.21",
8684
"moment": "^2.30.1"

packages/babel-preset-next/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = () => {
2626
modules: false,
2727
useBuiltIns: "entry",
2828
corejs: {
29-
version: "3.38",
29+
version: "3.40",
3030
},
3131
},
3232
],
@@ -49,7 +49,7 @@ module.exports = () => {
4949
transformRuntime,
5050
{
5151
// https://github.com/babel/babel/issues/9454#issuecomment-460425922
52-
version: "7.25.6",
52+
version: "7.26.0",
5353
},
5454
],
5555
],

packages/babel-preset-next/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
},
1212
"sideEffects": false,
1313
"dependencies": {
14-
"@babel/plugin-proposal-decorators": "^7.24.7",
15-
"@babel/plugin-transform-runtime": "^7.25.4",
16-
"@babel/preset-env": "^7.25.4",
17-
"@babel/preset-react": "^7.24.7",
18-
"@babel/preset-typescript": "^7.24.7",
19-
"@babel/runtime": "^7.25.6"
14+
"@babel/plugin-proposal-decorators": "^7.25.9",
15+
"@babel/plugin-transform-runtime": "^7.25.9",
16+
"@babel/preset-env": "^7.26.0",
17+
"@babel/preset-react": "^7.26.3",
18+
"@babel/preset-typescript": "^7.26.0",
19+
"@babel/runtime": "^7.26.0"
2020
}
2121
}

packages/brick-container/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"body-parser": "^1.20.3",
4040
"chalk": "^4.1.2",
4141
"chokidar": "^4.0.1",
42-
"compression": "^1.7.4",
43-
"express": "^4.21.0",
42+
"compression": "^1.7.5",
43+
"express": "^4.21.1",
4444
"glob": "^8.1.0",
4545
"http-proxy-middleware": "^3.0.3",
4646
"js-yaml": "^3.14.1",
@@ -65,8 +65,8 @@
6565
"@next-core/utils": "^1.7.28",
6666
"broadcast-channel": "^7.0.0",
6767
"copy-webpack-plugin": "^12.0.2",
68-
"core-js": "^3.38.1",
69-
"html-webpack-plugin": "^5.6.0",
68+
"core-js": "^3.40.0",
69+
"html-webpack-plugin": "^5.6.3",
7070
"regenerator-runtime": "^0.14.1",
7171
"webpack-dev-server": "^5.1.0"
7272
},

packages/brick-playground/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"dependencies": {
2626
"@next-core/doc-helpers": "^0.2.15",
2727
"@next-core/serve-helpers": "^1.2.4",
28-
"compression": "^1.7.4",
29-
"express": "^4.21.0",
28+
"compression": "^1.7.5",
29+
"express": "^4.21.1",
3030
"glob": "^8.1.0"
3131
},
3232
"devDependencies": {
@@ -35,7 +35,7 @@
3535
"@next-core/preview": "^0.7.44",
3636
"copy-to-clipboard": "^3.3.3",
3737
"copy-webpack-plugin": "^12.0.2",
38-
"html-webpack-plugin": "^5.6.0",
38+
"html-webpack-plugin": "^5.6.3",
3939
"monaco-editor": "^0.50.0",
4040
"monaco-editor-webpack-plugin": "^7.1.0",
4141
"webpack-dev-server": "^5.1.0"

packages/build-next-bricks/bin/build-next-bricks.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ try {
8383
console.error("Failed to build bricks:");
8484
console.error(err || stats.toString());
8585
} else {
86+
console.log(stats.toString());
8687
console.log("Build bricks done in watch mode");
8788
}
8889
});
@@ -93,6 +94,7 @@ try {
9394
console.error("Failed to build bricks:");
9495
reject(err || stats.toString());
9596
} else {
97+
console.log(stats.toString());
9698
resolve();
9799
}
98100
});

packages/build-next-bricks/package.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"node": ">=16"
3535
},
3636
"dependencies": {
37-
"@babel/parser": "^7.25.6",
38-
"@babel/traverse": "^7.25.6",
37+
"@babel/parser": "^7.26.5",
38+
"@babel/traverse": "^7.26.5",
3939
"@next-core/babel-preset-next": "^1.0.23",
4040
"@svgr/webpack": "^8.1.0",
4141
"babel-loader": "^9.2.1",
@@ -46,16 +46,19 @@
4646
"less": "^4.2.0",
4747
"less-loader": "^12.2.0",
4848
"lodash": "^4.17.21",
49-
"mini-css-extract-plugin": "^2.9.1",
50-
"postcss": "^8.4.47",
49+
"mini-css-extract-plugin": "^2.9.2",
50+
"postcss": "^8.4.49",
5151
"postcss-loader": "^8.1.1",
52-
"postcss-preset-env": "^10.0.5",
53-
"prettier": "^3.3.3",
52+
"postcss-preset-env": "^10.1.3",
53+
"prettier": "^3.4.2",
5454
"style-loader": "^4.0.0",
55-
"typescript": "^5.6.2",
56-
"webpack": "^5.94.0"
55+
"typescript": "^5.7.3",
56+
"webpack": "^5.97.1"
5757
},
5858
"devDependencies": {
5959
"@next-core/brick-manifest": "^0.7.1"
60+
},
61+
"peerDependencies": {
62+
"@next-shared/common-bricks": "*"
6063
}
6164
}

packages/build-next-bricks/src/build.js

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import path from "node:path";
2-
import { existsSync } from "node:fs";
32
import { readFile } from "node:fs/promises";
43
import { createRequire } from "node:module";
54
import webpack from "webpack";
@@ -8,6 +7,8 @@ import postcssPresetEnv from "postcss-preset-env";
87
import cssnano from "cssnano";
98
import cssnanoPresetLite from "cssnano-preset-lite";
109
import _ from "lodash";
10+
import commonBricksJson from "@next-shared/common-bricks/common-bricks.json" assert { type: "json" };
11+
import deprecatedBricksJson from "@next-shared/common-bricks/deprecated-bricks.json" assert { type: "json" };
1112
import EmitBricksJsonPlugin from "./EmitBricksJsonPlugin.js";
1213
import getCamelPackageName from "./getCamelPackageName.js";
1314
import getSvgrLoaders from "./getSvgrLoaders.js";
@@ -74,25 +75,8 @@ async function getWebpackConfig(config) {
7475

7576
/** @type {string[]} */
7677
let commonBricks;
77-
const commonBricksJsonFile = path.join(
78-
packageDir,
79-
"../../shared/common-bricks/common-bricks.json"
80-
);
81-
82-
const deprecatedBricksJsonFile = path.join(
83-
packageDir,
84-
"../../shared/common-bricks/deprecated-bricks.json"
85-
);
86-
87-
const deprecatedBricksJson = existsSync(deprecatedBricksJsonFile)
88-
? JSON.parse(await readFile(deprecatedBricksJsonFile, "utf-8"))
89-
: {};
90-
91-
if (existsSync(commonBricksJsonFile)) {
92-
const commonBricksJson = JSON.parse(
93-
await readFile(commonBricksJsonFile, "utf-8")
94-
);
9578

79+
if (commonBricksJson) {
9680
/** @type {Map<string, string | string[]>} */
9781
const commonBricksMap = new Map();
9882
for (const [pkg, bricks] of Object.entries(commonBricksJson)) {
@@ -213,18 +197,21 @@ async function getWebpackConfig(config) {
213197
packageJson.peerDependencies?.[dep] ??
214198
packageJson.devDependencies?.[dep] ??
215199
packageJson.dependencies?.[dep];
200+
const singleton = sharedSingletonPackages.includes(dep);
216201

217202
return [
218203
dep,
219204
{
220-
singleton: sharedSingletonPackages.includes(dep),
205+
singleton,
221206
version: depPackageJson.version,
222207
requiredVersion:
223208
getRequiredVersion(depPkgName) ??
224209
// Use react required version for react-dom if it is not specified
225210
(depPkgName === "react-dom"
226211
? getRequiredVersion("react")
227-
: undefined),
212+
: singleton
213+
? "*"
214+
: undefined),
228215
...customized,
229216
},
230217
];
@@ -265,7 +252,7 @@ async function getWebpackConfig(config) {
265252
const invalidElements = _.difference(elements, commonBricks);
266253
if (invalidElements.length > 0) {
267254
throw new Error(
268-
`Find common bricks in \`${packageName}\` which are not in common-bricks.json: ${invalidElements.join(
255+
`Find common bricks in \`${packageName}\` which are not in @next-shared/common-bricks/common-bricks.json: ${invalidElements.join(
269256
", "
270257
)}`
271258
);

0 commit comments

Comments
 (0)