@utoo/web 0.0.1-alpha.8 → 0.0.1-alpha.9

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/esm/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { Dirent, ProjectEndpoint } from "./type";
2
+ import { MountOpt } from "./worker";
2
3
  export declare class Project implements ProjectEndpoint {
3
4
  #private;
4
- private cwd;
5
5
  private remote;
6
- constructor(cwd: string, worker?: Worker);
6
+ constructor(opt: MountOpt & {
7
+ worker?: Worker;
8
+ });
7
9
  install(packageLock: string): Promise<void>;
8
10
  build(): Promise<void>;
9
11
  readFile(path: string, encoding?: "utf8"): Promise<any>;
package/esm/index.js CHANGED
@@ -16,10 +16,10 @@ import { Dirent } from "./type";
16
16
  let ProjectWorker;
17
17
  const ConnectedPorts = new Set();
18
18
  export class Project {
19
- constructor(cwd, worker) {
19
+ constructor(opt) {
20
20
  var _a, _b;
21
21
  _Project_tunnel.set(this, void 0);
22
- this.cwd = cwd;
22
+ const { cwd, worker, wasmUrl } = opt;
23
23
  const { port1, port2 } = new MessageChannel();
24
24
  (_a = this.remote) !== null && _a !== void 0 ? _a : (this.remote = comlink.wrap(port1));
25
25
  if (!ProjectWorker) {
@@ -33,7 +33,7 @@ export class Project {
33
33
  });
34
34
  }
35
35
  ProjectWorker.postMessage(HandShake, [port2]);
36
- __classPrivateFieldSet(this, _Project_tunnel, (_b = __classPrivateFieldGet(this, _Project_tunnel, "f")) !== null && _b !== void 0 ? _b : this.remote.mount(this.cwd), "f");
36
+ __classPrivateFieldSet(this, _Project_tunnel, (_b = __classPrivateFieldGet(this, _Project_tunnel, "f")) !== null && _b !== void 0 ? _b : this.remote.mount({ cwd, wasmUrl }), "f");
37
37
  }
38
38
  async install(packageLock) {
39
39
  await __classPrivateFieldGet(this, _Project_tunnel, "f");
@@ -1,13 +1,15 @@
1
1
  export function init_pack(): void;
2
+ /**
3
+ * Entry point for web workers
4
+ * @param {number} ptr
5
+ */
6
+ export function wasm_thread_entry_point(ptr: number): void;
2
7
  export class CreateSyncAccessHandleOptions {
3
8
  static __wrap(ptr: any): any;
4
9
  __destroy_into_raw(): number | undefined;
5
10
  __wbg_ptr: number | undefined;
6
11
  free(): void;
7
12
  }
8
- /**
9
- * Directory entry with name and type information
10
- */
11
13
  export class DirEntry {
12
14
  static __wrap(ptr: any): any;
13
15
  toJSON(): {
@@ -53,9 +55,9 @@ export class Project {
53
55
  */
54
56
  install(package_lock: string): Promise<void>;
55
57
  /**
56
- * @returns {Promise<void>}
58
+ * @returns {Promise<any>}
57
59
  */
58
- build(): Promise<void>;
60
+ build(): Promise<any>;
59
61
  /**
60
62
  * @param {string} path
61
63
  * @returns {Promise<Uint8Array>}
@@ -101,5 +103,5 @@ export class Project {
101
103
  copyFile(src: string, dst: string): Promise<void>;
102
104
  }
103
105
  export default __wbg_init;
104
- export function initSync(module: any): any;
105
- declare function __wbg_init(module_or_path: any): Promise<any>;
106
+ export function initSync(module: any, memory: any): any;
107
+ declare function __wbg_init(module_or_path: any, memory: any): Promise<any>;
package/esm/utoo/index.js CHANGED
@@ -2,68 +2,23 @@ let wasm;
2
2
  const heap = new Array(128).fill(undefined);
3
3
  heap.push(undefined, null, true, false);
4
4
  function getObject(idx) { return heap[idx]; }
5
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available'); } });
6
- if (typeof TextDecoder !== 'undefined') {
7
- cachedTextDecoder.decode();
8
- }
9
- ;
5
+ let WASM_VECTOR_LEN = 0;
10
6
  let cachedUint8ArrayMemory0 = null;
11
7
  function getUint8ArrayMemory0() {
12
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
8
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.buffer !== wasm.memory.buffer) {
13
9
  cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
14
10
  }
15
11
  return cachedUint8ArrayMemory0;
16
12
  }
17
- function getStringFromWasm0(ptr, len) {
18
- ptr = ptr >>> 0;
19
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
20
- }
21
- let heap_next = heap.length;
22
- function addHeapObject(obj) {
23
- if (heap_next === heap.length)
24
- heap.push(heap.length + 1);
25
- const idx = heap_next;
26
- heap_next = heap[idx];
27
- heap[idx] = obj;
28
- return idx;
29
- }
30
- function handleError(f, args) {
31
- try {
32
- return f.apply(this, args);
33
- }
34
- catch (e) {
35
- wasm.__wbindgen_export_0(addHeapObject(e));
36
- }
37
- }
38
- function dropObject(idx) {
39
- if (idx < 132)
40
- return;
41
- heap[idx] = heap_next;
42
- heap_next = idx;
43
- }
44
- function takeObject(idx) {
45
- const ret = getObject(idx);
46
- dropObject(idx);
47
- return ret;
48
- }
49
- function getArrayU8FromWasm0(ptr, len) {
50
- ptr = ptr >>> 0;
51
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
52
- }
53
- let WASM_VECTOR_LEN = 0;
54
13
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available'); } });
55
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
56
- ? function (arg, view) {
57
- return cachedTextEncoder.encodeInto(arg, view);
58
- }
59
- : function (arg, view) {
60
- const buf = cachedTextEncoder.encode(arg);
61
- view.set(buf);
62
- return {
63
- read: arg.length,
64
- written: buf.length
65
- };
66
- });
14
+ const encodeString = function (arg, view) {
15
+ const buf = cachedTextEncoder.encode(arg);
16
+ view.set(buf);
17
+ return {
18
+ read: arg.length,
19
+ written: buf.length
20
+ };
21
+ };
67
22
  function passStringToWasm0(arg, malloc, realloc) {
68
23
  if (realloc === undefined) {
69
24
  const buf = cachedTextEncoder.encode(arg);
@@ -97,18 +52,59 @@ function passStringToWasm0(arg, malloc, realloc) {
97
52
  }
98
53
  let cachedDataViewMemory0 = null;
99
54
  function getDataViewMemory0() {
100
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
55
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
101
56
  cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
102
57
  }
103
58
  return cachedDataViewMemory0;
104
59
  }
60
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available'); } });
61
+ if (typeof TextDecoder !== 'undefined') {
62
+ cachedTextDecoder.decode();
63
+ }
64
+ ;
65
+ function getStringFromWasm0(ptr, len) {
66
+ ptr = ptr >>> 0;
67
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().slice(ptr, ptr + len));
68
+ }
69
+ let heap_next = heap.length;
70
+ function addHeapObject(obj) {
71
+ if (heap_next === heap.length)
72
+ heap.push(heap.length + 1);
73
+ const idx = heap_next;
74
+ heap_next = heap[idx];
75
+ heap[idx] = obj;
76
+ return idx;
77
+ }
78
+ function handleError(f, args) {
79
+ try {
80
+ return f.apply(this, args);
81
+ }
82
+ catch (e) {
83
+ wasm.__wbindgen_export_3(addHeapObject(e));
84
+ }
85
+ }
86
+ function dropObject(idx) {
87
+ if (idx < 132)
88
+ return;
89
+ heap[idx] = heap_next;
90
+ heap_next = idx;
91
+ }
92
+ function takeObject(idx) {
93
+ const ret = getObject(idx);
94
+ dropObject(idx);
95
+ return ret;
96
+ }
97
+ function getArrayU8FromWasm0(ptr, len) {
98
+ ptr = ptr >>> 0;
99
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
100
+ }
105
101
  function isLikeNone(x) {
106
102
  return x === undefined || x === null;
107
103
  }
108
104
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
109
105
  ? { register: () => { }, unregister: () => { } }
110
106
  : new FinalizationRegistry(state => {
111
- wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b);
107
+ wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b);
112
108
  });
113
109
  function makeMutClosure(arg0, arg1, dtor, f) {
114
110
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
@@ -124,7 +120,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
124
120
  }
125
121
  finally {
126
122
  if (--state.cnt === 0) {
127
- wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
123
+ wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
128
124
  CLOSURE_DTORS.unregister(state);
129
125
  }
130
126
  else {
@@ -213,22 +209,48 @@ function passArray8ToWasm0(arg, malloc) {
213
209
  export function init_pack() {
214
210
  wasm.init_pack();
215
211
  }
216
- function __wbg_adapter_30(arg0, arg1) {
217
- wasm.__wbindgen_export_5(arg0, arg1);
212
+ /**
213
+ * Entry point for web workers
214
+ * @param {number} ptr
215
+ */
216
+ export function wasm_thread_entry_point(ptr) {
217
+ wasm.wasm_thread_entry_point(ptr);
218
+ }
219
+ function __wbg_adapter_46(arg0, arg1) {
220
+ wasm.__wbindgen_export_6(arg0, arg1);
221
+ }
222
+ function __wbg_adapter_49(arg0, arg1, arg2) {
223
+ wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
218
224
  }
219
- function __wbg_adapter_33(arg0, arg1, arg2) {
220
- wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
225
+ function __wbg_adapter_52(arg0, arg1, arg2) {
226
+ wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2));
227
+ }
228
+ let stack_pointer = 128;
229
+ function addBorrowedObject(obj) {
230
+ if (stack_pointer == 1)
231
+ throw new Error('out of js stack');
232
+ heap[--stack_pointer] = obj;
233
+ return stack_pointer;
234
+ }
235
+ function __wbg_adapter_57(arg0, arg1, arg2) {
236
+ try {
237
+ wasm.__wbindgen_export_9(arg0, arg1, addBorrowedObject(arg2));
238
+ }
239
+ finally {
240
+ heap[stack_pointer++] = undefined;
241
+ }
221
242
  }
222
- function __wbg_adapter_36(arg0, arg1) {
223
- wasm.__wbindgen_export_7(arg0, arg1);
243
+ function __wbg_adapter_60(arg0, arg1) {
244
+ wasm.__wbindgen_export_10(arg0, arg1);
224
245
  }
225
- function __wbg_adapter_71(arg0, arg1, arg2, arg3) {
226
- wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
246
+ function __wbg_adapter_109(arg0, arg1, arg2, arg3) {
247
+ wasm.__wbindgen_export_11(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
227
248
  }
228
249
  const __wbindgen_enum_DirEntryType = ["file", "directory"];
229
250
  const __wbindgen_enum_FileSystemHandleKind = ["file", "directory"];
230
251
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
231
252
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
253
+ const __wbindgen_enum_WorkerType = ["classic", "module"];
232
254
  const CreateSyncAccessHandleOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
233
255
  ? { register: () => { }, unregister: () => { } }
234
256
  : new FinalizationRegistry(ptr => wasm.__wbg_createsyncaccesshandleoptions_free(ptr >>> 0, 1));
@@ -254,9 +276,6 @@ export class CreateSyncAccessHandleOptions {
254
276
  const DirEntryFinalization = (typeof FinalizationRegistry === 'undefined')
255
277
  ? { register: () => { }, unregister: () => { } }
256
278
  : new FinalizationRegistry(ptr => wasm.__wbg_direntry_free(ptr >>> 0, 1));
257
- /**
258
- * Directory entry with name and type information
259
- */
260
279
  export class DirEntry {
261
280
  static __wrap(ptr) {
262
281
  ptr = ptr >>> 0;
@@ -301,14 +320,14 @@ export class DirEntry {
301
320
  }
302
321
  finally {
303
322
  wasm.__wbindgen_add_to_stack_pointer(16);
304
- wasm.__wbindgen_export_1(deferred1_0, deferred1_1, 1);
323
+ wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
305
324
  }
306
325
  }
307
326
  /**
308
327
  * @param {string} arg0
309
328
  */
310
329
  set name(arg0) {
311
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
330
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
312
331
  const len0 = WASM_VECTOR_LEN;
313
332
  wasm.__wbg_set_direntry_name(this.__wbg_ptr, ptr0, len0);
314
333
  }
@@ -344,7 +363,7 @@ export class Project {
344
363
  * @param {string} cwd
345
364
  */
346
365
  constructor(cwd) {
347
- const ptr0 = passStringToWasm0(cwd, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
366
+ const ptr0 = passStringToWasm0(cwd, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
348
367
  const len0 = WASM_VECTOR_LEN;
349
368
  const ret = wasm.project_new(ptr0, len0);
350
369
  this.__wbg_ptr = ret >>> 0;
@@ -368,7 +387,7 @@ export class Project {
368
387
  }
369
388
  finally {
370
389
  wasm.__wbindgen_add_to_stack_pointer(16);
371
- wasm.__wbindgen_export_1(deferred1_0, deferred1_1, 1);
390
+ wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
372
391
  }
373
392
  }
374
393
  /**
@@ -376,13 +395,13 @@ export class Project {
376
395
  * @returns {Promise<void>}
377
396
  */
378
397
  install(package_lock) {
379
- const ptr0 = passStringToWasm0(package_lock, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
398
+ const ptr0 = passStringToWasm0(package_lock, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
380
399
  const len0 = WASM_VECTOR_LEN;
381
400
  const ret = wasm.project_install(this.__wbg_ptr, ptr0, len0);
382
401
  return takeObject(ret);
383
402
  }
384
403
  /**
385
- * @returns {Promise<void>}
404
+ * @returns {Promise<any>}
386
405
  */
387
406
  build() {
388
407
  const ret = wasm.project_build(this.__wbg_ptr);
@@ -393,7 +412,7 @@ export class Project {
393
412
  * @returns {Promise<Uint8Array>}
394
413
  */
395
414
  read(path) {
396
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
415
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
397
416
  const len0 = WASM_VECTOR_LEN;
398
417
  const ret = wasm.project_read(this.__wbg_ptr, ptr0, len0);
399
418
  return takeObject(ret);
@@ -403,7 +422,7 @@ export class Project {
403
422
  * @returns {Promise<string>}
404
423
  */
405
424
  readToString(path) {
406
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
425
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
407
426
  const len0 = WASM_VECTOR_LEN;
408
427
  const ret = wasm.project_readToString(this.__wbg_ptr, ptr0, len0);
409
428
  return takeObject(ret);
@@ -414,9 +433,9 @@ export class Project {
414
433
  * @returns {Promise<void>}
415
434
  */
416
435
  write(path, content) {
417
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
436
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
418
437
  const len0 = WASM_VECTOR_LEN;
419
- const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_export_2);
438
+ const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_export_1);
420
439
  const len1 = WASM_VECTOR_LEN;
421
440
  const ret = wasm.project_write(this.__wbg_ptr, ptr0, len0, ptr1, len1);
422
441
  return takeObject(ret);
@@ -427,9 +446,9 @@ export class Project {
427
446
  * @returns {Promise<void>}
428
447
  */
429
448
  writeString(path, content) {
430
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
449
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
431
450
  const len0 = WASM_VECTOR_LEN;
432
- const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
451
+ const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
433
452
  const len1 = WASM_VECTOR_LEN;
434
453
  const ret = wasm.project_writeString(this.__wbg_ptr, ptr0, len0, ptr1, len1);
435
454
  return takeObject(ret);
@@ -439,7 +458,7 @@ export class Project {
439
458
  * @returns {Promise<DirEntry[]>}
440
459
  */
441
460
  readDir(path) {
442
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
461
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
443
462
  const len0 = WASM_VECTOR_LEN;
444
463
  const ret = wasm.project_readDir(this.__wbg_ptr, ptr0, len0);
445
464
  return takeObject(ret);
@@ -449,7 +468,7 @@ export class Project {
449
468
  * @returns {Promise<void>}
450
469
  */
451
470
  createDir(path) {
452
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
471
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
453
472
  const len0 = WASM_VECTOR_LEN;
454
473
  const ret = wasm.project_createDir(this.__wbg_ptr, ptr0, len0);
455
474
  return takeObject(ret);
@@ -459,7 +478,7 @@ export class Project {
459
478
  * @returns {Promise<void>}
460
479
  */
461
480
  createDirAll(path) {
462
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
481
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
463
482
  const len0 = WASM_VECTOR_LEN;
464
483
  const ret = wasm.project_createDirAll(this.__wbg_ptr, ptr0, len0);
465
484
  return takeObject(ret);
@@ -470,9 +489,9 @@ export class Project {
470
489
  * @returns {Promise<void>}
471
490
  */
472
491
  copyFile(src, dst) {
473
- const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
492
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
474
493
  const len0 = WASM_VECTOR_LEN;
475
- const ptr1 = passStringToWasm0(dst, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
494
+ const ptr1 = passStringToWasm0(dst, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
476
495
  const len1 = WASM_VECTOR_LEN;
477
496
  const ret = wasm.project_copyFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
478
497
  return takeObject(ret);
@@ -509,6 +528,13 @@ async function __wbg_load(module, imports) {
509
528
  function __wbg_get_imports() {
510
529
  const imports = {};
511
530
  imports.wbg = {};
531
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function (arg0, arg1) {
532
+ const ret = String(getObject(arg1));
533
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
534
+ const len1 = WASM_VECTOR_LEN;
535
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
536
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
537
+ };
512
538
  imports.wbg.__wbg_abort_410ec47a64ac6117 = function (arg0, arg1) {
513
539
  getObject(arg0).abort(getObject(arg1));
514
540
  };
@@ -526,6 +552,10 @@ function __wbg_get_imports() {
526
552
  return addHeapObject(ret);
527
553
  }, arguments);
528
554
  };
555
+ imports.wbg.__wbg_async_9ff6d9e405f13772 = function (arg0) {
556
+ const ret = getObject(arg0).async;
557
+ return ret;
558
+ };
529
559
  imports.wbg.__wbg_buffer_609cc3eee51ed158 = function (arg0) {
530
560
  const ret = getObject(arg0).buffer;
531
561
  return addHeapObject(ret);
@@ -549,10 +579,23 @@ function __wbg_get_imports() {
549
579
  imports.wbg.__wbg_close_a17af48266bd9942 = function (arg0) {
550
580
  getObject(arg0).close();
551
581
  };
582
+ imports.wbg.__wbg_createObjectURL_6e98d2f9c7bd9764 = function () {
583
+ return handleError(function (arg0, arg1) {
584
+ const ret = URL.createObjectURL(getObject(arg1));
585
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
586
+ const len1 = WASM_VECTOR_LEN;
587
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
588
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
589
+ }, arguments);
590
+ };
552
591
  imports.wbg.__wbg_createsyncaccesshandleoptions_new = function (arg0) {
553
592
  const ret = CreateSyncAccessHandleOptions.__wrap(arg0);
554
593
  return addHeapObject(ret);
555
594
  };
595
+ imports.wbg.__wbg_data_432d9c3df2630942 = function (arg0) {
596
+ const ret = getObject(arg0).data;
597
+ return addHeapObject(ret);
598
+ };
556
599
  imports.wbg.__wbg_debug_3cb59063b29f58c1 = function (arg0) {
557
600
  console.debug(getObject(arg0));
558
601
  };
@@ -583,12 +626,18 @@ function __wbg_get_imports() {
583
626
  console.error(getStringFromWasm0(arg0, arg1));
584
627
  }
585
628
  finally {
586
- wasm.__wbindgen_export_1(deferred0_0, deferred0_1, 1);
629
+ wasm.__wbindgen_export_4(deferred0_0, deferred0_1, 1);
587
630
  }
588
631
  };
589
632
  imports.wbg.__wbg_error_80de38b3f7cc3c3c = function (arg0, arg1, arg2, arg3) {
590
633
  console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
591
634
  };
635
+ imports.wbg.__wbg_eval_e10dc02e9547f640 = function () {
636
+ return handleError(function (arg0, arg1) {
637
+ const ret = eval(getStringFromWasm0(arg0, arg1));
638
+ return addHeapObject(ret);
639
+ }, arguments);
640
+ };
592
641
  imports.wbg.__wbg_fetch_11bff8299d0ecd2b = function (arg0) {
593
642
  const ret = fetch(getObject(arg0));
594
643
  return addHeapObject(ret);
@@ -613,9 +662,9 @@ function __wbg_get_imports() {
613
662
  const ret = getObject(arg0).getFileHandle(getStringFromWasm0(arg1, arg2), getObject(arg3));
614
663
  return addHeapObject(ret);
615
664
  };
616
- imports.wbg.__wbg_getRandomValues_21a0191e74d0e1d3 = function () {
617
- return handleError(function (arg0, arg1) {
618
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
665
+ imports.wbg.__wbg_getRandomValues_3a70830e53f8ccf5 = function () {
666
+ return handleError(function (arg0) {
667
+ globalThis.crypto.getRandomValues(getObject(arg0));
619
668
  }, arguments);
620
669
  };
621
670
  imports.wbg.__wbg_getSize_e7dbd5ffa0b43df1 = function () {
@@ -650,6 +699,17 @@ function __wbg_get_imports() {
650
699
  imports.wbg.__wbg_info_3daf2e093e091b66 = function (arg0) {
651
700
  console.info(getObject(arg0));
652
701
  };
702
+ imports.wbg.__wbg_instanceof_DedicatedWorkerGlobalScope_a688e81380e34e02 = function (arg0) {
703
+ let result;
704
+ try {
705
+ result = getObject(arg0) instanceof DedicatedWorkerGlobalScope;
706
+ }
707
+ catch (_) {
708
+ result = false;
709
+ }
710
+ const ret = result;
711
+ return ret;
712
+ };
653
713
  imports.wbg.__wbg_instanceof_DomException_ed1ccb7aaf39034c = function (arg0) {
654
714
  let result;
655
715
  try {
@@ -683,6 +743,17 @@ function __wbg_get_imports() {
683
743
  const ret = result;
684
744
  return ret;
685
745
  };
746
+ imports.wbg.__wbg_instanceof_WorkerGlobalScope_dbdbdea7e3b56493 = function (arg0) {
747
+ let result;
748
+ try {
749
+ result = getObject(arg0) instanceof WorkerGlobalScope;
750
+ }
751
+ catch (_) {
752
+ result = false;
753
+ }
754
+ const ret = result;
755
+ return ret;
756
+ };
686
757
  imports.wbg.__wbg_iterator_9a24c88df860dc65 = function () {
687
758
  const ret = Symbol.iterator;
688
759
  return addHeapObject(ret);
@@ -695,9 +766,16 @@ function __wbg_get_imports() {
695
766
  const ret = getObject(arg0).length;
696
767
  return ret;
697
768
  };
769
+ imports.wbg.__wbg_message_d1685a448ba00178 = function (arg0, arg1) {
770
+ const ret = getObject(arg1).message;
771
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
772
+ const len1 = WASM_VECTOR_LEN;
773
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
774
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
775
+ };
698
776
  imports.wbg.__wbg_name_f2d27098bfd843e7 = function (arg0, arg1) {
699
777
  const ret = getObject(arg1).name;
700
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
778
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
701
779
  const len1 = WASM_VECTOR_LEN;
702
780
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
703
781
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -719,7 +797,7 @@ function __wbg_get_imports() {
719
797
  const a = state0.a;
720
798
  state0.a = 0;
721
799
  try {
722
- return __wbg_adapter_71(a, state0.b, arg0, arg1);
800
+ return __wbg_adapter_109(a, state0.b, arg0, arg1);
723
801
  }
724
802
  finally {
725
803
  state0.a = a;
@@ -736,6 +814,14 @@ function __wbg_get_imports() {
736
814
  const ret = new Object();
737
815
  return addHeapObject(ret);
738
816
  };
817
+ imports.wbg.__wbg_new_5e0be73521bc8c17 = function () {
818
+ const ret = new Map();
819
+ return addHeapObject(ret);
820
+ };
821
+ imports.wbg.__wbg_new_78feb108b6472713 = function () {
822
+ const ret = new Array();
823
+ return addHeapObject(ret);
824
+ };
739
825
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function () {
740
826
  const ret = new Error();
741
827
  return addHeapObject(ret);
@@ -744,12 +830,22 @@ function __wbg_get_imports() {
744
830
  const ret = new Uint8Array(getObject(arg0));
745
831
  return addHeapObject(ret);
746
832
  };
833
+ imports.wbg.__wbg_new_b1a33e5095abf678 = function () {
834
+ return handleError(function (arg0, arg1) {
835
+ const ret = new Worker(getStringFromWasm0(arg0, arg1));
836
+ return addHeapObject(ret);
837
+ }, arguments);
838
+ };
747
839
  imports.wbg.__wbg_new_e25e5aab09ff45db = function () {
748
840
  return handleError(function () {
749
841
  const ret = new AbortController();
750
842
  return addHeapObject(ret);
751
843
  }, arguments);
752
844
  };
845
+ imports.wbg.__wbg_new_e9a4a67dbababe57 = function (arg0) {
846
+ const ret = new Int32Array(getObject(arg0));
847
+ return addHeapObject(ret);
848
+ };
753
849
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function (arg0, arg1) {
754
850
  const ret = new Function(getStringFromWasm0(arg0, arg1));
755
851
  return addHeapObject(ret);
@@ -758,12 +854,34 @@ function __wbg_get_imports() {
758
854
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
759
855
  return addHeapObject(ret);
760
856
  };
857
+ imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function (arg0) {
858
+ const ret = new Uint8Array(arg0 >>> 0);
859
+ return addHeapObject(ret);
860
+ };
861
+ imports.wbg.__wbg_newwithoptions_0419cac3977d7f7f = function () {
862
+ return handleError(function (arg0, arg1, arg2) {
863
+ const ret = new Worker(getStringFromWasm0(arg0, arg1), getObject(arg2));
864
+ return addHeapObject(ret);
865
+ }, arguments);
866
+ };
761
867
  imports.wbg.__wbg_newwithstrandinit_06c535e0a867c635 = function () {
762
868
  return handleError(function (arg0, arg1, arg2) {
763
869
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
764
870
  return addHeapObject(ret);
765
871
  }, arguments);
766
872
  };
873
+ imports.wbg.__wbg_newwithstrsequence_a242b062eda81d0b = function () {
874
+ return handleError(function (arg0) {
875
+ const ret = new Blob(getObject(arg0));
876
+ return addHeapObject(ret);
877
+ }, arguments);
878
+ };
879
+ imports.wbg.__wbg_newwithstrsequenceandoptions_aaff55b467c81b63 = function () {
880
+ return handleError(function (arg0, arg1) {
881
+ const ret = new Blob(getObject(arg0), getObject(arg1));
882
+ return addHeapObject(ret);
883
+ }, arguments);
884
+ };
767
885
  imports.wbg.__wbg_next_25feadfc0913fea9 = function (arg0) {
768
886
  const ret = getObject(arg0).next;
769
887
  return addHeapObject(ret);
@@ -784,10 +902,28 @@ function __wbg_get_imports() {
784
902
  const ret = getObject(arg0).now();
785
903
  return ret;
786
904
  };
905
+ imports.wbg.__wbg_of_4a05197bfc89556f = function (arg0, arg1, arg2) {
906
+ const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
907
+ return addHeapObject(ret);
908
+ };
787
909
  imports.wbg.__wbg_performance_7fe0928f3ab059e5 = function (arg0) {
788
910
  const ret = getObject(arg0).performance;
789
911
  return addHeapObject(ret);
790
912
  };
913
+ imports.wbg.__wbg_postMessage_6edafa8f7b9c2f52 = function () {
914
+ return handleError(function (arg0, arg1) {
915
+ getObject(arg0).postMessage(getObject(arg1));
916
+ }, arguments);
917
+ };
918
+ imports.wbg.__wbg_postMessage_83a8d58d3fcb6c13 = function () {
919
+ return handleError(function (arg0, arg1) {
920
+ getObject(arg0).postMessage(getObject(arg1));
921
+ }, arguments);
922
+ };
923
+ imports.wbg.__wbg_push_737cfc8c1432c2c6 = function (arg0, arg1) {
924
+ const ret = getObject(arg0).push(getObject(arg1));
925
+ return ret;
926
+ };
791
927
  imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function (arg0) {
792
928
  queueMicrotask(getObject(arg0));
793
929
  };
@@ -795,6 +931,10 @@ function __wbg_get_imports() {
795
931
  const ret = getObject(arg0).queueMicrotask;
796
932
  return addHeapObject(ret);
797
933
  };
934
+ imports.wbg.__wbg_random_3ad904d98382defe = function () {
935
+ const ret = Math.random();
936
+ return ret;
937
+ };
798
938
  imports.wbg.__wbg_read_f8fdd4b410209222 = function () {
799
939
  return handleError(function (arg0, arg1, arg2, arg3) {
800
940
  const ret = getObject(arg0).read(getArrayU8FromWasm0(arg1, arg2), getObject(arg3));
@@ -809,6 +949,11 @@ function __wbg_get_imports() {
809
949
  const ret = Promise.resolve(getObject(arg0));
810
950
  return addHeapObject(ret);
811
951
  };
952
+ imports.wbg.__wbg_revokeObjectURL_27267efebeb457c7 = function () {
953
+ return handleError(function (arg0, arg1) {
954
+ URL.revokeObjectURL(getStringFromWasm0(arg0, arg1));
955
+ }, arguments);
956
+ };
812
957
  imports.wbg.__wbg_setTimeout_42370cb3051b8c2c = function () {
813
958
  return handleError(function (arg0, arg1, arg2) {
814
959
  const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
@@ -819,9 +964,19 @@ function __wbg_get_imports() {
819
964
  const ret = setTimeout(getObject(arg0), arg1);
820
965
  return addHeapObject(ret);
821
966
  };
967
+ imports.wbg.__wbg_set_37837023f3d740e8 = function (arg0, arg1, arg2) {
968
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
969
+ };
970
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
971
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
972
+ };
822
973
  imports.wbg.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
823
974
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
824
975
  };
976
+ imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function (arg0, arg1, arg2) {
977
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
978
+ return addHeapObject(ret);
979
+ };
825
980
  imports.wbg.__wbg_setat_2a071a392643c10e = function (arg0, arg1) {
826
981
  getObject(arg0).at = arg1;
827
982
  };
@@ -846,19 +1001,44 @@ function __wbg_get_imports() {
846
1001
  imports.wbg.__wbg_setmode_5dc300b865044b65 = function (arg0, arg1) {
847
1002
  getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
848
1003
  };
1004
+ imports.wbg.__wbg_setname_73878b09a5ee3d0c = function (arg0, arg1, arg2) {
1005
+ getObject(arg0).name = getStringFromWasm0(arg1, arg2);
1006
+ };
1007
+ imports.wbg.__wbg_setonerror_57eeef5feb01fe7a = function (arg0, arg1) {
1008
+ getObject(arg0).onerror = getObject(arg1);
1009
+ };
1010
+ imports.wbg.__wbg_setonmessage_5a885b16bdc6dca6 = function (arg0, arg1) {
1011
+ getObject(arg0).onmessage = getObject(arg1);
1012
+ };
849
1013
  imports.wbg.__wbg_setrecursive_536113a081d6177a = function (arg0, arg1) {
850
1014
  getObject(arg0).recursive = arg1 !== 0;
851
1015
  };
852
1016
  imports.wbg.__wbg_setsignal_75b21ef3a81de905 = function (arg0, arg1) {
853
1017
  getObject(arg0).signal = getObject(arg1);
854
1018
  };
1019
+ imports.wbg.__wbg_settype_39ed370d3edd403c = function (arg0, arg1, arg2) {
1020
+ getObject(arg0).type = getStringFromWasm0(arg1, arg2);
1021
+ };
1022
+ imports.wbg.__wbg_settype_47fae7d6c82625e7 = function (arg0, arg1) {
1023
+ getObject(arg0).type = __wbindgen_enum_WorkerType[arg1];
1024
+ };
855
1025
  imports.wbg.__wbg_signal_aaf9ad74119f20a4 = function (arg0) {
856
1026
  const ret = getObject(arg0).signal;
857
1027
  return addHeapObject(ret);
858
1028
  };
1029
+ imports.wbg.__wbg_size_3808d41635a9c259 = function (arg0) {
1030
+ const ret = getObject(arg0).size;
1031
+ return ret;
1032
+ };
1033
+ imports.wbg.__wbg_slice_8c197bf0b6dfc84a = function () {
1034
+ return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1035
+ const ret = getObject(arg0).slice(arg1, arg2, getStringFromWasm0(arg3, arg4));
1036
+ return addHeapObject(ret);
1037
+ }, arguments);
1038
+ };
859
1039
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
860
1040
  const ret = getObject(arg1).stack;
861
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
1041
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
862
1042
  const len1 = WASM_VECTOR_LEN;
863
1043
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
864
1044
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -893,6 +1073,10 @@ function __wbg_get_imports() {
893
1073
  return addHeapObject(ret);
894
1074
  }, arguments);
895
1075
  };
1076
+ imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function (arg0, arg1, arg2) {
1077
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1078
+ return addHeapObject(ret);
1079
+ };
896
1080
  imports.wbg.__wbg_then_44b73946d2fb3e7d = function (arg0, arg1) {
897
1081
  const ret = getObject(arg0).then(getObject(arg1));
898
1082
  return addHeapObject(ret);
@@ -912,7 +1096,7 @@ function __wbg_get_imports() {
912
1096
  };
913
1097
  imports.wbg.__wbg_url_ae10c34ca209681d = function (arg0, arg1) {
914
1098
  const ret = getObject(arg1).url;
915
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
1099
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
916
1100
  const len1 = WASM_VECTOR_LEN;
917
1101
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
918
1102
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -921,6 +1105,18 @@ function __wbg_get_imports() {
921
1105
  const ret = getObject(arg0).value;
922
1106
  return addHeapObject(ret);
923
1107
  };
1108
+ imports.wbg.__wbg_value_dab73d3d5d4abaaf = function (arg0) {
1109
+ const ret = getObject(arg0).value;
1110
+ return addHeapObject(ret);
1111
+ };
1112
+ imports.wbg.__wbg_waitAsync_61f0a081053dd3c2 = function (arg0, arg1, arg2) {
1113
+ const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
1114
+ return addHeapObject(ret);
1115
+ };
1116
+ imports.wbg.__wbg_waitAsync_7ce6c8a047c752c3 = function () {
1117
+ const ret = Atomics.waitAsync;
1118
+ return addHeapObject(ret);
1119
+ };
924
1120
  imports.wbg.__wbg_warn_4ca3906c248c47c4 = function (arg0) {
925
1121
  console.warn(getObject(arg0));
926
1122
  };
@@ -940,6 +1136,14 @@ function __wbg_get_imports() {
940
1136
  imports.wbg.__wbindgen_array_push = function (arg0, arg1) {
941
1137
  getObject(arg0).push(takeObject(arg1));
942
1138
  };
1139
+ imports.wbg.__wbindgen_bigint_from_i64 = function (arg0) {
1140
+ const ret = arg0;
1141
+ return addHeapObject(ret);
1142
+ };
1143
+ imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
1144
+ const ret = BigInt.asUintN(64, arg0);
1145
+ return addHeapObject(ret);
1146
+ };
943
1147
  imports.wbg.__wbindgen_cb_drop = function (arg0) {
944
1148
  const obj = takeObject(arg0).original;
945
1149
  if (obj.cnt-- == 1) {
@@ -949,25 +1153,41 @@ function __wbg_get_imports() {
949
1153
  const ret = false;
950
1154
  return ret;
951
1155
  };
952
- imports.wbg.__wbindgen_closure_wrapper220138 = function (arg0, arg1, arg2) {
953
- const ret = makeMutClosure(arg0, arg1, 148252, __wbg_adapter_33);
1156
+ imports.wbg.__wbindgen_closure_wrapper204130 = function (arg0, arg1, arg2) {
1157
+ const ret = makeMutClosure(arg0, arg1, 131379, __wbg_adapter_49);
1158
+ return addHeapObject(ret);
1159
+ };
1160
+ imports.wbg.__wbindgen_closure_wrapper216712 = function (arg0, arg1, arg2) {
1161
+ const ret = makeMutClosure(arg0, arg1, 144806, __wbg_adapter_52);
954
1162
  return addHeapObject(ret);
955
1163
  };
956
- imports.wbg.__wbindgen_closure_wrapper220295 = function (arg0, arg1, arg2) {
957
- const ret = makeMutClosure(arg0, arg1, 148274, __wbg_adapter_36);
1164
+ imports.wbg.__wbindgen_closure_wrapper216713 = function (arg0, arg1, arg2) {
1165
+ const ret = makeMutClosure(arg0, arg1, 144806, __wbg_adapter_52);
958
1166
  return addHeapObject(ret);
959
1167
  };
960
- imports.wbg.__wbindgen_closure_wrapper33472 = function (arg0, arg1, arg2) {
961
- const ret = makeMutClosure(arg0, arg1, 19113, __wbg_adapter_30);
1168
+ imports.wbg.__wbindgen_closure_wrapper216764 = function (arg0, arg1, arg2) {
1169
+ const ret = makeMutClosure(arg0, arg1, 144832, __wbg_adapter_57);
1170
+ return addHeapObject(ret);
1171
+ };
1172
+ imports.wbg.__wbindgen_closure_wrapper216804 = function (arg0, arg1, arg2) {
1173
+ const ret = makeMutClosure(arg0, arg1, 144850, __wbg_adapter_60);
1174
+ return addHeapObject(ret);
1175
+ };
1176
+ imports.wbg.__wbindgen_closure_wrapper32222 = function (arg0, arg1, arg2) {
1177
+ const ret = makeMutClosure(arg0, arg1, 18428, __wbg_adapter_46);
962
1178
  return addHeapObject(ret);
963
1179
  };
964
1180
  imports.wbg.__wbindgen_debug_string = function (arg0, arg1) {
965
1181
  const ret = debugString(getObject(arg1));
966
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
1182
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
967
1183
  const len1 = WASM_VECTOR_LEN;
968
1184
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
969
1185
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
970
1186
  };
1187
+ imports.wbg.__wbindgen_error_new = function (arg0, arg1) {
1188
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1189
+ return addHeapObject(ret);
1190
+ };
971
1191
  imports.wbg.__wbindgen_is_function = function (arg0) {
972
1192
  const ret = typeof (getObject(arg0)) === 'function';
973
1193
  return ret;
@@ -977,14 +1197,46 @@ function __wbg_get_imports() {
977
1197
  const ret = typeof (val) === 'object' && val !== null;
978
1198
  return ret;
979
1199
  };
1200
+ imports.wbg.__wbindgen_is_string = function (arg0) {
1201
+ const ret = typeof (getObject(arg0)) === 'string';
1202
+ return ret;
1203
+ };
980
1204
  imports.wbg.__wbindgen_is_undefined = function (arg0) {
981
1205
  const ret = getObject(arg0) === undefined;
982
1206
  return ret;
983
1207
  };
1208
+ imports.wbg.__wbindgen_link_9579f016b4522a24 = function (arg0) {
1209
+ const val = `onmessage = function (ev) {
1210
+ let [ia, index, value] = ev.data;
1211
+ ia = new Int32Array(ia.buffer);
1212
+ let result = Atomics.wait(ia, index, value);
1213
+ postMessage(result);
1214
+ };
1215
+ `;
1216
+ const ret = typeof URL.createObjectURL === 'undefined' ? "data:application/javascript," + encodeURIComponent(val) : URL.createObjectURL(new Blob([val], { type: "text/javascript" }));
1217
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
1218
+ const len1 = WASM_VECTOR_LEN;
1219
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1220
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1221
+ };
984
1222
  imports.wbg.__wbindgen_memory = function () {
985
1223
  const ret = wasm.memory;
986
1224
  return addHeapObject(ret);
987
1225
  };
1226
+ imports.wbg.__wbindgen_module = function () {
1227
+ const ret = __wbg_init.__wbindgen_wasm_module;
1228
+ return addHeapObject(ret);
1229
+ };
1230
+ imports.wbg.__wbindgen_number_get = function (arg0, arg1) {
1231
+ const obj = getObject(arg1);
1232
+ const ret = typeof (obj) === 'number' ? obj : undefined;
1233
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1234
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1235
+ };
1236
+ imports.wbg.__wbindgen_number_new = function (arg0) {
1237
+ const ret = arg0;
1238
+ return addHeapObject(ret);
1239
+ };
988
1240
  imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
989
1241
  const ret = getObject(arg0);
990
1242
  return addHeapObject(ret);
@@ -992,10 +1244,13 @@ function __wbg_get_imports() {
992
1244
  imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
993
1245
  takeObject(arg0);
994
1246
  };
1247
+ imports.wbg.__wbindgen_rethrow = function (arg0) {
1248
+ throw takeObject(arg0);
1249
+ };
995
1250
  imports.wbg.__wbindgen_string_get = function (arg0, arg1) {
996
1251
  const obj = getObject(arg1);
997
1252
  const ret = typeof (obj) === 'string' ? obj : undefined;
998
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
1253
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
999
1254
  var len1 = WASM_VECTOR_LEN;
1000
1255
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1001
1256
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -1009,47 +1264,53 @@ function __wbg_get_imports() {
1009
1264
  };
1010
1265
  imports.wbg.__wbindgen_uint8_array_new = function (arg0, arg1) {
1011
1266
  var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1012
- wasm.__wbindgen_export_1(arg0, arg1 * 1, 1);
1267
+ wasm.__wbindgen_export_4(arg0, arg1 * 1, 1);
1013
1268
  const ret = v0;
1014
1269
  return addHeapObject(ret);
1015
1270
  };
1016
1271
  return imports;
1017
1272
  }
1018
1273
  function __wbg_init_memory(imports, memory) {
1274
+ imports.wbg.memory = memory || new WebAssembly.Memory({ initial: 224, maximum: 16384, shared: true });
1019
1275
  }
1020
- function __wbg_finalize_init(instance, module) {
1276
+ function __wbg_finalize_init(instance, module, thread_stack_size) {
1021
1277
  wasm = instance.exports;
1022
1278
  __wbg_init.__wbindgen_wasm_module = module;
1023
1279
  cachedDataViewMemory0 = null;
1024
1280
  cachedUint8ArrayMemory0 = null;
1025
- wasm.__wbindgen_start();
1281
+ if (typeof thread_stack_size !== 'undefined' && (typeof thread_stack_size !== 'number' || thread_stack_size === 0 || thread_stack_size % 65536 !== 0)) {
1282
+ throw 'invalid stack size';
1283
+ }
1284
+ wasm.__wbindgen_start(thread_stack_size);
1026
1285
  return wasm;
1027
1286
  }
1028
- function initSync(module) {
1287
+ function initSync(module, memory) {
1029
1288
  if (wasm !== undefined)
1030
1289
  return wasm;
1290
+ let thread_stack_size;
1031
1291
  if (typeof module !== 'undefined') {
1032
1292
  if (Object.getPrototypeOf(module) === Object.prototype) {
1033
- ({ module } = module);
1293
+ ({ module, memory, thread_stack_size } = module);
1034
1294
  }
1035
1295
  else {
1036
1296
  console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
1037
1297
  }
1038
1298
  }
1039
1299
  const imports = __wbg_get_imports();
1040
- __wbg_init_memory(imports);
1300
+ __wbg_init_memory(imports, memory);
1041
1301
  if (!(module instanceof WebAssembly.Module)) {
1042
1302
  module = new WebAssembly.Module(module);
1043
1303
  }
1044
1304
  const instance = new WebAssembly.Instance(module, imports);
1045
- return __wbg_finalize_init(instance, module);
1305
+ return __wbg_finalize_init(instance, module, thread_stack_size);
1046
1306
  }
1047
- async function __wbg_init(module_or_path) {
1307
+ async function __wbg_init(module_or_path, memory) {
1048
1308
  if (wasm !== undefined)
1049
1309
  return wasm;
1310
+ let thread_stack_size;
1050
1311
  if (typeof module_or_path !== 'undefined') {
1051
1312
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1052
- ({ module_or_path } = module_or_path);
1313
+ ({ module_or_path, memory, thread_stack_size } = module_or_path);
1053
1314
  }
1054
1315
  else {
1055
1316
  console.warn('using deprecated parameters for the initialization function; pass a single object instead');
@@ -1062,9 +1323,9 @@ async function __wbg_init(module_or_path) {
1062
1323
  if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1063
1324
  module_or_path = fetch(module_or_path);
1064
1325
  }
1065
- __wbg_init_memory(imports);
1326
+ __wbg_init_memory(imports, memory);
1066
1327
  const { instance, module } = await __wbg_load(await module_or_path, imports);
1067
- return __wbg_finalize_init(instance, module);
1328
+ return __wbg_finalize_init(instance, module, thread_stack_size);
1068
1329
  }
1069
1330
  export { initSync };
1070
1331
  export default __wbg_init;
Binary file
package/esm/worker.d.ts CHANGED
@@ -1 +1,4 @@
1
- export {};
1
+ export interface MountOpt {
2
+ cwd: string;
3
+ wasmUrl?: string;
4
+ }
package/esm/worker.js CHANGED
@@ -1,25 +1,27 @@
1
1
  import * as comlink from "comlink";
2
2
  import { HandShake } from "./message";
3
3
  import initWasm, { Project as ProjectInternal } from "./utoo";
4
- const WasmInit = initWasm();
5
4
  const projectEndpoint = {
6
5
  projectInternal: undefined,
7
- async mount(cwd) {
8
- await WasmInit;
6
+ wasmInit: undefined,
7
+ // This should be called only once
8
+ async mount(opt) {
9
+ const { cwd, wasmUrl } = opt;
10
+ this.wasmInit = initWasm(wasmUrl);
9
11
  this.projectInternal = new ProjectInternal(cwd);
10
12
  return;
11
13
  },
12
14
  async install(packageLock) {
13
- await WasmInit;
15
+ await this.wasmInit;
14
16
  await this.projectInternal.install(packageLock);
15
17
  return;
16
18
  },
17
19
  async build() {
18
- await WasmInit;
20
+ await this.wasmInit;
19
21
  return await this.projectInternal.build();
20
22
  },
21
23
  async readFile(path, encoding) {
22
- await WasmInit;
24
+ await this.wasmInit;
23
25
  let ret;
24
26
  if (encoding === "utf8") {
25
27
  ret = await this.projectInternal.readToString(path);
@@ -30,7 +32,7 @@ const projectEndpoint = {
30
32
  return ret;
31
33
  },
32
34
  async writeFile(path, content, _encoding) {
33
- await WasmInit;
35
+ await this.wasmInit;
34
36
  if (typeof content === "string") {
35
37
  return await this.projectInternal.writeString(path, content);
36
38
  }
@@ -39,11 +41,11 @@ const projectEndpoint = {
39
41
  }
40
42
  },
41
43
  async copyFile(src, dst) {
42
- await WasmInit;
44
+ await this.wasmInit;
43
45
  return await this.projectInternal.copyFile(src, dst);
44
46
  },
45
47
  async readdir(path, options) {
46
- await WasmInit;
48
+ await this.wasmInit;
47
49
  const dirEntries = (options === null || options === void 0 ? void 0 : options.recursive)
48
50
  ? await this.projectInternal.readDir(path)
49
51
  : // TODO: support recursive readDirAll
@@ -59,7 +61,7 @@ const projectEndpoint = {
59
61
  return rawDirents;
60
62
  },
61
63
  async mkdir(path, options) {
62
- await WasmInit;
64
+ await this.wasmInit;
63
65
  if (options === null || options === void 0 ? void 0 : options.recursive) {
64
66
  return await this.projectInternal.createDirAll(path);
65
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/web",
3
- "version": "0.0.1-alpha.8",
3
+ "version": "0.0.1-alpha.9",
4
4
  "module": "esm/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "files": [
@@ -8,14 +8,14 @@
8
8
  ],
9
9
  "scripts": {
10
10
  "install-toolchain": "cargo install wasm-bindgen-cli && brew install binaryen",
11
- "build-wasm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown",
12
- "build-wasm:pm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown --no-default-features",
11
+ "build-wasm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown -Z build-std=panic_abort,std",
12
+ "build-wasm:pm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown --no-default-features -Z build-std=panic_abort,std",
13
13
  "bindgen-dev": "wasm-bindgen ../../target/wasm32-unknown-unknown/wasm-dev/utoo_wasm.wasm --out-dir src/utoo --out-name index --target web --debug --keep-debug --no-demangle",
14
14
  "bindgen-build": "wasm-bindgen ../../target/wasm32-unknown-unknown/wasm-release/utoo_wasm.wasm --out-dir src/utoo --out-name index --target web",
15
15
  "tsx": "rm -rf esm && tsc -p ./tsconfig.json",
16
16
  "dev": "npm run build-wasm -- --profile wasm-dev && npm run bindgen-dev && npm run tsx && cp src/utoo/index_bg.wasm esm/utoo",
17
17
  "dev:pm": "npm run build-wasm:pm -- --profile wasm-dev && npm run bindgen-dev && npm run tsx && cp src/utoo/index_bg.wasm esm/utoo",
18
- "build": "npm run build-wasm -- --profile wasm-release && npm run bindgen-build && npm run tsx && wasm-opt src/utoo/index_bg.wasm -o esm/utoo/index_bg.wasm -O4 --enable-bulk-memory --enable-nontrapping-float-to-int",
18
+ "build": "npm run build-wasm -- --profile wasm-release && npm run bindgen-build && npm run tsx && wasm-opt src/utoo/index_bg.wasm -o esm/utoo/index_bg.wasm --enable-threads --enable-bulk-memory --enable-nontrapping-float-to-int -O4",
19
19
  "prepublishOnly": "npm run build"
20
20
  },
21
21
  "dependencies": {
@@ -28,5 +28,6 @@
28
28
  "node": ">= 20"
29
29
  },
30
30
  "author": "xusd320",
31
- "license": "MIT"
31
+ "license": "MIT",
32
+ "repository": "git@github.com:umijs/mako.git"
32
33
  }