@iconify/tools 4.1.5 → 4.2.0

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 (47) hide show
  1. package/lib/download/api/config.d.cts +2 -2
  2. package/lib/download/api/config.d.mts +2 -2
  3. package/lib/download/api/config.d.ts +2 -2
  4. package/lib/download/api/download.cjs +5 -9
  5. package/lib/download/api/download.mjs +5 -5
  6. package/lib/download/api/fetch.cjs +12 -0
  7. package/lib/download/api/fetch.d.cts +10 -0
  8. package/lib/download/api/fetch.d.mts +10 -0
  9. package/lib/download/api/fetch.d.ts +10 -0
  10. package/lib/download/api/fetch.mjs +9 -0
  11. package/lib/download/api/index.cjs +7 -10
  12. package/lib/download/api/index.mjs +7 -6
  13. package/lib/download/git/index.cjs +0 -1
  14. package/lib/download/git/index.mjs +0 -1
  15. package/lib/download/git/reset.cjs +0 -1
  16. package/lib/download/git/reset.mjs +0 -1
  17. package/lib/download/github/hash.cjs +1 -1
  18. package/lib/download/github/hash.mjs +1 -1
  19. package/lib/download/github/index.cjs +1 -1
  20. package/lib/download/github/index.mjs +1 -1
  21. package/lib/download/gitlab/hash.cjs +1 -1
  22. package/lib/download/gitlab/hash.mjs +1 -1
  23. package/lib/download/gitlab/index.cjs +1 -1
  24. package/lib/download/gitlab/index.mjs +1 -1
  25. package/lib/download/index.cjs +1 -1
  26. package/lib/download/index.mjs +1 -1
  27. package/lib/download/npm/index.cjs +1 -1
  28. package/lib/download/npm/index.mjs +1 -1
  29. package/lib/import/figma/index.cjs +1 -1
  30. package/lib/import/figma/index.mjs +1 -1
  31. package/lib/import/figma/query.cjs +1 -1
  32. package/lib/import/figma/query.mjs +1 -1
  33. package/lib/index.cjs +2 -1
  34. package/lib/index.d.cts +2 -1
  35. package/lib/index.d.mts +2 -1
  36. package/lib/index.d.ts +2 -1
  37. package/lib/index.mjs +1 -1
  38. package/lib/misc/scan.cjs +2 -2
  39. package/lib/misc/scan.d.cts +2 -2
  40. package/lib/misc/scan.d.mts +2 -2
  41. package/lib/misc/scan.d.ts +2 -2
  42. package/lib/misc/scan.mjs +2 -2
  43. package/lib/optimise/flags.cjs +1 -1
  44. package/lib/optimise/flags.mjs +1 -1
  45. package/lib/optimise/global-style.cjs +1 -1
  46. package/lib/optimise/global-style.mjs +1 -1
  47. package/package.json +15 -10
@@ -1,10 +1,10 @@
1
- import { AxiosRequestConfig } from 'axios';
1
+ import { RequestOptions } from 'node:http';
2
2
  import { APIQueryParams } from './types.cjs';
3
3
 
4
4
  /**
5
5
  * Axios config, customisable
6
6
  */
7
- declare const axiosConfig: Omit<AxiosRequestConfig, 'headers' | 'responseType' | 'url' | 'method' | 'data'>;
7
+ declare const axiosConfig: Omit<RequestOptions, 'headers' | 'responseType' | 'url' | 'method' | 'data'>;
8
8
  interface AxiosCallbacks {
9
9
  onStart?: (url: string, params: APIQueryParams) => void;
10
10
  onSuccess?: (url: string, params: APIQueryParams) => void;
@@ -1,10 +1,10 @@
1
- import { AxiosRequestConfig } from 'axios';
1
+ import { RequestOptions } from 'node:http';
2
2
  import { APIQueryParams } from './types.mjs';
3
3
 
4
4
  /**
5
5
  * Axios config, customisable
6
6
  */
7
- declare const axiosConfig: Omit<AxiosRequestConfig, 'headers' | 'responseType' | 'url' | 'method' | 'data'>;
7
+ declare const axiosConfig: Omit<RequestOptions, 'headers' | 'responseType' | 'url' | 'method' | 'data'>;
8
8
  interface AxiosCallbacks {
9
9
  onStart?: (url: string, params: APIQueryParams) => void;
10
10
  onSuccess?: (url: string, params: APIQueryParams) => void;
@@ -1,10 +1,10 @@
1
- import { AxiosRequestConfig } from 'axios';
1
+ import { RequestOptions } from 'node:http';
2
2
  import { APIQueryParams } from './types.js';
3
3
 
4
4
  /**
5
5
  * Axios config, customisable
6
6
  */
7
- declare const axiosConfig: Omit<AxiosRequestConfig, 'headers' | 'responseType' | 'url' | 'method' | 'data'>;
7
+ declare const axiosConfig: Omit<RequestOptions, 'headers' | 'responseType' | 'url' | 'method' | 'data'>;
8
8
  interface AxiosCallbacks {
9
9
  onStart?: (url: string, params: APIQueryParams) => void;
10
10
  onSuccess?: (url: string, params: APIQueryParams) => void;
@@ -1,28 +1,24 @@
1
1
  'use strict';
2
2
 
3
- const axios = require('axios');
4
3
  const promises = require('fs/promises');
5
4
  const download_api_config = require('./config.cjs');
6
-
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
8
-
9
- const axios__default = /*#__PURE__*/_interopDefaultCompat(axios);
5
+ const download_api_fetch = require('./fetch.cjs');
10
6
 
11
7
  async function downloadFile(query, target) {
12
8
  const params = query.params ? query.params.toString() : "";
13
9
  const url = query.uri + (params ? "?" + params : "");
14
10
  const headers = query.headers;
15
11
  download_api_config.fetchCallbacks.onStart?.(url, query);
16
- const response = await axios__default.get(url, {
12
+ const fetch = download_api_fetch.getFetch();
13
+ const response = await fetch(url, {
17
14
  ...download_api_config.axiosConfig,
18
- headers,
19
- responseType: "arraybuffer"
15
+ headers
20
16
  });
21
17
  if (response.status !== 200) {
22
18
  download_api_config.fetchCallbacks.onError?.(url, query, response.status);
23
19
  throw new Error(`Error downloading ${url}: ${response.status}`);
24
20
  }
25
- const data = response.data;
21
+ const data = await response.arrayBuffer();
26
22
  download_api_config.fetchCallbacks.onSuccess?.(url, query);
27
23
  await promises.writeFile(target, Buffer.from(data));
28
24
  }
@@ -1,22 +1,22 @@
1
- import axios from 'axios';
2
1
  import { writeFile } from 'fs/promises';
3
2
  import { fetchCallbacks, axiosConfig } from './config.mjs';
3
+ import { getFetch } from './fetch.mjs';
4
4
 
5
5
  async function downloadFile(query, target) {
6
6
  const params = query.params ? query.params.toString() : "";
7
7
  const url = query.uri + (params ? "?" + params : "");
8
8
  const headers = query.headers;
9
9
  fetchCallbacks.onStart?.(url, query);
10
- const response = await axios.get(url, {
10
+ const fetch = getFetch();
11
+ const response = await fetch(url, {
11
12
  ...axiosConfig,
12
- headers,
13
- responseType: "arraybuffer"
13
+ headers
14
14
  });
15
15
  if (response.status !== 200) {
16
16
  fetchCallbacks.onError?.(url, query, response.status);
17
17
  throw new Error(`Error downloading ${url}: ${response.status}`);
18
18
  }
19
- const data = response.data;
19
+ const data = await response.arrayBuffer();
20
20
  fetchCallbacks.onSuccess?.(url, query);
21
21
  await writeFile(target, Buffer.from(data));
22
22
  }
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ let customFetch = fetch;
4
+ function setFetch(fetchFunction) {
5
+ customFetch = fetchFunction;
6
+ }
7
+ function getFetch() {
8
+ return customFetch;
9
+ }
10
+
11
+ exports.getFetch = getFetch;
12
+ exports.setFetch = setFetch;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Set custom fetch function
3
+ */
4
+ declare function setFetch(fetchFunction: typeof fetch): void;
5
+ /**
6
+ * Get fetch function
7
+ */
8
+ declare function getFetch(): typeof fetch;
9
+
10
+ export { getFetch, setFetch };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Set custom fetch function
3
+ */
4
+ declare function setFetch(fetchFunction: typeof fetch): void;
5
+ /**
6
+ * Get fetch function
7
+ */
8
+ declare function getFetch(): typeof fetch;
9
+
10
+ export { getFetch, setFetch };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Set custom fetch function
3
+ */
4
+ declare function setFetch(fetchFunction: typeof fetch): void;
5
+ /**
6
+ * Get fetch function
7
+ */
8
+ declare function getFetch(): typeof fetch;
9
+
10
+ export { getFetch, setFetch };
@@ -0,0 +1,9 @@
1
+ let customFetch = fetch;
2
+ function setFetch(fetchFunction) {
3
+ customFetch = fetchFunction;
4
+ }
5
+ function getFetch() {
6
+ return customFetch;
7
+ }
8
+
9
+ export { getFetch, setFetch };
@@ -1,16 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const axios = require('axios');
4
3
  const download_api_cache = require('./cache.cjs');
5
4
  const download_api_config = require('./config.cjs');
5
+ const download_api_fetch = require('./fetch.cjs');
6
6
  require('fs');
7
7
  require('crypto');
8
8
  require('../../misc/scan.cjs');
9
9
 
10
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
-
12
- const axios__default = /*#__PURE__*/_interopDefaultCompat(axios);
13
-
14
10
  async function sendAPIQuery(query, cache) {
15
11
  const cacheKey = cache ? download_api_cache.apiCacheKey(query) : "";
16
12
  if (cache) {
@@ -38,20 +34,21 @@ async function sendQuery(query) {
38
34
  download_api_config.fetchCallbacks.onError?.(url, query, value);
39
35
  return value ?? 404;
40
36
  }
37
+ const fetch = download_api_fetch.getFetch();
41
38
  try {
42
- const response = await axios__default.get(url, {
39
+ const response = await fetch(url, {
43
40
  ...download_api_config.axiosConfig,
44
- headers,
45
- responseType: "text"
41
+ headers
46
42
  });
47
43
  if (response.status !== 200) {
48
44
  return fail(response.status);
49
45
  }
50
- if (typeof response.data !== "string") {
46
+ const data = await response.text();
47
+ if (typeof data !== "string") {
51
48
  return fail();
52
49
  }
53
50
  download_api_config.fetchCallbacks.onSuccess?.(url, query);
54
- return response.data;
51
+ return data;
55
52
  } catch (err) {
56
53
  return fail();
57
54
  }
@@ -1,6 +1,6 @@
1
- import axios from 'axios';
2
1
  import { apiCacheKey, getAPICache, storeAPICache } from './cache.mjs';
3
2
  import { fetchCallbacks, axiosConfig } from './config.mjs';
3
+ import { getFetch } from './fetch.mjs';
4
4
  import 'fs';
5
5
  import 'crypto';
6
6
  import '../../misc/scan.mjs';
@@ -32,20 +32,21 @@ async function sendQuery(query) {
32
32
  fetchCallbacks.onError?.(url, query, value);
33
33
  return value ?? 404;
34
34
  }
35
+ const fetch = getFetch();
35
36
  try {
36
- const response = await axios.get(url, {
37
+ const response = await fetch(url, {
37
38
  ...axiosConfig,
38
- headers,
39
- responseType: "text"
39
+ headers
40
40
  });
41
41
  if (response.status !== 200) {
42
42
  return fail(response.status);
43
43
  }
44
- if (typeof response.data !== "string") {
44
+ const data = await response.text();
45
+ if (typeof data !== "string") {
45
46
  return fail();
46
47
  }
47
48
  fetchCallbacks.onSuccess?.(url, query);
48
- return response.data;
49
+ return data;
49
50
  } catch (err) {
50
51
  return fail();
51
52
  }
@@ -23,7 +23,6 @@ require('@iconify/utils/lib/icon-set/convert-info');
23
23
  require('../../icon-set/props.cjs');
24
24
  require('@iconify/utils/lib/misc/objects');
25
25
  require('@iconify/utils/lib/colors');
26
- require('axios');
27
26
  require('crypto');
28
27
  require('fs/promises');
29
28
  require('extract-zip');
@@ -21,7 +21,6 @@ import '@iconify/utils/lib/icon-set/convert-info';
21
21
  import '../../icon-set/props.mjs';
22
22
  import '@iconify/utils/lib/misc/objects';
23
23
  import '@iconify/utils/lib/colors';
24
- import 'axios';
25
24
  import 'crypto';
26
25
  import 'fs/promises';
27
26
  import 'extract-zip';
@@ -13,7 +13,6 @@ require('@iconify/utils/lib/icon-set/minify');
13
13
  require('@iconify/utils/lib/icon-set/convert-info');
14
14
  require('../../icon-set/props.cjs');
15
15
  require('@iconify/utils/lib/colors');
16
- require('axios');
17
16
  require('fs');
18
17
  require('crypto');
19
18
  require('pathe');
@@ -11,7 +11,6 @@ import '@iconify/utils/lib/icon-set/minify';
11
11
  import '@iconify/utils/lib/icon-set/convert-info';
12
12
  import '../../icon-set/props.mjs';
13
13
  import '@iconify/utils/lib/colors';
14
- import 'axios';
15
14
  import 'fs';
16
15
  import 'crypto';
17
16
  import 'pathe';
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const download_api_index = require('../api/index.cjs');
4
- require('axios');
5
4
  require('../api/cache.cjs');
6
5
  require('fs');
7
6
  require('crypto');
8
7
  require('../../misc/scan.cjs');
9
8
  require('../api/config.cjs');
9
+ require('../api/fetch.cjs');
10
10
 
11
11
  async function getGitHubRepoHash(options) {
12
12
  const uri = `https://api.github.com/repos/${options.user}/${options.repo}/branches/${options.branch}`;
@@ -1,10 +1,10 @@
1
1
  import { sendAPIQuery } from '../api/index.mjs';
2
- import 'axios';
3
2
  import '../api/cache.mjs';
4
3
  import 'fs';
5
4
  import 'crypto';
6
5
  import '../../misc/scan.mjs';
7
6
  import '../api/config.mjs';
7
+ import '../api/fetch.mjs';
8
8
 
9
9
  async function getGitHubRepoHash(options) {
10
10
  const uri = `https://api.github.com/repos/${options.user}/${options.repo}/branches/${options.branch}`;
@@ -7,11 +7,11 @@ const download_api_download = require('../api/download.cjs');
7
7
  const download_helpers_unzip = require('../helpers/unzip.cjs');
8
8
  require('pathe');
9
9
  require('../api/index.cjs');
10
- require('axios');
11
10
  require('../api/cache.cjs');
12
11
  require('crypto');
13
12
  require('../../misc/scan.cjs');
14
13
  require('../api/config.cjs');
14
+ require('../api/fetch.cjs');
15
15
  require('fs/promises');
16
16
  require('extract-zip');
17
17
 
@@ -5,11 +5,11 @@ import { downloadFile } from '../api/download.mjs';
5
5
  import { unzip } from '../helpers/unzip.mjs';
6
6
  import 'pathe';
7
7
  import '../api/index.mjs';
8
- import 'axios';
9
8
  import '../api/cache.mjs';
10
9
  import 'crypto';
11
10
  import '../../misc/scan.mjs';
12
11
  import '../api/config.mjs';
12
+ import '../api/fetch.mjs';
13
13
  import 'fs/promises';
14
14
  import 'extract-zip';
15
15
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  const download_api_index = require('../api/index.cjs');
4
4
  const download_gitlab_types = require('./types.cjs');
5
- require('axios');
6
5
  require('../api/cache.cjs');
7
6
  require('fs');
8
7
  require('crypto');
9
8
  require('../../misc/scan.cjs');
10
9
  require('../api/config.cjs');
10
+ require('../api/fetch.cjs');
11
11
 
12
12
  async function getGitLabRepoHash(options) {
13
13
  const uri = `${options.uri || download_gitlab_types.defaultGitLabBaseURI}/${options.project}/repository/branches/${options.branch}/`;
@@ -1,11 +1,11 @@
1
1
  import { sendAPIQuery } from '../api/index.mjs';
2
2
  import { defaultGitLabBaseURI } from './types.mjs';
3
- import 'axios';
4
3
  import '../api/cache.mjs';
5
4
  import 'fs';
6
5
  import 'crypto';
7
6
  import '../../misc/scan.mjs';
8
7
  import '../api/config.mjs';
8
+ import '../api/fetch.mjs';
9
9
 
10
10
  async function getGitLabRepoHash(options) {
11
11
  const uri = `${options.uri || defaultGitLabBaseURI}/${options.project}/repository/branches/${options.branch}/`;
@@ -8,11 +8,11 @@ const download_api_download = require('../api/download.cjs');
8
8
  const download_helpers_unzip = require('../helpers/unzip.cjs');
9
9
  require('pathe');
10
10
  require('../api/index.cjs');
11
- require('axios');
12
11
  require('../api/cache.cjs');
13
12
  require('crypto');
14
13
  require('../../misc/scan.cjs');
15
14
  require('../api/config.cjs');
15
+ require('../api/fetch.cjs');
16
16
  require('fs/promises');
17
17
  require('extract-zip');
18
18
 
@@ -6,11 +6,11 @@ import { downloadFile } from '../api/download.mjs';
6
6
  import { unzip } from '../helpers/unzip.mjs';
7
7
  import 'pathe';
8
8
  import '../api/index.mjs';
9
- import 'axios';
10
9
  import '../api/cache.mjs';
11
10
  import 'crypto';
12
11
  import '../../misc/scan.mjs';
13
12
  import '../api/config.mjs';
13
+ import '../api/fetch.mjs';
14
14
  import 'fs/promises';
15
15
  import 'extract-zip';
16
16
 
@@ -9,11 +9,11 @@ require('../export/helpers/prepare.cjs');
9
9
  require('pathe');
10
10
  require('./github/hash.cjs');
11
11
  require('./api/index.cjs');
12
- require('axios');
13
12
  require('./api/cache.cjs');
14
13
  require('crypto');
15
14
  require('../misc/scan.cjs');
16
15
  require('./api/config.cjs');
16
+ require('./api/fetch.cjs');
17
17
  require('./api/download.cjs');
18
18
  require('fs/promises');
19
19
  require('./helpers/unzip.cjs');
@@ -7,11 +7,11 @@ import '../export/helpers/prepare.mjs';
7
7
  import 'pathe';
8
8
  import './github/hash.mjs';
9
9
  import './api/index.mjs';
10
- import 'axios';
11
10
  import './api/cache.mjs';
12
11
  import 'crypto';
13
12
  import '../misc/scan.mjs';
14
13
  import './api/config.mjs';
14
+ import './api/fetch.mjs';
15
15
  import './api/download.mjs';
16
16
  import 'fs/promises';
17
17
  import './helpers/unzip.mjs';
@@ -6,9 +6,9 @@ const download_api_download = require('../api/download.cjs');
6
6
  const download_helpers_untar = require('../helpers/untar.cjs');
7
7
  const download_npm_version = require('./version.cjs');
8
8
  require('pathe');
9
- require('axios');
10
9
  require('fs/promises');
11
10
  require('../api/config.cjs');
11
+ require('../api/fetch.cjs');
12
12
  require('tar');
13
13
  require('../../misc/exec.cjs');
14
14
  require('child_process');
@@ -4,9 +4,9 @@ import { downloadFile } from '../api/download.mjs';
4
4
  import { untar } from '../helpers/untar.mjs';
5
5
  import { getNPMVersion, getPackageVersion } from './version.mjs';
6
6
  import 'pathe';
7
- import 'axios';
8
7
  import 'fs/promises';
9
8
  import '../api/config.mjs';
9
+ import '../api/fetch.mjs';
10
10
  import 'tar';
11
11
  import '../../misc/exec.mjs';
12
12
  import 'child_process';
@@ -34,12 +34,12 @@ require('../../optimise/svgo.cjs');
34
34
  require('svgo');
35
35
  require('@iconify/utils/lib/svg/id');
36
36
  require('../../download/api/index.cjs');
37
- require('axios');
38
37
  require('../../download/api/cache.cjs');
39
38
  require('fs');
40
39
  require('crypto');
41
40
  require('../../misc/scan.cjs');
42
41
  require('../../download/api/config.cjs');
42
+ require('../../download/api/fetch.cjs');
43
43
  require('../../download/api/queue.cjs');
44
44
 
45
45
  async function importFromFigma(options) {
@@ -32,12 +32,12 @@ import '../../optimise/svgo.mjs';
32
32
  import 'svgo';
33
33
  import '@iconify/utils/lib/svg/id';
34
34
  import '../../download/api/index.mjs';
35
- import 'axios';
36
35
  import '../../download/api/cache.mjs';
37
36
  import 'fs';
38
37
  import 'crypto';
39
38
  import '../../misc/scan.mjs';
40
39
  import '../../download/api/config.mjs';
40
+ import '../../download/api/fetch.mjs';
41
41
  import '../../download/api/queue.mjs';
42
42
 
43
43
  async function importFromFigma(options) {
@@ -3,8 +3,8 @@
3
3
  const download_api_index = require('../../download/api/index.cjs');
4
4
  const download_api_cache = require('../../download/api/cache.cjs');
5
5
  const download_api_queue = require('../../download/api/queue.cjs');
6
- require('axios');
7
6
  require('../../download/api/config.cjs');
7
+ require('../../download/api/fetch.cjs');
8
8
  require('fs');
9
9
  require('crypto');
10
10
  require('../../misc/scan.cjs');
@@ -1,8 +1,8 @@
1
1
  import { sendAPIQuery } from '../../download/api/index.mjs';
2
2
  import { apiCacheKey, getAPICache, clearAPICache } from '../../download/api/cache.mjs';
3
3
  import { runConcurrentQueries } from '../../download/api/queue.mjs';
4
- import 'axios';
5
4
  import '../../download/api/config.mjs';
5
+ import '../../download/api/fetch.mjs';
6
6
  import 'fs';
7
7
  import 'crypto';
8
8
  import '../../misc/scan.mjs';
package/lib/index.cjs CHANGED
@@ -51,6 +51,7 @@ const misc_exec = require('./misc/exec.cjs');
51
51
  const misc_keyword = require('./misc/keyword.cjs');
52
52
  const misc_bumpVersion = require('./misc/bump-version.cjs');
53
53
  const download_api_config = require('./download/api/config.cjs');
54
+ const download_api_fetch = require('./download/api/fetch.cjs');
54
55
  const download_api_index = require('./download/api/index.cjs');
55
56
  const download_api_queue = require('./download/api/queue.cjs');
56
57
  require('cheerio');
@@ -81,7 +82,6 @@ require('crypto');
81
82
  require('svgo');
82
83
  require('@iconify/utils/lib/svg/id');
83
84
  require('@iconify/utils/lib/colors');
84
- require('axios');
85
85
  require('pathe');
86
86
  require('fs/promises');
87
87
  require('extract-zip');
@@ -151,6 +151,7 @@ exports.cleanupIconKeyword = misc_keyword.cleanupIconKeyword;
151
151
  exports.bumpVersion = misc_bumpVersion.bumpVersion;
152
152
  exports.axiosConfig = download_api_config.axiosConfig;
153
153
  exports.fetchCallbacks = download_api_config.fetchCallbacks;
154
+ exports.setFetch = download_api_fetch.setFetch;
154
155
  exports.sendAPIQuery = download_api_index.sendAPIQuery;
155
156
  exports.defaultQueueParams = download_api_queue.defaultQueueParams;
156
157
  exports.runConcurrentQueries = download_api_queue.runConcurrentQueries;
package/lib/index.d.cts CHANGED
@@ -49,6 +49,7 @@ export { execAsync } from './misc/exec.cjs';
49
49
  export { cleanupIconKeyword } from './misc/keyword.cjs';
50
50
  export { bumpVersion } from './misc/bump-version.cjs';
51
51
  export { axiosConfig, fetchCallbacks } from './download/api/config.cjs';
52
+ export { setFetch } from './download/api/fetch.cjs';
52
53
  export { sendAPIQuery } from './download/api/index.cjs';
53
54
  export { defaultQueueParams, runConcurrentQueries } from './download/api/queue.cjs';
54
55
  import 'cheerio';
@@ -76,4 +77,4 @@ import 'svgo';
76
77
  import './export/helpers/custom-files.cjs';
77
78
  import 'fs';
78
79
  import 'child_process';
79
- import 'axios';
80
+ import 'node:http';
package/lib/index.d.mts CHANGED
@@ -49,6 +49,7 @@ export { execAsync } from './misc/exec.mjs';
49
49
  export { cleanupIconKeyword } from './misc/keyword.mjs';
50
50
  export { bumpVersion } from './misc/bump-version.mjs';
51
51
  export { axiosConfig, fetchCallbacks } from './download/api/config.mjs';
52
+ export { setFetch } from './download/api/fetch.mjs';
52
53
  export { sendAPIQuery } from './download/api/index.mjs';
53
54
  export { defaultQueueParams, runConcurrentQueries } from './download/api/queue.mjs';
54
55
  import 'cheerio';
@@ -76,4 +77,4 @@ import 'svgo';
76
77
  import './export/helpers/custom-files.mjs';
77
78
  import 'fs';
78
79
  import 'child_process';
79
- import 'axios';
80
+ import 'node:http';
package/lib/index.d.ts CHANGED
@@ -49,6 +49,7 @@ export { execAsync } from './misc/exec.js';
49
49
  export { cleanupIconKeyword } from './misc/keyword.js';
50
50
  export { bumpVersion } from './misc/bump-version.js';
51
51
  export { axiosConfig, fetchCallbacks } from './download/api/config.js';
52
+ export { setFetch } from './download/api/fetch.js';
52
53
  export { sendAPIQuery } from './download/api/index.js';
53
54
  export { defaultQueueParams, runConcurrentQueries } from './download/api/queue.js';
54
55
  import 'cheerio';
@@ -76,4 +77,4 @@ import 'svgo';
76
77
  import './export/helpers/custom-files.js';
77
78
  import 'fs';
78
79
  import 'child_process';
79
- import 'axios';
80
+ import 'node:http';
package/lib/index.mjs CHANGED
@@ -49,6 +49,7 @@ export { execAsync } from './misc/exec.mjs';
49
49
  export { cleanupIconKeyword } from './misc/keyword.mjs';
50
50
  export { bumpVersion } from './misc/bump-version.mjs';
51
51
  export { axiosConfig, fetchCallbacks } from './download/api/config.mjs';
52
+ export { setFetch } from './download/api/fetch.mjs';
52
53
  export { sendAPIQuery } from './download/api/index.mjs';
53
54
  export { defaultQueueParams, runConcurrentQueries } from './download/api/queue.mjs';
54
55
  import 'cheerio';
@@ -79,7 +80,6 @@ import 'crypto';
79
80
  import 'svgo';
80
81
  import '@iconify/utils/lib/svg/id';
81
82
  import '@iconify/utils/lib/colors';
82
- import 'axios';
83
83
  import 'pathe';
84
84
  import 'fs/promises';
85
85
  import 'extract-zip';
package/lib/misc/scan.cjs CHANGED
@@ -33,7 +33,7 @@ async function scanDirectory(path, callback, subdirs = true) {
33
33
  let stat;
34
34
  try {
35
35
  stat = await fs.promises.stat(path + subdir + filename);
36
- } catch (err) {
36
+ } catch {
37
37
  continue;
38
38
  }
39
39
  if (stat.isDirectory()) {
@@ -79,7 +79,7 @@ function scanDirectorySync(path, callback, subdirs = true) {
79
79
  let stat;
80
80
  try {
81
81
  stat = fs.statSync(path + subdir + filename);
82
- } catch (err) {
82
+ } catch {
83
83
  continue;
84
84
  }
85
85
  if (stat.isDirectory()) {
@@ -17,8 +17,8 @@ type ScanDirectoryCallbackFalseResult = boolean | null | undefined;
17
17
  type ScanDirectoryCallbackStringResult = ScanDirectoryCallbackFalseResult | string;
18
18
  type Callback<T> = (ext: string, file: string, subdir: string, path: string, stat: Stats) => T;
19
19
  type AsyncCallback<T> = Callback<T | Promise<T>>;
20
- type ScanDirectoryCallback = AsyncCallback<ScanDirectoryCallbackStringResult | undefined>;
21
- type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult | undefined>;
20
+ type ScanDirectoryCallback = AsyncCallback<ScanDirectoryCallbackStringResult>;
21
+ type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult>;
22
22
  /**
23
23
  * Find all files in directory
24
24
  */
@@ -17,8 +17,8 @@ type ScanDirectoryCallbackFalseResult = boolean | null | undefined;
17
17
  type ScanDirectoryCallbackStringResult = ScanDirectoryCallbackFalseResult | string;
18
18
  type Callback<T> = (ext: string, file: string, subdir: string, path: string, stat: Stats) => T;
19
19
  type AsyncCallback<T> = Callback<T | Promise<T>>;
20
- type ScanDirectoryCallback = AsyncCallback<ScanDirectoryCallbackStringResult | undefined>;
21
- type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult | undefined>;
20
+ type ScanDirectoryCallback = AsyncCallback<ScanDirectoryCallbackStringResult>;
21
+ type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult>;
22
22
  /**
23
23
  * Find all files in directory
24
24
  */
@@ -17,8 +17,8 @@ type ScanDirectoryCallbackFalseResult = boolean | null | undefined;
17
17
  type ScanDirectoryCallbackStringResult = ScanDirectoryCallbackFalseResult | string;
18
18
  type Callback<T> = (ext: string, file: string, subdir: string, path: string, stat: Stats) => T;
19
19
  type AsyncCallback<T> = Callback<T | Promise<T>>;
20
- type ScanDirectoryCallback = AsyncCallback<ScanDirectoryCallbackStringResult | undefined>;
21
- type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult | undefined>;
20
+ type ScanDirectoryCallback = AsyncCallback<ScanDirectoryCallbackStringResult>;
21
+ type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult>;
22
22
  /**
23
23
  * Find all files in directory
24
24
  */
package/lib/misc/scan.mjs CHANGED
@@ -31,7 +31,7 @@ async function scanDirectory(path, callback, subdirs = true) {
31
31
  let stat;
32
32
  try {
33
33
  stat = await promises.stat(path + subdir + filename);
34
- } catch (err) {
34
+ } catch {
35
35
  continue;
36
36
  }
37
37
  if (stat.isDirectory()) {
@@ -77,7 +77,7 @@ function scanDirectorySync(path, callback, subdirs = true) {
77
77
  let stat;
78
78
  try {
79
79
  stat = statSync(path + subdir + filename);
80
- } catch (err) {
80
+ } catch {
81
81
  continue;
82
82
  }
83
83
  if (stat.isDirectory()) {
@@ -247,7 +247,7 @@ function deOptimisePaths(svg) {
247
247
  if (optimised !== d) {
248
248
  item.$element.attr("d", optimised);
249
249
  }
250
- } catch (err) {
250
+ } catch {
251
251
  }
252
252
  }
253
253
  });
@@ -245,7 +245,7 @@ function deOptimisePaths(svg) {
245
245
  if (optimised !== d) {
246
246
  item.$element.attr("d", optimised);
247
247
  }
248
- } catch (err) {
248
+ } catch {
249
249
  }
250
250
  }
251
251
  });
@@ -150,7 +150,7 @@ function cleanupGlobalStyle(svg) {
150
150
  item.$element.removeAttr(tempDataAttrbiute);
151
151
  });
152
152
  }
153
- } catch (err) {
153
+ } catch {
154
154
  svg.load(backup);
155
155
  }
156
156
  }
@@ -148,7 +148,7 @@ function cleanupGlobalStyle(svg) {
148
148
  item.$element.removeAttr(tempDataAttrbiute);
149
149
  });
150
150
  }
151
- } catch (err) {
151
+ } catch {
152
152
  svg.load(backup);
153
153
  }
154
154
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "description": "Collection of functions for cleaning up and parsing SVG for Iconify project",
5
5
  "author": "Vjacheslav Trushkin",
6
- "version": "4.1.5",
6
+ "version": "4.2.0",
7
7
  "license": "MIT",
8
8
  "bugs": "https://github.com/iconify/tools/issues",
9
9
  "homepage": "https://github.com/iconify/tools",
@@ -17,25 +17,25 @@
17
17
  "dependencies": {
18
18
  "@iconify/types": "^2.0.0",
19
19
  "@iconify/utils": "^2.3.0",
20
- "axios": "^1.13.2",
21
20
  "cheerio": "^1.1.2",
22
21
  "domhandler": "^5.0.3",
23
22
  "extract-zip": "^2.0.1",
24
- "local-pkg": "^0.5.1",
25
- "pathe": "^1.1.2",
23
+ "local-pkg": "^1.1.2",
24
+ "pathe": "^2.0.3",
26
25
  "svgo": "^3.3.2",
27
26
  "tar": "^7.5.2"
28
27
  },
29
28
  "devDependencies": {
30
- "@types/jest": "^29.5.14",
29
+ "@types/jest": "^30.0.0",
31
30
  "@types/node": "^24.10.1",
32
- "@typescript-eslint/eslint-plugin": "^6.21.0",
33
- "@typescript-eslint/parser": "^6.21.0",
34
- "cross-env": "^7.0.3",
35
- "eslint": "^8.57.1",
31
+ "@typescript-eslint/eslint-plugin": "^8.48.0",
32
+ "@typescript-eslint/parser": "^8.48.0",
33
+ "cross-env": "^10.1.0",
34
+ "eslint": "^9.39.1",
36
35
  "eslint-config-prettier": "^10.1.8",
37
36
  "eslint-plugin-prettier": "^5.5.4",
38
- "jest": "^29.7.0",
37
+ "globals": "^16.5.0",
38
+ "jest": "^30.2.0",
39
39
  "prettier": "^3.6.2",
40
40
  "rimraf": "^6.1.2",
41
41
  "ts-jest": "^29.4.5",
@@ -124,6 +124,11 @@
124
124
  "require": "./lib/download/api/download.cjs",
125
125
  "import": "./lib/download/api/download.mjs"
126
126
  },
127
+ "./lib/download/api/fetch": {
128
+ "types": "./lib/download/api/fetch.d.ts",
129
+ "require": "./lib/download/api/fetch.cjs",
130
+ "import": "./lib/download/api/fetch.mjs"
131
+ },
127
132
  "./lib/download/api": {
128
133
  "types": "./lib/download/api/index.d.ts",
129
134
  "require": "./lib/download/api/index.cjs",