rollup-plugin-svg-sprite-loader 0.0.1 → 0.0.2

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.
Files changed (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +189 -95
  3. package/dist/index.cjs.js +340 -291
  4. 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
- - [symbolId (string | function(path, query), default [name])](#symbolid-string--functionpath-query-default-name)
12
- - [symbolRegExp (default '')](#symbolregexp-default-)
13
- - [esModule (default true, auto-configured)](#esmodule-default-true-auto-configured)
14
- - [extract mode](#extract-mode)
15
- - [Usage](#usage)
16
- - [Licence](#licence)
17
-
18
- ## Installation
19
-
20
- ```bash
21
- # via npm
22
- npm install rollup-plugin-svg-sprite-loader -D
23
-
24
- # via yarn
25
- yarn add rollup-plugin-svg-sprite-loader
26
- ```
27
-
28
- ## Configuration
29
-
30
- ### symbolId (string | function(path, query), default [name])
31
-
32
- How `<symbol>` `id` attribute should be named. All patterns from [loader-utils#interpolateName](https://github.com/webpack/loader-utils#interpolatename)
33
- are supported. Also can be a function which accepts 2 args - file path and query string and return symbol id:
34
-
35
- ```js
36
- {
37
- symbolId: (filePath) => path.basename(filePath)
38
- }
39
- ```
40
-
41
- ### symbolRegExp (default '')
42
-
43
- ### esModule (default true, auto-configured)
44
-
45
- ### extract mode
46
-
47
- Extract mode: SpriteSymbol<id: string, viewBox: string, url: string, toString: Function>
48
-
49
- ## Usage
50
-
51
- ```jsx
52
- // rollup.config.js
53
- import svgSpriteLoader from "rollup-plugin-svg-sprite-loader"
54
- export default {
55
- input: "src/index.js",
56
- output: {
57
- file: "dist/app.js",
58
- format: "iife",
59
- },
60
- plugins: [
61
- svgSprite({
62
- outputFolder: "dist/public",
63
- external: true,
64
- }),
65
- ],
66
- }
67
-
68
- // somewhere in your project
69
- // extract mode
70
- import IconSVG from "./assets/icon/icon.svg"
71
-
72
- const Icon = () => {
73
- const { url } = IconSVG
74
- return (
75
- <svg>
76
- <use xlinkHref={url} />
77
- </svg>
78
- )
79
- }
80
-
81
- // inline mode
82
- import IconSVG from "./assets/icon/icon.svg"
83
-
84
- const Icon = () => {
85
- return (
86
- <svg>
87
- <use xlinkHref="#icon">
88
- </svg>
89
- )
90
- }
91
- ```
92
-
93
- ## Licence
94
-
95
- MIT
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 spriteDefsNode = new domhandler.Element("defs", {}, [spriteStyleNode]);
194
- var spriteNode = new domhandler.Element("svg", options.attrs, [spriteDefsNode], htmlparser2.ElementType.Tag);
195
- symbols.forEach(function (symbol) {
196
- domutils.appendChild(spriteDefsNode, symbol.dom);
197
- domutils.appendChild(spriteNode, new domhandler.Element("use", {
198
- id: symbol.id + "-usage",
199
- "xlink:href": "#" + symbol.id,
200
- class: "svg-sprite-symbol",
201
- }, [], htmlparser2.ElementType.Tag));
202
- });
203
- return render__default["default"](spriteNode, { xmlMode: "foreign" });
204
- }
205
- function serializeInlineSprite(symbols, options) {
206
- var spriteNode = new domhandler.Element("svg", options.attrs, [], htmlparser2.ElementType.Tag);
207
- symbols.forEach(function (symbol) {
208
- domutils.appendChild(spriteNode, symbol.dom);
209
- });
210
- return render__default["default"](spriteNode, { xmlMode: "foreign" });
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 spriteVarName = id.replace(validateReg, "_");
220
- return {
221
- // eslint-disable-next-line max-len
222
- code: "export const " + spriteVarName + " = {id: \"" + id + "\", viewBox: \"" + viewBox + "\", url: \"" + url + "\", toString() {return this.url}}; export default " + spriteVarName + ";",
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
- mode: "extract",
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 Sprite = /** @class */ (function () {
260
- function Sprite(options) {
261
- this.options = mergeOptions(options, defaultOptions$1);
262
- this.symbols = new Map();
263
- this._content = "";
264
- this._updated = true;
265
- }
266
- Sprite.prototype.add = function (id, symbolData) {
267
- var filename = path__default["default"].basename(id).slice(0, -4);
268
- var symbol = serializeSymbol(symbolData, filename);
269
- this.set(id, symbol);
270
- return symbol;
271
- };
272
- Sprite.prototype.set = function (id, symbol) {
273
- this._updated = false;
274
- return this.symbols.set(id, symbol);
275
- };
276
- Sprite.prototype.find = function (id) {
277
- return this.symbols.get(id) || null;
278
- };
279
- Sprite.prototype.has = function (id) {
280
- return this.symbols.has(id) && !!this.symbols.get(id);
281
- };
282
- Sprite.prototype.size = function () {
283
- return this.symbols.size;
284
- };
285
- Sprite.prototype.stringify = function () {
286
- if (!this._updated) {
287
- this._content = serializeExtractSprite(__spreadArray([], __read(this.symbols.values()), false).sort(function (a, b) { return (a.id > b.id ? 1 : -1); }), this.options);
288
- this._updated = true;
289
- }
290
- return this._content;
291
- };
292
- Sprite.prototype.destroy = function () {
293
- this.symbols.clear();
294
- this._updated = false;
295
- };
296
- Sprite.prototype.toString = function () {
297
- return this.stringify();
298
- };
299
- return Sprite;
300
- }());
301
- var InlineSprite = /** @class */ (function (_super) {
302
- __extends(InlineSprite, _super);
303
- function InlineSprite(options) {
304
- return _super.call(this, options) || this;
305
- }
306
- InlineSprite.prototype.stringify = function () {
307
- return serializeInlineSprite(__spreadArray([], __read(this.symbols.values()), false).sort(function (a, b) { return (a.id > b.id ? 1 : -1); }), this.options);
308
- };
309
- return InlineSprite;
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 _a;
313
- var svg = namespace.svg, xlink = namespace.xlink;
314
- var defaultOptions = {
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 inline = function (code, sprite, spriteNodeId, spriteGlobalVarName) {
325
- var data = sprite.stringify();
326
- 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__\"") + ")";
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
- var svgoOptions = {
330
- js2svg: {
331
- indent: 2,
332
- },
333
- plugins: [
334
- {
335
- name: "preset-default",
336
- params: {
337
- overrides: {
338
- cleanupIDs: false,
339
- removeViewBox: false,
340
- },
341
- },
342
- },
343
- "removeDimensions",
344
- "removeXMLNS",
345
- ],
346
- };
347
- function svgSpriteLoader(options) {
348
- if (options === void 0) { options = {}; }
349
- var _a = options.minify, minify = _a === void 0 ? false : _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, otherOptions = __rest(options, ["minify", "pretty", "extract", "outputPath", "publicPath", "spriteFilename"]);
350
- svgoOptions.js2svg.pretty = pretty && !minify;
351
- for (var key in otherOptions) {
352
- if (Object.prototype.hasOwnProperty.call(otherOptions, key)) {
353
- var params = otherOptions[key];
354
- if (params) {
355
- svgoOptions.plugins.push({ name: key, params: params });
356
- }
357
- }
358
- }
359
- var sprite = extract ? new Sprite(defaultOptions$1) : new InlineSprite(defaultOptions);
360
- var destination = path__default["default"].resolve(outputPath, publicPath);
361
- var fallbackOutput = path__default["default"].resolve(destination, "./default/defaultOutput.svg");
362
- var noImport = true;
363
- return {
364
- name: "rollup-plugin-svg-sprite-loader",
365
- load: function (id) {
366
- return __awaiter(this, void 0, void 0, function () {
367
- return __generator(this, function (_a) {
368
- if (isSVG(id)) {
369
- noImport = false;
370
- }
371
- return [2 /*return*/, null];
372
- });
373
- });
374
- },
375
- transform: function (code, id) {
376
- return __awaiter(this, void 0, void 0, function () {
377
- var data, symbol;
378
- return __generator(this, function (_a) {
379
- if (noImport || !isSVG(id)) {
380
- return [2 /*return*/, null];
381
- }
382
- data = svgo__default["default"].optimize(code, svgoOptions).data;
383
- symbol = sprite.add(id, data);
384
- if (extract) {
385
- symbol.url = path__default["default"].join(publicPath, spriteFilename + "#" + symbol.id).replace("\\", "\\\\");
386
- }
387
- return [2 /*return*/, exportSymbol(symbol)];
388
- });
389
- });
390
- },
391
- renderChunk: function (code) {
392
- return __awaiter(this, void 0, void 0, function () {
393
- var inlineCode;
394
- return __generator(this, function (_a) {
395
- if (extract) {
396
- return [2 /*return*/, { code: code }];
397
- }
398
- inlineCode = inline(code, sprite);
399
- return [2 /*return*/, { code: inlineCode }];
400
- });
401
- });
402
- },
403
- writeBundle: function () {
404
- return __awaiter(this, void 0, void 0, function () {
405
- var data, e_1, code;
406
- return __generator(this, function (_a) {
407
- switch (_a.label) {
408
- case 0:
409
- if (noImport) {
410
- return [2 /*return*/];
411
- }
412
- data = sprite.stringify();
413
- _a.label = 1;
414
- case 1:
415
- _a.trys.push([1, 5, 9, 10]);
416
- return [4 /*yield*/, fs.promises.mkdir(destination, { recursive: true })];
417
- case 2:
418
- _a.sent();
419
- if (!extract) return [3 /*break*/, 4];
420
- return [4 /*yield*/, fs.promises.writeFile(path__default["default"].resolve(destination, spriteFilename), data)];
421
- case 3:
422
- _a.sent();
423
- _a.label = 4;
424
- case 4: return [3 /*break*/, 10];
425
- case 5:
426
- e_1 = _a.sent();
427
- code = e_1.code;
428
- if (!(code === "ENOENT")) return [3 /*break*/, 8];
429
- return [4 /*yield*/, fs.promises.mkdir(fallbackOutput, { recursive: true })];
430
- case 6:
431
- _a.sent();
432
- return [4 /*yield*/, fs.promises.writeFile(fallbackOutput, data)];
433
- case 7:
434
- _a.sent();
435
- throw new Error("OutputPath must be a valid directory path.");
436
- case 8: throw e_1;
437
- case 9:
438
- sprite.destroy();
439
- return [7 /*endfinally*/];
440
- case 10: return [2 /*return*/];
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.1",
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
- "dom-serializer": "^1.3.2",
35
- "domhandler": "^4.2.2",
36
- "domutils": "^2.8.0",
37
- "htmlparser2": "^7.1.2",
38
- "svgo": "^2.7.0"
39
- },
40
- "devDependencies": {
41
- "@babel/core": "^7.15.8",
42
- "@babel/plugin-transform-runtime": "^7.15.8",
43
- "@babel/plugin-transform-typescript": "^7.15.8",
44
- "@babel/preset-env": "^7.15.8",
45
- "@babel/preset-typescript": "^7.15.0",
46
- "@rollup/plugin-babel": "^5.3.0",
47
- "@rollup/plugin-commonjs": "^21.0.0",
48
- "@rollup/plugin-json": "^4.1.0",
49
- "@rollup/plugin-node-resolve": "^13.0.5",
50
- "@rollup/plugin-typescript": "^8.2.5",
51
- "@types/babel__plugin-transform-runtime": "^7.9.2",
52
- "@types/jest": "^27.0.2",
53
- "@types/node": "^16.10.3",
54
- "@types/react": "^17.0.27",
55
- "@types/svgo": "^2.6.0",
56
- "@typescript-eslint/eslint-plugin": "^5.0.0",
57
- "@typescript-eslint/parser": "^5.0.0",
58
- "babel-jest": "^27.2.4",
59
- "csstype": "^3.0.9",
60
- "eslint": "^8.0.0",
61
- "eslint-config-prettier": "^8.3.0",
62
- "eslint-plugin-jest": "^25.0.5",
63
- "jest": "^27.2.4",
64
- "rimraf": "^3.0.2",
65
- "rollup": "^2.58.0",
66
- "ts-node": "^10.2.1",
67
- "tslib": "^2.3.1",
68
- "typescript": "^4.4.3"
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
+ }