rollup-plugin-svg-sprite-loader 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +189 -95
- package/dist/index.cjs.js +340 -291
- package/package.json +74 -70
package/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2021 nyanyani
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 nyanyani
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
@@ -1,95 +1,189 @@
|
|
1
|
-
# rollup-plugin-svg-sprite-loader
|
2
|
-
|
3
|
-
A rollup plugin to create and bundle external svg sprite file.
|
4
|
-
|
5
|
-
## Table of contents
|
6
|
-
|
7
|
-
- [rollup-plugin-svg-sprite-loader](#rollup-plugin-svg-sprite-loader)
|
8
|
-
- [Table of contents](#table-of-contents)
|
9
|
-
- [Installation](#installation)
|
10
|
-
- [Configuration](#configuration)
|
11
|
-
|
12
|
-
- [
|
13
|
-
- [
|
14
|
-
- [
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
```
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
1
|
+
# rollup-plugin-svg-sprite-loader
|
2
|
+
|
3
|
+
A rollup plugin to create and bundle external svg sprite file.
|
4
|
+
|
5
|
+
## Table of contents
|
6
|
+
|
7
|
+
- [rollup-plugin-svg-sprite-loader](#rollup-plugin-svg-sprite-loader)
|
8
|
+
- [Table of contents](#table-of-contents)
|
9
|
+
- [Installation](#installation)
|
10
|
+
- [Configuration](#configuration)
|
11
|
+
- [Module Config](#module-config)
|
12
|
+
- [`symbolId`](#symbolId)
|
13
|
+
- [`extract`](#extract)
|
14
|
+
- [`pureSprite`](#pureSprite)
|
15
|
+
- [`outputPath`](#outputPath)
|
16
|
+
- [`publicPath`](#publicPath)
|
17
|
+
- [`spriteFilename`](#spriteFilename)
|
18
|
+
- [Svgo Config](#svgo-config)
|
19
|
+
- [`pretty`](#pretty)
|
20
|
+
- [`minify`](#minify)
|
21
|
+
- [Usage](#usage)
|
22
|
+
- [Licence](#licence)
|
23
|
+
|
24
|
+
## Installation
|
25
|
+
|
26
|
+
```bash
|
27
|
+
# via npm
|
28
|
+
npm install rollup-plugin-svg-sprite-loader -D
|
29
|
+
|
30
|
+
# via yarn
|
31
|
+
yarn add rollup-plugin-svg-sprite-loader
|
32
|
+
```
|
33
|
+
|
34
|
+
## Configuration
|
35
|
+
|
36
|
+
## Module Config
|
37
|
+
|
38
|
+
<a id="symbolId"></a>
|
39
|
+
|
40
|
+
### `symbolIdQuery` (string | (filePath: string) => string, default `[name]`)
|
41
|
+
|
42
|
+
Set `<symbol>`attribute `id` , and set `<use>` attribute `id` to `[symbolId]-usage` in extract mode by default.
|
43
|
+
Patterns: `[extname]`, `[dirname]`, `[hash]`, `[name]`
|
44
|
+
|
45
|
+
e.g.:
|
46
|
+
|
47
|
+
```js
|
48
|
+
import svg from "rollup-plugin-svg-sprite-loader"
|
49
|
+
|
50
|
+
rollup({
|
51
|
+
//...
|
52
|
+
plugins: [
|
53
|
+
svg({
|
54
|
+
// custom function
|
55
|
+
symbolIdQuery(filePath) {
|
56
|
+
return `${baseName(filePath, extname(filePath))}-${hash()}`
|
57
|
+
},
|
58
|
+
// pattern
|
59
|
+
symbolIdQuery: "[name][hash]",
|
60
|
+
}),
|
61
|
+
],
|
62
|
+
})
|
63
|
+
```
|
64
|
+
|
65
|
+
<a id="extract"></a>
|
66
|
+
|
67
|
+
### `extract` (boolean, default `false`)
|
68
|
+
|
69
|
+
`true`: Create external sprite file in [`outputPath`](#outputPath)/[`publicPath`](#publicPath), and export `SpriteSymbol<id: string, viewBox: string, url: string, toString(): string>`
|
70
|
+
|
71
|
+
`false`: Inline sprite code and mount it when `DOMContentLoaded` , and export symbol instance `SpriteSymbol<id: string, viewBox: string>`
|
72
|
+
|
73
|
+
<a id="pureSprite"></a>
|
74
|
+
|
75
|
+
### `pureSprite` (boolean, default: `false`)
|
76
|
+
|
77
|
+
`true`: Build sprite file in extract mode without `<styles>` and `<use>`.
|
78
|
+
`false`: Build sprite file in extract mode with `<styles>` and `<use>`.
|
79
|
+
|
80
|
+
<a id="outputPath"></a>
|
81
|
+
|
82
|
+
### `outputPath` (string, default: `"./dist/"`)
|
83
|
+
|
84
|
+
Set bundle file path, should be equal to rollup config `output.dir`.
|
85
|
+
|
86
|
+
<a id="publicPath"></a>
|
87
|
+
|
88
|
+
### `publicPath` (string, default: `"/public/"`)
|
89
|
+
|
90
|
+
Set output path for sprite file which is relative to `outputPath`.
|
91
|
+
|
92
|
+
<a id="spriteFilename"></a>
|
93
|
+
|
94
|
+
### `spriteFilename` (string | (spriteDist: string) => string, default: `"sprite.svg"`)
|
95
|
+
|
96
|
+
Set output sprite filename in extract mode.
|
97
|
+
Patterns: `[dirname]`, `[hash]`
|
98
|
+
|
99
|
+
e.g.:
|
100
|
+
|
101
|
+
```js
|
102
|
+
import svg from "rollup-plugin-svg-sprite-loader"
|
103
|
+
|
104
|
+
rollup({
|
105
|
+
//...
|
106
|
+
plugins: [
|
107
|
+
svg({
|
108
|
+
// custom function
|
109
|
+
spriteFilename(spriteDist) {
|
110
|
+
return `sprite${baseName(filePath).slice(0, 6)}`
|
111
|
+
},
|
112
|
+
// pattern
|
113
|
+
spriteFilename: "sprite[hash].svg",
|
114
|
+
}),
|
115
|
+
],
|
116
|
+
})
|
117
|
+
```
|
118
|
+
|
119
|
+
## Svgo Config
|
120
|
+
|
121
|
+
Options are passed directly to svgo to toggle various svgo plugins. You can find all plugins here: https://github.com/svg/svgo#what-it-can-do
|
122
|
+
|
123
|
+
<a id="pretty"></a>
|
124
|
+
|
125
|
+
### `pretty` (boolean, default: `false`)
|
126
|
+
|
127
|
+
<a id="minify"></a>
|
128
|
+
|
129
|
+
### `minify` (boolean, default: `true`)
|
130
|
+
|
131
|
+
Option `minify` will override option `pretty`.
|
132
|
+
|
133
|
+
## Usage
|
134
|
+
|
135
|
+
```jsx
|
136
|
+
// rollup.config.js
|
137
|
+
import crypto from "crypto"
|
138
|
+
import { baseName, extname } from "path"
|
139
|
+
|
140
|
+
import svgSpriteLoader from "rollup-plugin-svg-sprite-loader"
|
141
|
+
|
142
|
+
const hash = () => crypto.createHash('sha1').update(buffer).digest('hex').substr(0, 16)
|
143
|
+
|
144
|
+
export default {
|
145
|
+
input: "src/index.js",
|
146
|
+
output: {
|
147
|
+
file: "dist/app.js",
|
148
|
+
format: "iife",
|
149
|
+
},
|
150
|
+
plugins: [
|
151
|
+
svgSprite({
|
152
|
+
outputPath: "dist/",
|
153
|
+
publicPath: "./public/",
|
154
|
+
spriteFilename: "sprite[hash]",
|
155
|
+
symbolIdQuery(filePath) {return `${baseName(filePath, extname(filePath))}-${hash()}`},
|
156
|
+
extract: true,
|
157
|
+
}),
|
158
|
+
],
|
159
|
+
}
|
160
|
+
|
161
|
+
// somewhere in your project
|
162
|
+
// extract mode
|
163
|
+
import IconSVG from "./assets/icon/icon.svg"
|
164
|
+
|
165
|
+
const Icon = () => {
|
166
|
+
const { viewBox, url } = IconSVG
|
167
|
+
return (
|
168
|
+
<svg viewBox={viewBox}>
|
169
|
+
<use xlinkHref={url} />
|
170
|
+
</svg>
|
171
|
+
)
|
172
|
+
}
|
173
|
+
|
174
|
+
// inline mode
|
175
|
+
import IconSVG from "./assets/icon/icon.svg"
|
176
|
+
|
177
|
+
const Icon = () => {
|
178
|
+
const { id, viewBox } = IconSVG
|
179
|
+
return (
|
180
|
+
<svg viewBox={viewBox}>
|
181
|
+
<use xlinkHref={`#${id}`>
|
182
|
+
</svg>
|
183
|
+
)
|
184
|
+
}
|
185
|
+
```
|
186
|
+
|
187
|
+
## Licence
|
188
|
+
|
189
|
+
MIT
|
package/dist/index.cjs.js
CHANGED
@@ -9,12 +9,14 @@ var htmlparser2 = require('htmlparser2');
|
|
9
9
|
var domhandler = require('domhandler');
|
10
10
|
var domutils = require('domutils');
|
11
11
|
var render = require('dom-serializer');
|
12
|
+
var crypto = require('crypto');
|
12
13
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
14
15
|
|
15
16
|
var svgo__default = /*#__PURE__*/_interopDefaultLegacy(svgo);
|
16
17
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
17
18
|
var render__default = /*#__PURE__*/_interopDefaultLegacy(render);
|
19
|
+
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
18
20
|
|
19
21
|
/*! *****************************************************************************
|
20
22
|
Copyright (c) Microsoft Corporation.
|
@@ -135,314 +137,361 @@ function __spreadArray(to, from, pack) {
|
|
135
137
|
return to.concat(ar || Array.prototype.slice.call(from));
|
136
138
|
}
|
137
139
|
|
138
|
-
var namespace = {
|
139
|
-
svg: {
|
140
|
-
name: "xmlns",
|
141
|
-
uri: "http://www.w3.org/2000/svg",
|
142
|
-
},
|
143
|
-
xlink: {
|
144
|
-
name: "xmlns:xlink",
|
145
|
-
uri: "http://www.w3.org/1999/xlink",
|
146
|
-
},
|
140
|
+
var namespace = {
|
141
|
+
svg: {
|
142
|
+
name: "xmlns",
|
143
|
+
uri: "http://www.w3.org/2000/svg",
|
144
|
+
},
|
145
|
+
xlink: {
|
146
|
+
name: "xmlns:xlink",
|
147
|
+
uri: "http://www.w3.org/1999/xlink",
|
148
|
+
},
|
147
149
|
};
|
148
150
|
|
149
|
-
var svgReg = /[^/\\*:?"<>|]\.svg$/i;
|
150
|
-
function isSVG(filePath) {
|
151
|
-
if (!filePath) {
|
152
|
-
return false;
|
153
|
-
}
|
154
|
-
return svgReg.test(filePath);
|
151
|
+
var svgReg = /[^/\\*:?"<>|]\.svg$/i;
|
152
|
+
function isSVG(filePath) {
|
153
|
+
if (!filePath) {
|
154
|
+
return false;
|
155
|
+
}
|
156
|
+
return svgReg.test(filePath);
|
155
157
|
}
|
156
158
|
|
157
|
-
var spriteStyleNode = new domhandler.Element("style", {}, [new domhandler.Text(".svg-sprite__symbol{display: none;}.svg-sprite__symbol:target{display: inline;}")], htmlparser2.ElementType.Style);
|
158
|
-
function serializeSymbol(code, id) {
|
159
|
-
var symbol = {
|
160
|
-
content: "",
|
161
|
-
id: "",
|
162
|
-
url: "",
|
163
|
-
viewBox: "",
|
164
|
-
dom: null,
|
165
|
-
};
|
166
|
-
var symbolDom = null;
|
167
|
-
var handler = new domhandler.DomHandler(function (error, dom) {
|
168
|
-
if (error) {
|
169
|
-
throw new Error("Invalid code.");
|
170
|
-
}
|
171
|
-
symbolDom = domutils.findOne(function (node) { return node.tagName === "svg"; }, dom);
|
172
|
-
if (symbolDom) {
|
173
|
-
var _a = symbolDom.attribs, attrsId = _a.id, className = _a.className, viewbox = _a.viewbox;
|
174
|
-
symbolDom.tagName = "symbol";
|
175
|
-
symbolDom.attribs.id = id;
|
176
|
-
symbolDom.attribs.class = (className ? className + " " : "") + "svg-sprite__symbol";
|
177
|
-
symbol.content = render__default["default"](dom);
|
178
|
-
symbol.dom = symbolDom;
|
179
|
-
symbol.id = attrsId || id;
|
180
|
-
symbol.viewBox = viewbox || "";
|
181
|
-
}
|
182
|
-
}, {
|
183
|
-
xmlMode: true,
|
184
|
-
});
|
185
|
-
var parser = new htmlparser2.Parser(handler);
|
186
|
-
if (code) {
|
187
|
-
parser.write(code);
|
188
|
-
}
|
189
|
-
parser.end();
|
190
|
-
return symbol;
|
191
|
-
}
|
192
|
-
function serializeExtractSprite(symbols, options) {
|
193
|
-
var
|
194
|
-
var
|
195
|
-
|
196
|
-
|
197
|
-
domutils.appendChild(
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
}
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
159
|
+
var spriteStyleNode = new domhandler.Element("style", {}, [new domhandler.Text(".svg-sprite__symbol{display: none;}.svg-sprite__symbol:target{display: inline;}")], htmlparser2.ElementType.Style);
|
160
|
+
function serializeSymbol(code, id) {
|
161
|
+
var symbol = {
|
162
|
+
content: "",
|
163
|
+
id: "",
|
164
|
+
url: "",
|
165
|
+
viewBox: "",
|
166
|
+
dom: null,
|
167
|
+
};
|
168
|
+
var symbolDom = null;
|
169
|
+
var handler = new domhandler.DomHandler(function (error, dom) {
|
170
|
+
if (error) {
|
171
|
+
throw new Error("Invalid code.");
|
172
|
+
}
|
173
|
+
symbolDom = domutils.findOne(function (node) { return node.tagName === "svg"; }, dom);
|
174
|
+
if (symbolDom) {
|
175
|
+
var _a = symbolDom.attribs, attrsId = _a.id, className = _a.className, viewbox = _a.viewbox;
|
176
|
+
symbolDom.tagName = "symbol";
|
177
|
+
symbolDom.attribs.id = id;
|
178
|
+
symbolDom.attribs.class = (className ? className + " " : "") + "svg-sprite__symbol";
|
179
|
+
symbol.content = render__default["default"](dom);
|
180
|
+
symbol.dom = symbolDom;
|
181
|
+
symbol.id = attrsId || id;
|
182
|
+
symbol.viewBox = viewbox || "";
|
183
|
+
}
|
184
|
+
}, {
|
185
|
+
xmlMode: true,
|
186
|
+
});
|
187
|
+
var parser = new htmlparser2.Parser(handler);
|
188
|
+
if (code) {
|
189
|
+
parser.write(code);
|
190
|
+
}
|
191
|
+
parser.end();
|
192
|
+
return symbol;
|
193
|
+
}
|
194
|
+
function serializeExtractSprite(symbols, options) {
|
195
|
+
var attrs = options.attrs, pureSprite = options.pureSprite;
|
196
|
+
var spriteDefsNode = new domhandler.Element("defs", {}, [spriteStyleNode]);
|
197
|
+
var spriteNode = new domhandler.Element("svg", attrs, [spriteDefsNode], htmlparser2.ElementType.Tag);
|
198
|
+
symbols.forEach(function (symbol) {
|
199
|
+
domutils.appendChild(spriteDefsNode, symbol.dom);
|
200
|
+
if (!pureSprite) {
|
201
|
+
domutils.appendChild(spriteNode, new domhandler.Element("use", {
|
202
|
+
id: symbol.id + "-usage",
|
203
|
+
"xlink:href": "#" + symbol.id,
|
204
|
+
class: "svg-sprite-symbol",
|
205
|
+
}, [], htmlparser2.ElementType.Tag));
|
206
|
+
}
|
207
|
+
});
|
208
|
+
return render__default["default"](spriteNode, { xmlMode: "foreign" });
|
209
|
+
}
|
210
|
+
function serializeInlineSprite(symbols, options) {
|
211
|
+
var spriteNode = new domhandler.Element("svg", options.attrs, [], htmlparser2.ElementType.Tag);
|
212
|
+
symbols.forEach(function (symbol) {
|
213
|
+
domutils.appendChild(spriteNode, symbol.dom);
|
214
|
+
});
|
215
|
+
return render__default["default"](spriteNode, { xmlMode: "foreign" });
|
211
216
|
}
|
212
217
|
|
213
|
-
var validateReg = /^[^a-zA-Z_$]|(?<=\w)-(?=\w)/g;
|
214
|
-
function exportSymbol(symbol) {
|
215
|
-
if (!symbol) {
|
216
|
-
return { code: "" };
|
217
|
-
}
|
218
|
-
var id = symbol.id, viewBox = symbol.viewBox, url = symbol.url;
|
219
|
-
var
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
218
|
+
var validateReg = /^[^a-zA-Z_$]|(?<=\w)-(?=\w)/g;
|
219
|
+
function exportSymbol(symbol, options) {
|
220
|
+
if (!symbol) {
|
221
|
+
return { code: "" };
|
222
|
+
}
|
223
|
+
var id = symbol.id, viewBox = symbol.viewBox, url = symbol.url;
|
224
|
+
var extract = options.extract, esModule = options.esModule;
|
225
|
+
var spriteVarName = id.replace(validateReg, "_");
|
226
|
+
var content = "const " + spriteVarName + " = {id: \"" + id + "\", viewBox: \"" + viewBox + "\"" + (extract ? ", url: \"" + url + "\", toString() {return this.url}" : "") + "};";
|
227
|
+
var exportModule = esModule
|
228
|
+
? "export { " + spriteVarName + " }; export default " + spriteVarName + ";"
|
229
|
+
: "module.exports = {..." + spriteVarName + "}};";
|
230
|
+
return {
|
231
|
+
code: content + " " + exportModule,
|
232
|
+
};
|
224
233
|
}
|
225
234
|
|
226
|
-
/**
|
227
|
-
* Deep merge sprite options (exclude function and array).
|
228
|
-
*/
|
229
|
-
function mergeOptions(target, source) {
|
230
|
-
if (!source || target === source) {
|
231
|
-
return (target || {});
|
232
|
-
}
|
233
|
-
var destination = __assign({}, source);
|
234
|
-
for (var key in target) {
|
235
|
-
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
236
|
-
var sourceValue = source[key];
|
237
|
-
var targetValue = target[key];
|
238
|
-
if (typeof targetValue === "object") {
|
239
|
-
destination[key] = mergeOptions(targetValue, sourceValue);
|
240
|
-
}
|
241
|
-
else if (typeof targetValue !== "undefined") {
|
242
|
-
destination[key] = targetValue;
|
243
|
-
}
|
244
|
-
}
|
245
|
-
}
|
246
|
-
return destination;
|
235
|
+
/**
|
236
|
+
* Deep merge sprite options (exclude function and array).
|
237
|
+
*/
|
238
|
+
function mergeOptions(target, source) {
|
239
|
+
if (!source || target === source) {
|
240
|
+
return (target || {});
|
241
|
+
}
|
242
|
+
var destination = __assign({}, source);
|
243
|
+
for (var key in target) {
|
244
|
+
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
245
|
+
var sourceValue = source[key];
|
246
|
+
var targetValue = target[key];
|
247
|
+
if (typeof targetValue === "object") {
|
248
|
+
destination[key] = mergeOptions(targetValue, sourceValue);
|
249
|
+
}
|
250
|
+
else if (typeof targetValue !== "undefined") {
|
251
|
+
destination[key] = targetValue;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
return destination;
|
256
|
+
}
|
257
|
+
|
258
|
+
function interpolateName(sourceDir, filePath, buffer, query) {
|
259
|
+
var ext = path.extname(filePath);
|
260
|
+
var name = path.basename(filePath, ext);
|
261
|
+
if (!query) {
|
262
|
+
return name;
|
263
|
+
}
|
264
|
+
var relativeDir = path.relative(sourceDir, path.dirname(filePath));
|
265
|
+
var outputFilename = query
|
266
|
+
.replace(/\[dirname\]/g, relativeDir === "" ? "" : "" + relativeDir + path.sep)
|
267
|
+
.replace(/\[extname\]/g, ext.slice(1))
|
268
|
+
.replace(/\[name\]/g, name);
|
269
|
+
if (/\[hash\]/g.test(outputFilename)) {
|
270
|
+
var hash = crypto__default["default"].createHash("sha1").update(buffer).digest("hex").substr(0, 16);
|
271
|
+
return outputFilename.replace(/\[hash\]/g, hash);
|
272
|
+
}
|
273
|
+
return outputFilename;
|
247
274
|
}
|
248
275
|
|
249
|
-
var _a$1;
|
250
|
-
var svg$1 = namespace.svg, xlink$1 = namespace.xlink;
|
251
|
-
var defaultOptions$1 = {
|
252
|
-
attrs: (_a$1 = {},
|
253
|
-
_a$1[svg$1.name] = svg$1.uri,
|
254
|
-
_a$1[xlink$1.name] = xlink$1.uri,
|
255
|
-
_a$1),
|
256
|
-
|
276
|
+
var _a$1;
|
277
|
+
var svg$1 = namespace.svg, xlink$1 = namespace.xlink;
|
278
|
+
var defaultOptions$1 = {
|
279
|
+
attrs: (_a$1 = {},
|
280
|
+
_a$1[svg$1.name] = svg$1.uri,
|
281
|
+
_a$1[xlink$1.name] = xlink$1.uri,
|
282
|
+
_a$1),
|
283
|
+
pureSprite: false,
|
284
|
+
mode: "extract",
|
257
285
|
};
|
258
286
|
|
259
|
-
var
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
}
|
279
|
-
Sprite.prototype.
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
287
|
+
var _a;
|
288
|
+
var svg = namespace.svg, xlink = namespace.xlink;
|
289
|
+
var defaultOptions = {
|
290
|
+
attrs: (_a = {},
|
291
|
+
_a[svg.name] = svg.uri,
|
292
|
+
_a[xlink.name] = xlink.uri,
|
293
|
+
_a.style = ["position: absolute", "width: 0", "height: 0"].join("; ") + ";",
|
294
|
+
_a["aria-hidden"] = "true",
|
295
|
+
_a),
|
296
|
+
mode: "inline",
|
297
|
+
pureSprite: false,
|
298
|
+
};
|
299
|
+
|
300
|
+
var Sprite = /** @class */ (function () {
|
301
|
+
function Sprite(options) {
|
302
|
+
this.options = mergeOptions(options, defaultOptions$1);
|
303
|
+
this.symbols = new Map();
|
304
|
+
this._content = "";
|
305
|
+
this._updated = true;
|
306
|
+
}
|
307
|
+
Sprite.prototype.add = function (id, symbolData) {
|
308
|
+
var symbol = serializeSymbol(symbolData, id);
|
309
|
+
this.set(id, symbol);
|
310
|
+
return symbol;
|
311
|
+
};
|
312
|
+
Sprite.prototype.set = function (id, symbol) {
|
313
|
+
this._updated = false;
|
314
|
+
return this.symbols.set(id, symbol);
|
315
|
+
};
|
316
|
+
Sprite.prototype.find = function (id) {
|
317
|
+
return this.symbols.get(id) || null;
|
318
|
+
};
|
319
|
+
Sprite.prototype.has = function (id) {
|
320
|
+
return this.symbols.has(id) && !!this.symbols.get(id);
|
321
|
+
};
|
322
|
+
Sprite.prototype.size = function () {
|
323
|
+
return this.symbols.size;
|
324
|
+
};
|
325
|
+
Sprite.prototype.stringify = function () {
|
326
|
+
if (!this._updated) {
|
327
|
+
this._content = serializeExtractSprite(__spreadArray([], __read(this.symbols.values()), false).sort(function (a, b) { return (a.id > b.id ? 1 : -1); }), this.options);
|
328
|
+
this._updated = true;
|
329
|
+
}
|
330
|
+
return this._content;
|
331
|
+
};
|
332
|
+
Sprite.prototype.destroy = function () {
|
333
|
+
this.symbols.clear();
|
334
|
+
this._updated = false;
|
335
|
+
};
|
336
|
+
Sprite.prototype.toString = function () {
|
337
|
+
return this.stringify();
|
338
|
+
};
|
339
|
+
return Sprite;
|
340
|
+
}());
|
341
|
+
var InlineSprite = /** @class */ (function (_super) {
|
342
|
+
__extends(InlineSprite, _super);
|
343
|
+
function InlineSprite(options) {
|
344
|
+
return _super.call(this, mergeOptions(options, defaultOptions)) || this;
|
345
|
+
}
|
346
|
+
InlineSprite.prototype.stringify = function () {
|
347
|
+
return serializeInlineSprite(__spreadArray([], __read(this.symbols.values()), false).sort(function (a, b) { return (a.id > b.id ? 1 : -1); }), this.options);
|
348
|
+
};
|
349
|
+
return InlineSprite;
|
310
350
|
}(Sprite));
|
311
351
|
|
312
|
-
var
|
313
|
-
var
|
314
|
-
|
315
|
-
attrs: (_a = {},
|
316
|
-
_a[svg.name] = svg.uri,
|
317
|
-
_a[xlink.name] = xlink.uri,
|
318
|
-
_a.style = ["position: absolute", "width: 0", "height: 0"].join("; ") + ";",
|
319
|
-
_a["aria-hidden"] = "true",
|
320
|
-
_a),
|
321
|
-
mode: "inline",
|
352
|
+
var inline = function (code, sprite, spriteNodeId, spriteGlobalVarName) {
|
353
|
+
var data = sprite.stringify();
|
354
|
+
return code + "\n;((spriteNodeId, spriteGlobalVarName) => {\n let sprite\n const isSpriteExists = Object.prototype.hasOwnProperty.call(window, spriteGlobalVarName)\n if (isSpriteExists) {\n sprite = window[spriteGlobalVarName]\n } else {\n sprite = `" + data + "`\n window[spriteGlobalVarName] = sprite\n }\n\n const loadSprite = () => {\n let svgSprite = document.getElementById(spriteNodeId)\n if (!svgSprite) {\n svgSprite = document.createElement(\"svg\")\n document.body.prepend(svgSprite)\n }\n svgSprite.outerHTML = sprite\n }\n\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", (e) => {\n loadSprite()\n })\n } else {\n loadSprite()\n }\n})(" + (spriteNodeId !== null && spriteNodeId !== void 0 ? spriteNodeId : "\"__SVG_SPRITE_NODE__\"") + ", " + (spriteGlobalVarName !== null && spriteGlobalVarName !== void 0 ? spriteGlobalVarName : "\"__SVG_SPRITE__\"") + ");";
|
322
355
|
};
|
323
356
|
|
324
|
-
var
|
325
|
-
|
326
|
-
|
357
|
+
var svgoOptions = {
|
358
|
+
js2svg: {
|
359
|
+
indent: 2,
|
360
|
+
},
|
361
|
+
plugins: [
|
362
|
+
{
|
363
|
+
name: "preset-default",
|
364
|
+
params: {
|
365
|
+
overrides: {
|
366
|
+
cleanupIDs: false,
|
367
|
+
removeViewBox: false,
|
368
|
+
},
|
369
|
+
},
|
370
|
+
},
|
371
|
+
"removeDimensions",
|
372
|
+
"removeXMLNS",
|
373
|
+
],
|
327
374
|
};
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
if (extract) {
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
case
|
415
|
-
_a.
|
416
|
-
return [4 /*yield*/, fs.promises.
|
417
|
-
case
|
418
|
-
_a.sent();
|
419
|
-
|
420
|
-
|
421
|
-
case
|
422
|
-
_a.sent();
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
case
|
434
|
-
|
435
|
-
|
436
|
-
case
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
375
|
+
function svgSpriteLoader(options) {
|
376
|
+
if (options === void 0) { options = {}; }
|
377
|
+
var _a = options.minify, minify = _a === void 0 ? true : _a, _b = options.pretty, pretty = _b === void 0 ? false : _b, _c = options.extract, extract = _c === void 0 ? false : _c, _d = options.outputPath, outputPath = _d === void 0 ? "dist/" : _d, _e = options.publicPath, publicPath = _e === void 0 ? "./public/" : _e, _f = options.spriteFilename, spriteFilename = _f === void 0 ? "sprite.svg" : _f, _g = options.pureSprite, pureSprite = _g === void 0 ? false : _g, symbolIdQuery = options.symbolIdQuery, symbolAttrs = options.symbolAttrs, _h = options.esModule, esModule = _h === void 0 ? true : _h, otherOptions = __rest(options, ["minify", "pretty", "extract", "outputPath", "publicPath", "spriteFilename", "pureSprite", "symbolIdQuery", "symbolAttrs", "esModule"]);
|
378
|
+
svgoOptions.js2svg.pretty = pretty && !minify;
|
379
|
+
for (var key in otherOptions) {
|
380
|
+
if (Object.prototype.hasOwnProperty.call(otherOptions, key)) {
|
381
|
+
var params = otherOptions[key];
|
382
|
+
if (params) {
|
383
|
+
svgoOptions.plugins.push({ name: key, params: params });
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}
|
387
|
+
var spriteOptions = { pureSprite: pureSprite, attrs: symbolAttrs };
|
388
|
+
var sprite = extract ? new Sprite(spriteOptions) : new InlineSprite(spriteOptions);
|
389
|
+
var destination = path__default["default"].resolve(outputPath, publicPath);
|
390
|
+
var fallbackOutput = path__default["default"].resolve(destination, "./default");
|
391
|
+
var noImport = true;
|
392
|
+
var spriteSvgName = typeof spriteFilename === "function" ? spriteFilename(destination) : spriteFilename;
|
393
|
+
var shouldInterpolate = extract && /\[hash|dirname|extname|name\]/g.test(spriteSvgName);
|
394
|
+
return {
|
395
|
+
name: "rollup-plugin-svg-sprite-loader",
|
396
|
+
load: function (id) {
|
397
|
+
return __awaiter(this, void 0, void 0, function () {
|
398
|
+
return __generator(this, function (_a) {
|
399
|
+
if (isSVG(id)) {
|
400
|
+
noImport = false;
|
401
|
+
}
|
402
|
+
return [2 /*return*/, null];
|
403
|
+
});
|
404
|
+
});
|
405
|
+
},
|
406
|
+
transform: function (code, id) {
|
407
|
+
return __awaiter(this, void 0, void 0, function () {
|
408
|
+
var data, interpolatedId, symbol;
|
409
|
+
return __generator(this, function (_a) {
|
410
|
+
if (noImport || !isSVG(id)) {
|
411
|
+
return [2 /*return*/, null];
|
412
|
+
}
|
413
|
+
data = svgo__default["default"].optimize(code, svgoOptions).data;
|
414
|
+
interpolatedId = typeof symbolIdQuery === "function" ? symbolIdQuery(id) : interpolateName(outputPath, id, code, symbolIdQuery);
|
415
|
+
symbol = sprite.add(interpolatedId, data);
|
416
|
+
if (extract) {
|
417
|
+
// If filename should be replaced by pattern, then set it to an unused unicode char.
|
418
|
+
symbol.url = path__default["default"]
|
419
|
+
.join(publicPath, (shouldInterpolate ? "\u2764" : spriteFilename) + "#" + symbol.id)
|
420
|
+
.split(path__default["default"].sep)
|
421
|
+
.join(path__default["default"].posix.sep);
|
422
|
+
}
|
423
|
+
return [2 /*return*/, exportSymbol(symbol, { extract: extract, esModule: esModule })];
|
424
|
+
});
|
425
|
+
});
|
426
|
+
},
|
427
|
+
renderChunk: function (code) {
|
428
|
+
return __awaiter(this, void 0, void 0, function () {
|
429
|
+
var data, inlineCode;
|
430
|
+
return __generator(this, function (_a) {
|
431
|
+
if (extract) {
|
432
|
+
if (shouldInterpolate) {
|
433
|
+
data = sprite.stringify();
|
434
|
+
spriteSvgName = interpolateName(outputPath, destination, data, spriteSvgName);
|
435
|
+
return [2 /*return*/, {
|
436
|
+
code: replaceCode(code, /\u2764/g, spriteSvgName),
|
437
|
+
}];
|
438
|
+
}
|
439
|
+
return [2 /*return*/, { code: code }];
|
440
|
+
}
|
441
|
+
inlineCode = inline(code, sprite);
|
442
|
+
return [2 /*return*/, { code: inlineCode }];
|
443
|
+
});
|
444
|
+
});
|
445
|
+
},
|
446
|
+
writeBundle: function () {
|
447
|
+
return __awaiter(this, void 0, void 0, function () {
|
448
|
+
var data, e_1, code;
|
449
|
+
return __generator(this, function (_a) {
|
450
|
+
switch (_a.label) {
|
451
|
+
case 0:
|
452
|
+
if (noImport) {
|
453
|
+
return [2 /*return*/];
|
454
|
+
}
|
455
|
+
data = sprite.stringify();
|
456
|
+
_a.label = 1;
|
457
|
+
case 1:
|
458
|
+
_a.trys.push([1, 5, 9, 10]);
|
459
|
+
if (!extract) return [3 /*break*/, 4];
|
460
|
+
return [4 /*yield*/, fs.promises.mkdir(destination, { recursive: true })];
|
461
|
+
case 2:
|
462
|
+
_a.sent();
|
463
|
+
return [4 /*yield*/, fs.promises.writeFile(path__default["default"].resolve(destination, spriteSvgName), data)];
|
464
|
+
case 3:
|
465
|
+
_a.sent();
|
466
|
+
_a.label = 4;
|
467
|
+
case 4: return [3 /*break*/, 10];
|
468
|
+
case 5:
|
469
|
+
e_1 = _a.sent();
|
470
|
+
code = e_1.code;
|
471
|
+
if (!(code === "ENOENT")) return [3 /*break*/, 8];
|
472
|
+
return [4 /*yield*/, fs.promises.mkdir(fallbackOutput, { recursive: true })];
|
473
|
+
case 6:
|
474
|
+
_a.sent();
|
475
|
+
return [4 /*yield*/, fs.promises.writeFile(path__default["default"].resolve(fallbackOutput, "sprite.svg"), data)];
|
476
|
+
case 7:
|
477
|
+
_a.sent();
|
478
|
+
throw new Error("OutputPath must be a valid directory path.");
|
479
|
+
case 8: throw e_1;
|
480
|
+
case 9:
|
481
|
+
sprite.destroy();
|
482
|
+
return [7 /*endfinally*/];
|
483
|
+
case 10: return [2 /*return*/];
|
484
|
+
}
|
485
|
+
});
|
486
|
+
});
|
487
|
+
},
|
488
|
+
};
|
489
|
+
}
|
490
|
+
function replaceCode(code, source, target) {
|
491
|
+
if (!source || !target) {
|
492
|
+
return code;
|
493
|
+
}
|
494
|
+
return code.replace(source, target);
|
446
495
|
}
|
447
496
|
|
448
497
|
exports["default"] = svgSpriteLoader;
|
package/package.json
CHANGED
@@ -1,70 +1,74 @@
|
|
1
|
-
{
|
2
|
-
"name": "rollup-plugin-svg-sprite-loader",
|
3
|
-
"version": "0.0.
|
4
|
-
"description": "A rollup plugin to create and bundle inline/external svg sprite file.",
|
5
|
-
"main": "dist/index.cjs.js",
|
6
|
-
"module": "dist/index.esm.js",
|
7
|
-
"files": [
|
8
|
-
"./dist"
|
9
|
-
],
|
10
|
-
"directories": {
|
11
|
-
"test": "tests"
|
12
|
-
},
|
13
|
-
"types": "dist/types",
|
14
|
-
"scripts": {
|
15
|
-
"test": "jest",
|
16
|
-
"clear": "rimraf ./dist",
|
17
|
-
"build": "rimraf ./dist && rollup --config rollup.config.ts --configPlugin typescript"
|
18
|
-
},
|
19
|
-
"repository": {
|
20
|
-
"type": "git",
|
21
|
-
"url": "git+https://github.com/nyanyani/rollup-plugin-svg-sprite-loader"
|
22
|
-
},
|
23
|
-
"keywords": [
|
24
|
-
"rollup-plugin",
|
25
|
-
"svg-sprite"
|
26
|
-
],
|
27
|
-
"author": "Nyanyani",
|
28
|
-
"license": "MIT",
|
29
|
-
"bugs": {
|
30
|
-
"url": "https://github.com/nyanyani/rollup-plugin-svg-sprite-loader/issues"
|
31
|
-
},
|
32
|
-
"homepage": "https://github.com/nyanyani/rollup-plugin-svg-sprite-loader#readme",
|
33
|
-
"dependencies": {
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"@babel/
|
44
|
-
"@babel/
|
45
|
-
"@babel/
|
46
|
-
"@
|
47
|
-
"@
|
48
|
-
"@rollup/plugin-
|
49
|
-
"@rollup/plugin-
|
50
|
-
"@rollup/plugin-
|
51
|
-
"@
|
52
|
-
"@
|
53
|
-
"@types/
|
54
|
-
"@types/
|
55
|
-
"@types/
|
56
|
-
"@
|
57
|
-
"@
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"eslint
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
|
70
|
-
|
1
|
+
{
|
2
|
+
"name": "rollup-plugin-svg-sprite-loader",
|
3
|
+
"version": "0.0.2",
|
4
|
+
"description": "A rollup plugin to create and bundle inline/external svg sprite file.",
|
5
|
+
"main": "dist/index.cjs.js",
|
6
|
+
"module": "dist/index.esm.js",
|
7
|
+
"files": [
|
8
|
+
"./dist"
|
9
|
+
],
|
10
|
+
"directories": {
|
11
|
+
"test": "tests"
|
12
|
+
},
|
13
|
+
"types": "dist/types",
|
14
|
+
"scripts": {
|
15
|
+
"test": "jest",
|
16
|
+
"clear": "rimraf ./dist",
|
17
|
+
"build": "rimraf ./dist && rollup --config rollup.config.ts --configPlugin typescript"
|
18
|
+
},
|
19
|
+
"repository": {
|
20
|
+
"type": "git",
|
21
|
+
"url": "git+https://github.com/nyanyani/rollup-plugin-svg-sprite-loader"
|
22
|
+
},
|
23
|
+
"keywords": [
|
24
|
+
"rollup-plugin",
|
25
|
+
"svg-sprite"
|
26
|
+
],
|
27
|
+
"author": "Nyanyani",
|
28
|
+
"license": "MIT",
|
29
|
+
"bugs": {
|
30
|
+
"url": "https://github.com/nyanyani/rollup-plugin-svg-sprite-loader/issues"
|
31
|
+
},
|
32
|
+
"homepage": "https://github.com/nyanyani/rollup-plugin-svg-sprite-loader#readme",
|
33
|
+
"dependencies": {
|
34
|
+
"@commitlint/cli": "^13.2.1",
|
35
|
+
"@commitlint/config-conventional": "^13.2.0",
|
36
|
+
"dom-serializer": "^1.3.2",
|
37
|
+
"domhandler": "^4.2.2",
|
38
|
+
"domutils": "^2.8.0",
|
39
|
+
"htmlparser2": "^7.1.2",
|
40
|
+
"svgo": "^2.7.0"
|
41
|
+
},
|
42
|
+
"devDependencies": {
|
43
|
+
"@babel/core": "^7.15.8",
|
44
|
+
"@babel/plugin-transform-runtime": "^7.15.8",
|
45
|
+
"@babel/plugin-transform-typescript": "^7.15.8",
|
46
|
+
"@babel/preset-env": "^7.15.8",
|
47
|
+
"@babel/preset-typescript": "^7.15.0",
|
48
|
+
"@rollup/plugin-babel": "^5.3.0",
|
49
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
50
|
+
"@rollup/plugin-json": "^4.1.0",
|
51
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
52
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
53
|
+
"@types/babel__plugin-transform-runtime": "^7.9.2",
|
54
|
+
"@types/jest": "^27.0.2",
|
55
|
+
"@types/node": "^16.11.6",
|
56
|
+
"@types/react": "^17.0.33",
|
57
|
+
"@types/svgo": "^2.6.0",
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
59
|
+
"@typescript-eslint/parser": "^5.2.0",
|
60
|
+
"babel-jest": "^27.3.1",
|
61
|
+
"csstype": "^3.0.9",
|
62
|
+
"eslint": "^8.1.0",
|
63
|
+
"eslint-config-prettier": "^8.3.0",
|
64
|
+
"eslint-plugin-jest": "^25.2.2",
|
65
|
+
"husky": "^7.0.4",
|
66
|
+
"jest": "^27.3.1",
|
67
|
+
"rimraf": "^3.0.2",
|
68
|
+
"rollup": "^2.58.3",
|
69
|
+
"ts-jest": "^27.0.7",
|
70
|
+
"ts-node": "^10.4.0",
|
71
|
+
"tslib": "^2.3.1",
|
72
|
+
"typescript": "^4.4.4"
|
73
|
+
}
|
74
|
+
}
|