@figma-export/core
Advanced tools
Comparing version 4.0.1 to 4.2.0
@@ -14,3 +14,3 @@ "use strict"; | ||
const figma_1 = require("./figma"); | ||
const components = ({ token, fileId, version, onlyFromPages = [], transformers = [], outputters = [], concurrency = 30, log = (msg) => { | ||
const components = ({ token, fileId, version, onlyFromPages = [], transformers = [], outputters = [], concurrency = 30, retries = 3, log = (msg) => { | ||
// eslint-disable-next-line no-console | ||
@@ -32,2 +32,3 @@ console.log(msg); | ||
concurrency, | ||
retries, | ||
onFetchCompleted: ({ index, total }) => { | ||
@@ -34,0 +35,0 @@ log(`fetching components ${index}/${total}`); |
@@ -20,2 +20,3 @@ /// <reference types="react" /> | ||
concurrency?: number; | ||
retries?: number; | ||
onFetchCompleted?: (data: { | ||
@@ -26,5 +27,5 @@ index: number; | ||
}; | ||
declare const fileSvgs: (client: Figma.ClientInterface, fileId: string, ids: string[], { concurrency, transformers, onFetchCompleted, }?: FileSvgOptions) => Promise<FigmaExportFileSvg>; | ||
declare const fileSvgs: (client: Figma.ClientInterface, fileId: string, ids: string[], { concurrency, retries, transformers, onFetchCompleted, }?: FileSvgOptions) => Promise<FigmaExportFileSvg>; | ||
declare const enrichPagesWithSvg: (client: Figma.ClientInterface, fileId: string, pages: FigmaExport.PageNode[], svgOptions?: FileSvgOptions | undefined) => Promise<FigmaExport.PageNode[]>; | ||
export { getComponents, getPages, getIdsFromPages, getClient, getImages, fileSvgs, enrichPagesWithSvg, }; | ||
//# sourceMappingURL=figma.d.ts.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -38,2 +42,3 @@ if (k2 === undefined) k2 = k; | ||
const p_limit_1 = __importDefault(require("p-limit")); | ||
const p_retry_1 = __importDefault(require("p-retry")); | ||
const utils_1 = require("./utils"); | ||
@@ -101,3 +106,3 @@ const getComponents = (children = []) => { | ||
exports.getImages = getImages; | ||
const fileSvgs = (client, fileId, ids, { concurrency = 30, transformers = [], | ||
const fileSvgs = (client, fileId, ids, { concurrency = 30, retries = 3, transformers = [], | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
@@ -109,3 +114,3 @@ onFetchCompleted = () => { }, } = {}) => __awaiter(void 0, void 0, void 0, function* () { | ||
const svgPromises = Object.entries(images).map(([id, url]) => __awaiter(void 0, void 0, void 0, function* () { | ||
const svg = yield limit(() => (0, utils_1.fetchAsSvgXml)(url)); | ||
const svg = yield limit(() => (0, p_retry_1.default)(() => (0, utils_1.fetchAsSvgXml)(url), { retries })); | ||
const svgTransformed = yield (0, utils_1.promiseSequentially)(transformers, svg); | ||
@@ -112,0 +117,0 @@ onFetchCompleted({ |
{ | ||
"name": "@figma-export/core", | ||
"version": "4.0.1", | ||
"version": "4.2.0", | ||
"description": "@figma-export core functionalities", | ||
@@ -26,6 +26,7 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@figma-export/types": "^4.0.1", | ||
"axios": "~0.24.0", | ||
"figma-js": "~1.14.0", | ||
"p-limit": "^3.1.0" | ||
"@figma-export/types": "^4.2.0", | ||
"axios": "~0.26.1", | ||
"figma-js": "~1.15.0", | ||
"p-limit": "^3.1.0", | ||
"p-retry": "^4.6.1" | ||
}, | ||
@@ -35,3 +36,3 @@ "engines": { | ||
}, | ||
"gitHead": "f0f6b98b885ee5a8bd1f5b9e61f06f19c6fc2396" | ||
"gitHead": "b0502c1ceedab1c44d262cc7ff028f8057e742ce" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
53172
630
5
+ Addedp-retry@^4.6.1
+ Added@types/retry@0.12.0(transitive)
+ Addedaxios@0.26.1(transitive)
+ Addedfigma-js@1.15.0(transitive)
+ Addedp-retry@4.6.2(transitive)
+ Addedretry@0.13.1(transitive)
- Removedaxios@0.24.0(transitive)
- Removedfigma-js@1.14.0(transitive)
Updated@figma-export/types@^4.2.0
Updatedaxios@~0.26.1
Updatedfigma-js@~1.15.0