@rsbuild/plugin-svgr 0.6.2 → 0.6.4
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.js +7 -7
- package/dist/index.mjs +8 -8
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -64,7 +64,11 @@ var pluginSvgr = (options = {}) => ({
|
|
|
64
64
|
const outputName = import_node_path.default.posix.join(distDir, filename);
|
|
65
65
|
const { dataUriLimit } = config.output;
|
|
66
66
|
const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit.svg;
|
|
67
|
-
|
|
67
|
+
let generatorOptions = {};
|
|
68
|
+
if (chain.module.rules.has(CHAIN_ID.RULE.SVG)) {
|
|
69
|
+
generatorOptions = chain.module.rules.get(CHAIN_ID.RULE.SVG).oneOfs.get(CHAIN_ID.ONE_OF.SVG_URL).get("generator");
|
|
70
|
+
chain.module.rules.delete(CHAIN_ID.RULE.SVG);
|
|
71
|
+
}
|
|
68
72
|
const rule = chain.module.rule(CHAIN_ID.RULE.SVG).test(import_shared.SVG_REGEX);
|
|
69
73
|
const svgrOptions = (0, import_shared.deepmerge)(
|
|
70
74
|
{
|
|
@@ -73,9 +77,7 @@ var pluginSvgr = (options = {}) => ({
|
|
|
73
77
|
},
|
|
74
78
|
options.svgrOptions || {}
|
|
75
79
|
);
|
|
76
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type("asset/resource").resourceQuery(/(__inline=false|url)/).set("generator",
|
|
77
|
-
filename: outputName
|
|
78
|
-
});
|
|
80
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type("asset/resource").resourceQuery(/(__inline=false|url)/).set("generator", generatorOptions);
|
|
79
81
|
rule.oneOf(CHAIN_ID.ONE_OF.SVG_INLINE).type("asset/inline").resourceQuery(/inline/);
|
|
80
82
|
rule.oneOf(CHAIN_ID.ONE_OF.SVG_REACT).type("javascript/auto").resourceQuery(options.query || /react/).use(CHAIN_ID.USE.SVGR).loader(import_node_path.default.resolve(__dirname, "./loader")).options({
|
|
81
83
|
...svgrOptions,
|
|
@@ -106,9 +108,7 @@ var pluginSvgr = (options = {}) => ({
|
|
|
106
108
|
dataUrlCondition: {
|
|
107
109
|
maxSize
|
|
108
110
|
}
|
|
109
|
-
}).set("generator",
|
|
110
|
-
filename: outputName
|
|
111
|
-
});
|
|
111
|
+
}).set("generator", generatorOptions);
|
|
112
112
|
const jsRule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
113
113
|
[CHAIN_ID.USE.SWC, CHAIN_ID.USE.BABEL].some((jsUseId) => {
|
|
114
114
|
const use = jsRule.uses.get(jsUseId);
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from 'module';
|
|
|
2
2
|
var require = createRequire(import.meta['url']);
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.
|
|
5
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.49.0_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
import path from "path";
|
|
8
8
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -47,7 +47,11 @@ var pluginSvgr = (options = {}) => ({
|
|
|
47
47
|
const outputName = path2.posix.join(distDir, filename);
|
|
48
48
|
const { dataUriLimit } = config.output;
|
|
49
49
|
const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit.svg;
|
|
50
|
-
|
|
50
|
+
let generatorOptions = {};
|
|
51
|
+
if (chain.module.rules.has(CHAIN_ID.RULE.SVG)) {
|
|
52
|
+
generatorOptions = chain.module.rules.get(CHAIN_ID.RULE.SVG).oneOfs.get(CHAIN_ID.ONE_OF.SVG_URL).get("generator");
|
|
53
|
+
chain.module.rules.delete(CHAIN_ID.RULE.SVG);
|
|
54
|
+
}
|
|
51
55
|
const rule = chain.module.rule(CHAIN_ID.RULE.SVG).test(SVG_REGEX);
|
|
52
56
|
const svgrOptions = deepmerge(
|
|
53
57
|
{
|
|
@@ -56,9 +60,7 @@ var pluginSvgr = (options = {}) => ({
|
|
|
56
60
|
},
|
|
57
61
|
options.svgrOptions || {}
|
|
58
62
|
);
|
|
59
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type("asset/resource").resourceQuery(/(__inline=false|url)/).set("generator",
|
|
60
|
-
filename: outputName
|
|
61
|
-
});
|
|
63
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type("asset/resource").resourceQuery(/(__inline=false|url)/).set("generator", generatorOptions);
|
|
62
64
|
rule.oneOf(CHAIN_ID.ONE_OF.SVG_INLINE).type("asset/inline").resourceQuery(/inline/);
|
|
63
65
|
rule.oneOf(CHAIN_ID.ONE_OF.SVG_REACT).type("javascript/auto").resourceQuery(options.query || /react/).use(CHAIN_ID.USE.SVGR).loader(path2.resolve(__dirname, "./loader")).options({
|
|
64
66
|
...svgrOptions,
|
|
@@ -89,9 +91,7 @@ var pluginSvgr = (options = {}) => ({
|
|
|
89
91
|
dataUrlCondition: {
|
|
90
92
|
maxSize
|
|
91
93
|
}
|
|
92
|
-
}).set("generator",
|
|
93
|
-
filename: outputName
|
|
94
|
-
});
|
|
94
|
+
}).set("generator", generatorOptions);
|
|
95
95
|
const jsRule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
96
96
|
[CHAIN_ID.USE.SWC, CHAIN_ID.USE.BABEL].some((jsUseId) => {
|
|
97
97
|
const use = jsRule.uses.get(jsUseId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-svgr",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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.6.
|
|
30
|
-
"@rsbuild/plugin-react": "0.6.
|
|
29
|
+
"@rsbuild/shared": "0.6.4",
|
|
30
|
+
"@rsbuild/plugin-react": "0.6.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "16.x",
|
|
34
34
|
"typescript": "^5.4.2",
|
|
35
|
-
"@rsbuild/core": "0.6.
|
|
36
|
-
"@scripts/test-helper": "0.6.
|
|
35
|
+
"@rsbuild/core": "0.6.4",
|
|
36
|
+
"@scripts/test-helper": "0.6.4"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@rsbuild/core": "^0.6.
|
|
39
|
+
"@rsbuild/core": "^0.6.4"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public",
|