@next-core/build-next-bricks 1.7.0 → 1.7.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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Compiler, Configuration, RuleSetRule, container } from "webpack";
2
2
 
3
3
  export declare function build(config: BuildNextBricksConfig): Compiler;
4
- export declare function getSvgrLoaders(options: {
4
+ export declare function getSvgrLoaders(options?: {
5
5
  /** Set it to true for font icons */
6
6
  convertCurrentColor?: boolean;
7
7
  }): RuleSetRule["use"];
@@ -75,7 +75,7 @@ export interface BuildNextBricksConfig {
75
75
  extractCss?: boolean;
76
76
  /** Treat svg as React component instead of asset */
77
77
  svgAsReactComponent?: boolean;
78
- /** Customize rules for svg */
78
+ /** Customize rules for svg, this will take precedence over `svgAsReactComponent` */
79
79
  svgRules?: RuleSetRule[];
80
80
  /** By default the image assets are named `images/[hash][ext][query]` */
81
81
  imageAssetFilename?: string | ((pathData: any, assetInfo: any) => string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/build-next-bricks",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
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",
@@ -51,5 +51,5 @@
51
51
  "devDependencies": {
52
52
  "@next-core/brick-manifest": "^0.1.0"
53
53
  },
54
- "gitHead": "aabcaa697f6aae0c4494f0dc19cf5e02e5bcf990"
54
+ "gitHead": "63a9e117ef211c71b6ce4bf0dfca21dadcc1472a"
55
55
  }
package/src/build.js CHANGED
@@ -259,7 +259,7 @@ async function getWebpackConfig(config) {
259
259
  "jpg",
260
260
  "jpeg",
261
261
  "gif",
262
- ...(config.svgRules ? [] : ["svg"]),
262
+ ...(config.svgRules || config.svgAsReactComponent ? [] : ["svg"]),
263
263
  ].join("|")})$`,
264
264
  "i"
265
265
  ),
@@ -273,7 +273,7 @@ async function getWebpackConfig(config) {
273
273
  ? [
274
274
  {
275
275
  test: /\.svg$/i,
276
- use: getSvgrLoaders(false),
276
+ use: getSvgrLoaders(),
277
277
  },
278
278
  ]
279
279
  : [])),
package/src/scanBricks.js CHANGED
@@ -449,6 +449,10 @@ export default async function scanBricks(packageDir) {
449
449
  * @param {string | undefined} overrideImport
450
450
  */
451
451
  async function scanByImport([dirname, files], importFrom, overrideImport) {
452
+ // Ignore missing imports (maybe auto generated)
453
+ if (!existsSync(dirname)) {
454
+ return;
455
+ }
452
456
  const dirents = await readdir(dirname, { withFileTypes: true });
453
457
  const possibleFilenames = [...files].map(
454
458
  (filename) => new RegExp(`${escapeRegExp(filename)}\\.[tj]sx?$`)