From b5461276536239cf865122dae67b1fbdf067e1ae Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Sat, 30 Jul 2022 18:01:20 +0200 Subject: [PATCH] Revert "Don't limit to a concurrency of 1 now that harfbuzzjs auto-grows the wasm heap" Whoops, this breaks the subfont test suite. This reverts commit e09399546948a49cba9702fb29108b607b74bd7b. --- index.js | 7 +++++-- package.json | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 3437c87..61244b6 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,7 @@ const loadAndInitializeHarfbuzz = _.once(async () => { return [exports, heapu8]; }); -module.exports = async function subsetFont( +async function subsetFont( originalFont, text, { targetFormat = fontverter.detectFormat(originalFont), preserveNameIds } = {} @@ -113,4 +113,7 @@ module.exports = async function subsetFont( exports.free(fontBuffer); return await fontverter.convert(subsetFont, targetFormat, 'truetype'); -}; +} + +const limiter = require('p-limit')(1); +module.exports = (...args) => limiter(() => subsetFont(...args)); diff --git a/package.json b/package.json index 413e9e1..3315377 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dependencies": { "fontverter": "^2.0.0", "harfbuzzjs": "^0.3.0", - "lodash": "^4.17.21" + "lodash": "^4.17.21", + "p-limit": "^3.1.0" }, "devDependencies": { "coveralls": "^3.0.2",