@rsbuild/plugin-svgr 0.2.13 → 0.2.15

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/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  import { RsbuildPlugin } from '@rsbuild/core';
2
+ import { Config } from '@svgr/core';
2
3
 
3
4
  type SvgDefaultExport = 'component' | 'url';
4
5
  type PluginSvgrOptions = {
6
+ /**
7
+ * Configure SVGR options.
8
+ */
9
+ svgrOptions?: Config;
5
10
  /**
6
11
  * Configure the default export type of SVG files.
7
12
  */
package/dist/index.js CHANGED
@@ -90,10 +90,14 @@ var pluginSvgr = (options = {}) => ({
90
90
  }
91
91
  return false;
92
92
  });
93
- svgrRule.use(CHAIN_ID.USE.SVGR).loader(import_path.default.resolve(__dirname, "./loader")).options({
94
- svgo: true,
95
- svgoConfig: getSvgoDefaultConfig()
96
- }).end().when(
93
+ const svgrOptions = (0, import_shared.deepmerge)(
94
+ {
95
+ svgo: true,
96
+ svgoConfig: getSvgoDefaultConfig()
97
+ },
98
+ options.svgrOptions || {}
99
+ );
100
+ svgrRule.use(CHAIN_ID.USE.SVGR).loader(import_path.default.resolve(__dirname, "./loader")).options(svgrOptions).end().when(
97
101
  svgDefaultExport === "url",
98
102
  (c) => c.use(CHAIN_ID.USE.URL).loader(require.resolve("url-loader")).options({
99
103
  limit: config.output.dataUriLimit.svg,
package/dist/index.mjs CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  JS_REGEX,
24
24
  TS_REGEX,
25
25
  SVG_REGEX,
26
+ deepmerge,
26
27
  getDistPath,
27
28
  getFilename as getFilename2,
28
29
  chainStaticAssetRule
@@ -82,10 +83,14 @@ var pluginSvgr = (options = {}) => ({
82
83
  }
83
84
  return false;
84
85
  });
85
- svgrRule.use(CHAIN_ID.USE.SVGR).loader(path2.resolve(__dirname, "./loader")).options({
86
- svgo: true,
87
- svgoConfig: getSvgoDefaultConfig()
88
- }).end().when(
86
+ const svgrOptions = deepmerge(
87
+ {
88
+ svgo: true,
89
+ svgoConfig: getSvgoDefaultConfig()
90
+ },
91
+ options.svgrOptions || {}
92
+ );
93
+ svgrRule.use(CHAIN_ID.USE.SVGR).loader(path2.resolve(__dirname, "./loader")).options(svgrOptions).end().when(
89
94
  svgDefaultExport === "url",
90
95
  (c) => c.use(CHAIN_ID.USE.URL).loader(__require.resolve("url-loader")).options({
91
96
  limit: config.output.dataUriLimit.svg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-svgr",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "svgr plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,13 +26,13 @@
26
26
  "@svgr/plugin-jsx": "8.1.0",
27
27
  "@svgr/plugin-svgo": "8.1.0",
28
28
  "url-loader": "4.1.1",
29
- "@rsbuild/shared": "0.2.13"
29
+ "@rsbuild/shared": "0.2.15"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "16.x",
33
33
  "typescript": "^5.3.0",
34
- "@rsbuild/core": "0.2.13",
35
- "@rsbuild/test-helper": "0.2.13"
34
+ "@rsbuild/core": "0.2.15",
35
+ "@rsbuild/test-helper": "0.2.15"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public",