@utoo/web 0.0.1-alpha.34 → 0.0.1-alpha.36
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/project.js +2 -1
- package/esm/threadWorker.js +6 -0
- package/esm/type.d.ts +1 -0
- package/esm/utoo/index.js +46 -42
- package/esm/utoo/index_bg.wasm +0 -0
- package/esm/worker.js +13 -2
- package/package.json +1 -1
package/esm/project.js
CHANGED
|
@@ -22,7 +22,7 @@ export class Project {
|
|
|
22
22
|
constructor(options) {
|
|
23
23
|
var _a, _b;
|
|
24
24
|
_Project_mount.set(this, void 0);
|
|
25
|
-
const { cwd, workerUrl, wasmUrl, threadWorkerUrl, serviceWorker } = options;
|
|
25
|
+
const { cwd, workerUrl, wasmUrl, threadWorkerUrl, serviceWorker, logFilter, } = options;
|
|
26
26
|
this.serviceWorkerOptions = serviceWorker;
|
|
27
27
|
const { port1, port2 } = new MessageChannel();
|
|
28
28
|
(_a = this.remote) !== null && _a !== void 0 ? _a : (this.remote = comlink.wrap(port1));
|
|
@@ -44,6 +44,7 @@ export class Project {
|
|
|
44
44
|
cwd,
|
|
45
45
|
wasmUrl,
|
|
46
46
|
threadWorkerUrl,
|
|
47
|
+
logFilter,
|
|
47
48
|
}), "f");
|
|
48
49
|
}
|
|
49
50
|
connectWorker(e) {
|
package/esm/threadWorker.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import initWasm from "./utoo";
|
|
2
|
+
// Read logFilter from URL query string and set to globalThis
|
|
3
|
+
const urlParams = new URLSearchParams(self.location.search);
|
|
4
|
+
const logFilter = urlParams.get("logFilter");
|
|
5
|
+
if (logFilter) {
|
|
6
|
+
globalThis.__UTOO_LOG_FILTER__ = logFilter;
|
|
7
|
+
}
|
|
2
8
|
// this is for wasm_thread to spawn new worker thread.
|
|
3
9
|
// see: https://github.com/utooland/wasm_thread/blob/94438ff771ee0a6a55d79e49a655707970acb615/src/wasm32/js/web_worker.js#L10
|
|
4
10
|
self.wasm_bindgen = initWasm;
|
package/esm/type.d.ts
CHANGED
package/esm/utoo/index.js
CHANGED
|
@@ -208,15 +208,6 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
208
208
|
CLOSURE_DTORS.register(real, state, state);
|
|
209
209
|
return real;
|
|
210
210
|
}
|
|
211
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
212
|
-
ptr = ptr >>> 0;
|
|
213
|
-
const mem = getDataViewMemory0();
|
|
214
|
-
const result = [];
|
|
215
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
216
|
-
result.push(takeObject(mem.getUint32(i, true)));
|
|
217
|
-
}
|
|
218
|
-
return result;
|
|
219
|
-
}
|
|
220
211
|
function makeClosure(arg0, arg1, dtor, f) {
|
|
221
212
|
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
222
213
|
const real = (...args) => {
|
|
@@ -239,6 +230,15 @@ function makeClosure(arg0, arg1, dtor, f) {
|
|
|
239
230
|
CLOSURE_DTORS.register(real, state, state);
|
|
240
231
|
return real;
|
|
241
232
|
}
|
|
233
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
234
|
+
ptr = ptr >>> 0;
|
|
235
|
+
const mem = getDataViewMemory0();
|
|
236
|
+
const result = [];
|
|
237
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
238
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
242
|
export function init_pack() {
|
|
243
243
|
wasm.init_pack();
|
|
244
244
|
}
|
|
@@ -255,10 +255,10 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
255
255
|
export function wasm_thread_entry_point(ptr) {
|
|
256
256
|
wasm.wasm_thread_entry_point(ptr);
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function __wbg_adapter_4(arg0, arg1, arg2) {
|
|
259
259
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function __wbg_adapter_7(arg0, arg1, arg2) {
|
|
262
262
|
wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
|
|
263
263
|
}
|
|
264
264
|
let stack_pointer = 128;
|
|
@@ -268,7 +268,7 @@ function addBorrowedObject(obj) {
|
|
|
268
268
|
heap[--stack_pointer] = obj;
|
|
269
269
|
return stack_pointer;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function __wbg_adapter_10(arg0, arg1, arg2) {
|
|
272
272
|
try {
|
|
273
273
|
wasm.__wbindgen_export_8(arg0, arg1, addBorrowedObject(arg2));
|
|
274
274
|
}
|
|
@@ -276,7 +276,7 @@ function __wbg_adapter_18(arg0, arg1, arg2) {
|
|
|
276
276
|
heap[stack_pointer++] = undefined;
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function __wbg_adapter_13(arg0, arg1) {
|
|
280
280
|
wasm.__wbindgen_export_9(arg0, arg1);
|
|
281
281
|
}
|
|
282
282
|
function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
|
|
@@ -1286,6 +1286,10 @@ function __wbg_get_imports() {
|
|
|
1286
1286
|
const ret = typeof (getObject(arg0)) === 'function';
|
|
1287
1287
|
return ret;
|
|
1288
1288
|
};
|
|
1289
|
+
imports.wbg.__wbg_wbindgenisnull_f3037694abe4d97a = function (arg0) {
|
|
1290
|
+
const ret = getObject(arg0) === null;
|
|
1291
|
+
return ret;
|
|
1292
|
+
};
|
|
1289
1293
|
imports.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function (arg0) {
|
|
1290
1294
|
const val = getObject(arg0);
|
|
1291
1295
|
const ret = typeof (val) === 'object' && val !== null;
|
|
@@ -1339,24 +1343,24 @@ function __wbg_get_imports() {
|
|
|
1339
1343
|
return ret;
|
|
1340
1344
|
}, arguments);
|
|
1341
1345
|
};
|
|
1346
|
+
imports.wbg.__wbindgen_cast_00971014be4c41e9 = function (arg0, arg1) {
|
|
1347
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 9063, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 9073, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1348
|
+
const ret = makeMutClosure(arg0, arg1, 9063, __wbg_adapter_10);
|
|
1349
|
+
return addHeapObject(ret);
|
|
1350
|
+
};
|
|
1342
1351
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
1343
1352
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1344
1353
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
1345
1354
|
return addHeapObject(ret);
|
|
1346
1355
|
};
|
|
1347
|
-
imports.wbg.__wbindgen_cast_22634e72d9e94906 = function (arg0, arg1) {
|
|
1348
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 8797, function: Function { arguments: [Externref], shim_idx: 8798, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1349
|
-
const ret = makeMutClosure(arg0, arg1, 8797, __wbg_adapter_15);
|
|
1350
|
-
return addHeapObject(ret);
|
|
1351
|
-
};
|
|
1352
1356
|
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
|
|
1353
1357
|
// Cast intrinsic for `U64 -> Externref`.
|
|
1354
1358
|
const ret = BigInt.asUintN(64, arg0);
|
|
1355
1359
|
return addHeapObject(ret);
|
|
1356
1360
|
};
|
|
1357
|
-
imports.wbg.
|
|
1358
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1359
|
-
const ret =
|
|
1361
|
+
imports.wbg.__wbindgen_cast_631793fd2186b3cf = function (arg0, arg1) {
|
|
1362
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 9063, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 9064, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
1363
|
+
const ret = makeClosure(arg0, arg1, 9063, __wbg_adapter_7);
|
|
1360
1364
|
return addHeapObject(ret);
|
|
1361
1365
|
};
|
|
1362
1366
|
imports.wbg.__wbindgen_cast_76322aab70622876 = function (arg0, arg1) {
|
|
@@ -1373,39 +1377,39 @@ function __wbg_get_imports() {
|
|
|
1373
1377
|
const ret = v0;
|
|
1374
1378
|
return addHeapObject(ret);
|
|
1375
1379
|
};
|
|
1376
|
-
imports.wbg.
|
|
1377
|
-
// Cast intrinsic for `
|
|
1378
|
-
const ret =
|
|
1380
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
|
|
1381
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1382
|
+
const ret = arg0;
|
|
1379
1383
|
return addHeapObject(ret);
|
|
1380
1384
|
};
|
|
1381
|
-
imports.wbg.
|
|
1382
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1383
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1385
|
+
imports.wbg.__wbindgen_cast_a1eef3adaaf2ed9c = function (arg0, arg1) {
|
|
1386
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 8793, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8794, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1387
|
+
const ret = makeMutClosure(arg0, arg1, 8793, __wbg_adapter_4);
|
|
1384
1388
|
return addHeapObject(ret);
|
|
1385
1389
|
};
|
|
1386
|
-
imports.wbg.
|
|
1387
|
-
// Cast intrinsic for `
|
|
1388
|
-
const ret = arg0;
|
|
1390
|
+
imports.wbg.__wbindgen_cast_aa86286f6e9d676e = function (arg0, arg1) {
|
|
1391
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 620, function: Function { arguments: [], shim_idx: 621, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1392
|
+
const ret = makeMutClosure(arg0, arg1, 620, __wbg_adapter_13);
|
|
1389
1393
|
return addHeapObject(ret);
|
|
1390
1394
|
};
|
|
1391
|
-
imports.wbg.
|
|
1392
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1393
|
-
const ret =
|
|
1395
|
+
imports.wbg.__wbindgen_cast_b3f2dc423ce0326d = function (arg0, arg1) {
|
|
1396
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 9075, function: Function { arguments: [], shim_idx: 621, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1397
|
+
const ret = makeMutClosure(arg0, arg1, 9075, __wbg_adapter_13);
|
|
1394
1398
|
return addHeapObject(ret);
|
|
1395
1399
|
};
|
|
1396
|
-
imports.wbg.
|
|
1397
|
-
// Cast intrinsic for `
|
|
1398
|
-
const ret = arg0;
|
|
1400
|
+
imports.wbg.__wbindgen_cast_b95228bca84fbfaa = function (arg0, arg1) {
|
|
1401
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 8793, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 8794, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1402
|
+
const ret = makeMutClosure(arg0, arg1, 8793, __wbg_adapter_4);
|
|
1399
1403
|
return addHeapObject(ret);
|
|
1400
1404
|
};
|
|
1401
|
-
imports.wbg.
|
|
1402
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1403
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1405
|
+
imports.wbg.__wbindgen_cast_cadf9b3f6ab5c9a3 = function (arg0, arg1) {
|
|
1406
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 8793, function: Function { arguments: [Externref], shim_idx: 8794, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1407
|
+
const ret = makeMutClosure(arg0, arg1, 8793, __wbg_adapter_4);
|
|
1404
1408
|
return addHeapObject(ret);
|
|
1405
1409
|
};
|
|
1406
|
-
imports.wbg.
|
|
1407
|
-
// Cast intrinsic for `
|
|
1408
|
-
const ret =
|
|
1410
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
|
|
1411
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1412
|
+
const ret = arg0;
|
|
1409
1413
|
return addHeapObject(ret);
|
|
1410
1414
|
};
|
|
1411
1415
|
imports.wbg.__wbindgen_link_dd5153a359f2e504 = function (arg0) {
|
package/esm/utoo/index_bg.wasm
CHANGED
|
Binary file
|
package/esm/worker.js
CHANGED
|
@@ -7,10 +7,21 @@ const projectEndpoint = {
|
|
|
7
7
|
// This should be called only once
|
|
8
8
|
async mount(opt) {
|
|
9
9
|
var _a;
|
|
10
|
-
const { cwd, wasmUrl, threadWorkerUrl } = opt;
|
|
10
|
+
const { cwd, wasmUrl, threadWorkerUrl, logFilter } = opt;
|
|
11
|
+
// Set global log filter before wasm init
|
|
12
|
+
if (logFilter) {
|
|
13
|
+
globalThis.__UTOO_LOG_FILTER__ = logFilter;
|
|
14
|
+
}
|
|
11
15
|
(_a = this.wasmInit) !== null && _a !== void 0 ? _a : (this.wasmInit = initWasm(wasmUrl));
|
|
12
16
|
await this.wasmInit;
|
|
13
|
-
|
|
17
|
+
// Pass logFilter to thread worker via URL query string
|
|
18
|
+
let finalThreadWorkerUrl = threadWorkerUrl;
|
|
19
|
+
if (logFilter) {
|
|
20
|
+
const url = new URL(threadWorkerUrl, self.location.href);
|
|
21
|
+
url.searchParams.set("logFilter", logFilter);
|
|
22
|
+
finalThreadWorkerUrl = url.toString();
|
|
23
|
+
}
|
|
24
|
+
this.projectInternal = new ProjectInternal(cwd, finalThreadWorkerUrl);
|
|
14
25
|
return;
|
|
15
26
|
},
|
|
16
27
|
async install(packageLock) {
|