@utoo/web 0.0.1-alpha.37 → 0.0.1-alpha.39

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.
@@ -2,7 +2,7 @@ import { ProjectEndpoint } from "./type";
2
2
  export declare class ForkedProject implements ProjectEndpoint {
3
3
  private endpoint;
4
4
  constructor(port: MessagePort);
5
- install(packageLock: string): Promise<void>;
5
+ install(packageLock: string, maxConcurrentDownloads?: number): Promise<void>;
6
6
  build(): Promise<import("./type").BuildOutput>;
7
7
  readFile(path: string, encoding?: "utf8"): Promise<any>;
8
8
  writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
@@ -4,8 +4,8 @@ export class ForkedProject {
4
4
  var _a;
5
5
  (_a = this.endpoint) !== null && _a !== void 0 ? _a : (this.endpoint = comlink.wrap(port));
6
6
  }
7
- async install(packageLock) {
8
- return await this.endpoint.install(packageLock);
7
+ async install(packageLock, maxConcurrentDownloads) {
8
+ return await this.endpoint.install(packageLock, maxConcurrentDownloads);
9
9
  }
10
10
  async build() {
11
11
  return await this.endpoint.build();
package/esm/project.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare class Project implements ProjectEndpoint {
7
7
  private connectWorker;
8
8
  installServiceWorker(): Promise<void>;
9
9
  mount(): Promise<void>;
10
- install(packageLock: string): Promise<void>;
10
+ install(packageLock: string, maxConcurrentDownloads?: number): Promise<void>;
11
11
  build(): Promise<BuildOutput>;
12
12
  readFile(path: string, encoding?: "utf8"): Promise<any>;
13
13
  writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
package/esm/project.js CHANGED
@@ -63,9 +63,9 @@ export class Project {
63
63
  async mount() {
64
64
  return await __classPrivateFieldGet(this, _Project_mount, "f");
65
65
  }
66
- async install(packageLock) {
66
+ async install(packageLock, maxConcurrentDownloads) {
67
67
  await __classPrivateFieldGet(this, _Project_mount, "f");
68
- return await this.remote.install(packageLock);
68
+ return await this.remote.install(packageLock, maxConcurrentDownloads);
69
69
  }
70
70
  async build() {
71
71
  await __classPrivateFieldGet(this, _Project_mount, "f");
@@ -22,10 +22,7 @@ self.addEventListener("fetch", async (event) => {
22
22
  event.respondWith(readFileFromProject(projectPath));
23
23
  }
24
24
  else {
25
- event.respondWith(fetch(new Request(event.request, {
26
- mode: "cors",
27
- credentials: "same-origin",
28
- })));
25
+ return;
29
26
  }
30
27
  });
31
28
  async function readFileFromProject(projectPath) {
package/esm/type.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface BuildOutput {
15
15
  issues: Issue[];
16
16
  }
17
17
  export interface ProjectEndpoint {
18
- install: (packageLock: string) => Promise<void>;
18
+ install: (packageLock: string, maxConcurrentDownloads?: number) => Promise<void>;
19
19
  build: () => Promise<BuildOutput>;
20
20
  readFile(path: string): Promise<Uint8Array>;
21
21
  readFile(path: string, encoding?: "utf8"): Promise<string>;
@@ -107,9 +107,10 @@ export class Project {
107
107
  write(path: string, content: Uint8Array): Promise<void>;
108
108
  /**
109
109
  * @param {string} package_lock
110
+ * @param {number | null} [max_concurrent_downloads]
110
111
  * @returns {Promise<void>}
111
112
  */
112
- install(package_lock: string): Promise<void>;
113
+ install(package_lock: string, max_concurrent_downloads?: number | null): Promise<void>;
113
114
  /**
114
115
  * @param {string} path
115
116
  * @returns {Promise<Metadata>}
package/esm/utoo/index.js CHANGED
@@ -208,6 +208,15 @@ 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
+ }
211
220
  function makeClosure(arg0, arg1, dtor, f) {
212
221
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
213
222
  const real = (...args) => {
@@ -230,15 +239,6 @@ function makeClosure(arg0, arg1, dtor, f) {
230
239
  CLOSURE_DTORS.register(real, state, state);
231
240
  return real;
232
241
  }
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,6 +255,15 @@ 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 __wbg_adapter_8(arg0, arg1) {
259
+ wasm.__wbindgen_export_6(arg0, arg1);
260
+ }
261
+ function __wbg_adapter_19(arg0, arg1, arg2) {
262
+ wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
263
+ }
264
+ function __wbg_adapter_22(arg0, arg1, arg2) {
265
+ wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2));
266
+ }
258
267
  let stack_pointer = 128;
259
268
  function addBorrowedObject(obj) {
260
269
  if (stack_pointer == 1)
@@ -262,23 +271,14 @@ function addBorrowedObject(obj) {
262
271
  heap[--stack_pointer] = obj;
263
272
  return stack_pointer;
264
273
  }
265
- function __wbg_adapter_8(arg0, arg1, arg2) {
274
+ function __wbg_adapter_27(arg0, arg1, arg2) {
266
275
  try {
267
- wasm.__wbindgen_export_6(arg0, arg1, addBorrowedObject(arg2));
276
+ wasm.__wbindgen_export_9(arg0, arg1, addBorrowedObject(arg2));
268
277
  }
269
278
  finally {
270
279
  heap[stack_pointer++] = undefined;
271
280
  }
272
281
  }
273
- function __wbg_adapter_11(arg0, arg1) {
274
- wasm.__wbindgen_export_7(arg0, arg1);
275
- }
276
- function __wbg_adapter_16(arg0, arg1, arg2) {
277
- wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2));
278
- }
279
- function __wbg_adapter_23(arg0, arg1, arg2) {
280
- wasm.__wbindgen_export_9(arg0, arg1, addHeapObject(arg2));
281
- }
282
282
  function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
283
283
  wasm.__wbindgen_export_10(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
284
284
  }
@@ -561,12 +561,13 @@ export class Project {
561
561
  }
562
562
  /**
563
563
  * @param {string} package_lock
564
+ * @param {number | null} [max_concurrent_downloads]
564
565
  * @returns {Promise<void>}
565
566
  */
566
- install(package_lock) {
567
+ install(package_lock, max_concurrent_downloads) {
567
568
  const ptr0 = passStringToWasm0(package_lock, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
568
569
  const len0 = WASM_VECTOR_LEN;
569
- const ret = wasm.project_install(this.__wbg_ptr, ptr0, len0);
570
+ const ret = wasm.project_install(this.__wbg_ptr, ptr0, len0, isLikeNone(max_concurrent_downloads) ? 0x100000001 : (max_concurrent_downloads) >>> 0);
570
571
  return takeObject(ret);
571
572
  }
572
573
  /**
@@ -1348,9 +1349,19 @@ function __wbg_get_imports() {
1348
1349
  return ret;
1349
1350
  }, arguments);
1350
1351
  };
1351
- imports.wbg.__wbindgen_cast_0f100a735c4920db = function (arg0, arg1) {
1352
- // Cast intrinsic for `Closure(Closure { dtor_idx: 8794, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 8795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1353
- const ret = makeMutClosure(arg0, arg1, 8794, __wbg_adapter_16);
1352
+ imports.wbg.__wbindgen_cast_089f9f7ff7a05c34 = function (arg0, arg1) {
1353
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8792, function: Function { arguments: [Externref], shim_idx: 8793, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1354
+ const ret = makeMutClosure(arg0, arg1, 8792, __wbg_adapter_19);
1355
+ return addHeapObject(ret);
1356
+ };
1357
+ imports.wbg.__wbindgen_cast_0fa6bc778e36759b = function (arg0, arg1) {
1358
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 610, function: Function { arguments: [], shim_idx: 611, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1359
+ const ret = makeMutClosure(arg0, arg1, 610, __wbg_adapter_8);
1360
+ return addHeapObject(ret);
1361
+ };
1362
+ imports.wbg.__wbindgen_cast_21aa834240a50280 = function (arg0, arg1) {
1363
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8792, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8793, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1364
+ const ret = makeMutClosure(arg0, arg1, 8792, __wbg_adapter_19);
1354
1365
  return addHeapObject(ret);
1355
1366
  };
1356
1367
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
@@ -1358,26 +1369,11 @@ function __wbg_get_imports() {
1358
1369
  const ret = getStringFromWasm0(arg0, arg1);
1359
1370
  return addHeapObject(ret);
1360
1371
  };
1361
- imports.wbg.__wbindgen_cast_349f2f0d319f2e1c = function (arg0, arg1) {
1362
- // Cast intrinsic for `Closure(Closure { dtor_idx: 8794, function: Function { arguments: [Externref], shim_idx: 8795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1363
- const ret = makeMutClosure(arg0, arg1, 8794, __wbg_adapter_16);
1364
- return addHeapObject(ret);
1365
- };
1366
1372
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
1367
1373
  // Cast intrinsic for `U64 -> Externref`.
1368
1374
  const ret = BigInt.asUintN(64, arg0);
1369
1375
  return addHeapObject(ret);
1370
1376
  };
1371
- imports.wbg.__wbindgen_cast_631793fd2186b3cf = function (arg0, arg1) {
1372
- // 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`.
1373
- const ret = makeClosure(arg0, arg1, 9063, __wbg_adapter_23);
1374
- return addHeapObject(ret);
1375
- };
1376
- imports.wbg.__wbindgen_cast_64031a50bc0c5042 = function (arg0, arg1) {
1377
- // Cast intrinsic for `Closure(Closure { dtor_idx: 9074, function: Function { arguments: [], shim_idx: 621, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1378
- const ret = makeMutClosure(arg0, arg1, 9074, __wbg_adapter_11);
1379
- return addHeapObject(ret);
1380
- };
1381
1377
  imports.wbg.__wbindgen_cast_76322aab70622876 = function (arg0, arg1) {
1382
1378
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
1383
1379
  wasm.__wbindgen_export_4(arg0, arg1 * 4, 4);
@@ -1397,9 +1393,14 @@ function __wbg_get_imports() {
1397
1393
  const ret = arg0;
1398
1394
  return addHeapObject(ret);
1399
1395
  };
1400
- imports.wbg.__wbindgen_cast_aa86286f6e9d676e = function (arg0, arg1) {
1401
- // Cast intrinsic for `Closure(Closure { dtor_idx: 620, function: Function { arguments: [], shim_idx: 621, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1402
- const ret = makeMutClosure(arg0, arg1, 620, __wbg_adapter_11);
1396
+ imports.wbg.__wbindgen_cast_ac061a975f6fe616 = function (arg0, arg1) {
1397
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 9059, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 9068, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1398
+ const ret = makeMutClosure(arg0, arg1, 9059, __wbg_adapter_27);
1399
+ return addHeapObject(ret);
1400
+ };
1401
+ imports.wbg.__wbindgen_cast_d2a79abcd9dd4a4f = function (arg0, arg1) {
1402
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 9059, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 9060, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1403
+ const ret = makeClosure(arg0, arg1, 9059, __wbg_adapter_22);
1403
1404
  return addHeapObject(ret);
1404
1405
  };
1405
1406
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
@@ -1407,14 +1408,14 @@ function __wbg_get_imports() {
1407
1408
  const ret = arg0;
1408
1409
  return addHeapObject(ret);
1409
1410
  };
1410
- imports.wbg.__wbindgen_cast_e61e3b1a31545f58 = function (arg0, arg1) {
1411
- // Cast intrinsic for `Closure(Closure { dtor_idx: 8794, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1412
- const ret = makeMutClosure(arg0, arg1, 8794, __wbg_adapter_16);
1411
+ imports.wbg.__wbindgen_cast_e08369719eaa749a = function (arg0, arg1) {
1412
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8792, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 8793, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1413
+ const ret = makeMutClosure(arg0, arg1, 8792, __wbg_adapter_19);
1413
1414
  return addHeapObject(ret);
1414
1415
  };
1415
- imports.wbg.__wbindgen_cast_f7cd87a7af04d859 = function (arg0, arg1) {
1416
- // Cast intrinsic for `Closure(Closure { dtor_idx: 9063, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 9072, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1417
- const ret = makeMutClosure(arg0, arg1, 9063, __wbg_adapter_8);
1416
+ imports.wbg.__wbindgen_cast_e241456a1a2ffbf2 = function (arg0, arg1) {
1417
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 9070, function: Function { arguments: [], shim_idx: 611, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1418
+ const ret = makeMutClosure(arg0, arg1, 9070, __wbg_adapter_8);
1418
1419
  return addHeapObject(ret);
1419
1420
  };
1420
1421
  imports.wbg.__wbindgen_link_dd5153a359f2e504 = function (arg0) {
Binary file
package/esm/worker.js CHANGED
@@ -24,9 +24,9 @@ const projectEndpoint = {
24
24
  this.projectInternal = new ProjectInternal(cwd, finalThreadWorkerUrl);
25
25
  return;
26
26
  },
27
- async install(packageLock) {
27
+ async install(packageLock, maxConcurrentDownloads) {
28
28
  await this.wasmInit;
29
- await this.projectInternal.install(packageLock);
29
+ await this.projectInternal.install(packageLock, maxConcurrentDownloads);
30
30
  return;
31
31
  },
32
32
  async build() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/web",
3
- "version": "0.0.1-alpha.37",
3
+ "version": "0.0.1-alpha.39",
4
4
  "module": "esm/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "files": [