@rsbuild/plugin-svgr 1.0.3 → 1.0.5
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 +208 -167
- package/dist/index.js +150 -145
- package/dist/loader.cjs +102 -74
- package/package.json +10 -11
- package/dist-types/package.json +0 -1
- /package/{dist-types → dist}/index.d.ts +0 -0
- /package/{dist-types → dist}/loader.d.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,175 +1,216 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
// The require scope
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
/************************************************************************/ // webpack/runtime/compat_get_default_export
|
|
5
|
+
(()=>{
|
|
6
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
7
|
+
__webpack_require__.n = function(module1) {
|
|
8
|
+
var getter = module1 && module1.__esModule ? function() {
|
|
9
|
+
return module1['default'];
|
|
10
|
+
} : function() {
|
|
11
|
+
return module1;
|
|
12
|
+
};
|
|
13
|
+
__webpack_require__.d(getter, {
|
|
14
|
+
a: getter
|
|
15
|
+
});
|
|
16
|
+
return getter;
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
// webpack/runtime/define_property_getters
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
22
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: definition[key]
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
// webpack/runtime/has_own_property
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.o = function(obj, prop) {
|
|
31
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
// webpack/runtime/make_namespace_object
|
|
35
|
+
(()=>{
|
|
36
|
+
// define __esModule on exports
|
|
37
|
+
__webpack_require__.r = function(exports1) {
|
|
38
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
39
|
+
value: 'Module'
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
42
|
+
value: true
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
/************************************************************************/ var __webpack_exports__ = {};
|
|
47
|
+
// ESM COMPAT FLAG
|
|
48
|
+
__webpack_require__.r(__webpack_exports__);
|
|
49
|
+
// EXPORTS
|
|
50
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
51
|
+
PLUGIN_SVGR_NAME: ()=>/* binding */ PLUGIN_SVGR_NAME,
|
|
52
|
+
pluginSvgr: ()=>/* binding */ pluginSvgr
|
|
35
53
|
});
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let mergedPlugins = [];
|
|
61
|
-
for (const plugin of config.plugins) {
|
|
62
|
-
if (typeof plugin === "string") {
|
|
63
|
-
const exist = mergedPlugins.find(
|
|
64
|
-
(item) => item === plugin || typeof item === "object" && item.name === plugin
|
|
65
|
-
);
|
|
66
|
-
if (!exist) {
|
|
67
|
-
mergedPlugins.push(plugin);
|
|
68
|
-
}
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
const strIndex = mergedPlugins.findIndex(
|
|
72
|
-
(item) => typeof item === "string" && item === plugin.name
|
|
73
|
-
);
|
|
74
|
-
if (strIndex !== -1) {
|
|
75
|
-
mergedPlugins[strIndex] = plugin;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
let isMerged = false;
|
|
79
|
-
mergedPlugins = mergedPlugins.map((item) => {
|
|
80
|
-
if (typeof item === "object" && item.name === plugin.name) {
|
|
81
|
-
isMerged = true;
|
|
82
|
-
return (0, import_deepmerge.default)(item, plugin);
|
|
83
|
-
}
|
|
84
|
-
return item;
|
|
54
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
55
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
56
|
+
const external_node_url_namespaceObject = require("node:url");
|
|
57
|
+
const plugin_react_namespaceObject = require("@rsbuild/plugin-react");
|
|
58
|
+
const external_deepmerge_namespaceObject = require("deepmerge");
|
|
59
|
+
var external_deepmerge_default = /*#__PURE__*/ __webpack_require__.n(external_deepmerge_namespaceObject);
|
|
60
|
+
const src_dirname = external_node_path_default().dirname((0, external_node_url_namespaceObject.fileURLToPath)(/*#__PURE__*/ function() {
|
|
61
|
+
return 'undefined' == typeof document ? new (module.require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
62
|
+
}()));
|
|
63
|
+
const SVG_REGEX = /\.svg$/;
|
|
64
|
+
const getSvgoDefaultConfig = ()=>({
|
|
65
|
+
plugins: [
|
|
66
|
+
{
|
|
67
|
+
name: 'preset-default',
|
|
68
|
+
params: {
|
|
69
|
+
overrides: {
|
|
70
|
+
// viewBox is required to resize SVGs with CSS.
|
|
71
|
+
// @see https://github.com/svg/svgo/issues/1128
|
|
72
|
+
removeViewBox: false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
'prefixIds'
|
|
77
|
+
]
|
|
85
78
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
svgoConfig: getSvgoDefaultConfig()
|
|
112
|
-
},
|
|
113
|
-
options.svgrOptions || {}
|
|
114
|
-
);
|
|
115
|
-
svgrOptions.svgoConfig = dedupeSvgoPlugins(svgrOptions.svgoConfig);
|
|
116
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type("asset/resource").resourceQuery(/(__inline=false|url)/).set("generator", generatorOptions);
|
|
117
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_INLINE).type("asset/inline").resourceQuery(/inline/);
|
|
118
|
-
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.cjs")).options({
|
|
119
|
-
...svgrOptions,
|
|
120
|
-
exportType: "default"
|
|
121
|
-
}).end();
|
|
122
|
-
const { mixedImport = false } = options;
|
|
123
|
-
if (mixedImport || svgrOptions.exportType) {
|
|
124
|
-
const { exportType = mixedImport ? "named" : void 0 } = svgrOptions;
|
|
125
|
-
const issuerInclude = [
|
|
126
|
-
/\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
|
|
127
|
-
/\.mdx$/
|
|
128
|
-
];
|
|
129
|
-
const issuer = options.excludeImporter ? { and: [issuerInclude, { not: options.excludeImporter }] } : issuerInclude;
|
|
130
|
-
const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG);
|
|
131
|
-
if (options.exclude) {
|
|
132
|
-
svgRule.exclude.add(options.exclude);
|
|
133
|
-
}
|
|
134
|
-
svgRule.type("javascript/auto").set("issuer", issuer).use(CHAIN_ID.USE.SVGR).loader(import_node_path.default.resolve(__dirname, "./loader.cjs")).options({
|
|
135
|
-
...svgrOptions,
|
|
136
|
-
exportType
|
|
137
|
-
}).end();
|
|
138
|
-
if (mixedImport && exportType === "named") {
|
|
139
|
-
svgRule.use(CHAIN_ID.USE.URL).loader(import_node_path.default.join(__dirname, "../compiled", "url-loader/index.js")).options({
|
|
140
|
-
limit: maxSize,
|
|
141
|
-
name: generatorOptions?.filename
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_ASSET).type("asset").parser({
|
|
146
|
-
// Inline SVG if size < maxSize
|
|
147
|
-
dataUrlCondition: {
|
|
148
|
-
maxSize
|
|
149
|
-
}
|
|
150
|
-
}).set("generator", generatorOptions);
|
|
151
|
-
const jsRule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
152
|
-
[CHAIN_ID.USE.SWC, CHAIN_ID.USE.BABEL].some((jsUseId) => {
|
|
153
|
-
const use = jsRule.uses.get(jsUseId);
|
|
154
|
-
if (!use) {
|
|
155
|
-
return false;
|
|
79
|
+
/**
|
|
80
|
+
* Dedupe SVGO plugins config.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* Input:
|
|
84
|
+
* {
|
|
85
|
+
* plugins: [
|
|
86
|
+
* { name: 'preset-default', params: { foo: true }],
|
|
87
|
+
* { name: 'preset-default', params: { bar: true }],
|
|
88
|
+
* ]
|
|
89
|
+
* }
|
|
90
|
+
* Output:
|
|
91
|
+
* {
|
|
92
|
+
* plugins: [
|
|
93
|
+
* { name: 'preset-default', params: { foo: true, bar: true }],
|
|
94
|
+
* ]
|
|
95
|
+
* }
|
|
96
|
+
*/ const dedupeSvgoPlugins = (config)=>{
|
|
97
|
+
if (!config.plugins) return config;
|
|
98
|
+
let mergedPlugins = [];
|
|
99
|
+
for (const plugin of config.plugins){
|
|
100
|
+
if ('string' == typeof plugin) {
|
|
101
|
+
const exist = mergedPlugins.find((item)=>item === plugin || 'object' == typeof item && item.name === plugin);
|
|
102
|
+
if (!exist) mergedPlugins.push(plugin);
|
|
103
|
+
continue;
|
|
156
104
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
]) {
|
|
161
|
-
if (!rule.oneOfs.has(oneOfId)) {
|
|
105
|
+
const strIndex = mergedPlugins.findIndex((item)=>'string' == typeof item && item === plugin.name);
|
|
106
|
+
if (-1 !== strIndex) {
|
|
107
|
+
mergedPlugins[strIndex] = plugin;
|
|
162
108
|
continue;
|
|
163
|
-
}
|
|
164
|
-
rule.oneOf(oneOfId).use(jsUseId).before(CHAIN_ID.USE.SVGR).loader(use.get("loader")).options(use.get("options"));
|
|
165
109
|
}
|
|
166
|
-
|
|
167
|
-
|
|
110
|
+
let isMerged = false;
|
|
111
|
+
mergedPlugins = mergedPlugins.map((item)=>{
|
|
112
|
+
if ('object' == typeof item && item.name === plugin.name) {
|
|
113
|
+
isMerged = true;
|
|
114
|
+
return external_deepmerge_default()(item, plugin);
|
|
115
|
+
}
|
|
116
|
+
return item;
|
|
117
|
+
});
|
|
118
|
+
if (!isMerged) mergedPlugins.push(plugin);
|
|
119
|
+
}
|
|
120
|
+
config.plugins = mergedPlugins;
|
|
121
|
+
return config;
|
|
122
|
+
};
|
|
123
|
+
const PLUGIN_SVGR_NAME = 'rsbuild:svgr';
|
|
124
|
+
const pluginSvgr = (options = {})=>({
|
|
125
|
+
name: PLUGIN_SVGR_NAME,
|
|
126
|
+
pre: [
|
|
127
|
+
plugin_react_namespaceObject.PLUGIN_REACT_NAME
|
|
128
|
+
],
|
|
129
|
+
setup (api) {
|
|
130
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
131
|
+
const { config } = environment;
|
|
132
|
+
const { dataUriLimit } = config.output;
|
|
133
|
+
const maxSize = 'number' == typeof dataUriLimit ? dataUriLimit : dataUriLimit.svg;
|
|
134
|
+
let generatorOptions = {};
|
|
135
|
+
if (chain.module.rules.has(CHAIN_ID.RULE.SVG)) {
|
|
136
|
+
generatorOptions = chain.module.rules.get(CHAIN_ID.RULE.SVG).oneOfs.get(CHAIN_ID.ONE_OF.SVG_URL).get('generator');
|
|
137
|
+
// delete Rsbuild builtin SVG rules
|
|
138
|
+
chain.module.rules.delete(CHAIN_ID.RULE.SVG);
|
|
139
|
+
}
|
|
140
|
+
const rule = chain.module.rule(CHAIN_ID.RULE.SVG).test(SVG_REGEX);
|
|
141
|
+
const svgrOptions = external_deepmerge_default()({
|
|
142
|
+
svgo: true,
|
|
143
|
+
svgoConfig: getSvgoDefaultConfig()
|
|
144
|
+
}, options.svgrOptions || {});
|
|
145
|
+
svgrOptions.svgoConfig = dedupeSvgoPlugins(svgrOptions.svgoConfig);
|
|
146
|
+
// force to url: "foo.svg?url",
|
|
147
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type('asset/resource').resourceQuery(/(__inline=false|url)/).set('generator', generatorOptions);
|
|
148
|
+
// force to inline: "foo.svg?inline"
|
|
149
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_INLINE).type('asset/inline').resourceQuery(/inline/);
|
|
150
|
+
// force to react component: "foo.svg?react"
|
|
151
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_REACT).type('javascript/auto').resourceQuery(options.query || /react/).use(CHAIN_ID.USE.SVGR).loader(external_node_path_default().resolve(src_dirname, './loader.cjs')).options({
|
|
152
|
+
...svgrOptions,
|
|
153
|
+
exportType: 'default'
|
|
154
|
+
}).end();
|
|
155
|
+
// SVG in JS files
|
|
156
|
+
const { mixedImport = false } = options;
|
|
157
|
+
if (mixedImport || svgrOptions.exportType) {
|
|
158
|
+
const { exportType = mixedImport ? 'named' : void 0 } = svgrOptions;
|
|
159
|
+
const issuerInclude = [
|
|
160
|
+
/\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
|
|
161
|
+
/\.mdx$/
|
|
162
|
+
];
|
|
163
|
+
const issuer = options.excludeImporter ? {
|
|
164
|
+
and: [
|
|
165
|
+
issuerInclude,
|
|
166
|
+
{
|
|
167
|
+
not: options.excludeImporter
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
} : issuerInclude;
|
|
171
|
+
const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG);
|
|
172
|
+
if (options.exclude) svgRule.exclude.add(options.exclude);
|
|
173
|
+
svgRule.type('javascript/auto') // The issuer option ensures that SVGR will only apply if the SVG is imported from a JS file.
|
|
174
|
+
.set('issuer', issuer).use(CHAIN_ID.USE.SVGR).loader(external_node_path_default().resolve(src_dirname, './loader.cjs')).options({
|
|
175
|
+
...svgrOptions,
|
|
176
|
+
exportType
|
|
177
|
+
}).end();
|
|
178
|
+
/**
|
|
179
|
+
* For mixed import.
|
|
180
|
+
* @example import logoUrl, { ReactComponent } from './logo.svg';`
|
|
181
|
+
*/ if (mixedImport && 'named' === exportType) svgRule.use(CHAIN_ID.USE.URL).loader(external_node_path_default().join(src_dirname, '../compiled', 'url-loader/index.js')).options({
|
|
182
|
+
limit: maxSize,
|
|
183
|
+
name: null == generatorOptions ? void 0 : generatorOptions.filename
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
// SVG as assets
|
|
187
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_ASSET).type('asset').parser({
|
|
188
|
+
// Inline SVG if size < maxSize
|
|
189
|
+
dataUrlCondition: {
|
|
190
|
+
maxSize
|
|
191
|
+
}
|
|
192
|
+
}).set('generator', generatorOptions);
|
|
193
|
+
// apply current JS transform rule to SVGR rules
|
|
194
|
+
const jsRule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
195
|
+
[
|
|
196
|
+
CHAIN_ID.USE.SWC,
|
|
197
|
+
CHAIN_ID.USE.BABEL
|
|
198
|
+
].some((jsUseId)=>{
|
|
199
|
+
const use = jsRule.uses.get(jsUseId);
|
|
200
|
+
if (!use) return false;
|
|
201
|
+
for (const oneOfId of [
|
|
202
|
+
CHAIN_ID.ONE_OF.SVG,
|
|
203
|
+
CHAIN_ID.ONE_OF.SVG_REACT
|
|
204
|
+
]){
|
|
205
|
+
if (!!rule.oneOfs.has(oneOfId)) rule.oneOf(oneOfId).use(jsUseId).before(CHAIN_ID.USE.SVGR).loader(use.get('loader')).options(use.get('options'));
|
|
206
|
+
}
|
|
207
|
+
return true;
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
}
|
|
168
211
|
});
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
PLUGIN_SVGR_NAME,
|
|
174
|
-
pluginSvgr
|
|
212
|
+
var __webpack_export_target__ = exports;
|
|
213
|
+
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|
|
214
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
215
|
+
value: true
|
|
175
216
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,150 +1,155 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
params: {
|
|
22
|
-
overrides: {
|
|
23
|
-
// viewBox is required to resize SVGs with CSS.
|
|
24
|
-
// @see https://github.com/svg/svgo/issues/1128
|
|
25
|
-
removeViewBox: false
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"prefixIds"
|
|
30
|
-
]
|
|
31
|
-
});
|
|
32
|
-
var dedupeSvgoPlugins = (config) => {
|
|
33
|
-
if (!config.plugins) {
|
|
34
|
-
return config;
|
|
35
|
-
}
|
|
36
|
-
let mergedPlugins = [];
|
|
37
|
-
for (const plugin of config.plugins) {
|
|
38
|
-
if (typeof plugin === "string") {
|
|
39
|
-
const exist = mergedPlugins.find(
|
|
40
|
-
(item) => item === plugin || typeof item === "object" && item.name === plugin
|
|
41
|
-
);
|
|
42
|
-
if (!exist) {
|
|
43
|
-
mergedPlugins.push(plugin);
|
|
44
|
-
}
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
const strIndex = mergedPlugins.findIndex(
|
|
48
|
-
(item) => typeof item === "string" && item === plugin.name
|
|
49
|
-
);
|
|
50
|
-
if (strIndex !== -1) {
|
|
51
|
-
mergedPlugins[strIndex] = plugin;
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
let isMerged = false;
|
|
55
|
-
mergedPlugins = mergedPlugins.map((item) => {
|
|
56
|
-
if (typeof item === "object" && item.name === plugin.name) {
|
|
57
|
-
isMerged = true;
|
|
58
|
-
return deepmerge(item, plugin);
|
|
59
|
-
}
|
|
60
|
-
return item;
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_url__ from "node:url";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react__ from "@rsbuild/plugin-react";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_deepmerge__ from "deepmerge";
|
|
5
|
+
const src_dirname = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url__.fileURLToPath)(import.meta.url));
|
|
6
|
+
const SVG_REGEX = /\.svg$/;
|
|
7
|
+
const getSvgoDefaultConfig = ()=>({
|
|
8
|
+
plugins: [
|
|
9
|
+
{
|
|
10
|
+
name: 'preset-default',
|
|
11
|
+
params: {
|
|
12
|
+
overrides: {
|
|
13
|
+
// viewBox is required to resize SVGs with CSS.
|
|
14
|
+
// @see https://github.com/svg/svgo/issues/1128
|
|
15
|
+
removeViewBox: false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
'prefixIds'
|
|
20
|
+
]
|
|
61
21
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
svgoConfig: getSvgoDefaultConfig()
|
|
88
|
-
},
|
|
89
|
-
options.svgrOptions || {}
|
|
90
|
-
);
|
|
91
|
-
svgrOptions.svgoConfig = dedupeSvgoPlugins(svgrOptions.svgoConfig);
|
|
92
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type("asset/resource").resourceQuery(/(__inline=false|url)/).set("generator", generatorOptions);
|
|
93
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_INLINE).type("asset/inline").resourceQuery(/inline/);
|
|
94
|
-
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.cjs")).options({
|
|
95
|
-
...svgrOptions,
|
|
96
|
-
exportType: "default"
|
|
97
|
-
}).end();
|
|
98
|
-
const { mixedImport = false } = options;
|
|
99
|
-
if (mixedImport || svgrOptions.exportType) {
|
|
100
|
-
const { exportType = mixedImport ? "named" : void 0 } = svgrOptions;
|
|
101
|
-
const issuerInclude = [
|
|
102
|
-
/\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
|
|
103
|
-
/\.mdx$/
|
|
104
|
-
];
|
|
105
|
-
const issuer = options.excludeImporter ? { and: [issuerInclude, { not: options.excludeImporter }] } : issuerInclude;
|
|
106
|
-
const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG);
|
|
107
|
-
if (options.exclude) {
|
|
108
|
-
svgRule.exclude.add(options.exclude);
|
|
109
|
-
}
|
|
110
|
-
svgRule.type("javascript/auto").set("issuer", issuer).use(CHAIN_ID.USE.SVGR).loader(path2.resolve(__dirname, "./loader.cjs")).options({
|
|
111
|
-
...svgrOptions,
|
|
112
|
-
exportType
|
|
113
|
-
}).end();
|
|
114
|
-
if (mixedImport && exportType === "named") {
|
|
115
|
-
svgRule.use(CHAIN_ID.USE.URL).loader(path2.join(__dirname, "../compiled", "url-loader/index.js")).options({
|
|
116
|
-
limit: maxSize,
|
|
117
|
-
name: generatorOptions?.filename
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
rule.oneOf(CHAIN_ID.ONE_OF.SVG_ASSET).type("asset").parser({
|
|
122
|
-
// Inline SVG if size < maxSize
|
|
123
|
-
dataUrlCondition: {
|
|
124
|
-
maxSize
|
|
125
|
-
}
|
|
126
|
-
}).set("generator", generatorOptions);
|
|
127
|
-
const jsRule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
128
|
-
[CHAIN_ID.USE.SWC, CHAIN_ID.USE.BABEL].some((jsUseId) => {
|
|
129
|
-
const use = jsRule.uses.get(jsUseId);
|
|
130
|
-
if (!use) {
|
|
131
|
-
return false;
|
|
22
|
+
/**
|
|
23
|
+
* Dedupe SVGO plugins config.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* Input:
|
|
27
|
+
* {
|
|
28
|
+
* plugins: [
|
|
29
|
+
* { name: 'preset-default', params: { foo: true }],
|
|
30
|
+
* { name: 'preset-default', params: { bar: true }],
|
|
31
|
+
* ]
|
|
32
|
+
* }
|
|
33
|
+
* Output:
|
|
34
|
+
* {
|
|
35
|
+
* plugins: [
|
|
36
|
+
* { name: 'preset-default', params: { foo: true, bar: true }],
|
|
37
|
+
* ]
|
|
38
|
+
* }
|
|
39
|
+
*/ const dedupeSvgoPlugins = (config)=>{
|
|
40
|
+
if (!config.plugins) return config;
|
|
41
|
+
let mergedPlugins = [];
|
|
42
|
+
for (const plugin of config.plugins){
|
|
43
|
+
if ('string' == typeof plugin) {
|
|
44
|
+
const exist = mergedPlugins.find((item)=>item === plugin || 'object' == typeof item && item.name === plugin);
|
|
45
|
+
if (!exist) mergedPlugins.push(plugin);
|
|
46
|
+
continue;
|
|
132
47
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
]) {
|
|
137
|
-
if (!rule.oneOfs.has(oneOfId)) {
|
|
48
|
+
const strIndex = mergedPlugins.findIndex((item)=>'string' == typeof item && item === plugin.name);
|
|
49
|
+
if (-1 !== strIndex) {
|
|
50
|
+
mergedPlugins[strIndex] = plugin;
|
|
138
51
|
continue;
|
|
139
|
-
}
|
|
140
|
-
rule.oneOf(oneOfId).use(jsUseId).before(CHAIN_ID.USE.SVGR).loader(use.get("loader")).options(use.get("options"));
|
|
141
52
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
53
|
+
let isMerged = false;
|
|
54
|
+
mergedPlugins = mergedPlugins.map((item)=>{
|
|
55
|
+
if ('object' == typeof item && item.name === plugin.name) {
|
|
56
|
+
isMerged = true;
|
|
57
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"])(item, plugin);
|
|
58
|
+
}
|
|
59
|
+
return item;
|
|
60
|
+
});
|
|
61
|
+
if (!isMerged) mergedPlugins.push(plugin);
|
|
62
|
+
}
|
|
63
|
+
config.plugins = mergedPlugins;
|
|
64
|
+
return config;
|
|
150
65
|
};
|
|
66
|
+
const PLUGIN_SVGR_NAME = 'rsbuild:svgr';
|
|
67
|
+
const pluginSvgr = (options = {})=>({
|
|
68
|
+
name: PLUGIN_SVGR_NAME,
|
|
69
|
+
pre: [
|
|
70
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react__.PLUGIN_REACT_NAME
|
|
71
|
+
],
|
|
72
|
+
setup (api) {
|
|
73
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
74
|
+
const { config } = environment;
|
|
75
|
+
const { dataUriLimit } = config.output;
|
|
76
|
+
const maxSize = 'number' == typeof dataUriLimit ? dataUriLimit : dataUriLimit.svg;
|
|
77
|
+
let generatorOptions = {};
|
|
78
|
+
if (chain.module.rules.has(CHAIN_ID.RULE.SVG)) {
|
|
79
|
+
generatorOptions = chain.module.rules.get(CHAIN_ID.RULE.SVG).oneOfs.get(CHAIN_ID.ONE_OF.SVG_URL).get('generator');
|
|
80
|
+
// delete Rsbuild builtin SVG rules
|
|
81
|
+
chain.module.rules.delete(CHAIN_ID.RULE.SVG);
|
|
82
|
+
}
|
|
83
|
+
const rule = chain.module.rule(CHAIN_ID.RULE.SVG).test(SVG_REGEX);
|
|
84
|
+
const svgrOptions = (0, __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"])({
|
|
85
|
+
svgo: true,
|
|
86
|
+
svgoConfig: getSvgoDefaultConfig()
|
|
87
|
+
}, options.svgrOptions || {});
|
|
88
|
+
svgrOptions.svgoConfig = dedupeSvgoPlugins(svgrOptions.svgoConfig);
|
|
89
|
+
// force to url: "foo.svg?url",
|
|
90
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_URL).type('asset/resource').resourceQuery(/(__inline=false|url)/).set('generator', generatorOptions);
|
|
91
|
+
// force to inline: "foo.svg?inline"
|
|
92
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_INLINE).type('asset/inline').resourceQuery(/inline/);
|
|
93
|
+
// force to react component: "foo.svg?react"
|
|
94
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_REACT).type('javascript/auto').resourceQuery(options.query || /react/).use(CHAIN_ID.USE.SVGR).loader(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(src_dirname, './loader.cjs')).options({
|
|
95
|
+
...svgrOptions,
|
|
96
|
+
exportType: 'default'
|
|
97
|
+
}).end();
|
|
98
|
+
// SVG in JS files
|
|
99
|
+
const { mixedImport = false } = options;
|
|
100
|
+
if (mixedImport || svgrOptions.exportType) {
|
|
101
|
+
const { exportType = mixedImport ? 'named' : void 0 } = svgrOptions;
|
|
102
|
+
const issuerInclude = [
|
|
103
|
+
/\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
|
|
104
|
+
/\.mdx$/
|
|
105
|
+
];
|
|
106
|
+
const issuer = options.excludeImporter ? {
|
|
107
|
+
and: [
|
|
108
|
+
issuerInclude,
|
|
109
|
+
{
|
|
110
|
+
not: options.excludeImporter
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
} : issuerInclude;
|
|
114
|
+
const svgRule = rule.oneOf(CHAIN_ID.ONE_OF.SVG);
|
|
115
|
+
if (options.exclude) svgRule.exclude.add(options.exclude);
|
|
116
|
+
svgRule.type('javascript/auto') // The issuer option ensures that SVGR will only apply if the SVG is imported from a JS file.
|
|
117
|
+
.set('issuer', issuer).use(CHAIN_ID.USE.SVGR).loader(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(src_dirname, './loader.cjs')).options({
|
|
118
|
+
...svgrOptions,
|
|
119
|
+
exportType
|
|
120
|
+
}).end();
|
|
121
|
+
/**
|
|
122
|
+
* For mixed import.
|
|
123
|
+
* @example import logoUrl, { ReactComponent } from './logo.svg';`
|
|
124
|
+
*/ if (mixedImport && 'named' === exportType) svgRule.use(CHAIN_ID.USE.URL).loader(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].join(src_dirname, '../compiled', 'url-loader/index.js')).options({
|
|
125
|
+
limit: maxSize,
|
|
126
|
+
name: null == generatorOptions ? void 0 : generatorOptions.filename
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// SVG as assets
|
|
130
|
+
rule.oneOf(CHAIN_ID.ONE_OF.SVG_ASSET).type('asset').parser({
|
|
131
|
+
// Inline SVG if size < maxSize
|
|
132
|
+
dataUrlCondition: {
|
|
133
|
+
maxSize
|
|
134
|
+
}
|
|
135
|
+
}).set('generator', generatorOptions);
|
|
136
|
+
// apply current JS transform rule to SVGR rules
|
|
137
|
+
const jsRule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
138
|
+
[
|
|
139
|
+
CHAIN_ID.USE.SWC,
|
|
140
|
+
CHAIN_ID.USE.BABEL
|
|
141
|
+
].some((jsUseId)=>{
|
|
142
|
+
const use = jsRule.uses.get(jsUseId);
|
|
143
|
+
if (!use) return false;
|
|
144
|
+
for (const oneOfId of [
|
|
145
|
+
CHAIN_ID.ONE_OF.SVG,
|
|
146
|
+
CHAIN_ID.ONE_OF.SVG_REACT
|
|
147
|
+
]){
|
|
148
|
+
if (!!rule.oneOfs.has(oneOfId)) rule.oneOf(oneOfId).use(jsUseId).before(CHAIN_ID.USE.SVGR).loader(use.get('loader')).options(use.get('options'));
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export { PLUGIN_SVGR_NAME, pluginSvgr };
|
package/dist/loader.cjs
CHANGED
|
@@ -1,80 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
2
|
+
// The require scope
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
/************************************************************************/ // webpack/runtime/compat_get_default_export
|
|
5
|
+
(()=>{
|
|
6
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
7
|
+
__webpack_require__.n = function(module) {
|
|
8
|
+
var getter = module && module.__esModule ? function() {
|
|
9
|
+
return module['default'];
|
|
10
|
+
} : function() {
|
|
11
|
+
return module;
|
|
12
|
+
};
|
|
13
|
+
__webpack_require__.d(getter, {
|
|
14
|
+
a: getter
|
|
15
|
+
});
|
|
16
|
+
return getter;
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
// webpack/runtime/define_property_getters
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
22
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: definition[key]
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
// webpack/runtime/has_own_property
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.o = function(obj, prop) {
|
|
31
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
// webpack/runtime/make_namespace_object
|
|
35
|
+
(()=>{
|
|
36
|
+
// define __esModule on exports
|
|
37
|
+
__webpack_require__.r = function(exports1) {
|
|
38
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
39
|
+
value: 'Module'
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
42
|
+
value: true
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
/************************************************************************/ var __webpack_exports__ = {};
|
|
47
|
+
// ESM COMPAT FLAG
|
|
48
|
+
__webpack_require__.r(__webpack_exports__);
|
|
49
|
+
// EXPORTS
|
|
50
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
51
|
+
default: ()=>/* binding */ loader
|
|
34
52
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
)
|
|
53
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
54
|
+
const external_node_util_namespaceObject = require("node:util");
|
|
55
|
+
const core_namespaceObject = require("@svgr/core");
|
|
56
|
+
const plugin_jsx_namespaceObject = require("@svgr/plugin-jsx");
|
|
57
|
+
var plugin_jsx_default = /*#__PURE__*/ __webpack_require__.n(plugin_jsx_namespaceObject);
|
|
58
|
+
const plugin_svgo_namespaceObject = require("@svgr/plugin-svgo");
|
|
59
|
+
var plugin_svgo_default = /*#__PURE__*/ __webpack_require__.n(plugin_svgo_namespaceObject);
|
|
60
|
+
/**
|
|
61
|
+
* Copyright (c) 2017, Smooth Code
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE file in the root directory of this source tree.
|
|
65
|
+
* modified from https://github.com/gregberge/svgr/blob/7595d378b73d4826a4cead165b3f32386b07315b/packages/webpack/src/index.ts
|
|
66
|
+
*/ const transformSvg = (0, external_node_util_namespaceObject.callbackify)(async (contents, config, state)=>(0, core_namespaceObject.transform)(contents, config, state));
|
|
44
67
|
function svgrLoader(contents) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.fs.readFile(this.resourcePath, (err, result)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
transformSvg(String(result), options, state, (err2, content) => {
|
|
71
|
-
if (err2) {
|
|
72
|
-
callback(err2);
|
|
73
|
-
return;
|
|
68
|
+
var _this;
|
|
69
|
+
null === (_this = this) || void 0 === _this || _this.cacheable();
|
|
70
|
+
const callback = this.async();
|
|
71
|
+
const options = this.getOptions();
|
|
72
|
+
const previousExport = (()=>{
|
|
73
|
+
if (contents.startsWith('export ')) return contents;
|
|
74
|
+
const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/);
|
|
75
|
+
return exportMatches ? `export default ${exportMatches[1]}` : null;
|
|
76
|
+
})();
|
|
77
|
+
const state = {
|
|
78
|
+
caller: {
|
|
79
|
+
name: '@rsbuild/plugin-svgr',
|
|
80
|
+
previousExport,
|
|
81
|
+
defaultPlugins: [
|
|
82
|
+
plugin_svgo_default(),
|
|
83
|
+
plugin_jsx_default()
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
filePath: (0, external_node_path_namespaceObject.normalize)(this.resourcePath)
|
|
87
|
+
};
|
|
88
|
+
if (previousExport) this.fs.readFile(this.resourcePath, (err, result)=>{
|
|
89
|
+
if (err) {
|
|
90
|
+
callback(err);
|
|
91
|
+
return;
|
|
74
92
|
}
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
transformSvg(String(result), options, state, (err, content)=>{
|
|
94
|
+
if (err) {
|
|
95
|
+
callback(err);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
callback(null, content);
|
|
99
|
+
});
|
|
77
100
|
});
|
|
78
|
-
|
|
101
|
+
else transformSvg(contents, options, state, callback);
|
|
79
102
|
}
|
|
80
|
-
|
|
103
|
+
/* ESM default export */ const loader = svgrLoader;
|
|
104
|
+
var __webpack_export_target__ = exports;
|
|
105
|
+
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|
|
106
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
107
|
+
value: true
|
|
108
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-svgr",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "svgr plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,17 +11,16 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./dist
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
15
|
"import": "./dist/index.js",
|
|
16
16
|
"require": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"main": "./dist/index.cjs",
|
|
20
|
-
"types": "./dist
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"compiled"
|
|
24
|
-
"dist-types"
|
|
23
|
+
"compiled"
|
|
25
24
|
],
|
|
26
25
|
"dependencies": {
|
|
27
26
|
"@svgr/core": "8.1.0",
|
|
@@ -29,20 +28,20 @@
|
|
|
29
28
|
"@svgr/plugin-svgo": "8.1.0",
|
|
30
29
|
"deepmerge": "^4.3.1",
|
|
31
30
|
"loader-utils": "^2.0.4",
|
|
32
|
-
"@rsbuild/plugin-react": "1.0.
|
|
31
|
+
"@rsbuild/plugin-react": "1.0.6"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@types/node": "18.x",
|
|
36
35
|
"file-loader": "6.2.0",
|
|
37
36
|
"prebundle": "1.2.2",
|
|
38
37
|
"svgo": "^3.3.2",
|
|
39
|
-
"typescript": "^5.
|
|
38
|
+
"typescript": "^5.6.3",
|
|
40
39
|
"url-loader": "4.1.1",
|
|
41
|
-
"@rsbuild/core": "1.0.
|
|
40
|
+
"@rsbuild/core": "1.0.19",
|
|
42
41
|
"@scripts/test-helper": "1.0.1"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
|
-
"@rsbuild/core": "1.x
|
|
44
|
+
"@rsbuild/core": "1.x"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public",
|
|
@@ -50,8 +49,8 @@
|
|
|
50
49
|
"registry": "https://registry.npmjs.org/"
|
|
51
50
|
},
|
|
52
51
|
"scripts": {
|
|
53
|
-
"build": "
|
|
54
|
-
"dev": "
|
|
52
|
+
"build": "rslib build",
|
|
53
|
+
"dev": "rslib build --watch",
|
|
55
54
|
"prebundle": "prebundle"
|
|
56
55
|
}
|
|
57
56
|
}
|
package/dist-types/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"//":"This file is for making TypeScript work with moduleResolution node16+.","version":"1.0.0"}
|
|
File without changes
|
|
File without changes
|