@rsbuild/plugin-svgr 0.5.7 → 0.5.8

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,4 +1,4 @@
1
- import { RsbuildPlugin } from '@rsbuild/core';
1
+ import { Rspack, RsbuildPlugin } from '@rsbuild/core';
2
2
  import { Config } from '@svgr/core';
3
3
 
4
4
  type SvgDefaultExport = 'component' | 'url';
@@ -18,6 +18,10 @@ type PluginSvgrOptions = {
18
18
  * @default /react/
19
19
  */
20
20
  query?: RegExp;
21
+ /**
22
+ * Exclude specific files to be transformed by SVGR.
23
+ */
24
+ exclude?: Rspack.RuleSetCondition;
21
25
  };
22
26
  declare const pluginSvgr: (options?: PluginSvgrOptions) => RsbuildPlugin;
23
27
 
package/dist/index.js CHANGED
@@ -84,7 +84,9 @@ var pluginSvgr = (options = {}) => ({
84
84
  const { mixedImport = false } = options;
85
85
  if (mixedImport || svgrOptions.exportType) {
86
86
  const { exportType = mixedImport ? "named" : void 0 } = svgrOptions;
87
- const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG).type("javascript/auto").set("issuer", [import_shared.SCRIPT_REGEX, /\.mdx$/]).use(CHAIN_ID.USE.SVGR).loader(import_node_path.default.resolve(__dirname, "./loader")).options({
87
+ const issuerInclude = [import_shared.SCRIPT_REGEX, /\.mdx$/];
88
+ const issuer = options.exclude ? { and: [issuerInclude, { not: options.exclude }] } : issuerInclude;
89
+ const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG).type("javascript/auto").set("issuer", issuer).use(CHAIN_ID.USE.SVGR).loader(import_node_path.default.resolve(__dirname, "./loader")).options({
88
90
  ...svgrOptions,
89
91
  exportType
90
92
  }).end();
package/dist/index.mjs CHANGED
@@ -67,7 +67,9 @@ var pluginSvgr = (options = {}) => ({
67
67
  const { mixedImport = false } = options;
68
68
  if (mixedImport || svgrOptions.exportType) {
69
69
  const { exportType = mixedImport ? "named" : void 0 } = svgrOptions;
70
- const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG).type("javascript/auto").set("issuer", [SCRIPT_REGEX, /\.mdx$/]).use(CHAIN_ID.USE.SVGR).loader(path2.resolve(__dirname, "./loader")).options({
70
+ const issuerInclude = [SCRIPT_REGEX, /\.mdx$/];
71
+ const issuer = options.exclude ? { and: [issuerInclude, { not: options.exclude }] } : issuerInclude;
72
+ const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG).type("javascript/auto").set("issuer", issuer).use(CHAIN_ID.USE.SVGR).loader(path2.resolve(__dirname, "./loader")).options({
71
73
  ...svgrOptions,
72
74
  exportType
73
75
  }).end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-svgr",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
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.5.7",
30
- "@rsbuild/plugin-react": "0.5.7"
29
+ "@rsbuild/shared": "0.5.8",
30
+ "@rsbuild/plugin-react": "0.5.8"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "16.x",
34
34
  "typescript": "^5.4.2",
35
- "@rsbuild/core": "0.5.7",
36
- "@scripts/test-helper": "0.5.7"
35
+ "@rsbuild/core": "0.5.8",
36
+ "@scripts/test-helper": "0.5.8"
37
37
  },
38
38
  "peerDependencies": {
39
- "@rsbuild/core": "^0.5.7"
39
+ "@rsbuild/core": "^0.5.8"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public",