@utoo/web 0.0.1-alpha.10 → 0.0.1-alpha.11

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
@@ -3,7 +3,7 @@ export declare class Project implements ProjectEndpoint {
3
3
  #private;
4
4
  private remote;
5
5
  constructor(opt: MountOpt & {
6
- worker?: Worker;
6
+ entryUrl?: string;
7
7
  });
8
8
  install(packageLock: string): Promise<void>;
9
9
  build(): Promise<void>;
package/esm/index.js CHANGED
@@ -19,12 +19,13 @@ export class Project {
19
19
  constructor(opt) {
20
20
  var _a, _b;
21
21
  _Project_tunnel.set(this, void 0);
22
- const { cwd, worker, wasmUrl } = opt;
22
+ const { cwd, entryUrl, wasmUrl, threadUrl } = 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) {
26
- ProjectWorker =
27
- worker || new Worker(new URL("./worker", import.meta.url));
26
+ ProjectWorker = entryUrl
27
+ ? new Worker(entryUrl)
28
+ : new Worker(new URL("./worker", import.meta.url));
28
29
  self.addEventListener("message", (e) => {
29
30
  const port = e.ports[0];
30
31
  if (e.data === Fork && !ConnectedPorts.has(port)) {
@@ -33,7 +34,7 @@ export class Project {
33
34
  });
34
35
  }
35
36
  ProjectWorker.postMessage(HandShake, [port2]);
36
- __classPrivateFieldSet(this, _Project_tunnel, (_b = __classPrivateFieldGet(this, _Project_tunnel, "f")) !== null && _b !== void 0 ? _b : this.remote.mount({ cwd, wasmUrl }), "f");
37
+ __classPrivateFieldSet(this, _Project_tunnel, (_b = __classPrivateFieldGet(this, _Project_tunnel, "f")) !== null && _b !== void 0 ? _b : this.remote.mount({ cwd, wasmUrl, threadUrl }), "f");
37
38
  }
38
39
  async install(packageLock) {
39
40
  await __classPrivateFieldGet(this, _Project_tunnel, "f");
package/esm/type.d.ts CHANGED
@@ -26,5 +26,6 @@ export interface ProjectEndpoint {
26
26
  }
27
27
  export interface MountOpt {
28
28
  cwd: string;
29
+ threadUrl: string;
29
30
  wasmUrl?: string;
30
31
  }
@@ -40,8 +40,9 @@ export class DirEntry {
40
40
  export class Project {
41
41
  /**
42
42
  * @param {string} cwd
43
+ * @param {string} thread_url
43
44
  */
44
- constructor(cwd: string);
45
+ constructor(cwd: string, thread_url: string);
45
46
  __destroy_into_raw(): number;
46
47
  __wbg_ptr: number;
47
48
  free(): void;
package/esm/utoo/index.js CHANGED
@@ -361,11 +361,14 @@ export class Project {
361
361
  }
362
362
  /**
363
363
  * @param {string} cwd
364
+ * @param {string} thread_url
364
365
  */
365
- constructor(cwd) {
366
+ constructor(cwd, thread_url) {
366
367
  const ptr0 = passStringToWasm0(cwd, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
367
368
  const len0 = WASM_VECTOR_LEN;
368
- const ret = wasm.project_new(ptr0, len0);
369
+ const ptr1 = passStringToWasm0(thread_url, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
370
+ const len1 = WASM_VECTOR_LEN;
371
+ const ret = wasm.project_new(ptr0, len0, ptr1, len1);
369
372
  this.__wbg_ptr = ret >>> 0;
370
373
  ProjectFinalization.register(this, this.__wbg_ptr, this);
371
374
  return this;
@@ -662,7 +665,7 @@ function __wbg_get_imports() {
662
665
  const ret = getObject(arg0).getFileHandle(getStringFromWasm0(arg1, arg2), getObject(arg3));
663
666
  return addHeapObject(ret);
664
667
  };
665
- imports.wbg.__wbg_getRandomValues_3a70830e53f8ccf5 = function () {
668
+ imports.wbg.__wbg_getRandomValues_80578b2ff2a093ba = function () {
666
669
  return handleError(function (arg0) {
667
670
  globalThis.crypto.getRandomValues(getObject(arg0));
668
671
  }, arguments);
@@ -1153,28 +1156,28 @@ function __wbg_get_imports() {
1153
1156
  const ret = false;
1154
1157
  return ret;
1155
1158
  };
1156
- imports.wbg.__wbindgen_closure_wrapper204130 = function (arg0, arg1, arg2) {
1157
- const ret = makeMutClosure(arg0, arg1, 131379, __wbg_adapter_49);
1159
+ imports.wbg.__wbindgen_closure_wrapper201206 = function (arg0, arg1, arg2) {
1160
+ const ret = makeMutClosure(arg0, arg1, 129965, __wbg_adapter_49);
1158
1161
  return addHeapObject(ret);
1159
1162
  };
1160
- imports.wbg.__wbindgen_closure_wrapper216712 = function (arg0, arg1, arg2) {
1161
- const ret = makeMutClosure(arg0, arg1, 144806, __wbg_adapter_52);
1163
+ imports.wbg.__wbindgen_closure_wrapper216627 = function (arg0, arg1, arg2) {
1164
+ const ret = makeMutClosure(arg0, arg1, 144802, __wbg_adapter_52);
1162
1165
  return addHeapObject(ret);
1163
1166
  };
1164
- imports.wbg.__wbindgen_closure_wrapper216713 = function (arg0, arg1, arg2) {
1165
- const ret = makeMutClosure(arg0, arg1, 144806, __wbg_adapter_52);
1167
+ imports.wbg.__wbindgen_closure_wrapper216628 = function (arg0, arg1, arg2) {
1168
+ const ret = makeMutClosure(arg0, arg1, 144802, __wbg_adapter_52);
1166
1169
  return addHeapObject(ret);
1167
1170
  };
1168
- imports.wbg.__wbindgen_closure_wrapper216764 = function (arg0, arg1, arg2) {
1169
- const ret = makeMutClosure(arg0, arg1, 144832, __wbg_adapter_57);
1171
+ imports.wbg.__wbindgen_closure_wrapper216680 = function (arg0, arg1, arg2) {
1172
+ const ret = makeMutClosure(arg0, arg1, 144828, __wbg_adapter_57);
1170
1173
  return addHeapObject(ret);
1171
1174
  };
1172
- imports.wbg.__wbindgen_closure_wrapper216804 = function (arg0, arg1, arg2) {
1173
- const ret = makeMutClosure(arg0, arg1, 144850, __wbg_adapter_60);
1175
+ imports.wbg.__wbindgen_closure_wrapper216720 = function (arg0, arg1, arg2) {
1176
+ const ret = makeMutClosure(arg0, arg1, 144846, __wbg_adapter_60);
1174
1177
  return addHeapObject(ret);
1175
1178
  };
1176
- imports.wbg.__wbindgen_closure_wrapper32222 = function (arg0, arg1, arg2) {
1177
- const ret = makeMutClosure(arg0, arg1, 18428, __wbg_adapter_46);
1179
+ imports.wbg.__wbindgen_closure_wrapper32230 = function (arg0, arg1, arg2) {
1180
+ const ret = makeMutClosure(arg0, arg1, 18432, __wbg_adapter_46);
1178
1181
  return addHeapObject(ret);
1179
1182
  };
1180
1183
  imports.wbg.__wbindgen_debug_string = function (arg0, arg1) {
Binary file
package/esm/worker.js CHANGED
@@ -7,10 +7,10 @@ const projectEndpoint = {
7
7
  // This should be called only once
8
8
  async mount(opt) {
9
9
  var _a;
10
- const { cwd, wasmUrl } = opt;
10
+ const { cwd, wasmUrl, threadUrl } = opt;
11
11
  (_a = this.wasmInit) !== null && _a !== void 0 ? _a : (this.wasmInit = initWasm(wasmUrl));
12
12
  await this.wasmInit;
13
- this.projectInternal = new ProjectInternal(cwd);
13
+ this.projectInternal = new ProjectInternal(cwd, threadUrl);
14
14
  return;
15
15
  },
16
16
  async install(packageLock) {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import initWasm from "./utoo";
2
+ self.wasm_bindgen = initWasm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/web",
3
- "version": "0.0.1-alpha.10",
3
+ "version": "0.0.1-alpha.11",
4
4
  "module": "esm/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "files": [