@rsbuild/plugin-image-compress 0.2.18 → 0.3.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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Rsbuild
6
6
 
7
- Unleash the power of Rspack with the out-of-the-box build tool.
7
+ The Rspack-based build tool. It's fast, out-of-the-box and extensible.
8
8
 
9
9
  ## Documentation
10
10
 
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ var jpegCodec = {
48
48
  return (0, import_image.compressJpeg)(buf, options);
49
49
  },
50
50
  defaultOptions: {
51
- test: /\.(jpg|jpeg)$/
51
+ test: /\.(?:jpg|jpeg)$/
52
52
  }
53
53
  };
54
54
  var pngCodec = {
@@ -72,7 +72,7 @@ var icoCodec = {
72
72
  return new import_image.Transformer(buf).ico();
73
73
  },
74
74
  defaultOptions: {
75
- test: /\.(ico|icon)$/
75
+ test: /\.(?:ico|icon)$/
76
76
  }
77
77
  };
78
78
  var svgCodec = {
@@ -109,7 +109,9 @@ var ImageMinimizerPlugin = class {
109
109
  const message = file && context ? `"${file}" in "${context}" from Image Minimizer:
110
110
  ${cause.message}` : cause.message;
111
111
  const ret = new compiler.webpack.WebpackError(message);
112
- error instanceof Error && (ret.error = error);
112
+ if (error instanceof Error) {
113
+ ret.error = error;
114
+ }
113
115
  return ret;
114
116
  };
115
117
  const codec = codecs_default[this.options.use];
package/dist/index.mjs CHANGED
@@ -26,7 +26,7 @@ var jpegCodec = {
26
26
  return compressJpeg(buf, options);
27
27
  },
28
28
  defaultOptions: {
29
- test: /\.(jpg|jpeg)$/
29
+ test: /\.(?:jpg|jpeg)$/
30
30
  }
31
31
  };
32
32
  var pngCodec = {
@@ -50,7 +50,7 @@ var icoCodec = {
50
50
  return new Transformer(buf).ico();
51
51
  },
52
52
  defaultOptions: {
53
- test: /\.(ico|icon)$/
53
+ test: /\.(?:ico|icon)$/
54
54
  }
55
55
  };
56
56
  var svgCodec = {
@@ -87,7 +87,9 @@ var ImageMinimizerPlugin = class {
87
87
  const message = file && context ? `"${file}" in "${context}" from Image Minimizer:
88
88
  ${cause.message}` : cause.message;
89
89
  const ret = new compiler.webpack.WebpackError(message);
90
- error instanceof Error && (ret.error = error);
90
+ if (error instanceof Error) {
91
+ ret.error = error;
92
+ }
91
93
  return ret;
92
94
  };
93
95
  const codec = codecs_default[this.options.use];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-image-compress",
3
- "version": "0.2.18",
3
+ "version": "0.3.0",
4
4
  "description": "Image compress plugin for Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -24,16 +24,16 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@napi-rs/image": "^1.7.0",
27
- "svgo": "^3.0.2",
28
- "@rsbuild/shared": "0.2.18"
27
+ "svgo": "^3.2.0",
28
+ "@rsbuild/shared": "0.3.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "16.x",
32
32
  "typescript": "^5.3.0",
33
33
  "webpack": "^5.89.0",
34
- "@rsbuild/test-helper": "0.2.18",
35
- "@rsbuild/core": "0.2.18",
36
- "@rsbuild/webpack": "0.2.18"
34
+ "@rsbuild/core": "0.3.0",
35
+ "@rsbuild/test-helper": "0.3.0",
36
+ "@rsbuild/webpack": "0.3.0"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public",