@shotstack/shotstack-canvas 1.4.3 → 1.4.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.
@@ -315,6 +315,17 @@ function setupWasmInterceptors(wasmBinary) {
315
315
  };
316
316
  }
317
317
  }
318
+ async function importHarfBuzzJS() {
319
+ try {
320
+ const dynamicImport = new Function("specifier", "return import(specifier)");
321
+ return await dynamicImport("harfbuzzjs");
322
+ } catch (err) {
323
+ console.error("Failed to import harfbuzzjs:", err);
324
+ throw new Error(
325
+ `Cannot import harfbuzzjs. This library requires harfbuzzjs to be installed. Error: ${err instanceof Error ? err.message : String(err)}`
326
+ );
327
+ }
328
+ }
318
329
  async function initHB(wasmBaseURL) {
319
330
  if (hbSingleton) return hbSingleton;
320
331
  try {
@@ -331,7 +342,7 @@ async function initHB(wasmBaseURL) {
331
342
  if (!isNode()) {
332
343
  setupWasmInterceptors(wasmBinary);
333
344
  }
334
- const mod = await import("harfbuzzjs");
345
+ const mod = await importHarfBuzzJS();
335
346
  let hb;
336
347
  const candidate = mod.default || mod;
337
348
  if (typeof candidate === "function") {
@@ -276,6 +276,17 @@ function setupWasmInterceptors(wasmBinary) {
276
276
  };
277
277
  }
278
278
  }
279
+ async function importHarfBuzzJS() {
280
+ try {
281
+ const dynamicImport = new Function("specifier", "return import(specifier)");
282
+ return await dynamicImport("harfbuzzjs");
283
+ } catch (err) {
284
+ console.error("Failed to import harfbuzzjs:", err);
285
+ throw new Error(
286
+ `Cannot import harfbuzzjs. This library requires harfbuzzjs to be installed. Error: ${err instanceof Error ? err.message : String(err)}`
287
+ );
288
+ }
289
+ }
279
290
  async function initHB(wasmBaseURL) {
280
291
  if (hbSingleton) return hbSingleton;
281
292
  try {
@@ -292,7 +303,7 @@ async function initHB(wasmBaseURL) {
292
303
  if (!isNode()) {
293
304
  setupWasmInterceptors(wasmBinary);
294
305
  }
295
- const mod = await import("harfbuzzjs");
306
+ const mod = await importHarfBuzzJS();
296
307
  let hb;
297
308
  const candidate = mod.default || mod;
298
309
  if (typeof candidate === "function") {
package/dist/entry.web.js CHANGED
@@ -280,6 +280,17 @@ function setupWasmInterceptors(wasmBinary) {
280
280
  };
281
281
  }
282
282
  }
283
+ async function importHarfBuzzJS() {
284
+ try {
285
+ const dynamicImport = new Function("specifier", "return import(specifier)");
286
+ return await dynamicImport("harfbuzzjs");
287
+ } catch (err) {
288
+ console.error("Failed to import harfbuzzjs:", err);
289
+ throw new Error(
290
+ `Cannot import harfbuzzjs. This library requires harfbuzzjs to be installed. Error: ${err instanceof Error ? err.message : String(err)}`
291
+ );
292
+ }
293
+ }
283
294
  async function initHB(wasmBaseURL) {
284
295
  if (hbSingleton) return hbSingleton;
285
296
  try {
@@ -296,7 +307,7 @@ async function initHB(wasmBaseURL) {
296
307
  if (!isNode()) {
297
308
  setupWasmInterceptors(wasmBinary);
298
309
  }
299
- const mod = await import("harfbuzzjs");
310
+ const mod = await importHarfBuzzJS();
300
311
  let hb;
301
312
  const candidate = mod.default || mod;
302
313
  if (typeof candidate === "function") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/shotstack-canvas",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Text layout & animation engine (HarfBuzz) for Node & Web - fully self-contained.",
5
5
  "type": "module",
6
6
  "main": "./dist/entry.node.cjs",