@shotstack/shotstack-canvas 1.9.0 → 1.9.1

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
  }
@@ -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
  }
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
  }
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.1",
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",