@rsbuild/plugin-svgr 0.3.6 → 0.3.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.js +5 -5
- package/dist/loader.js +4 -4
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ __export(src_exports, {
|
|
|
33
33
|
pluginSvgr: () => pluginSvgr
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_node_path = __toESM(require("path"));
|
|
37
37
|
var import_shared = require("@rsbuild/shared");
|
|
38
38
|
var import_plugin_react = require("@rsbuild/plugin-react");
|
|
39
39
|
var import_core = require("@rsbuild/core");
|
|
@@ -69,14 +69,14 @@ var pluginSvgr = (options = {}) => ({
|
|
|
69
69
|
const assetType = "svg";
|
|
70
70
|
const distDir = (0, import_shared.getDistPath)(config, assetType);
|
|
71
71
|
const filename = (0, import_shared.getFilename)(config, assetType, isProd);
|
|
72
|
-
const outputName =
|
|
72
|
+
const outputName = import_node_path.default.posix.join(distDir, filename);
|
|
73
73
|
const maxSize = config.output.dataUriLimit[assetType];
|
|
74
74
|
chain.module.rules.delete(CHAIN_ID.RULE.SVG);
|
|
75
75
|
const rule = chain.module.rule(CHAIN_ID.RULE.SVG).test(import_shared.SVG_REGEX);
|
|
76
76
|
(0, import_shared.chainStaticAssetRule)({
|
|
77
77
|
rule,
|
|
78
78
|
maxSize,
|
|
79
|
-
filename:
|
|
79
|
+
filename: import_node_path.default.posix.join(distDir, filename),
|
|
80
80
|
assetType,
|
|
81
81
|
issuer: {
|
|
82
82
|
// The issuer option ensures that SVGR will only apply if the SVG is imported from a JS file.
|
|
@@ -104,9 +104,9 @@ var pluginSvgr = (options = {}) => ({
|
|
|
104
104
|
},
|
|
105
105
|
options.svgrOptions || {}
|
|
106
106
|
);
|
|
107
|
-
svgrRule.use(CHAIN_ID.USE.SVGR).loader(
|
|
107
|
+
svgrRule.use(CHAIN_ID.USE.SVGR).loader(import_node_path.default.resolve(__dirname, "./loader")).options(svgrOptions).end().when(
|
|
108
108
|
svgDefaultExport === "url",
|
|
109
|
-
(c) => c.use(CHAIN_ID.USE.URL).loader(
|
|
109
|
+
(c) => c.use(CHAIN_ID.USE.URL).loader(import_node_path.default.join(__dirname, "../compiled", "url-loader")).options({
|
|
110
110
|
limit: config.output.dataUriLimit.svg,
|
|
111
111
|
name: outputName
|
|
112
112
|
})
|
package/dist/loader.js
CHANGED
|
@@ -33,12 +33,12 @@ __export(loader_exports, {
|
|
|
33
33
|
default: () => loader_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(loader_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_node_util = require("util");
|
|
37
37
|
var import_core = require("@svgr/core");
|
|
38
|
-
var
|
|
38
|
+
var import_node_path = require("path");
|
|
39
39
|
var import_plugin_svgo = __toESM(require("@svgr/plugin-svgo"));
|
|
40
40
|
var import_plugin_jsx = __toESM(require("@svgr/plugin-jsx"));
|
|
41
|
-
var transformSvg = (0,
|
|
41
|
+
var transformSvg = (0, import_node_util.callbackify)(
|
|
42
42
|
async (contents, config, state) => (0, import_core.transform)(contents, config, state)
|
|
43
43
|
);
|
|
44
44
|
function svgrLoader(contents) {
|
|
@@ -57,7 +57,7 @@ function svgrLoader(contents) {
|
|
|
57
57
|
previousExport,
|
|
58
58
|
defaultPlugins: [import_plugin_svgo.default, import_plugin_jsx.default]
|
|
59
59
|
},
|
|
60
|
-
filePath: (0,
|
|
60
|
+
filePath: (0, import_node_path.normalize)(this.resourcePath)
|
|
61
61
|
};
|
|
62
62
|
if (!previousExport) {
|
|
63
63
|
transformSvg(contents, options, state, callback);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-svgr",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.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.3.
|
|
30
|
-
"@rsbuild/plugin-react": "0.3.
|
|
29
|
+
"@rsbuild/shared": "0.3.8",
|
|
30
|
+
"@rsbuild/plugin-react": "0.3.8"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "16.x",
|
|
34
34
|
"typescript": "^5.3.0",
|
|
35
|
-
"@rsbuild/core": "0.3.
|
|
36
|
-
"@scripts/test-helper": "0.3.
|
|
35
|
+
"@rsbuild/core": "0.3.8",
|
|
36
|
+
"@scripts/test-helper": "0.3.8"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@rsbuild/core": "^0.3.
|
|
39
|
+
"@rsbuild/core": "^0.3.8"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public",
|