@utoo/web 0.0.1-alpha.2 → 0.0.1-alpha.3

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.
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @param {PartialProjectOptions} partial_options
3
+ * @returns {Promise<void>}
4
+ */
5
+ export function build(partial_options: PartialProjectOptions): Promise<void>;
6
+ export function init_pack(): void;
1
7
  export class CreateSyncAccessHandleOptions {
2
8
  static __wrap(ptr: any): any;
3
9
  __destroy_into_raw(): number | undefined;
@@ -34,6 +40,27 @@ export class DirEntry {
34
40
  */
35
41
  get type(): DirEntryType;
36
42
  }
43
+ export class PartialProjectOptions {
44
+ __destroy_into_raw(): number | undefined;
45
+ __wbg_ptr: number | undefined;
46
+ free(): void;
47
+ /**
48
+ * @param {string} arg0
49
+ */
50
+ set project_path(arg0: string);
51
+ /**
52
+ * @returns {string}
53
+ */
54
+ get project_path(): string;
55
+ /**
56
+ * @param {string | null} [arg0]
57
+ */
58
+ set config(arg0: string | null);
59
+ /**
60
+ * @returns {string | undefined}
61
+ */
62
+ get config(): string | undefined;
63
+ }
37
64
  export class Project {
38
65
  /**
39
66
  * @param {string} cwd
package/esm/utoo/index.js CHANGED
@@ -46,6 +46,10 @@ function takeObject(idx) {
46
46
  dropObject(idx);
47
47
  return ret;
48
48
  }
49
+ function getArrayU8FromWasm0(ptr, len) {
50
+ ptr = ptr >>> 0;
51
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
52
+ }
49
53
  let WASM_VECTOR_LEN = 0;
50
54
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available'); } });
51
55
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -98,10 +102,6 @@ function getDataViewMemory0() {
98
102
  }
99
103
  return cachedDataViewMemory0;
100
104
  }
101
- function getArrayU8FromWasm0(ptr, len) {
102
- ptr = ptr >>> 0;
103
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
104
- }
105
105
  function isLikeNone(x) {
106
106
  return x === undefined || x === null;
107
107
  }
@@ -204,13 +204,31 @@ function debugString(val) {
204
204
  // TODO we could test for more things here, like `Set`s and `Map`s.
205
205
  return className;
206
206
  }
207
+ function _assertClass(instance, klass) {
208
+ if (!(instance instanceof klass)) {
209
+ throw new Error(`expected instance of ${klass.name}`);
210
+ }
211
+ }
212
+ /**
213
+ * @param {PartialProjectOptions} partial_options
214
+ * @returns {Promise<void>}
215
+ */
216
+ export function build(partial_options) {
217
+ _assertClass(partial_options, PartialProjectOptions);
218
+ var ptr0 = partial_options.__destroy_into_raw();
219
+ const ret = wasm.build(ptr0);
220
+ return takeObject(ret);
221
+ }
222
+ export function init_pack() {
223
+ wasm.init_pack();
224
+ }
207
225
  function __wbg_adapter_28(arg0, arg1) {
208
226
  wasm.__wbindgen_export_5(arg0, arg1);
209
227
  }
210
228
  function __wbg_adapter_31(arg0, arg1, arg2) {
211
229
  wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
212
230
  }
213
- function __wbg_adapter_66(arg0, arg1, arg2, arg3) {
231
+ function __wbg_adapter_68(arg0, arg1, arg2, arg3) {
214
232
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
215
233
  }
216
234
  const __wbindgen_enum_DirEntryType = ["file", "directory"];
@@ -314,6 +332,77 @@ export class DirEntry {
314
332
  wasm.__wbg_set_direntry_type(this.__wbg_ptr, (__wbindgen_enum_DirEntryType.indexOf(arg0) + 1 || 3) - 1);
315
333
  }
316
334
  }
335
+ const PartialProjectOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
336
+ ? { register: () => { }, unregister: () => { } }
337
+ : new FinalizationRegistry(ptr => wasm.__wbg_partialprojectoptions_free(ptr >>> 0, 1));
338
+ export class PartialProjectOptions {
339
+ __destroy_into_raw() {
340
+ const ptr = this.__wbg_ptr;
341
+ this.__wbg_ptr = 0;
342
+ PartialProjectOptionsFinalization.unregister(this);
343
+ return ptr;
344
+ }
345
+ free() {
346
+ const ptr = this.__destroy_into_raw();
347
+ wasm.__wbg_partialprojectoptions_free(ptr, 0);
348
+ }
349
+ /**
350
+ * @returns {string}
351
+ */
352
+ get project_path() {
353
+ let deferred1_0;
354
+ let deferred1_1;
355
+ try {
356
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
357
+ wasm.__wbg_get_partialprojectoptions_project_path(retptr, this.__wbg_ptr);
358
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
359
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
360
+ deferred1_0 = r0;
361
+ deferred1_1 = r1;
362
+ return getStringFromWasm0(r0, r1);
363
+ }
364
+ finally {
365
+ wasm.__wbindgen_add_to_stack_pointer(16);
366
+ wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
367
+ }
368
+ }
369
+ /**
370
+ * @param {string} arg0
371
+ */
372
+ set project_path(arg0) {
373
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
374
+ const len0 = WASM_VECTOR_LEN;
375
+ wasm.__wbg_set_partialprojectoptions_project_path(this.__wbg_ptr, ptr0, len0);
376
+ }
377
+ /**
378
+ * @returns {string | undefined}
379
+ */
380
+ get config() {
381
+ try {
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ wasm.__wbg_get_partialprojectoptions_config(retptr, this.__wbg_ptr);
384
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
385
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
386
+ let v1;
387
+ if (r0 !== 0) {
388
+ v1 = getStringFromWasm0(r0, r1).slice();
389
+ wasm.__wbindgen_export_4(r0, r1 * 1, 1);
390
+ }
391
+ return v1;
392
+ }
393
+ finally {
394
+ wasm.__wbindgen_add_to_stack_pointer(16);
395
+ }
396
+ }
397
+ /**
398
+ * @param {string | null} [arg0]
399
+ */
400
+ set config(arg0) {
401
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
402
+ var len0 = WASM_VECTOR_LEN;
403
+ wasm.__wbg_set_partialprojectoptions_config(this.__wbg_ptr, ptr0, len0);
404
+ }
405
+ }
317
406
  const ProjectFinalization = (typeof FinalizationRegistry === 'undefined')
318
407
  ? { register: () => { }, unregister: () => { } }
319
408
  : new FinalizationRegistry(ptr => wasm.__wbg_project_free(ptr >>> 0, 1));
@@ -554,6 +643,11 @@ function __wbg_get_imports() {
554
643
  const ret = getObject(arg0).getFileHandle(getStringFromWasm0(arg1, arg2), getObject(arg3));
555
644
  return addHeapObject(ret);
556
645
  };
646
+ imports.wbg.__wbg_getRandomValues_21a0191e74d0e1d3 = function () {
647
+ return handleError(function (arg0, arg1) {
648
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
649
+ }, arguments);
650
+ };
557
651
  imports.wbg.__wbg_getSize_e7dbd5ffa0b43df1 = function () {
558
652
  return handleError(function (arg0) {
559
653
  const ret = getObject(arg0).getSize();
@@ -649,7 +743,7 @@ function __wbg_get_imports() {
649
743
  const a = state0.a;
650
744
  state0.a = 0;
651
745
  try {
652
- return __wbg_adapter_66(a, state0.b, arg0, arg1);
746
+ return __wbg_adapter_68(a, state0.b, arg0, arg1);
653
747
  }
654
748
  finally {
655
749
  state0.a = a;
@@ -719,6 +813,10 @@ function __wbg_get_imports() {
719
813
  return ret;
720
814
  }, arguments);
721
815
  };
816
+ imports.wbg.__wbg_removeEntry_a424e90dff229b19 = function (arg0, arg1, arg2, arg3) {
817
+ const ret = getObject(arg0).removeEntry(getStringFromWasm0(arg1, arg2), getObject(arg3));
818
+ return addHeapObject(ret);
819
+ };
722
820
  imports.wbg.__wbg_resolve_4851785c9c5f573d = function (arg0) {
723
821
  const ret = Promise.resolve(getObject(arg0));
724
822
  return addHeapObject(ret);
@@ -754,6 +852,9 @@ function __wbg_get_imports() {
754
852
  imports.wbg.__wbg_setmode_5dc300b865044b65 = function (arg0, arg1) {
755
853
  getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
756
854
  };
855
+ imports.wbg.__wbg_setrecursive_536113a081d6177a = function (arg0, arg1) {
856
+ getObject(arg0).recursive = arg1 !== 0;
857
+ };
757
858
  imports.wbg.__wbg_setsignal_75b21ef3a81de905 = function (arg0, arg1) {
758
859
  getObject(arg0).signal = getObject(arg1);
759
860
  };
@@ -841,12 +942,12 @@ function __wbg_get_imports() {
841
942
  const ret = false;
842
943
  return ret;
843
944
  };
844
- imports.wbg.__wbindgen_closure_wrapper1053 = function (arg0, arg1, arg2) {
845
- const ret = makeMutClosure(arg0, arg1, 172, __wbg_adapter_28);
945
+ imports.wbg.__wbindgen_closure_wrapper178346 = function (arg0, arg1, arg2) {
946
+ const ret = makeMutClosure(arg0, arg1, 141890, __wbg_adapter_31);
846
947
  return addHeapObject(ret);
847
948
  };
848
- imports.wbg.__wbindgen_closure_wrapper1670 = function (arg0, arg1, arg2) {
849
- const ret = makeMutClosure(arg0, arg1, 443, __wbg_adapter_31);
949
+ imports.wbg.__wbindgen_closure_wrapper25760 = function (arg0, arg1, arg2) {
950
+ const ret = makeMutClosure(arg0, arg1, 18204, __wbg_adapter_28);
850
951
  return addHeapObject(ret);
851
952
  };
852
953
  imports.wbg.__wbindgen_debug_string = function (arg0, arg1) {
@@ -904,6 +1005,7 @@ function __wbg_finalize_init(instance, module) {
904
1005
  __wbg_init.__wbindgen_wasm_module = module;
905
1006
  cachedDataViewMemory0 = null;
906
1007
  cachedUint8ArrayMemory0 = null;
1008
+ wasm.__wbindgen_start();
907
1009
  return wasm;
908
1010
  }
909
1011
  function initSync(module) {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/web",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.3",
4
4
  "module": "esm/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "files": [
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "wasmpack": "wasm-pack build ../../crates/utoo-wasm --out-dir ../../packages/utoo-web/src/utoo --out-name index --no-pack --target web",
11
11
  "tsx": "rm -rf esm && tsc -p ./tsconfig.json",
12
- "dev": "npm run wasmpack -- --dev && npm run tsx && cp ./src/utoo/*.wasm ./esm/utoo",
12
+ "dev": "npm run wasmpack -- --profiling && npm run tsx && cp ./src/utoo/*.wasm ./esm/utoo",
13
13
  "build": "npm run wasmpack -- --release && npm run tsx && cp ./src/utoo/*.wasm ./esm/utoo",
14
14
  "prepublishOnly": "npm run build"
15
15
  },