@rsbuild/plugin-svgr 0.7.8 → 0.7.9
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.cjs +2 -5
- package/dist/index.js +3 -11
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -61,11 +61,8 @@ var pluginSvgr = (options = {}) => ({
|
|
|
61
61
|
name: PLUGIN_SVGR_NAME,
|
|
62
62
|
pre: [import_plugin_react.PLUGIN_REACT_NAME],
|
|
63
63
|
setup(api) {
|
|
64
|
-
api.modifyBundlerChain(async (chain, {
|
|
64
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
|
|
65
65
|
const config = api.getNormalizedConfig();
|
|
66
|
-
const distDir = (0, import_shared.getDistPath)(config, "svg");
|
|
67
|
-
const filename = (0, import_shared.getFilename)(config, "svg", isProd);
|
|
68
|
-
const outputName = import_node_path.default.posix.join(distDir, filename);
|
|
69
66
|
const { dataUriLimit } = config.output;
|
|
70
67
|
const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit.svg;
|
|
71
68
|
let generatorOptions = {};
|
|
@@ -103,7 +100,7 @@ var pluginSvgr = (options = {}) => ({
|
|
|
103
100
|
if (mixedImport && exportType === "named") {
|
|
104
101
|
svgRule.use(CHAIN_ID.USE.URL).loader(import_node_path.default.join(__dirname, "../compiled", "url-loader/index.js")).options({
|
|
105
102
|
limit: maxSize,
|
|
106
|
-
name:
|
|
103
|
+
name: generatorOptions?.filename
|
|
107
104
|
});
|
|
108
105
|
}
|
|
109
106
|
}
|
package/dist/index.js
CHANGED
|
@@ -12,12 +12,7 @@ var __dirname = /* @__PURE__ */ getDirname();
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
import path2 from "path";
|
|
14
14
|
import { PLUGIN_REACT_NAME } from "@rsbuild/plugin-react";
|
|
15
|
-
import {
|
|
16
|
-
SCRIPT_REGEX,
|
|
17
|
-
deepmerge,
|
|
18
|
-
getDistPath,
|
|
19
|
-
getFilename as getFilename2
|
|
20
|
-
} from "@rsbuild/shared";
|
|
15
|
+
import { SCRIPT_REGEX, deepmerge } from "@rsbuild/shared";
|
|
21
16
|
var SVG_REGEX = /\.svg$/;
|
|
22
17
|
function getSvgoDefaultConfig() {
|
|
23
18
|
return {
|
|
@@ -41,11 +36,8 @@ var pluginSvgr = (options = {}) => ({
|
|
|
41
36
|
name: PLUGIN_SVGR_NAME,
|
|
42
37
|
pre: [PLUGIN_REACT_NAME],
|
|
43
38
|
setup(api) {
|
|
44
|
-
api.modifyBundlerChain(async (chain, {
|
|
39
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
|
|
45
40
|
const config = api.getNormalizedConfig();
|
|
46
|
-
const distDir = getDistPath(config, "svg");
|
|
47
|
-
const filename = getFilename2(config, "svg", isProd);
|
|
48
|
-
const outputName = path2.posix.join(distDir, filename);
|
|
49
41
|
const { dataUriLimit } = config.output;
|
|
50
42
|
const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit.svg;
|
|
51
43
|
let generatorOptions = {};
|
|
@@ -83,7 +75,7 @@ var pluginSvgr = (options = {}) => ({
|
|
|
83
75
|
if (mixedImport && exportType === "named") {
|
|
84
76
|
svgRule.use(CHAIN_ID.USE.URL).loader(path2.join(__dirname, "../compiled", "url-loader/index.js")).options({
|
|
85
77
|
limit: maxSize,
|
|
86
|
-
name:
|
|
78
|
+
name: generatorOptions?.filename
|
|
87
79
|
});
|
|
88
80
|
}
|
|
89
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-svgr",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"description": "svgr plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"@svgr/plugin-jsx": "8.1.0",
|
|
28
28
|
"@svgr/plugin-svgo": "8.1.0",
|
|
29
29
|
"loader-utils": "^2.0.4",
|
|
30
|
-
"@rsbuild/plugin-react": "0.7.
|
|
31
|
-
"@rsbuild/shared": "0.7.
|
|
30
|
+
"@rsbuild/plugin-react": "0.7.9",
|
|
31
|
+
"@rsbuild/shared": "0.7.9"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "18.x",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"prebundle": "1.1.0",
|
|
37
37
|
"typescript": "^5.4.2",
|
|
38
38
|
"url-loader": "4.1.1",
|
|
39
|
-
"@rsbuild/core": "0.7.
|
|
40
|
-
"@scripts/test-helper": "0.7.
|
|
39
|
+
"@rsbuild/core": "0.7.9",
|
|
40
|
+
"@scripts/test-helper": "0.7.9"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@rsbuild/core": "^0.7.
|
|
43
|
+
"@rsbuild/core": "^0.7.9"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public",
|