@rsbuild/plugin-svgr 0.4.14 → 0.4.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
@@ -11,6 +11,7 @@ type PluginSvgrOptions = {
11
11
  /**
12
12
  * Configure the default export type of SVG files.
13
13
  * @default 'url'
14
+ * @deprecated use `svgrOptions.exportType` instead
14
15
  */
15
16
  svgDefaultExport?: SvgDefaultExport;
16
17
  };
package/dist/index.js CHANGED
@@ -59,7 +59,6 @@ var pluginSvgr = (options = {}) => ({
59
59
  setup(api) {
60
60
  api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID }) => {
61
61
  const config = api.getNormalizedConfig();
62
- const { svgDefaultExport = "url" } = options;
63
62
  const distDir = (0, import_shared.getDistPath)(config, "svg");
64
63
  const filename = (0, import_shared.getFilename)(config, "svg", isProd);
65
64
  const outputName = import_node_path.default.posix.join(distDir, filename);
@@ -92,7 +91,8 @@ var pluginSvgr = (options = {}) => ({
92
91
  // The issuer option ensures that SVGR will only apply if the SVG is imported from a JS file.
93
92
  not: [import_shared.SCRIPT_REGEX]
94
93
  });
95
- const exportType = svgDefaultExport === "url" ? "named" : "default";
94
+ const { svgDefaultExport = "url" } = options;
95
+ const exportType = svgrOptions.exportType ?? (svgDefaultExport === "url" ? "named" : "default");
96
96
  rule.oneOf(CHAIN_ID.ONE_OF.SVG).type("javascript/auto").use(CHAIN_ID.USE.SVGR).loader(import_node_path.default.resolve(__dirname, "./loader")).options({
97
97
  ...svgrOptions,
98
98
  exportType
package/dist/index.mjs CHANGED
@@ -42,7 +42,6 @@ var pluginSvgr = (options = {}) => ({
42
42
  setup(api) {
43
43
  api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID }) => {
44
44
  const config = api.getNormalizedConfig();
45
- const { svgDefaultExport = "url" } = options;
46
45
  const distDir = getDistPath(config, "svg");
47
46
  const filename = getFilename2(config, "svg", isProd);
48
47
  const outputName = path2.posix.join(distDir, filename);
@@ -75,7 +74,8 @@ var pluginSvgr = (options = {}) => ({
75
74
  // The issuer option ensures that SVGR will only apply if the SVG is imported from a JS file.
76
75
  not: [SCRIPT_REGEX]
77
76
  });
78
- const exportType = svgDefaultExport === "url" ? "named" : "default";
77
+ const { svgDefaultExport = "url" } = options;
78
+ const exportType = svgrOptions.exportType ?? (svgDefaultExport === "url" ? "named" : "default");
79
79
  rule.oneOf(CHAIN_ID.ONE_OF.SVG).type("javascript/auto").use(CHAIN_ID.USE.SVGR).loader(path2.resolve(__dirname, "./loader")).options({
80
80
  ...svgrOptions,
81
81
  exportType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-svgr",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "svgr plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,17 +26,17 @@
26
26
  "@svgr/core": "8.1.0",
27
27
  "@svgr/plugin-jsx": "8.1.0",
28
28
  "@svgr/plugin-svgo": "8.1.0",
29
- "@rsbuild/shared": "0.4.14",
30
- "@rsbuild/plugin-react": "0.4.14"
29
+ "@rsbuild/shared": "0.4.15",
30
+ "@rsbuild/plugin-react": "0.4.15"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "16.x",
34
34
  "typescript": "^5.4.2",
35
- "@rsbuild/core": "0.4.14",
36
- "@scripts/test-helper": "0.4.14"
35
+ "@rsbuild/core": "0.4.15",
36
+ "@scripts/test-helper": "0.4.15"
37
37
  },
38
38
  "peerDependencies": {
39
- "@rsbuild/core": "^0.4.14"
39
+ "@rsbuild/core": "^0.4.15"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public",