@iconify/tools 4.0.0-beta.2 → 4.0.0-beta.4
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.cjs +7 -0
- package/lib/download/api/config.d.ts +8 -0
- package/lib/download/api/config.mjs +5 -0
- package/lib/download/api/download.cjs +12 -7
- package/lib/download/api/download.mjs +8 -7
- package/lib/download/api/index.cjs +15 -4
- package/lib/download/api/index.mjs +11 -4
- package/lib/download/api/queue.cjs +102 -0
- package/lib/download/api/queue.d.ts +30 -0
- package/lib/download/api/queue.mjs +99 -0
- package/lib/download/git/index.cjs +1 -3
- package/lib/download/git/index.mjs +1 -3
- package/lib/download/git/reset.cjs +2 -4
- package/lib/download/git/reset.mjs +2 -4
- package/lib/download/github/hash.cjs +2 -0
- package/lib/download/github/hash.mjs +2 -0
- package/lib/download/github/index.cjs +2 -2
- package/lib/download/github/index.mjs +2 -2
- package/lib/download/gitlab/hash.cjs +2 -0
- package/lib/download/gitlab/hash.mjs +2 -0
- package/lib/download/gitlab/index.cjs +2 -2
- package/lib/download/gitlab/index.mjs +2 -2
- package/lib/download/index.cjs +2 -2
- package/lib/download/index.mjs +2 -2
- package/lib/download/npm/index.cjs +2 -2
- package/lib/download/npm/index.mjs +2 -2
- package/lib/import/figma/index.cjs +3 -0
- package/lib/import/figma/index.mjs +3 -0
- package/lib/import/figma/query.cjs +104 -76
- package/lib/import/figma/query.d.ts +15 -2
- package/lib/import/figma/query.mjs +106 -78
- package/lib/index.cjs +4 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.mjs +3 -2
- package/lib/optimise/svgo.cjs +1 -1
- package/lib/optimise/svgo.mjs +1 -1
- package/package.json +13 -5
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const download_api_index = require('../../download/api/index.cjs');
|
|
4
4
|
const download_api_cache = require('../../download/api/cache.cjs');
|
|
5
|
+
const download_api_queue = require('../../download/api/queue.cjs');
|
|
6
|
+
require('axios');
|
|
7
|
+
require('../../download/api/config.cjs');
|
|
5
8
|
require('fs');
|
|
6
9
|
require('crypto');
|
|
7
10
|
require('../../misc/scan.cjs');
|
|
@@ -113,78 +116,92 @@ async function figmaImagesQuery(options, nodes, cache) {
|
|
|
113
116
|
const uri = "https://api.figma.com/v1/images/" + options.file;
|
|
114
117
|
const maxLength = 2048 - uri.length;
|
|
115
118
|
const svgOptions = options.svgOptions || {};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
119
|
+
const query = (ids2) => {
|
|
120
|
+
return new Promise((resolve, reject) => {
|
|
121
|
+
const params = new URLSearchParams({
|
|
122
|
+
ids: ids2.join(","),
|
|
123
|
+
format: "svg"
|
|
124
|
+
});
|
|
125
|
+
if (options.version) {
|
|
126
|
+
params.set("version", options.version);
|
|
127
|
+
}
|
|
128
|
+
if (svgOptions.includeID) {
|
|
129
|
+
params.set("svg_include_id", "true");
|
|
130
|
+
}
|
|
131
|
+
if (svgOptions.simplifyStroke) {
|
|
132
|
+
params.set("svg_simplify_stroke", "true");
|
|
133
|
+
}
|
|
134
|
+
if (svgOptions.useAbsoluteBounds) {
|
|
135
|
+
params.set("use_absolute_bounds", "true");
|
|
136
|
+
}
|
|
137
|
+
download_api_index.sendAPIQuery(
|
|
138
|
+
{
|
|
139
|
+
uri,
|
|
140
|
+
params,
|
|
141
|
+
headers: {
|
|
142
|
+
"X-FIGMA-TOKEN": options.token
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
cache
|
|
146
|
+
).then((data) => {
|
|
147
|
+
if (typeof data === "number") {
|
|
148
|
+
reject(data);
|
|
149
|
+
return;
|
|
143
150
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
const parsedData = JSON.parse(data);
|
|
153
|
-
const images = parsedData.images;
|
|
154
|
-
for (const id in images) {
|
|
155
|
-
const node = nodes.icons[id];
|
|
156
|
-
const target = images[id];
|
|
157
|
-
if (node && target) {
|
|
158
|
-
node.url = target;
|
|
159
|
-
found++;
|
|
151
|
+
let parsedData;
|
|
152
|
+
try {
|
|
153
|
+
parsedData = JSON.parse(data);
|
|
154
|
+
} catch {
|
|
155
|
+
reject("Bad API response");
|
|
156
|
+
return;
|
|
160
157
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
158
|
+
resolve(parsedData);
|
|
159
|
+
}).catch(reject);
|
|
160
|
+
});
|
|
165
161
|
};
|
|
162
|
+
let ids = [];
|
|
163
|
+
let idsLength = 0;
|
|
166
164
|
const allKeys = Object.keys(nodes.icons);
|
|
165
|
+
const queue = [];
|
|
167
166
|
for (let i = 0; i < allKeys.length; i++) {
|
|
168
167
|
const id = allKeys[i];
|
|
169
168
|
ids.push(id);
|
|
170
169
|
idsLength += id.length + 1;
|
|
171
170
|
if (idsLength >= maxLength) {
|
|
172
|
-
|
|
171
|
+
queue.push(ids.slice(0));
|
|
173
172
|
ids = [];
|
|
174
173
|
idsLength = 0;
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
176
|
if (idsLength) {
|
|
178
|
-
|
|
177
|
+
queue.push(ids.slice(0));
|
|
179
178
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
const queryParams = {
|
|
180
|
+
// Params
|
|
181
|
+
total: queue.length,
|
|
182
|
+
callback: (index) => query(queue[index]),
|
|
183
|
+
// Payload to identify failed items in onfail callback
|
|
184
|
+
function: "figmaImagesQuery",
|
|
185
|
+
payload: queue
|
|
186
|
+
};
|
|
187
|
+
const results = await download_api_queue.runConcurrentQueries(queryParams);
|
|
188
|
+
let found = 0;
|
|
189
|
+
results.forEach((data) => {
|
|
190
|
+
if (!data) {
|
|
191
|
+
return;
|
|
187
192
|
}
|
|
193
|
+
const images = data.images;
|
|
194
|
+
for (const id in images) {
|
|
195
|
+
const node = nodes.icons[id];
|
|
196
|
+
const target = images[id];
|
|
197
|
+
if (node && target) {
|
|
198
|
+
node.url = target;
|
|
199
|
+
found++;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
if (!found) {
|
|
204
|
+
throw new Error("No valid icon layers were found");
|
|
188
205
|
}
|
|
189
206
|
nodes.generatedIconsCount = found;
|
|
190
207
|
return nodes;
|
|
@@ -193,32 +210,43 @@ async function figmaDownloadImages(nodes, cache) {
|
|
|
193
210
|
const icons = nodes.icons;
|
|
194
211
|
const ids = Object.keys(icons);
|
|
195
212
|
let count = 0;
|
|
196
|
-
|
|
213
|
+
const filtered = [];
|
|
197
214
|
for (let i = 0; i < ids.length; i++) {
|
|
198
215
|
const id = ids[i];
|
|
199
216
|
const item = icons[id];
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
const result = await download_api_index.sendAPIQuery(
|
|
204
|
-
{
|
|
205
|
-
uri: item.url
|
|
206
|
-
},
|
|
207
|
-
cache
|
|
208
|
-
);
|
|
209
|
-
if (typeof result === "number") {
|
|
210
|
-
lastError = result;
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
if (typeof result === "string") {
|
|
214
|
-
count++;
|
|
215
|
-
item.content = result;
|
|
217
|
+
if (item.url) {
|
|
218
|
+
filtered.push(item);
|
|
216
219
|
}
|
|
217
220
|
}
|
|
221
|
+
const params = {
|
|
222
|
+
// Params
|
|
223
|
+
total: filtered.length,
|
|
224
|
+
callback: (index) => {
|
|
225
|
+
return new Promise((resolve, reject) => {
|
|
226
|
+
const item = filtered[index];
|
|
227
|
+
download_api_index.sendAPIQuery(
|
|
228
|
+
{
|
|
229
|
+
uri: item.url
|
|
230
|
+
},
|
|
231
|
+
cache
|
|
232
|
+
).then((data) => {
|
|
233
|
+
if (typeof data === "string") {
|
|
234
|
+
count++;
|
|
235
|
+
item.content = data;
|
|
236
|
+
resolve(void 0);
|
|
237
|
+
} else {
|
|
238
|
+
reject(data);
|
|
239
|
+
}
|
|
240
|
+
}).catch(reject);
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
// Payload to identify failed items in onfail callback
|
|
244
|
+
function: "figmaDownloadImages",
|
|
245
|
+
payload: filtered
|
|
246
|
+
};
|
|
247
|
+
await download_api_queue.runConcurrentQueries(params);
|
|
218
248
|
if (!count) {
|
|
219
|
-
throw new Error(
|
|
220
|
-
`Error retrieving images${lastError ? ": " + lastError.toString() : ""}`
|
|
221
|
-
);
|
|
249
|
+
throw new Error("Error retrieving images");
|
|
222
250
|
}
|
|
223
251
|
nodes.downloadedIconsCount = count;
|
|
224
252
|
return nodes;
|
|
@@ -2,7 +2,7 @@ import { APICacheOptions } from '../../download/api/types.js';
|
|
|
2
2
|
import { DocumentNotModified } from '../../download/types/modified.js';
|
|
3
3
|
import { FigmaDocument } from './types/api.js';
|
|
4
4
|
import { FigmaIfModifiedSinceOption, FigmaFilesQueryOptions, FigmaImagesQueryOptions } from './types/options.js';
|
|
5
|
-
import { FigmaNodesImportResult } from './types/result.js';
|
|
5
|
+
import { FigmaNodesImportResult, FigmaIconNode } from './types/result.js';
|
|
6
6
|
import '../../icon-set/index.js';
|
|
7
7
|
import '@iconify/types';
|
|
8
8
|
import '@iconify/utils/lib/customisations/defaults';
|
|
@@ -12,6 +12,19 @@ import 'cheerio';
|
|
|
12
12
|
import '@iconify/utils/lib/icon-set/tree';
|
|
13
13
|
import './types/nodes.js';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Extra parameters added to runConcurrentQueries()
|
|
17
|
+
*
|
|
18
|
+
* Can be used to identify failed items in onfail callback
|
|
19
|
+
*/
|
|
20
|
+
interface FigmaIconNodeWithURL extends FigmaIconNode {
|
|
21
|
+
url: string;
|
|
22
|
+
}
|
|
23
|
+
type FigmaConcurrentQueriesParamsFunction = 'figmaImagesQuery' | 'figmaDownloadImages';
|
|
24
|
+
interface FigmaConcurrentQueriesParams<T extends FigmaConcurrentQueriesParamsFunction> {
|
|
25
|
+
function: T;
|
|
26
|
+
payload: T extends 'figmaImagesQuery' ? string[][] : FigmaIconNodeWithURL[];
|
|
27
|
+
}
|
|
15
28
|
/**
|
|
16
29
|
* Get Figma files
|
|
17
30
|
*/
|
|
@@ -26,4 +39,4 @@ declare function figmaImagesQuery(options: FigmaImagesQueryOptions, nodes: Figma
|
|
|
26
39
|
*/
|
|
27
40
|
declare function figmaDownloadImages(nodes: FigmaNodesImportResult, cache?: APICacheOptions): Promise<FigmaNodesImportResult>;
|
|
28
41
|
|
|
29
|
-
export { figmaDownloadImages, figmaFilesQuery, figmaImagesQuery };
|
|
42
|
+
export { FigmaConcurrentQueriesParams, FigmaConcurrentQueriesParamsFunction, figmaDownloadImages, figmaFilesQuery, figmaImagesQuery };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { sendAPIQuery } from '../../download/api/index.mjs';
|
|
2
2
|
import { apiCacheKey, getAPICache, clearAPICache } from '../../download/api/cache.mjs';
|
|
3
|
+
import { runConcurrentQueries } from '../../download/api/queue.mjs';
|
|
4
|
+
import 'axios';
|
|
5
|
+
import '../../download/api/config.mjs';
|
|
3
6
|
import 'fs';
|
|
4
7
|
import 'crypto';
|
|
5
8
|
import '../../misc/scan.mjs';
|
|
@@ -111,78 +114,92 @@ async function figmaImagesQuery(options, nodes, cache) {
|
|
|
111
114
|
const uri = "https://api.figma.com/v1/images/" + options.file;
|
|
112
115
|
const maxLength = 2048 - uri.length;
|
|
113
116
|
const svgOptions = options.svgOptions || {};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
117
|
+
const query = (ids2) => {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const params = new URLSearchParams({
|
|
120
|
+
ids: ids2.join(","),
|
|
121
|
+
format: "svg"
|
|
122
|
+
});
|
|
123
|
+
if (options.version) {
|
|
124
|
+
params.set("version", options.version);
|
|
125
|
+
}
|
|
126
|
+
if (svgOptions.includeID) {
|
|
127
|
+
params.set("svg_include_id", "true");
|
|
128
|
+
}
|
|
129
|
+
if (svgOptions.simplifyStroke) {
|
|
130
|
+
params.set("svg_simplify_stroke", "true");
|
|
131
|
+
}
|
|
132
|
+
if (svgOptions.useAbsoluteBounds) {
|
|
133
|
+
params.set("use_absolute_bounds", "true");
|
|
134
|
+
}
|
|
135
|
+
sendAPIQuery(
|
|
136
|
+
{
|
|
137
|
+
uri,
|
|
138
|
+
params,
|
|
139
|
+
headers: {
|
|
140
|
+
"X-FIGMA-TOKEN": options.token
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
cache
|
|
144
|
+
).then((data) => {
|
|
145
|
+
if (typeof data === "number") {
|
|
146
|
+
reject(data);
|
|
147
|
+
return;
|
|
141
148
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
const parsedData = JSON.parse(data);
|
|
151
|
-
const images = parsedData.images;
|
|
152
|
-
for (const id in images) {
|
|
153
|
-
const node = nodes.icons[id];
|
|
154
|
-
const target = images[id];
|
|
155
|
-
if (node && target) {
|
|
156
|
-
node.url = target;
|
|
157
|
-
found++;
|
|
149
|
+
let parsedData;
|
|
150
|
+
try {
|
|
151
|
+
parsedData = JSON.parse(data);
|
|
152
|
+
} catch {
|
|
153
|
+
reject("Bad API response");
|
|
154
|
+
return;
|
|
158
155
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
156
|
+
resolve(parsedData);
|
|
157
|
+
}).catch(reject);
|
|
158
|
+
});
|
|
163
159
|
};
|
|
160
|
+
let ids = [];
|
|
161
|
+
let idsLength = 0;
|
|
164
162
|
const allKeys = Object.keys(nodes.icons);
|
|
163
|
+
const queue = [];
|
|
165
164
|
for (let i = 0; i < allKeys.length; i++) {
|
|
166
165
|
const id = allKeys[i];
|
|
167
166
|
ids.push(id);
|
|
168
167
|
idsLength += id.length + 1;
|
|
169
168
|
if (idsLength >= maxLength) {
|
|
170
|
-
|
|
169
|
+
queue.push(ids.slice(0));
|
|
171
170
|
ids = [];
|
|
172
171
|
idsLength = 0;
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
if (idsLength) {
|
|
176
|
-
|
|
175
|
+
queue.push(ids.slice(0));
|
|
177
176
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
const queryParams = {
|
|
178
|
+
// Params
|
|
179
|
+
total: queue.length,
|
|
180
|
+
callback: (index) => query(queue[index]),
|
|
181
|
+
// Payload to identify failed items in onfail callback
|
|
182
|
+
function: "figmaImagesQuery",
|
|
183
|
+
payload: queue
|
|
184
|
+
};
|
|
185
|
+
const results = await runConcurrentQueries(queryParams);
|
|
186
|
+
let found = 0;
|
|
187
|
+
results.forEach((data) => {
|
|
188
|
+
if (!data) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const images = data.images;
|
|
192
|
+
for (const id in images) {
|
|
193
|
+
const node = nodes.icons[id];
|
|
194
|
+
const target = images[id];
|
|
195
|
+
if (node && target) {
|
|
196
|
+
node.url = target;
|
|
197
|
+
found++;
|
|
198
|
+
}
|
|
185
199
|
}
|
|
200
|
+
});
|
|
201
|
+
if (!found) {
|
|
202
|
+
throw new Error("No valid icon layers were found");
|
|
186
203
|
}
|
|
187
204
|
nodes.generatedIconsCount = found;
|
|
188
205
|
return nodes;
|
|
@@ -191,32 +208,43 @@ async function figmaDownloadImages(nodes, cache) {
|
|
|
191
208
|
const icons = nodes.icons;
|
|
192
209
|
const ids = Object.keys(icons);
|
|
193
210
|
let count = 0;
|
|
194
|
-
|
|
211
|
+
const filtered = [];
|
|
195
212
|
for (let i = 0; i < ids.length; i++) {
|
|
196
213
|
const id = ids[i];
|
|
197
214
|
const item = icons[id];
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
if (item.url) {
|
|
216
|
+
filtered.push(item);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const params = {
|
|
220
|
+
// Params
|
|
221
|
+
total: filtered.length,
|
|
222
|
+
callback: (index) => {
|
|
223
|
+
return new Promise((resolve, reject) => {
|
|
224
|
+
const item = filtered[index];
|
|
225
|
+
sendAPIQuery(
|
|
226
|
+
{
|
|
227
|
+
uri: item.url
|
|
228
|
+
},
|
|
229
|
+
cache
|
|
230
|
+
).then((data) => {
|
|
231
|
+
if (typeof data === "string") {
|
|
232
|
+
count++;
|
|
233
|
+
item.content = data;
|
|
234
|
+
resolve(void 0);
|
|
235
|
+
} else {
|
|
236
|
+
reject(data);
|
|
237
|
+
}
|
|
238
|
+
}).catch(reject);
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
// Payload to identify failed items in onfail callback
|
|
242
|
+
function: "figmaDownloadImages",
|
|
243
|
+
payload: filtered
|
|
244
|
+
};
|
|
245
|
+
await runConcurrentQueries(params);
|
|
216
246
|
if (!count) {
|
|
217
|
-
throw new Error(
|
|
218
|
-
`Error retrieving images${lastError ? ": " + lastError.toString() : ""}`
|
|
219
|
-
);
|
|
247
|
+
throw new Error("Error retrieving images");
|
|
220
248
|
}
|
|
221
249
|
nodes.downloadedIconsCount = count;
|
|
222
250
|
return nodes;
|
package/lib/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ const download_helpers_untar = require('./download/helpers/untar.cjs');
|
|
|
49
49
|
const misc_exec = require('./misc/exec.cjs');
|
|
50
50
|
const misc_keyword = require('./misc/keyword.cjs');
|
|
51
51
|
const misc_bumpVersion = require('./misc/bump-version.cjs');
|
|
52
|
+
const download_api_config = require('./download/api/config.cjs');
|
|
52
53
|
const download_api_index = require('./download/api/index.cjs');
|
|
53
54
|
require('cheerio');
|
|
54
55
|
require('@iconify/utils');
|
|
@@ -79,10 +80,10 @@ require('./import/figma/query.cjs');
|
|
|
79
80
|
require('./download/api/cache.cjs');
|
|
80
81
|
require('fs');
|
|
81
82
|
require('crypto');
|
|
83
|
+
require('./download/api/queue.cjs');
|
|
84
|
+
require('axios');
|
|
82
85
|
require('pathe');
|
|
83
86
|
require('child_process');
|
|
84
|
-
require('util');
|
|
85
|
-
require('stream');
|
|
86
87
|
require('fs/promises');
|
|
87
88
|
require('extract-zip');
|
|
88
89
|
require('tar');
|
|
@@ -145,4 +146,5 @@ exports.untar = download_helpers_untar.untar;
|
|
|
145
146
|
exports.execAsync = misc_exec.execAsync;
|
|
146
147
|
exports.cleanupIconKeyword = misc_keyword.cleanupIconKeyword;
|
|
147
148
|
exports.bumpVersion = misc_bumpVersion.bumpVersion;
|
|
149
|
+
exports.axiosConfig = download_api_config.axiosConfig;
|
|
148
150
|
exports.sendAPIQuery = download_api_index.sendAPIQuery;
|
package/lib/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export { untar } from './download/helpers/untar.js';
|
|
|
47
47
|
export { execAsync } from './misc/exec.js';
|
|
48
48
|
export { cleanupIconKeyword } from './misc/keyword.js';
|
|
49
49
|
export { bumpVersion } from './misc/bump-version.js';
|
|
50
|
+
export { axiosConfig } from './download/api/config.js';
|
|
50
51
|
export { sendAPIQuery } from './download/api/index.js';
|
|
51
52
|
import 'cheerio';
|
|
52
53
|
import '@iconify/types';
|
|
@@ -72,3 +73,4 @@ import 'svgo';
|
|
|
72
73
|
import './export/helpers/custom-files.js';
|
|
73
74
|
import 'fs';
|
|
74
75
|
import 'child_process';
|
|
76
|
+
import 'axios';
|
package/lib/index.mjs
CHANGED
|
@@ -47,6 +47,7 @@ export { untar } from './download/helpers/untar.mjs';
|
|
|
47
47
|
export { execAsync } from './misc/exec.mjs';
|
|
48
48
|
export { cleanupIconKeyword } from './misc/keyword.mjs';
|
|
49
49
|
export { bumpVersion } from './misc/bump-version.mjs';
|
|
50
|
+
export { axiosConfig } from './download/api/config.mjs';
|
|
50
51
|
export { sendAPIQuery } from './download/api/index.mjs';
|
|
51
52
|
import 'cheerio';
|
|
52
53
|
import '@iconify/utils';
|
|
@@ -77,10 +78,10 @@ import './import/figma/query.mjs';
|
|
|
77
78
|
import './download/api/cache.mjs';
|
|
78
79
|
import 'fs';
|
|
79
80
|
import 'crypto';
|
|
81
|
+
import './download/api/queue.mjs';
|
|
82
|
+
import 'axios';
|
|
80
83
|
import 'pathe';
|
|
81
84
|
import 'child_process';
|
|
82
|
-
import 'util';
|
|
83
|
-
import 'stream';
|
|
84
85
|
import 'fs/promises';
|
|
85
86
|
import 'extract-zip';
|
|
86
87
|
import 'tar';
|
package/lib/optimise/svgo.cjs
CHANGED
|
@@ -30,7 +30,7 @@ function getSVGOPlugins(options) {
|
|
|
30
30
|
...options.animated ? [] : ["removeUselessStrokeAndFill"],
|
|
31
31
|
// Plugins that modify shapes or are bugged when using animations
|
|
32
32
|
...options.animated || options.keepShapes ? [] : [
|
|
33
|
-
// 'removeHiddenElems', // bugged: not working before 3.0.4,
|
|
33
|
+
// 'removeHiddenElems', // bugged: not working before 3.0.4, breaks some icons since 3.0.4
|
|
34
34
|
"convertShapeToPath",
|
|
35
35
|
"convertEllipseToCircle",
|
|
36
36
|
{
|
package/lib/optimise/svgo.mjs
CHANGED
|
@@ -28,7 +28,7 @@ function getSVGOPlugins(options) {
|
|
|
28
28
|
...options.animated ? [] : ["removeUselessStrokeAndFill"],
|
|
29
29
|
// Plugins that modify shapes or are bugged when using animations
|
|
30
30
|
...options.animated || options.keepShapes ? [] : [
|
|
31
|
-
// 'removeHiddenElems', // bugged: not working before 3.0.4,
|
|
31
|
+
// 'removeHiddenElems', // bugged: not working before 3.0.4, breaks some icons since 3.0.4
|
|
32
32
|
"convertShapeToPath",
|
|
33
33
|
"convertEllipseToCircle",
|
|
34
34
|
{
|
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.0.0-beta.
|
|
6
|
+
"version": "4.0.0-beta.4",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"tag": "next"
|
|
9
9
|
},
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@iconify/types": "^2.0.0",
|
|
22
22
|
"@iconify/utils": "^2.1.12",
|
|
23
23
|
"@types/tar": "^6.1.10",
|
|
24
|
+
"axios": "^1.6.2",
|
|
24
25
|
"cheerio": "1.0.0-rc.12",
|
|
25
26
|
"extract-zip": "^2.0.1",
|
|
26
27
|
"local-pkg": "^0.4.3",
|
|
@@ -36,9 +37,7 @@
|
|
|
36
37
|
"cross-env": "^7.0.3",
|
|
37
38
|
"eslint": "^8.54.0",
|
|
38
39
|
"eslint-config-prettier": "^8.10.0",
|
|
39
|
-
"eslint-plugin-jasmine": "^4.1.3",
|
|
40
40
|
"eslint-plugin-prettier": "^4.2.1",
|
|
41
|
-
"jasmine": "^5.1.0",
|
|
42
41
|
"jest": "^29.7.0",
|
|
43
42
|
"prettier": "^2.8.8",
|
|
44
43
|
"rimraf": "^5.0.5",
|
|
@@ -118,6 +117,11 @@
|
|
|
118
117
|
"require": "./lib/download/api/cache.cjs",
|
|
119
118
|
"import": "./lib/download/api/cache.mjs"
|
|
120
119
|
},
|
|
120
|
+
"./lib/download/api/config": {
|
|
121
|
+
"types": "./lib/download/api/config.d.ts",
|
|
122
|
+
"require": "./lib/download/api/config.cjs",
|
|
123
|
+
"import": "./lib/download/api/config.mjs"
|
|
124
|
+
},
|
|
121
125
|
"./lib/download/api/download": {
|
|
122
126
|
"types": "./lib/download/api/download.d.ts",
|
|
123
127
|
"require": "./lib/download/api/download.cjs",
|
|
@@ -133,6 +137,11 @@
|
|
|
133
137
|
"require": "./lib/download/api/index.cjs",
|
|
134
138
|
"import": "./lib/download/api/index.mjs"
|
|
135
139
|
},
|
|
140
|
+
"./lib/download/api/queue": {
|
|
141
|
+
"types": "./lib/download/api/queue.d.ts",
|
|
142
|
+
"require": "./lib/download/api/queue.cjs",
|
|
143
|
+
"import": "./lib/download/api/queue.mjs"
|
|
144
|
+
},
|
|
136
145
|
"./lib/download/api/types": {
|
|
137
146
|
"types": "./lib/download/api/types.d.ts",
|
|
138
147
|
"require": "./lib/download/api/types.cjs",
|
|
@@ -541,8 +550,7 @@
|
|
|
541
550
|
"build": "unbuild",
|
|
542
551
|
"test:jest-cjs": "jest --clearCache --config=jest.config.cjs && jest --runInBand --config=jest.config.cjs",
|
|
543
552
|
"test:jest-esm": "cross-env NODE_OPTIONS=--experimental-vm-modules TEST_REMOTE=false jest --clearCache --config=jest.config.mjs && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest --runInBand --config=jest.config.mjs",
|
|
544
|
-
"test
|
|
545
|
-
"test": "npm run test:jest-cjs && npm run test:jest-esm && npm run test:jasmine",
|
|
553
|
+
"test": "npm run test:jest-cjs && npm run test:jest-esm",
|
|
546
554
|
"test:ci": "cross-env TEST_REMOTE=false npm run test"
|
|
547
555
|
}
|
|
548
556
|
}
|