@iconify/tools 4.1.4 → 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.
- package/lib/download/api/config.d.cts +2 -2
- package/lib/download/api/config.d.mts +2 -2
- package/lib/download/api/config.d.ts +2 -2
- package/lib/download/api/download.cjs +5 -9
- package/lib/download/api/download.mjs +5 -5
- package/lib/download/api/fetch.cjs +12 -0
- package/lib/download/api/fetch.d.cts +10 -0
- package/lib/download/api/fetch.d.mts +10 -0
- package/lib/download/api/fetch.d.ts +10 -0
- package/lib/download/api/fetch.mjs +9 -0
- package/lib/download/api/index.cjs +7 -10
- package/lib/download/api/index.mjs +7 -6
- package/lib/download/git/index.cjs +0 -1
- package/lib/download/git/index.mjs +0 -1
- package/lib/download/git/reset.cjs +0 -1
- package/lib/download/git/reset.mjs +0 -1
- package/lib/download/github/hash.cjs +1 -1
- package/lib/download/github/hash.mjs +1 -1
- package/lib/download/github/index.cjs +1 -1
- package/lib/download/github/index.mjs +1 -1
- package/lib/download/gitlab/hash.cjs +1 -1
- package/lib/download/gitlab/hash.mjs +1 -1
- package/lib/download/gitlab/index.cjs +1 -1
- package/lib/download/gitlab/index.mjs +1 -1
- package/lib/download/index.cjs +1 -1
- package/lib/download/index.mjs +1 -1
- package/lib/download/npm/index.cjs +1 -1
- package/lib/download/npm/index.mjs +1 -1
- package/lib/import/figma/index.cjs +1 -1
- package/lib/import/figma/index.mjs +1 -1
- package/lib/import/figma/query.cjs +1 -1
- package/lib/import/figma/query.mjs +1 -1
- package/lib/index.cjs +2 -1
- package/lib/index.d.cts +2 -1
- package/lib/index.d.mts +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.mjs +1 -1
- package/lib/misc/scan.cjs +2 -2
- package/lib/misc/scan.d.cts +2 -2
- package/lib/misc/scan.d.mts +2 -2
- package/lib/misc/scan.d.ts +2 -2
- package/lib/misc/scan.mjs +2 -2
- package/lib/optimise/flags.cjs +1 -1
- package/lib/optimise/flags.mjs +1 -1
- package/lib/optimise/global-style.cjs +1 -1
- package/lib/optimise/global-style.mjs +1 -1
- package/package.json +21 -17
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
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<
|
|
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 {
|
|
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<
|
|
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 {
|
|
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<
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
19
|
+
const data = await response.arrayBuffer();
|
|
20
20
|
fetchCallbacks.onSuccess?.(url, query);
|
|
21
21
|
await writeFile(target, Buffer.from(data));
|
|
22
22
|
}
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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');
|
|
@@ -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');
|
|
@@ -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
|
|
package/lib/download/index.cjs
CHANGED
|
@@ -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');
|
package/lib/download/index.mjs
CHANGED
|
@@ -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 '
|
|
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 '
|
|
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 '
|
|
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
|
|
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
|
|
82
|
+
} catch {
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
85
|
if (stat.isDirectory()) {
|
package/lib/misc/scan.d.cts
CHANGED
|
@@ -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
|
|
21
|
-
type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult
|
|
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.d.mts
CHANGED
|
@@ -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
|
|
21
|
-
type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult
|
|
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.d.ts
CHANGED
|
@@ -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
|
|
21
|
-
type ScanDirectorySyncCallback = Callback<ScanDirectoryCallbackStringResult
|
|
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
|
|
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
|
|
80
|
+
} catch {
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
83
|
if (stat.isDirectory()) {
|
package/lib/optimise/flags.cjs
CHANGED
package/lib/optimise/flags.mjs
CHANGED
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.
|
|
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,30 +17,29 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@iconify/types": "^2.0.0",
|
|
19
19
|
"@iconify/utils": "^2.3.0",
|
|
20
|
-
"
|
|
21
|
-
"axios": "^1.12.1",
|
|
22
|
-
"cheerio": "1.0.0",
|
|
20
|
+
"cheerio": "^1.1.2",
|
|
23
21
|
"domhandler": "^5.0.3",
|
|
24
22
|
"extract-zip": "^2.0.1",
|
|
25
|
-
"local-pkg": "^
|
|
26
|
-
"pathe": "^
|
|
23
|
+
"local-pkg": "^1.1.2",
|
|
24
|
+
"pathe": "^2.0.3",
|
|
27
25
|
"svgo": "^3.3.2",
|
|
28
|
-
"tar": "^
|
|
26
|
+
"tar": "^7.5.2"
|
|
29
27
|
},
|
|
30
28
|
"devDependencies": {
|
|
31
|
-
"@types/jest": "^
|
|
32
|
-
"@types/node": "^24.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
34
|
-
"@typescript-eslint/parser": "^
|
|
35
|
-
"cross-env": "^
|
|
36
|
-
"eslint": "^
|
|
29
|
+
"@types/jest": "^30.0.0",
|
|
30
|
+
"@types/node": "^24.10.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",
|
|
37
35
|
"eslint-config-prettier": "^10.1.8",
|
|
38
36
|
"eslint-plugin-prettier": "^5.5.4",
|
|
39
|
-
"
|
|
37
|
+
"globals": "^16.5.0",
|
|
38
|
+
"jest": "^30.2.0",
|
|
40
39
|
"prettier": "^3.6.2",
|
|
41
|
-
"rimraf": "^6.
|
|
42
|
-
"ts-jest": "^29.4.
|
|
43
|
-
"typescript": "^5.9.
|
|
40
|
+
"rimraf": "^6.1.2",
|
|
41
|
+
"ts-jest": "^29.4.5",
|
|
42
|
+
"typescript": "^5.9.3",
|
|
44
43
|
"unbuild": "^2.0.0"
|
|
45
44
|
},
|
|
46
45
|
"exports": {
|
|
@@ -125,6 +124,11 @@
|
|
|
125
124
|
"require": "./lib/download/api/download.cjs",
|
|
126
125
|
"import": "./lib/download/api/download.mjs"
|
|
127
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
|
+
},
|
|
128
132
|
"./lib/download/api": {
|
|
129
133
|
"types": "./lib/download/api/index.d.ts",
|
|
130
134
|
"require": "./lib/download/api/index.cjs",
|