vite-awesome-svg-loader 3.0.0 → 3.0.1

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 +21 -22
  2. package/index.d.ts +21 -22
  3. package/package.json +1 -1
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)[];
@@ -194,7 +193,7 @@ interface SvgLoaderOptions {
194
193
  * @example
195
194
  *
196
195
  * viteAwesomeSvgLoader({
197
- * skipTransformsList: [/some\/pattern\//, "some/directory", "some/file.svg"],
196
+ * skipTransformsList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
198
197
  * })
199
198
  */
200
199
  skipTransformsList?: (string | RegExp)[];
@@ -232,7 +231,7 @@ interface SvgLoaderOptions {
232
231
  * @example
233
232
  *
234
233
  * viteAwesomeSvgLoader({
235
- * skipFilesList: [/some\/pattern\//, "some/directory", "some/file.svg"],
234
+ * skipFilesList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
236
235
  * })
237
236
  */
238
237
  skipFilesList?: (string | RegExp)[];
@@ -341,7 +340,7 @@ type ColorMap = Record<string, string>;
341
340
  *
342
341
  * @example
343
342
  *
344
- * {
343
+ * const map = {
345
344
  * // Optional list of files to apply replacements to.
346
345
  * files: ["my-file.svg", /icon\-*.\.svg/],
347
346
  *
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)[];
@@ -194,7 +193,7 @@ interface SvgLoaderOptions {
194
193
  * @example
195
194
  *
196
195
  * viteAwesomeSvgLoader({
197
- * skipTransformsList: [/some\/pattern\//, "some/directory", "some/file.svg"],
196
+ * skipTransformsList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
198
197
  * })
199
198
  */
200
199
  skipTransformsList?: (string | RegExp)[];
@@ -232,7 +231,7 @@ interface SvgLoaderOptions {
232
231
  * @example
233
232
  *
234
233
  * viteAwesomeSvgLoader({
235
- * skipFilesList: [/some\/pattern\//, "some/directory", "some/file.svg"],
234
+ * skipFilesList: [new RegExp("some\\/pattern\\/"), "some/directory", "some/file.svg"],
236
235
  * })
237
236
  */
238
237
  skipFilesList?: (string | RegExp)[];
@@ -341,7 +340,7 @@ type ColorMap = Record<string, string>;
341
340
  *
342
341
  * @example
343
342
  *
344
- * {
343
+ * const map = {
345
344
  * // Optional list of files to apply replacements to.
346
345
  * files: ["my-file.svg", /icon\-*.\.svg/],
347
346
  *
package/package.json CHANGED
@@ -27,7 +27,7 @@
27
27
  "vite-awesome-svg-loader",
28
28
  "svgo"
29
29
  ],
30
- "version": "3.0.0",
30
+ "version": "3.0.1",
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",