vite-awesome-svg-loader 3.0.0 → 3.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 (3) hide show
  1. package/index.d.mts +23 -26
  2. package/index.d.ts +23 -26
  3. package/package.json +5 -5
package/index.d.mts CHANGED
@@ -5,9 +5,10 @@ import { Plugin } from 'vite';
5
5
  *
6
6
  * **Paths**
7
7
  *
8
- * Both file name and its path relative to the project's root with leading slash will be compared.
8
+ * If an option accepts a path, both file name and the path relative to the project's root with leading slash are
9
+ * compared against the matchers.
9
10
  *
10
- * For example, if you have a file `/src/assets/icons/menu.svg` then following strings will be checked:
11
+ * For example, for a file `/src/assets/icons/menu.svg` following strings will be compared:
11
12
  *
12
13
  * 1. `/assets/icons/menu.svg` - note that it doesn't start with `/src`
13
14
  * 2. `menu.svg`
@@ -16,20 +17,18 @@ import { Plugin } from 'vite';
16
17
  *
17
18
  * Examples:
18
19
  *
19
- * ```js
20
- * plugins: [
21
- * viteReBinSvgLoader({
22
- * preserveLineWidthList: [
23
- * // Recommended formats:
24
- * /\/img\/icons/, // Matches all paths containing "/img/line-art/"
25
- * "/assets/img/logo.svg", // Matches single file "/assets/img/logo.svg".
20
+ * ```ts
21
+ * viteAwesomeSvgLoader({
22
+ * preserveLineWidthList: [
23
+ * // Recommended formats:
24
+ * new RegExp("\\/img\\/icons"), // Matches all paths containing "/img/line-art/"
25
+ * "/assets/img/logo.svg", // Matches single file "/assets/img/logo.svg"
26
26
  *
27
- * // Not recommended formats:
28
- * "splash.svg", // Matches all files named "splash.svg"
29
- * /\/icons\/plus\.svg/, // Matches all paths containing "/icons/plus.svg"
30
- * ],
31
- * }),
32
- * ],
27
+ * // Not recommended formats:
28
+ * "splash.svg", // Matches all files named "splash.svg"
29
+ * new RegExp("\\/icons\\/plus\\.svg", // Matches all paths containing "/icons/plus.svg"
30
+ * ],
31
+ * })
33
32
  * ```
34
33
  */
35
34
  interface SvgLoaderOptions {
@@ -49,7 +48,7 @@ interface SvgLoaderOptions {
49
48
  * @example
50
49
  *
51
50
  * viteAwesomeSvgLoader({
52
- * preserveLineWidthList: [/some\/pattern\//, "some/directory", "some/file.svg"],
51
+ * preserveLineWidthList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
53
52
  * })
54
53
  */
55
54
  preserveLineWidthList?: (string | RegExp)[];
@@ -59,7 +58,7 @@ interface SvgLoaderOptions {
59
58
  * @example
60
59
  *
61
60
  * viteAwesomeSvgLoader({
62
- * skipPreserveLineWidthList: [/some\/pattern\//, "some/directory", "some/file.svg"],
61
+ * skipPreserveLineWidthList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
63
62
  * })
64
63
  */
65
64
  skipPreserveLineWidthList?: (string | RegExp)[];
@@ -117,7 +116,7 @@ interface SvgLoaderOptions {
117
116
  * "some-file.svg",
118
117
  *
119
118
  * // Regexes that are checked against whole path and file name with extension
120
- * /some\/pattern\//,
119
+ * new RegExp("some\\/pattern\\/"),
121
120
  *
122
121
  * // Map of color replacements. Key is an original color, value is its replacement. Both can be any values:
123
122
  * // HEX, name, rgb() or arbitrary custom values. Applied to all files.
@@ -152,7 +151,7 @@ interface SvgLoaderOptions {
152
151
  * @example
153
152
  *
154
153
  * viteAwesomeSvgLoader({
155
- * skipReplaceColorsList: [/some\/pattern\//, "some/directory", "some/file.svg"],
154
+ * skipReplaceColorsList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
156
155
  * })
157
156
  */
158
157
  skipReplaceColorsList?: (string | RegExp)[];
@@ -162,8 +161,7 @@ interface SvgLoaderOptions {
162
161
  *
163
162
  * Can be a list of selectors or selectors-per-files specifiers.
164
163
  *
165
- * **You probably don't need this option.** Think of other ways to solve your problem. "Recipes" section
166
- * in the demos may help you.
164
+ * **You probably don't need this option.** Think about other solutions to your problem. See the demos for the tips.
167
165
  *
168
166
  * **Heavy usage may significantly slow down build time.** Limit selectors to specific files to improve performance.
169
167
  *
@@ -194,7 +192,7 @@ interface SvgLoaderOptions {
194
192
  * @example
195
193
  *
196
194
  * viteAwesomeSvgLoader({
197
- * skipTransformsList: [/some\/pattern\//, "some/directory", "some/file.svg"],
195
+ * skipTransformsList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
198
196
  * })
199
197
  */
200
198
  skipTransformsList?: (string | RegExp)[];
@@ -203,8 +201,7 @@ interface SvgLoaderOptions {
203
201
  *
204
202
  * Can be a list of selectors or selectors-per-files specifiers.
205
203
  *
206
- * **You probably don't need this option.** Think of other ways to solve your problem. "Recipes" section
207
- * in the demos may help you.
204
+ * **You probably don't need this option.** Think about other solutions to your problem. See the demos for the tips.
208
205
  *
209
206
  * **Heavy usage may significantly slow down build time.** Limit selectors to specific files to improve performance.
210
207
  *
@@ -232,7 +229,7 @@ interface SvgLoaderOptions {
232
229
  * @example
233
230
  *
234
231
  * viteAwesomeSvgLoader({
235
- * skipFilesList: [/some\/pattern\//, "some/directory", "some/file.svg"],
232
+ * skipFilesList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
236
233
  * })
237
234
  */
238
235
  skipFilesList?: (string | RegExp)[];
@@ -341,7 +338,7 @@ type ColorMap = Record<string, string>;
341
338
  *
342
339
  * @example
343
340
  *
344
- * {
341
+ * const map = {
345
342
  * // Optional list of files to apply replacements to.
346
343
  * files: ["my-file.svg", /icon\-*.\.svg/],
347
344
  *
package/index.d.ts CHANGED
@@ -5,9 +5,10 @@ import { Plugin } from 'vite';
5
5
  *
6
6
  * **Paths**
7
7
  *
8
- * Both file name and its path relative to the project's root with leading slash will be compared.
8
+ * If an option accepts a path, both file name and the path relative to the project's root with leading slash are
9
+ * compared against the matchers.
9
10
  *
10
- * For example, if you have a file `/src/assets/icons/menu.svg` then following strings will be checked:
11
+ * For example, for a file `/src/assets/icons/menu.svg` following strings will be compared:
11
12
  *
12
13
  * 1. `/assets/icons/menu.svg` - note that it doesn't start with `/src`
13
14
  * 2. `menu.svg`
@@ -16,20 +17,18 @@ import { Plugin } from 'vite';
16
17
  *
17
18
  * Examples:
18
19
  *
19
- * ```js
20
- * plugins: [
21
- * viteReBinSvgLoader({
22
- * preserveLineWidthList: [
23
- * // Recommended formats:
24
- * /\/img\/icons/, // Matches all paths containing "/img/line-art/"
25
- * "/assets/img/logo.svg", // Matches single file "/assets/img/logo.svg".
20
+ * ```ts
21
+ * viteAwesomeSvgLoader({
22
+ * preserveLineWidthList: [
23
+ * // Recommended formats:
24
+ * new RegExp("\\/img\\/icons"), // Matches all paths containing "/img/line-art/"
25
+ * "/assets/img/logo.svg", // Matches single file "/assets/img/logo.svg"
26
26
  *
27
- * // Not recommended formats:
28
- * "splash.svg", // Matches all files named "splash.svg"
29
- * /\/icons\/plus\.svg/, // Matches all paths containing "/icons/plus.svg"
30
- * ],
31
- * }),
32
- * ],
27
+ * // Not recommended formats:
28
+ * "splash.svg", // Matches all files named "splash.svg"
29
+ * new RegExp("\\/icons\\/plus\\.svg", // Matches all paths containing "/icons/plus.svg"
30
+ * ],
31
+ * })
33
32
  * ```
34
33
  */
35
34
  interface SvgLoaderOptions {
@@ -49,7 +48,7 @@ interface SvgLoaderOptions {
49
48
  * @example
50
49
  *
51
50
  * viteAwesomeSvgLoader({
52
- * preserveLineWidthList: [/some\/pattern\//, "some/directory", "some/file.svg"],
51
+ * preserveLineWidthList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
53
52
  * })
54
53
  */
55
54
  preserveLineWidthList?: (string | RegExp)[];
@@ -59,7 +58,7 @@ interface SvgLoaderOptions {
59
58
  * @example
60
59
  *
61
60
  * viteAwesomeSvgLoader({
62
- * skipPreserveLineWidthList: [/some\/pattern\//, "some/directory", "some/file.svg"],
61
+ * skipPreserveLineWidthList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
63
62
  * })
64
63
  */
65
64
  skipPreserveLineWidthList?: (string | RegExp)[];
@@ -117,7 +116,7 @@ interface SvgLoaderOptions {
117
116
  * "some-file.svg",
118
117
  *
119
118
  * // Regexes that are checked against whole path and file name with extension
120
- * /some\/pattern\//,
119
+ * new RegExp("some\\/pattern\\/"),
121
120
  *
122
121
  * // Map of color replacements. Key is an original color, value is its replacement. Both can be any values:
123
122
  * // HEX, name, rgb() or arbitrary custom values. Applied to all files.
@@ -152,7 +151,7 @@ interface SvgLoaderOptions {
152
151
  * @example
153
152
  *
154
153
  * viteAwesomeSvgLoader({
155
- * skipReplaceColorsList: [/some\/pattern\//, "some/directory", "some/file.svg"],
154
+ * skipReplaceColorsList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
156
155
  * })
157
156
  */
158
157
  skipReplaceColorsList?: (string | RegExp)[];
@@ -162,8 +161,7 @@ interface SvgLoaderOptions {
162
161
  *
163
162
  * Can be a list of selectors or selectors-per-files specifiers.
164
163
  *
165
- * **You probably don't need this option.** Think of other ways to solve your problem. "Recipes" section
166
- * in the demos may help you.
164
+ * **You probably don't need this option.** Think about other solutions to your problem. See the demos for the tips.
167
165
  *
168
166
  * **Heavy usage may significantly slow down build time.** Limit selectors to specific files to improve performance.
169
167
  *
@@ -194,7 +192,7 @@ interface SvgLoaderOptions {
194
192
  * @example
195
193
  *
196
194
  * viteAwesomeSvgLoader({
197
- * skipTransformsList: [/some\/pattern\//, "some/directory", "some/file.svg"],
195
+ * skipTransformsList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
198
196
  * })
199
197
  */
200
198
  skipTransformsList?: (string | RegExp)[];
@@ -203,8 +201,7 @@ interface SvgLoaderOptions {
203
201
  *
204
202
  * Can be a list of selectors or selectors-per-files specifiers.
205
203
  *
206
- * **You probably don't need this option.** Think of other ways to solve your problem. "Recipes" section
207
- * in the demos may help you.
204
+ * **You probably don't need this option.** Think about other solutions to your problem. See the demos for the tips.
208
205
  *
209
206
  * **Heavy usage may significantly slow down build time.** Limit selectors to specific files to improve performance.
210
207
  *
@@ -232,7 +229,7 @@ interface SvgLoaderOptions {
232
229
  * @example
233
230
  *
234
231
  * viteAwesomeSvgLoader({
235
- * skipFilesList: [/some\/pattern\//, "some/directory", "some/file.svg"],
232
+ * skipFilesList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
236
233
  * })
237
234
  */
238
235
  skipFilesList?: (string | RegExp)[];
@@ -341,7 +338,7 @@ type ColorMap = Record<string, string>;
341
338
  *
342
339
  * @example
343
340
  *
344
- * {
341
+ * const map = {
345
342
  * // Optional list of files to apply replacements to.
346
343
  * files: ["my-file.svg", /icon\-*.\.svg/],
347
344
  *
package/package.json CHANGED
@@ -5,6 +5,10 @@
5
5
  "vite",
6
6
  "svg",
7
7
  "loader",
8
+ "import",
9
+ "image",
10
+ "icon",
11
+ "plugin",
8
12
  "vite-svg",
9
13
  "vite-loader",
10
14
  "vite-plugin",
@@ -15,11 +19,7 @@
15
19
  "sprite-sheet",
16
20
  "svg-sprite",
17
21
  "sprites",
18
- "svg-sprites",
19
- "spritesheet",
20
22
  "sprite-sheets",
21
- "svg-spritesheets",
22
- "svg-sprite-sheets",
23
23
  "preserve-line-width",
24
24
  "preserve-stroke-width",
25
25
  "currentColor",
@@ -27,7 +27,7 @@
27
27
  "vite-awesome-svg-loader",
28
28
  "svgo"
29
29
  ],
30
- "version": "3.0.0",
30
+ "version": "3.0.2",
31
31
  "homepage": "https://matafokka.github.io/vite-awesome-svg-loader",
32
32
  "repository": "https://github.com/matafokka/vite-awesome-svg-loader",
33
33
  "license": "LGPL-2.1-or-later",