@swc/wasm-web 1.3.0 → 1.3.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.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "강동윤 <kdy1997.dev@gmail.com>"
5
5
  ],
6
6
  "description": "wasm module for swc",
7
- "version": "1.3.0",
7
+ "version": "1.3.1",
8
8
  "license": "Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
package/wasm-web.d.ts CHANGED
@@ -2848,14 +2848,16 @@ export interface InitOutput {
2848
2848
  readonly __wbindgen_export_6: (a: number, b: number, c: number, d: number) => void;
2849
2849
  }
2850
2850
 
2851
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
2851
2852
  /**
2852
- * Synchronously compiles the given `bytes` and instantiates the WebAssembly module.
2853
+ * Instantiates the given `module`, which can either be bytes or
2854
+ * a precompiled `WebAssembly.Module`.
2853
2855
  *
2854
- * @param {BufferSource} bytes
2856
+ * @param {SyncInitInput} module
2855
2857
  *
2856
2858
  * @returns {InitOutput}
2857
2859
  */
2858
- export function initSync(bytes: BufferSource): InitOutput;
2860
+ export function initSync(module: SyncInitInput): InitOutput;
2859
2861
 
2860
2862
  /**
2861
2863
  * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
package/wasm-web.js CHANGED
@@ -85,6 +85,10 @@ function passStringToWasm0(arg, malloc, realloc) {
85
85
  return ptr;
86
86
  }
87
87
 
88
+ function isLikeNone(x) {
89
+ return x === undefined || x === null;
90
+ }
91
+
88
92
  let cachedInt32Memory0 = new Int32Array();
89
93
 
90
94
  function getInt32Memory0() {
@@ -94,10 +98,6 @@ function getInt32Memory0() {
94
98
  return cachedInt32Memory0;
95
99
  }
96
100
 
97
- function isLikeNone(x) {
98
- return x === undefined || x === null;
99
- }
100
-
101
101
  const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
102
102
 
103
103
  cachedTextDecoder.decode();
@@ -325,7 +325,7 @@ function getImports() {
325
325
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
326
326
  takeObject(arg0);
327
327
  };
328
- imports.wbg.__wbg_call_65af9f665ab6ade5 = function() { return handleError(function (arg0, arg1, arg2) {
328
+ imports.wbg.__wbg_call_168da88779e35f61 = function() { return handleError(function (arg0, arg1, arg2) {
329
329
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
330
330
  return addHeapObject(ret);
331
331
  }, arguments) };
@@ -337,13 +337,9 @@ function getImports() {
337
337
  const ret = getObject(arg0) === undefined;
338
338
  return ret;
339
339
  };
340
- imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
341
- const obj = getObject(arg1);
342
- const ret = JSON.stringify(obj === undefined ? null : obj);
343
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
344
- const len0 = WASM_VECTOR_LEN;
345
- getInt32Memory0()[arg0 / 4 + 1] = len0;
346
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
340
+ imports.wbg.__wbindgen_is_string = function(arg0) {
341
+ const ret = typeof(getObject(arg0)) === 'string';
342
+ return ret;
347
343
  };
348
344
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
349
345
  const obj = getObject(arg1);
@@ -353,15 +349,19 @@ function getImports() {
353
349
  getInt32Memory0()[arg0 / 4 + 1] = len0;
354
350
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
355
351
  };
352
+ imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
353
+ const obj = getObject(arg1);
354
+ const ret = JSON.stringify(obj === undefined ? null : obj);
355
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
356
+ const len0 = WASM_VECTOR_LEN;
357
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
358
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
359
+ };
356
360
  imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
357
361
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
358
362
  return addHeapObject(ret);
359
363
  };
360
- imports.wbg.__wbindgen_is_string = function(arg0) {
361
- const ret = typeof(getObject(arg0)) === 'string';
362
- return ret;
363
- };
364
- imports.wbg.__wbg_new_52205195aa880fc2 = function(arg0, arg1) {
364
+ imports.wbg.__wbg_new_9962f939219f1820 = function(arg0, arg1) {
365
365
  try {
366
366
  var state0 = {a: arg0, b: arg1};
367
367
  var cb0 = (arg0, arg1) => {
@@ -383,30 +383,30 @@ function getImports() {
383
383
  const ret = getStringFromWasm0(arg0, arg1);
384
384
  return addHeapObject(ret);
385
385
  };
386
- imports.wbg.__wbg_new0_adda2d4bcb124f0a = function() {
386
+ imports.wbg.__wbg_new0_a57059d72c5b7aee = function() {
387
387
  const ret = new Date();
388
388
  return addHeapObject(ret);
389
389
  };
390
- imports.wbg.__wbg_getTimezoneOffset_8a39b51acb4f52c9 = function(arg0) {
390
+ imports.wbg.__wbg_getTimezoneOffset_89bd4275e1ca8341 = function(arg0) {
391
391
  const ret = getObject(arg0).getTimezoneOffset();
392
392
  return ret;
393
393
  };
394
- imports.wbg.__wbg_getTime_58b0bdbebd4ef11d = function(arg0) {
394
+ imports.wbg.__wbg_getTime_cb82adb2556ed13e = function(arg0) {
395
395
  const ret = getObject(arg0).getTime();
396
396
  return ret;
397
397
  };
398
- imports.wbg.__wbg_new_693216e109162396 = function() {
398
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
399
399
  const ret = new Error();
400
400
  return addHeapObject(ret);
401
401
  };
402
- imports.wbg.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) {
402
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
403
403
  const ret = getObject(arg1).stack;
404
404
  const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
405
405
  const len0 = WASM_VECTOR_LEN;
406
406
  getInt32Memory0()[arg0 / 4 + 1] = len0;
407
407
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
408
408
  };
409
- imports.wbg.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
409
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
410
410
  var v0 = getCachedStringFromWasm0(arg0, arg1);
411
411
  if (arg0 !== 0) { wasm.__wbindgen_export_4(arg0, arg1); }
412
412
  console.error(v0);
@@ -414,7 +414,7 @@ function getImports() {
414
414
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
415
415
  throw new Error(getStringFromWasm0(arg0, arg1));
416
416
  };
417
- imports.wbg.__wbg_resolve_0107b3a501450ba0 = function(arg0) {
417
+ imports.wbg.__wbg_resolve_99fe17964f31ffc0 = function(arg0) {
418
418
  const ret = Promise.resolve(getObject(arg0));
419
419
  return addHeapObject(ret);
420
420
  };
@@ -427,11 +427,11 @@ imports.wbg.__wbindgen_cb_drop = function(arg0) {
427
427
  const ret = false;
428
428
  return ret;
429
429
  };
430
- imports.wbg.__wbg_then_18da6e5453572fc8 = function(arg0, arg1) {
430
+ imports.wbg.__wbg_then_11f7a54d67b4bfad = function(arg0, arg1) {
431
431
  const ret = getObject(arg0).then(getObject(arg1));
432
432
  return addHeapObject(ret);
433
433
  };
434
- imports.wbg.__wbindgen_closure_wrapper14781 = function(arg0, arg1, arg2) {
434
+ imports.wbg.__wbindgen_closure_wrapper19930 = function(arg0, arg1, arg2) {
435
435
  const ret = makeMutClosure(arg0, arg1, 162, __wbg_adapter_22);
436
436
  return addHeapObject(ret);
437
437
  };
@@ -453,12 +453,15 @@ function finalizeInit(instance, module) {
453
453
  return wasm;
454
454
  }
455
455
 
456
- function initSync(bytes) {
456
+ function initSync(module) {
457
457
  const imports = getImports();
458
458
 
459
459
  initMemory(imports);
460
460
 
461
- const module = new WebAssembly.Module(bytes);
461
+ if (!(module instanceof WebAssembly.Module)) {
462
+ module = new WebAssembly.Module(module);
463
+ }
464
+
462
465
  const instance = new WebAssembly.Instance(module, imports);
463
466
 
464
467
  return finalizeInit(instance, module);
package/wasm-web_bg.wasm CHANGED
Binary file