@next-core/build-next-bricks 1.1.0 → 1.1.2
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/package.json +2 -2
- package/src/build.js +42 -40
- package/src/scanBricks.js +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/build-next-bricks",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Build next bricks",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/build-next-bricks",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"typescript": "^5.0.2",
|
|
47
47
|
"webpack": "^5.76.2"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "3e4c6996c85fb0bb14330cd1d128dd8ff690bf5e"
|
|
50
50
|
}
|
package/src/build.js
CHANGED
|
@@ -240,52 +240,54 @@ export default async function build(config) {
|
|
|
240
240
|
rootMode: "upward",
|
|
241
241
|
},
|
|
242
242
|
},
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
loader: "babel-loader",
|
|
252
|
-
options: {
|
|
253
|
-
rootMode: "upward",
|
|
243
|
+
config.svgAsAsset
|
|
244
|
+
? {
|
|
245
|
+
// Images
|
|
246
|
+
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
247
|
+
type: "asset/resource",
|
|
248
|
+
generator: {
|
|
249
|
+
filename:
|
|
250
|
+
config.imageAssetFilename ?? "images/[hash][ext][query]",
|
|
254
251
|
},
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
252
|
+
}
|
|
253
|
+
: {
|
|
254
|
+
test: /\.svg$/i,
|
|
255
|
+
issuer(input) {
|
|
256
|
+
// The issuer is null (or an empty string) for dynamic import
|
|
257
|
+
return !input || /\.[jt]sx?$/.test(input);
|
|
258
|
+
},
|
|
259
|
+
use: [
|
|
260
|
+
{
|
|
261
|
+
loader: "babel-loader",
|
|
262
|
+
options: {
|
|
263
|
+
rootMode: "upward",
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
loader: "@svgr/webpack",
|
|
268
|
+
options: {
|
|
269
|
+
babel: false,
|
|
270
|
+
icon: true,
|
|
271
|
+
svgoConfig: {
|
|
272
|
+
plugins: [
|
|
273
|
+
{
|
|
274
|
+
name: "preset-default",
|
|
275
|
+
params: {
|
|
276
|
+
overrides: {
|
|
277
|
+
// Keep `viewbox`
|
|
278
|
+
removeViewBox: false,
|
|
279
|
+
convertColors: {
|
|
280
|
+
currentColor: true,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
271
283
|
},
|
|
272
284
|
},
|
|
273
|
-
|
|
285
|
+
],
|
|
274
286
|
},
|
|
275
|
-
|
|
287
|
+
},
|
|
276
288
|
},
|
|
277
|
-
|
|
289
|
+
],
|
|
278
290
|
},
|
|
279
|
-
],
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
// Images
|
|
283
|
-
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
284
|
-
type: "asset/resource",
|
|
285
|
-
generator: {
|
|
286
|
-
filename: config.imageAssetFilename ?? "images/[hash][ext][query]",
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
291
|
{
|
|
290
292
|
// Fonts
|
|
291
293
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
package/src/scanBricks.js
CHANGED
|
@@ -248,12 +248,14 @@ export default async function scanBricks(packageDir) {
|
|
|
248
248
|
}
|
|
249
249
|
} else if (
|
|
250
250
|
callee.type === "Identifier" &&
|
|
251
|
-
callee.name === "wrapBrick" &&
|
|
251
|
+
(callee.name === "wrapBrick" || callee.name === "unwrapProvider") &&
|
|
252
252
|
args.length >= 1
|
|
253
253
|
) {
|
|
254
254
|
const { type, value: brickName } = args[0];
|
|
255
255
|
if (type !== "StringLiteral") {
|
|
256
|
-
throw new Error(
|
|
256
|
+
throw new Error(
|
|
257
|
+
`Please call \`${callee.name}\` only with literal string`
|
|
258
|
+
);
|
|
257
259
|
}
|
|
258
260
|
const bricks = usingWrappedBricks.get(filePath);
|
|
259
261
|
if (bricks) {
|