@next-core/build-next-bricks 1.23.8 → 1.23.9
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/bin/build-next-bricks.js +2 -0
- package/package.json +14 -11
- package/src/build.js +9 -22
package/bin/build-next-bricks.js
CHANGED
|
@@ -83,6 +83,7 @@ try {
|
|
|
83
83
|
console.error("Failed to build bricks:");
|
|
84
84
|
console.error(err || stats.toString());
|
|
85
85
|
} else {
|
|
86
|
+
console.log(stats.toString());
|
|
86
87
|
console.log("Build bricks done in watch mode");
|
|
87
88
|
}
|
|
88
89
|
});
|
|
@@ -93,6 +94,7 @@ try {
|
|
|
93
94
|
console.error("Failed to build bricks:");
|
|
94
95
|
reject(err || stats.toString());
|
|
95
96
|
} else {
|
|
97
|
+
console.log(stats.toString());
|
|
96
98
|
resolve();
|
|
97
99
|
}
|
|
98
100
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/build-next-bricks",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.9",
|
|
4
4
|
"description": "Build next bricks",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/build-next-bricks",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"node": ">=16"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/parser": "^7.
|
|
38
|
-
"@babel/traverse": "^7.
|
|
39
|
-
"@next-core/babel-preset-next": "^1.0.
|
|
37
|
+
"@babel/parser": "^7.26.5",
|
|
38
|
+
"@babel/traverse": "^7.26.5",
|
|
39
|
+
"@next-core/babel-preset-next": "^1.0.24",
|
|
40
40
|
"@svgr/webpack": "^8.1.0",
|
|
41
41
|
"babel-loader": "^9.2.1",
|
|
42
42
|
"css-loader": "^7.1.2",
|
|
@@ -46,17 +46,20 @@
|
|
|
46
46
|
"less": "^4.2.0",
|
|
47
47
|
"less-loader": "^12.2.0",
|
|
48
48
|
"lodash": "^4.17.21",
|
|
49
|
-
"mini-css-extract-plugin": "^2.9.
|
|
50
|
-
"postcss": "^8.4.
|
|
49
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
50
|
+
"postcss": "^8.4.49",
|
|
51
51
|
"postcss-loader": "^8.1.1",
|
|
52
|
-
"postcss-preset-env": "^10.
|
|
53
|
-
"prettier": "^3.
|
|
52
|
+
"postcss-preset-env": "^10.1.3",
|
|
53
|
+
"prettier": "^3.4.2",
|
|
54
54
|
"style-loader": "^4.0.0",
|
|
55
|
-
"typescript": "^5.
|
|
56
|
-
"webpack": "^5.
|
|
55
|
+
"typescript": "^5.7.3",
|
|
56
|
+
"webpack": "^5.97.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@next-core/brick-manifest": "^0.7.1"
|
|
60
60
|
},
|
|
61
|
-
"
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@next-shared/common-bricks": "*"
|
|
63
|
+
},
|
|
64
|
+
"gitHead": "4ccb83083fe769561c5411d385628164c9519099"
|
|
62
65
|
}
|
package/src/build.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
2
|
import { readFile } from "node:fs/promises";
|
|
4
3
|
import { createRequire } from "node:module";
|
|
5
4
|
import webpack from "webpack";
|
|
@@ -8,6 +7,8 @@ import postcssPresetEnv from "postcss-preset-env";
|
|
|
8
7
|
import cssnano from "cssnano";
|
|
9
8
|
import cssnanoPresetLite from "cssnano-preset-lite";
|
|
10
9
|
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" };
|
|
11
12
|
import EmitBricksJsonPlugin from "./EmitBricksJsonPlugin.js";
|
|
12
13
|
import getCamelPackageName from "./getCamelPackageName.js";
|
|
13
14
|
import getSvgrLoaders from "./getSvgrLoaders.js";
|
|
@@ -74,25 +75,8 @@ async function getWebpackConfig(config) {
|
|
|
74
75
|
|
|
75
76
|
/** @type {string[]} */
|
|
76
77
|
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
|
-
);
|
|
95
78
|
|
|
79
|
+
if (commonBricksJson) {
|
|
96
80
|
/** @type {Map<string, string | string[]>} */
|
|
97
81
|
const commonBricksMap = new Map();
|
|
98
82
|
for (const [pkg, bricks] of Object.entries(commonBricksJson)) {
|
|
@@ -213,18 +197,21 @@ async function getWebpackConfig(config) {
|
|
|
213
197
|
packageJson.peerDependencies?.[dep] ??
|
|
214
198
|
packageJson.devDependencies?.[dep] ??
|
|
215
199
|
packageJson.dependencies?.[dep];
|
|
200
|
+
const singleton = sharedSingletonPackages.includes(dep);
|
|
216
201
|
|
|
217
202
|
return [
|
|
218
203
|
dep,
|
|
219
204
|
{
|
|
220
|
-
singleton
|
|
205
|
+
singleton,
|
|
221
206
|
version: depPackageJson.version,
|
|
222
207
|
requiredVersion:
|
|
223
208
|
getRequiredVersion(depPkgName) ??
|
|
224
209
|
// Use react required version for react-dom if it is not specified
|
|
225
210
|
(depPkgName === "react-dom"
|
|
226
211
|
? getRequiredVersion("react")
|
|
227
|
-
:
|
|
212
|
+
: singleton
|
|
213
|
+
? "*"
|
|
214
|
+
: undefined),
|
|
228
215
|
...customized,
|
|
229
216
|
},
|
|
230
217
|
];
|
|
@@ -265,7 +252,7 @@ async function getWebpackConfig(config) {
|
|
|
265
252
|
const invalidElements = _.difference(elements, commonBricks);
|
|
266
253
|
if (invalidElements.length > 0) {
|
|
267
254
|
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(
|
|
269
256
|
", "
|
|
270
257
|
)}`
|
|
271
258
|
);
|