@utoo/web 1.0.0 → 1.0.2

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/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,14 +239,65 @@ 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;
242
+ /**
243
+ * @returns {Promise<WorkerTermination>}
244
+ */
245
+ export function recvWorkerTermination() {
246
+ const ret = wasm.recvWorkerTermination();
247
+ return takeObject(ret);
248
+ }
249
+ /**
250
+ * @param {number} task_id
251
+ * @param {number} worker_id
252
+ * @returns {Promise<void>}
253
+ */
254
+ export function notifyWorkerAck(task_id, worker_id) {
255
+ const ret = wasm.notifyWorkerAck(task_id, worker_id);
256
+ return takeObject(ret);
257
+ }
258
+ /**
259
+ * @param {number} task_id
260
+ * @param {string} message
261
+ * @returns {Promise<void>}
262
+ */
263
+ export function sendTaskMessage(task_id, message) {
264
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ret = wasm.sendTaskMessage(task_id, ptr0, len0);
267
+ return takeObject(ret);
268
+ }
269
+ /**
270
+ * @param {number} worker_id
271
+ * @returns {Promise<string>}
272
+ */
273
+ export function recvMessageInWorker(worker_id) {
274
+ const ret = wasm.recvMessageInWorker(worker_id);
275
+ return takeObject(ret);
276
+ }
277
+ /**
278
+ * @param {string} pool_id
279
+ * @returns {Promise<number>}
280
+ */
281
+ export function recvWorkerRequest(pool_id) {
282
+ const ptr0 = passStringToWasm0(pool_id, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
283
+ const len0 = WASM_VECTOR_LEN;
284
+ const ret = wasm.recvWorkerRequest(ptr0, len0);
285
+ return takeObject(ret);
286
+ }
287
+ /**
288
+ * @returns {Promise<PoolOptions>}
289
+ */
290
+ export function recvPoolRequest() {
291
+ const ret = wasm.recvPoolRequest();
292
+ return takeObject(ret);
293
+ }
294
+ /**
295
+ * @param {string} filter
296
+ */
297
+ export function init_log_filter(filter) {
298
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
299
+ const len0 = WASM_VECTOR_LEN;
300
+ wasm.init_log_filter(ptr0, len0);
241
301
  }
242
302
  export function init_pack() {
243
303
  wasm.init_pack();
@@ -255,6 +315,12 @@ function passArray8ToWasm0(arg, malloc) {
255
315
  export function wasm_thread_entry_point(ptr) {
256
316
  wasm.wasm_thread_entry_point(ptr);
257
317
  }
318
+ function __wbg_adapter_10(arg0, arg1, arg2) {
319
+ wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
320
+ }
321
+ function __wbg_adapter_13(arg0, arg1, arg2) {
322
+ wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
323
+ }
258
324
  let stack_pointer = 128;
259
325
  function addBorrowedObject(obj) {
260
326
  if (stack_pointer == 1)
@@ -262,24 +328,18 @@ function addBorrowedObject(obj) {
262
328
  heap[--stack_pointer] = obj;
263
329
  return stack_pointer;
264
330
  }
265
- function __wbg_adapter_4(arg0, arg1, arg2) {
331
+ function __wbg_adapter_22(arg0, arg1, arg2) {
266
332
  try {
267
- wasm.__wbindgen_export_6(arg0, arg1, addBorrowedObject(arg2));
333
+ wasm.__wbindgen_export_8(arg0, arg1, addBorrowedObject(arg2));
268
334
  }
269
335
  finally {
270
336
  heap[stack_pointer++] = undefined;
271
337
  }
272
338
  }
273
- function __wbg_adapter_17(arg0, arg1, arg2) {
274
- wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
275
- }
276
- function __wbg_adapter_22(arg0, arg1, arg2) {
277
- wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2));
278
- }
279
339
  function __wbg_adapter_25(arg0, arg1) {
280
340
  wasm.__wbindgen_export_9(arg0, arg1);
281
341
  }
282
- function __wbg_adapter_102(arg0, arg1, arg2, arg3) {
342
+ function __wbg_adapter_94(arg0, arg1, arg2, arg3) {
283
343
  wasm.__wbindgen_export_10(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
284
344
  }
285
345
  const __wbindgen_enum_DirEntryType = ["file", "directory"];
@@ -417,6 +477,71 @@ export class Metadata {
417
477
  }
418
478
  if (Symbol.dispose)
419
479
  Metadata.prototype[Symbol.dispose] = Metadata.prototype.free;
480
+ const PoolOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
481
+ ? { register: () => { }, unregister: () => { } }
482
+ : new FinalizationRegistry(ptr => wasm.__wbg_pooloptions_free(ptr >>> 0, 1));
483
+ export class PoolOptions {
484
+ static __wrap(ptr) {
485
+ ptr = ptr >>> 0;
486
+ const obj = Object.create(PoolOptions.prototype);
487
+ obj.__wbg_ptr = ptr;
488
+ PoolOptionsFinalization.register(obj, obj.__wbg_ptr, obj);
489
+ return obj;
490
+ }
491
+ __destroy_into_raw() {
492
+ const ptr = this.__wbg_ptr;
493
+ this.__wbg_ptr = 0;
494
+ PoolOptionsFinalization.unregister(this);
495
+ return ptr;
496
+ }
497
+ free() {
498
+ const ptr = this.__destroy_into_raw();
499
+ wasm.__wbg_pooloptions_free(ptr, 0);
500
+ }
501
+ /**
502
+ * @returns {string}
503
+ */
504
+ get filename() {
505
+ let deferred1_0;
506
+ let deferred1_1;
507
+ try {
508
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
509
+ wasm.__wbg_get_pooloptions_filename(retptr, this.__wbg_ptr);
510
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
511
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
512
+ deferred1_0 = r0;
513
+ deferred1_1 = r1;
514
+ return getStringFromWasm0(r0, r1);
515
+ }
516
+ finally {
517
+ wasm.__wbindgen_add_to_stack_pointer(16);
518
+ wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
519
+ }
520
+ }
521
+ /**
522
+ * @param {string} arg0
523
+ */
524
+ set filename(arg0) {
525
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
526
+ const len0 = WASM_VECTOR_LEN;
527
+ wasm.__wbg_set_pooloptions_filename(this.__wbg_ptr, ptr0, len0);
528
+ }
529
+ /**
530
+ * @returns {number}
531
+ */
532
+ get maxConcurrency() {
533
+ const ret = wasm.__wbg_get_pooloptions_maxConcurrency(this.__wbg_ptr);
534
+ return ret >>> 0;
535
+ }
536
+ /**
537
+ * @param {number} arg0
538
+ */
539
+ set maxConcurrency(arg0) {
540
+ wasm.__wbg_set_pooloptions_maxConcurrency(this.__wbg_ptr, arg0);
541
+ }
542
+ }
543
+ if (Symbol.dispose)
544
+ PoolOptions.prototype[Symbol.dispose] = PoolOptions.prototype.free;
420
545
  const ProjectFinalization = (typeof FinalizationRegistry === 'undefined')
421
546
  ? { register: () => { }, unregister: () => { } }
422
547
  : new FinalizationRegistry(ptr => wasm.__wbg_project_free(ptr >>> 0, 1));
@@ -652,6 +777,71 @@ export class Project {
652
777
  }
653
778
  if (Symbol.dispose)
654
779
  Project.prototype[Symbol.dispose] = Project.prototype.free;
780
+ const WorkerTerminationFinalization = (typeof FinalizationRegistry === 'undefined')
781
+ ? { register: () => { }, unregister: () => { } }
782
+ : new FinalizationRegistry(ptr => wasm.__wbg_workertermination_free(ptr >>> 0, 1));
783
+ export class WorkerTermination {
784
+ static __wrap(ptr) {
785
+ ptr = ptr >>> 0;
786
+ const obj = Object.create(WorkerTermination.prototype);
787
+ obj.__wbg_ptr = ptr;
788
+ WorkerTerminationFinalization.register(obj, obj.__wbg_ptr, obj);
789
+ return obj;
790
+ }
791
+ __destroy_into_raw() {
792
+ const ptr = this.__wbg_ptr;
793
+ this.__wbg_ptr = 0;
794
+ WorkerTerminationFinalization.unregister(this);
795
+ return ptr;
796
+ }
797
+ free() {
798
+ const ptr = this.__destroy_into_raw();
799
+ wasm.__wbg_workertermination_free(ptr, 0);
800
+ }
801
+ /**
802
+ * @returns {string}
803
+ */
804
+ get filename() {
805
+ let deferred1_0;
806
+ let deferred1_1;
807
+ try {
808
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
809
+ wasm.__wbg_get_pooloptions_filename(retptr, this.__wbg_ptr);
810
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
811
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
812
+ deferred1_0 = r0;
813
+ deferred1_1 = r1;
814
+ return getStringFromWasm0(r0, r1);
815
+ }
816
+ finally {
817
+ wasm.__wbindgen_add_to_stack_pointer(16);
818
+ wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
819
+ }
820
+ }
821
+ /**
822
+ * @param {string} arg0
823
+ */
824
+ set filename(arg0) {
825
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
826
+ const len0 = WASM_VECTOR_LEN;
827
+ wasm.__wbg_set_pooloptions_filename(this.__wbg_ptr, ptr0, len0);
828
+ }
829
+ /**
830
+ * @returns {number}
831
+ */
832
+ get workerId() {
833
+ const ret = wasm.__wbg_get_pooloptions_maxConcurrency(this.__wbg_ptr);
834
+ return ret >>> 0;
835
+ }
836
+ /**
837
+ * @param {number} arg0
838
+ */
839
+ set workerId(arg0) {
840
+ wasm.__wbg_set_pooloptions_maxConcurrency(this.__wbg_ptr, arg0);
841
+ }
842
+ }
843
+ if (Symbol.dispose)
844
+ WorkerTermination.prototype[Symbol.dispose] = WorkerTermination.prototype.free;
655
845
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
656
846
  async function __wbg_load(module, imports) {
657
847
  if (typeof Response === 'function' && module instanceof Response) {
@@ -741,7 +931,7 @@ function __wbg_get_imports() {
741
931
  const ret = getObject(arg0).changedHandle;
742
932
  return addHeapObject(ret);
743
933
  };
744
- imports.wbg.__wbg_clearTimeout_6222fede17abcb1a = function (arg0) {
934
+ imports.wbg.__wbg_clearTimeout_7a42b49784aea641 = function (arg0) {
745
935
  const ret = clearTimeout(takeObject(arg0));
746
936
  return addHeapObject(ret);
747
937
  };
@@ -807,12 +997,12 @@ function __wbg_get_imports() {
807
997
  return addHeapObject(ret);
808
998
  }, arguments);
809
999
  };
810
- imports.wbg.__wbg_fetch_87aed7f306ec6d63 = function (arg0, arg1) {
811
- const ret = getObject(arg0).fetch(getObject(arg1));
1000
+ imports.wbg.__wbg_fetch_74a3e84ebd2c9a0e = function (arg0) {
1001
+ const ret = fetch(getObject(arg0));
812
1002
  return addHeapObject(ret);
813
1003
  };
814
- imports.wbg.__wbg_fetch_f156d10be9a5c88a = function (arg0) {
815
- const ret = fetch(getObject(arg0));
1004
+ imports.wbg.__wbg_fetch_87aed7f306ec6d63 = function (arg0, arg1) {
1005
+ const ret = getObject(arg0).fetch(getObject(arg1));
816
1006
  return addHeapObject(ret);
817
1007
  };
818
1008
  imports.wbg.__wbg_flush_d2487a24f3bc3cf4 = function () {
@@ -967,13 +1157,6 @@ function __wbg_get_imports() {
967
1157
  const ret = getObject(arg0).length;
968
1158
  return ret;
969
1159
  };
970
- imports.wbg.__wbg_message_702ebc62fa8b0c7c = function (arg0, arg1) {
971
- const ret = getObject(arg1).message;
972
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
973
- const len1 = WASM_VECTOR_LEN;
974
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
975
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
976
- };
977
1160
  imports.wbg.__wbg_metadata_new = function (arg0) {
978
1161
  const ret = Metadata.__wrap(arg0);
979
1162
  return addHeapObject(ret);
@@ -1008,7 +1191,7 @@ function __wbg_get_imports() {
1008
1191
  const a = state0.a;
1009
1192
  state0.a = 0;
1010
1193
  try {
1011
- return __wbg_adapter_102(a, state0.b, arg0, arg1);
1194
+ return __wbg_adapter_94(a, state0.b, arg0, arg1);
1012
1195
  }
1013
1196
  finally {
1014
1197
  state0.a = a;
@@ -1085,12 +1268,6 @@ function __wbg_get_imports() {
1085
1268
  return addHeapObject(ret);
1086
1269
  }, arguments);
1087
1270
  };
1088
- imports.wbg.__wbg_newwithstrsequenceandoptions_5b257525e688af7d = function () {
1089
- return handleError(function (arg0, arg1) {
1090
- const ret = new Blob(getObject(arg0), getObject(arg1));
1091
- return addHeapObject(ret);
1092
- }, arguments);
1093
- };
1094
1271
  imports.wbg.__wbg_next_1142e1658f75ec63 = function () {
1095
1272
  return handleError(function (arg0) {
1096
1273
  const ret = getObject(arg0).next();
@@ -1127,6 +1304,10 @@ function __wbg_get_imports() {
1127
1304
  const ret = getObject(arg0).performance;
1128
1305
  return addHeapObject(ret);
1129
1306
  };
1307
+ imports.wbg.__wbg_pooloptions_new = function (arg0) {
1308
+ const ret = PoolOptions.__wrap(arg0);
1309
+ return addHeapObject(ret);
1310
+ };
1130
1311
  imports.wbg.__wbg_postMessage_38909232d65f5870 = function () {
1131
1312
  return handleError(function (arg0, arg1) {
1132
1313
  getObject(arg0).postMessage(getObject(arg1));
@@ -1179,21 +1360,16 @@ function __wbg_get_imports() {
1179
1360
  const ret = Promise.resolve(getObject(arg0));
1180
1361
  return addHeapObject(ret);
1181
1362
  };
1182
- imports.wbg.__wbg_revokeObjectURL_651b859c81bf1af0 = function () {
1183
- return handleError(function (arg0, arg1) {
1184
- URL.revokeObjectURL(getStringFromWasm0(arg0, arg1));
1185
- }, arguments);
1186
- };
1187
- imports.wbg.__wbg_setTimeout_2b339866a2aa3789 = function (arg0, arg1) {
1188
- const ret = setTimeout(getObject(arg0), arg1);
1189
- return addHeapObject(ret);
1190
- };
1191
1363
  imports.wbg.__wbg_setTimeout_63008613644b07af = function () {
1192
1364
  return handleError(function (arg0, arg1, arg2) {
1193
1365
  const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
1194
1366
  return addHeapObject(ret);
1195
1367
  }, arguments);
1196
1368
  };
1369
+ imports.wbg.__wbg_setTimeout_7bb3429662ab1e70 = function (arg0, arg1) {
1370
+ const ret = setTimeout(getObject(arg0), arg1);
1371
+ return addHeapObject(ret);
1372
+ };
1197
1373
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
1198
1374
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1199
1375
  };
@@ -1234,9 +1410,6 @@ function __wbg_get_imports() {
1234
1410
  imports.wbg.__wbg_setname_6c6a9da905405176 = function (arg0, arg1, arg2) {
1235
1411
  getObject(arg0).name = getStringFromWasm0(arg1, arg2);
1236
1412
  };
1237
- imports.wbg.__wbg_setonerror_d1f7d212a8fc3389 = function (arg0, arg1) {
1238
- getObject(arg0).onerror = getObject(arg1);
1239
- };
1240
1413
  imports.wbg.__wbg_setonmessage_c943f7891405ab22 = function (arg0, arg1) {
1241
1414
  getObject(arg0).onmessage = getObject(arg1);
1242
1415
  };
@@ -1249,9 +1422,6 @@ function __wbg_get_imports() {
1249
1422
  imports.wbg.__wbg_setsignal_8c45ad1247a74809 = function (arg0, arg1) {
1250
1423
  getObject(arg0).signal = getObject(arg1);
1251
1424
  };
1252
- imports.wbg.__wbg_settype_298968e371b58a33 = function (arg0, arg1, arg2) {
1253
- getObject(arg0).type = getStringFromWasm0(arg1, arg2);
1254
- };
1255
1425
  imports.wbg.__wbg_settype_3dc790721d11b6f5 = function (arg0, arg1) {
1256
1426
  getObject(arg0).type = __wbindgen_enum_WorkerType[arg1];
1257
1427
  };
@@ -1389,10 +1559,6 @@ function __wbg_get_imports() {
1389
1559
  const ret = typeof (getObject(arg0)) === 'function';
1390
1560
  return ret;
1391
1561
  };
1392
- imports.wbg.__wbg_wbindgenisnull_f3037694abe4d97a = function (arg0) {
1393
- const ret = getObject(arg0) === null;
1394
- return ret;
1395
- };
1396
1562
  imports.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function (arg0) {
1397
1563
  const val = getObject(arg0);
1398
1564
  const ret = typeof (val) === 'object' && val !== null;
@@ -1438,6 +1604,10 @@ function __wbg_get_imports() {
1438
1604
  imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function (arg0, arg1) {
1439
1605
  throw new Error(getStringFromWasm0(arg0, arg1));
1440
1606
  };
1607
+ imports.wbg.__wbg_workertermination_new = function (arg0) {
1608
+ const ret = WorkerTermination.__wrap(arg0);
1609
+ return addHeapObject(ret);
1610
+ };
1441
1611
  imports.wbg.__wbg_write_9ac6a5f58a8c835c = function () {
1442
1612
  return handleError(function (arg0, arg1, arg2, arg3) {
1443
1613
  const ret = getObject(arg0).write(getArrayU8FromWasm0(arg1, arg2), getObject(arg3));
@@ -1450,29 +1620,19 @@ function __wbg_get_imports() {
1450
1620
  return ret;
1451
1621
  }, arguments);
1452
1622
  };
1453
- imports.wbg.__wbindgen_cast_1ca0782ec1faf942 = function (arg0, arg1) {
1454
- // Cast intrinsic for `Closure(Closure { dtor_idx: 604, function: Function { arguments: [], shim_idx: 605, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1455
- const ret = makeMutClosure(arg0, arg1, 604, __wbg_adapter_25);
1456
- return addHeapObject(ret);
1457
- };
1458
1623
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
1459
1624
  // Cast intrinsic for `Ref(String) -> Externref`.
1460
1625
  const ret = getStringFromWasm0(arg0, arg1);
1461
1626
  return addHeapObject(ret);
1462
1627
  };
1463
- imports.wbg.__wbindgen_cast_2bf53ab5a6985333 = function (arg0, arg1) {
1464
- // Cast intrinsic for `Closure(Closure { dtor_idx: 8791, function: Function { arguments: [Externref], shim_idx: 8792, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1465
- const ret = makeMutClosure(arg0, arg1, 8791, __wbg_adapter_17);
1628
+ imports.wbg.__wbindgen_cast_2aafe3a70f74f3e0 = function (arg0, arg1) {
1629
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8681, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8682, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1630
+ const ret = makeMutClosure(arg0, arg1, 8681, __wbg_adapter_13);
1466
1631
  return addHeapObject(ret);
1467
1632
  };
1468
- imports.wbg.__wbindgen_cast_33aa391726f172ef = function (arg0, arg1) {
1469
- // Cast intrinsic for `Closure(Closure { dtor_idx: 9074, function: Function { arguments: [], shim_idx: 605, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1470
- const ret = makeMutClosure(arg0, arg1, 9074, __wbg_adapter_25);
1471
- return addHeapObject(ret);
1472
- };
1473
- imports.wbg.__wbindgen_cast_34e5558c5d1de712 = function (arg0, arg1) {
1474
- // Cast intrinsic for `Closure(Closure { dtor_idx: 8791, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 8792, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1475
- const ret = makeMutClosure(arg0, arg1, 8791, __wbg_adapter_17);
1633
+ imports.wbg.__wbindgen_cast_3bfef9a8628dc119 = function (arg0, arg1) {
1634
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8688, function: Function { arguments: [], shim_idx: 600, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1635
+ const ret = makeMutClosure(arg0, arg1, 8688, __wbg_adapter_25);
1476
1636
  return addHeapObject(ret);
1477
1637
  };
1478
1638
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
@@ -1480,14 +1640,14 @@ function __wbg_get_imports() {
1480
1640
  const ret = BigInt.asUintN(64, arg0);
1481
1641
  return addHeapObject(ret);
1482
1642
  };
1483
- imports.wbg.__wbindgen_cast_4a3e076a883393e0 = function (arg0, arg1) {
1484
- // Cast intrinsic for `Closure(Closure { dtor_idx: 9058, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 9059, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1485
- const ret = makeClosure(arg0, arg1, 9058, __wbg_adapter_22);
1643
+ imports.wbg.__wbindgen_cast_4c807b347a3d0cbf = function (arg0, arg1) {
1644
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 599, function: Function { arguments: [], shim_idx: 600, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1645
+ const ret = makeMutClosure(arg0, arg1, 599, __wbg_adapter_25);
1486
1646
  return addHeapObject(ret);
1487
1647
  };
1488
- imports.wbg.__wbindgen_cast_690c59a3c7b902df = function (arg0, arg1) {
1489
- // Cast intrinsic for `Closure(Closure { dtor_idx: 8791, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 8792, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1490
- const ret = makeMutClosure(arg0, arg1, 8791, __wbg_adapter_17);
1648
+ imports.wbg.__wbindgen_cast_5cc12922bca91779 = function (arg0, arg1) {
1649
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8681, function: Function { arguments: [Externref], shim_idx: 8682, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1650
+ const ret = makeMutClosure(arg0, arg1, 8681, __wbg_adapter_13);
1491
1651
  return addHeapObject(ret);
1492
1652
  };
1493
1653
  imports.wbg.__wbindgen_cast_76322aab70622876 = function (arg0, arg1) {
@@ -1504,16 +1664,21 @@ function __wbg_get_imports() {
1504
1664
  const ret = v0;
1505
1665
  return addHeapObject(ret);
1506
1666
  };
1507
- imports.wbg.__wbindgen_cast_9a09b473951e479b = function (arg0, arg1) {
1508
- // Cast intrinsic for `Closure(Closure { dtor_idx: 9058, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 9072, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1509
- const ret = makeMutClosure(arg0, arg1, 9058, __wbg_adapter_4);
1510
- return addHeapObject(ret);
1511
- };
1512
1667
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
1513
1668
  // Cast intrinsic for `I64 -> Externref`.
1514
1669
  const ret = arg0;
1515
1670
  return addHeapObject(ret);
1516
1671
  };
1672
+ imports.wbg.__wbindgen_cast_9b1d89ef740b288c = function (arg0, arg1) {
1673
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8662, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 8686, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1674
+ const ret = makeMutClosure(arg0, arg1, 8662, __wbg_adapter_22);
1675
+ return addHeapObject(ret);
1676
+ };
1677
+ imports.wbg.__wbindgen_cast_9c5a3d861803a5de = function (arg0, arg1) {
1678
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8662, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 8663, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1679
+ const ret = makeClosure(arg0, arg1, 8662, __wbg_adapter_10);
1680
+ return addHeapObject(ret);
1681
+ };
1517
1682
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
1518
1683
  // Cast intrinsic for `F64 -> Externref`.
1519
1684
  const ret = arg0;
@@ -1543,7 +1708,7 @@ function __wbg_get_imports() {
1543
1708
  return imports;
1544
1709
  }
1545
1710
  function __wbg_init_memory(imports, memory) {
1546
- imports.wbg.memory = memory || new WebAssembly.Memory({ initial: 128, maximum: 16384, shared: true });
1711
+ imports.wbg.memory = memory || new WebAssembly.Memory({ initial: 129, maximum: 16384, shared: true });
1547
1712
  }
1548
1713
  function __wbg_finalize_init(instance, module, thread_stack_size) {
1549
1714
  wasm = instance.exports;
Binary file
@@ -0,0 +1,3 @@
1
+ export const __esModule: boolean;
2
+ export default lessLoader;
3
+ declare function lessLoader(source: any): Promise<void>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = void 0;
6
+ var _path = _interopRequireDefault(require("path"));
7
+ var _options = _interopRequireDefault(require("./options.json"));
8
+ var _utils = require("./utils");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ async function lessLoader(source) {
11
+ const options = this.getOptions(_options.default);
12
+ const callback = this.async();
13
+ let implementation;
14
+ try {
15
+ implementation = (0, _utils.getLessImplementation)(this, options.implementation);
16
+ }
17
+ catch (error) {
18
+ callback(error);
19
+ return;
20
+ }
21
+ if (!implementation) {
22
+ callback(new Error(`The Less implementation "${options.implementation}" not found`));
23
+ return;
24
+ }
25
+ const lessOptions = (0, _utils.getLessOptions)(this, options, implementation);
26
+ const useSourceMap = typeof options.sourceMap === "boolean" ? options.sourceMap : this.sourceMap;
27
+ if (useSourceMap) {
28
+ lessOptions.sourceMap = {
29
+ outputSourceFiles: true
30
+ };
31
+ }
32
+ let data = source;
33
+ if (typeof options.additionalData !== "undefined") {
34
+ data = typeof options.additionalData === "function" ? `${await options.additionalData(data, this)}` : `${options.additionalData}\n${data}`;
35
+ }
36
+ const logger = this.getLogger("less-loader");
37
+ const loaderContext = this;
38
+ const loggerListener = {
39
+ error(message) {
40
+ // TODO enable by default in the next major release
41
+ if (options.lessLogAsWarnOrErr) {
42
+ loaderContext.emitError(new Error(message));
43
+ }
44
+ else {
45
+ logger.error(message);
46
+ }
47
+ },
48
+ warn(message) {
49
+ // TODO enable by default in the next major release
50
+ if (options.lessLogAsWarnOrErr) {
51
+ loaderContext.emitWarning(new Error(message));
52
+ }
53
+ else {
54
+ logger.warn(message);
55
+ }
56
+ },
57
+ info(message) {
58
+ logger.log(message);
59
+ },
60
+ debug(message) {
61
+ logger.debug(message);
62
+ }
63
+ };
64
+ implementation.logger.addListener(loggerListener);
65
+ let result;
66
+ try {
67
+ result = await implementation.render(data, lessOptions);
68
+ }
69
+ catch (error) {
70
+ if (error.filename) {
71
+ // `less` returns forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
72
+ // Ref: https://github.com/webpack-contrib/less-loader/issues/357
73
+ this.addDependency(_path.default.normalize(error.filename));
74
+ }
75
+ callback((0, _utils.errorFactory)(error));
76
+ return;
77
+ }
78
+ finally {
79
+ // Fix memory leaks in `less`
80
+ implementation.logger.removeListener(loggerListener);
81
+ delete lessOptions.pluginManager.webpackLoaderContext;
82
+ delete lessOptions.pluginManager;
83
+ }
84
+ const { css, imports } = result;
85
+ imports.forEach(item => {
86
+ if ((0, _utils.isUnsupportedUrl)(item)) {
87
+ return;
88
+ }
89
+ // `less` return forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
90
+ // Ref: https://github.com/webpack-contrib/less-loader/issues/357
91
+ const normalizedItem = _path.default.normalize(item);
92
+ // Custom `importer` can return only `contents` so item will be relative
93
+ if (_path.default.isAbsolute(normalizedItem)) {
94
+ this.addDependency(normalizedItem);
95
+ }
96
+ });
97
+ let map = typeof result.map === "string" ? JSON.parse(result.map) : result.map;
98
+ if (map && useSourceMap) {
99
+ map = (0, _utils.normalizeSourceMap)(map, this.rootContext);
100
+ }
101
+ callback(null, css, map);
102
+ }
103
+ var _default = exports.default = lessLoader;
@@ -0,0 +1,67 @@
1
+ {
2
+ "title": "Less Loader options",
3
+ "type": "object",
4
+ "properties": {
5
+ "lessOptions": {
6
+ "description": "Options to pass through to `Less`.",
7
+ "link": "https://github.com/webpack-contrib/less-loader#lessoptions",
8
+ "anyOf": [
9
+ {
10
+ "type": "object",
11
+ "additionalProperties": true
12
+ },
13
+ {
14
+ "instanceof": "Function"
15
+ }
16
+ ]
17
+ },
18
+ "additionalData": {
19
+ "description": "Prepends/Appends `Less` code to the actual entry file.",
20
+ "link": "https://github.com/webpack-contrib/less-loader#additionalData",
21
+ "anyOf": [
22
+ {
23
+ "type": "string"
24
+ },
25
+ {
26
+ "instanceof": "Function"
27
+ }
28
+ ]
29
+ },
30
+ "sourceMap": {
31
+ "description": "Enables/Disables generation of source maps.",
32
+ "link": "https://github.com/webpack-contrib/less-loader#sourcemap",
33
+ "type": "boolean"
34
+ },
35
+ "webpackImporter": {
36
+ "description": "Enables/Disables default `webpack` importer.",
37
+ "link": "https://github.com/webpack-contrib/less-loader#webpackimporter",
38
+ "anyOf": [
39
+ {
40
+ "type": "boolean"
41
+ },
42
+ {
43
+ "type": "string",
44
+ "enum": ["only"]
45
+ }
46
+ ]
47
+ },
48
+ "implementation": {
49
+ "description": "The implementation of the `Less` to be used.",
50
+ "link": "https://github.com/webpack-contrib/less-loader#implementation",
51
+ "anyOf": [
52
+ {
53
+ "type": "string"
54
+ },
55
+ {
56
+ "type": "object"
57
+ }
58
+ ]
59
+ },
60
+ "lessLogAsWarnOrErr": {
61
+ "description": "Less warnings and errors will be webpack warnings or errors.",
62
+ "link": "https://github.com/webpack-contrib/less-loader#lesslogaswarnorerr",
63
+ "type": "boolean"
64
+ }
65
+ },
66
+ "additionalProperties": false
67
+ }