@shotstack/shotstack-canvas 1.9.0 → 1.9.2

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.
@@ -346,6 +346,10 @@ function setupWasmInterceptors(wasmBinary) {
346
346
  if (bufferSourceOrModule instanceof WebAssembly.Module) {
347
347
  return originalInstantiate.call(WebAssembly, bufferSourceOrModule, importObject);
348
348
  }
349
+ const inputSize = bufferSourceOrModule instanceof ArrayBuffer ? bufferSourceOrModule.byteLength : bufferSourceOrModule.byteLength;
350
+ if (inputSize !== wasmBinary.byteLength) {
351
+ return originalInstantiate.call(WebAssembly, bufferSourceOrModule, importObject);
352
+ }
349
353
  const module2 = await WebAssembly.compile(wasmBinary);
350
354
  const instance = await originalInstantiate.call(
351
355
  WebAssembly,
@@ -367,9 +371,7 @@ function setupWasmInterceptors(wasmBinary) {
367
371
  }
368
372
  return originalInstantiateStreaming.call(WebAssembly, response, importObject);
369
373
  } catch (err) {
370
- const module2 = await WebAssembly.compile(wasmBinary);
371
- const instance = await WebAssembly.instantiate(module2, importObject);
372
- return { module: module2, instance };
374
+ throw err;
373
375
  }
374
376
  };
375
377
  }
@@ -640,19 +642,12 @@ var FontRegistry = class _FontRegistry {
640
642
  if (!this.colorEmojiFontBytes.has(desc.family)) {
641
643
  this.colorEmojiFontBytes.set(desc.family, bytes.slice(0));
642
644
  }
643
- console.log(`\u{1F3A8} Registered color emoji font: ${desc.family}`);
644
645
  }
645
646
  if (fkFont.variationAxes && Object.keys(fkFont.variationAxes).length > 0) {
646
647
  const variationFont = fkFont.getVariation({ wght: weightNum });
647
648
  this.fontkitFonts.set(k, variationFont);
648
- if (!isColorEmojiFont) {
649
- console.log(`\u2705 Registered variable font: ${desc.family} weight=${weightNum}`);
650
- }
651
649
  } else {
652
650
  this.fontkitFonts.set(k, fkFont);
653
- if (!isColorEmojiFont) {
654
- console.log(`\u2705 Registered static font: ${desc.family}`);
655
- }
656
651
  }
657
652
  } catch (err) {
658
653
  console.warn(`\u26A0\uFE0F Fontkit failed for ${desc.family}:`, err);
@@ -743,9 +738,6 @@ var FontRegistry = class _FontRegistry {
743
738
  try {
744
739
  const variationFont = baseFkFont.getVariation({ wght: targetWeightNum });
745
740
  this.fontkitFonts.set(k, variationFont);
746
- console.log(
747
- `\u2705 Derived variable font: ${targetFamily} weight=${targetWeightNum} from existing registration`
748
- );
749
741
  } catch (err) {
750
742
  this.fontkitFonts.set(k, baseFkFont);
751
743
  console.warn(`\u26A0\uFE0F Could not apply weight variation, using base font for ${targetFamily}`);
@@ -302,6 +302,10 @@ function setupWasmInterceptors(wasmBinary) {
302
302
  if (bufferSourceOrModule instanceof WebAssembly.Module) {
303
303
  return originalInstantiate.call(WebAssembly, bufferSourceOrModule, importObject);
304
304
  }
305
+ const inputSize = bufferSourceOrModule instanceof ArrayBuffer ? bufferSourceOrModule.byteLength : bufferSourceOrModule.byteLength;
306
+ if (inputSize !== wasmBinary.byteLength) {
307
+ return originalInstantiate.call(WebAssembly, bufferSourceOrModule, importObject);
308
+ }
305
309
  const module = await WebAssembly.compile(wasmBinary);
306
310
  const instance = await originalInstantiate.call(
307
311
  WebAssembly,
@@ -323,9 +327,7 @@ function setupWasmInterceptors(wasmBinary) {
323
327
  }
324
328
  return originalInstantiateStreaming.call(WebAssembly, response, importObject);
325
329
  } catch (err) {
326
- const module = await WebAssembly.compile(wasmBinary);
327
- const instance = await WebAssembly.instantiate(module, importObject);
328
- return { module, instance };
330
+ throw err;
329
331
  }
330
332
  };
331
333
  }
@@ -596,19 +598,12 @@ var FontRegistry = class _FontRegistry {
596
598
  if (!this.colorEmojiFontBytes.has(desc.family)) {
597
599
  this.colorEmojiFontBytes.set(desc.family, bytes.slice(0));
598
600
  }
599
- console.log(`\u{1F3A8} Registered color emoji font: ${desc.family}`);
600
601
  }
601
602
  if (fkFont.variationAxes && Object.keys(fkFont.variationAxes).length > 0) {
602
603
  const variationFont = fkFont.getVariation({ wght: weightNum });
603
604
  this.fontkitFonts.set(k, variationFont);
604
- if (!isColorEmojiFont) {
605
- console.log(`\u2705 Registered variable font: ${desc.family} weight=${weightNum}`);
606
- }
607
605
  } else {
608
606
  this.fontkitFonts.set(k, fkFont);
609
- if (!isColorEmojiFont) {
610
- console.log(`\u2705 Registered static font: ${desc.family}`);
611
- }
612
607
  }
613
608
  } catch (err) {
614
609
  console.warn(`\u26A0\uFE0F Fontkit failed for ${desc.family}:`, err);
@@ -699,9 +694,6 @@ var FontRegistry = class _FontRegistry {
699
694
  try {
700
695
  const variationFont = baseFkFont.getVariation({ wght: targetWeightNum });
701
696
  this.fontkitFonts.set(k, variationFont);
702
- console.log(
703
- `\u2705 Derived variable font: ${targetFamily} weight=${targetWeightNum} from existing registration`
704
- );
705
697
  } catch (err) {
706
698
  this.fontkitFonts.set(k, baseFkFont);
707
699
  console.warn(`\u26A0\uFE0F Could not apply weight variation, using base font for ${targetFamily}`);
package/dist/entry.web.js CHANGED
@@ -306,6 +306,10 @@ function setupWasmInterceptors(wasmBinary) {
306
306
  if (bufferSourceOrModule instanceof WebAssembly.Module) {
307
307
  return originalInstantiate.call(WebAssembly, bufferSourceOrModule, importObject);
308
308
  }
309
+ const inputSize = bufferSourceOrModule instanceof ArrayBuffer ? bufferSourceOrModule.byteLength : bufferSourceOrModule.byteLength;
310
+ if (inputSize !== wasmBinary.byteLength) {
311
+ return originalInstantiate.call(WebAssembly, bufferSourceOrModule, importObject);
312
+ }
309
313
  const module = await WebAssembly.compile(wasmBinary);
310
314
  const instance = await originalInstantiate.call(
311
315
  WebAssembly,
@@ -327,9 +331,7 @@ function setupWasmInterceptors(wasmBinary) {
327
331
  }
328
332
  return originalInstantiateStreaming.call(WebAssembly, response, importObject);
329
333
  } catch (err) {
330
- const module = await WebAssembly.compile(wasmBinary);
331
- const instance = await WebAssembly.instantiate(module, importObject);
332
- return { module, instance };
334
+ throw err;
333
335
  }
334
336
  };
335
337
  }
@@ -596,19 +598,12 @@ var _FontRegistry = class _FontRegistry {
596
598
  if (!this.colorEmojiFontBytes.has(desc.family)) {
597
599
  this.colorEmojiFontBytes.set(desc.family, bytes.slice(0));
598
600
  }
599
- console.log(`\u{1F3A8} Registered color emoji font: ${desc.family}`);
600
601
  }
601
602
  if (fkFont.variationAxes && Object.keys(fkFont.variationAxes).length > 0) {
602
603
  const variationFont = fkFont.getVariation({ wght: weightNum });
603
604
  this.fontkitFonts.set(k, variationFont);
604
- if (!isColorEmojiFont) {
605
- console.log(`\u2705 Registered variable font: ${desc.family} weight=${weightNum}`);
606
- }
607
605
  } else {
608
606
  this.fontkitFonts.set(k, fkFont);
609
- if (!isColorEmojiFont) {
610
- console.log(`\u2705 Registered static font: ${desc.family}`);
611
- }
612
607
  }
613
608
  } catch (err) {
614
609
  console.warn(`\u26A0\uFE0F Fontkit failed for ${desc.family}:`, err);
@@ -699,9 +694,6 @@ var _FontRegistry = class _FontRegistry {
699
694
  try {
700
695
  const variationFont = baseFkFont.getVariation({ wght: targetWeightNum });
701
696
  this.fontkitFonts.set(k, variationFont);
702
- console.log(
703
- `\u2705 Derived variable font: ${targetFamily} weight=${targetWeightNum} from existing registration`
704
- );
705
697
  } catch (err) {
706
698
  this.fontkitFonts.set(k, baseFkFont);
707
699
  console.warn(`\u26A0\uFE0F Could not apply weight variation, using base font for ${targetFamily}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/shotstack-canvas",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
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",