@0xweb/hardhat 0.1.33 → 0.1.34
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/0xc/hardhat/Foo/Foo.ts +208 -0
- package/0xc/hardhat/Foo/FooAbi.json +65 -0
- package/0xweb.json +16 -0
- package/artifacts/build-info/c1643630dd28520b4bf816afd2347880.json +1 -0
- package/cache/solidity-files-cache.json +39 -0
- package/coverage/report/base.css +213 -0
- package/coverage/report/coverage/Foo.sol.html +125 -0
- package/coverage/report/coverage/index.html +93 -0
- package/coverage/report/coverage-final.json +2 -0
- package/coverage/report/index.html +93 -0
- package/coverage/report/lcov-report/base.css +213 -0
- package/coverage/report/lcov-report/coverage/Foo.sol.html +125 -0
- package/coverage/report/lcov-report/coverage/index.html +93 -0
- package/coverage/report/lcov-report/index.html +93 -0
- package/coverage/report/lcov-report/prettify.css +1 -0
- package/coverage/report/lcov-report/prettify.js +1 -0
- package/coverage/report/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/report/lcov-report/sorter.js +158 -0
- package/coverage/report/lcov.info +23 -0
- package/coverage/report/prettify.css +1 -0
- package/coverage/report/prettify.js +1 -0
- package/coverage/report/sort-arrow-sprite.png +0 -0
- package/coverage/report/sorter.js +158 -0
- package/coverage.json +1 -0
- package/hardhat.config.js +28 -0
- package/lib/index.js +1839 -3
- package/package.json +8 -3
package/lib/index.js
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
// source ./RootModuleWrapped.js
|
|
3
3
|
(function(){
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _node_modules_memd_lib_umd_memd = {};
|
|
6
|
+
var _src_config = {};
|
|
6
7
|
var _src_constants = {};
|
|
8
|
+
var _src_coverage__coverage = {};
|
|
9
|
+
var _src_utils__command = {};
|
|
7
10
|
var _src_utils__path = {};
|
|
8
11
|
|
|
9
12
|
// source ./ModuleSimplified.js
|
|
@@ -56,9 +59,10 @@ var _src_constants;
|
|
|
56
59
|
|
|
57
60
|
"use strict";
|
|
58
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.TASK_0xWEB_GENERATE = exports.TASK_0xWEB = void 0;
|
|
62
|
+
exports.TASK_COVERAGE = exports.TASK_0xWEB_GENERATE = exports.TASK_0xWEB = void 0;
|
|
60
63
|
exports.TASK_0xWEB = '0xweb';
|
|
61
64
|
exports.TASK_0xWEB_GENERATE = '0xweb:generate';
|
|
65
|
+
exports.TASK_COVERAGE = 'coverage';
|
|
62
66
|
//# sourceMappingURL=constants.js.map
|
|
63
67
|
//# sourceMappingURL=constants.ts.map;
|
|
64
68
|
|
|
@@ -149,8 +153,1820 @@ var $path;
|
|
|
149
153
|
|
|
150
154
|
// end:source ./ModuleSimplified.js
|
|
151
155
|
|
|
156
|
+
|
|
157
|
+
// source ./ModuleSimplified.js
|
|
158
|
+
var _node_modules_memd_lib_umd_memd;
|
|
159
|
+
(function () {
|
|
160
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
161
|
+
var define = null;
|
|
162
|
+
var exports = _node_modules_memd_lib_umd_memd != null ? _node_modules_memd_lib_umd_memd : {};
|
|
163
|
+
var module = { exports: exports };
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
// source ./UMD.js
|
|
167
|
+
(function (factory) {
|
|
168
|
+
|
|
169
|
+
var _name = 'memd',
|
|
170
|
+
_global = typeof window === 'undefined' ? global : window,
|
|
171
|
+
_module = {
|
|
172
|
+
exports: {}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
factory(_module, _module.exports, _global);
|
|
176
|
+
|
|
177
|
+
if (typeof module === 'object' && module.exports) {
|
|
178
|
+
module.exports = _module.exports;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (typeof define === 'function' && define.amd) {
|
|
182
|
+
define([], function () {
|
|
183
|
+
return _module.exports;
|
|
184
|
+
});
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (_name) {
|
|
189
|
+
_global[_name] = _module.exports;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
}(function (module, exports, global) {
|
|
193
|
+
|
|
194
|
+
var _src_Cache = {};
|
|
195
|
+
var _src_deco_debounce = {};
|
|
196
|
+
var _src_deco_memoize = {};
|
|
197
|
+
var _src_deco_queued = {};
|
|
198
|
+
var _src_deco_throttle = {};
|
|
199
|
+
var _src_fn_Args = {};
|
|
200
|
+
var _src_fn_memoize = {};
|
|
201
|
+
var _src_fn_queued = {};
|
|
202
|
+
var _src_model_Deferred = {};
|
|
203
|
+
var _src_persistence_FsTransport = {};
|
|
204
|
+
var _src_persistence_LocalStorageTransport = {};
|
|
205
|
+
var _src_persistence_StoreWorker = {};
|
|
206
|
+
var _src_persistence_TransportWorker = {};
|
|
207
|
+
var _src_utils_requireLib = {};
|
|
208
|
+
var _src_workers_CachedWorker = {};
|
|
209
|
+
|
|
210
|
+
// source ./ModuleSimplified.js
|
|
211
|
+
var _src_fn_Args;
|
|
212
|
+
(function () {
|
|
213
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
214
|
+
var define = null;
|
|
215
|
+
var exports = _src_fn_Args != null ? _src_fn_Args : {};
|
|
216
|
+
var module = { exports: exports };
|
|
217
|
+
|
|
218
|
+
"use strict";
|
|
219
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
220
|
+
exports.Args = void 0;
|
|
221
|
+
var Args;
|
|
222
|
+
(function (Args) {
|
|
223
|
+
function getKey(args, keyOptions, selector, ctx) {
|
|
224
|
+
if (ctx == null) {
|
|
225
|
+
ctx = { level: 0, refs: [] };
|
|
226
|
+
}
|
|
227
|
+
if (keyOptions == null) {
|
|
228
|
+
keyOptions = {};
|
|
229
|
+
}
|
|
230
|
+
if (keyOptions.deep == null) {
|
|
231
|
+
keyOptions.deep = 3;
|
|
232
|
+
}
|
|
233
|
+
if (selector == null) {
|
|
234
|
+
selector = '';
|
|
235
|
+
}
|
|
236
|
+
let key = '';
|
|
237
|
+
for (let i = 0; i < args.length; i++) {
|
|
238
|
+
if (i > 0) {
|
|
239
|
+
key += '.';
|
|
240
|
+
}
|
|
241
|
+
ctx.level++;
|
|
242
|
+
key += getKeySingle(args[i], `${selector}.${i}`, keyOptions, ctx);
|
|
243
|
+
ctx.level--;
|
|
244
|
+
}
|
|
245
|
+
return key;
|
|
246
|
+
}
|
|
247
|
+
Args.getKey = getKey;
|
|
248
|
+
function getKeySingle(misc, selector, keyOptions, ctx) {
|
|
249
|
+
if (keyOptions.deep != null && ctx.level > keyOptions.deep) {
|
|
250
|
+
return '';
|
|
251
|
+
}
|
|
252
|
+
if (keyOptions.serialize != null && keyOptions.serialize[selector.substring(1) /* cut trailing '.'*/] != null) {
|
|
253
|
+
return keyOptions.serialize[selector.substring(1)](misc);
|
|
254
|
+
}
|
|
255
|
+
if (misc == null) {
|
|
256
|
+
return '';
|
|
257
|
+
}
|
|
258
|
+
if (typeof misc !== 'object') {
|
|
259
|
+
return misc;
|
|
260
|
+
}
|
|
261
|
+
if (misc instanceof Date) {
|
|
262
|
+
return misc.getTime();
|
|
263
|
+
}
|
|
264
|
+
if (misc instanceof Array) {
|
|
265
|
+
return getKey(misc, keyOptions, selector, ctx);
|
|
266
|
+
}
|
|
267
|
+
let str = '';
|
|
268
|
+
for (let key in misc) {
|
|
269
|
+
ctx.level++;
|
|
270
|
+
str += '.' + getKeySingle(misc[key], `${selector}.${key}`, keyOptions, ctx);
|
|
271
|
+
ctx.level--;
|
|
272
|
+
}
|
|
273
|
+
return str;
|
|
274
|
+
}
|
|
275
|
+
})(Args = exports.Args || (exports.Args = {}));
|
|
276
|
+
//# sourceMappingURL=Args.js.map
|
|
277
|
+
//# sourceMappingURL=Args.ts.map;
|
|
278
|
+
|
|
279
|
+
function __isObj(x) {
|
|
280
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
281
|
+
}
|
|
282
|
+
if (_src_fn_Args === module.exports) {
|
|
283
|
+
// do nothing if
|
|
284
|
+
} else if (__isObj(_src_fn_Args) && __isObj(module.exports)) {
|
|
285
|
+
Object.assign(_src_fn_Args, module.exports);
|
|
286
|
+
} else {
|
|
287
|
+
_src_fn_Args = module.exports;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
;
|
|
291
|
+
}());
|
|
292
|
+
|
|
293
|
+
// end:source ./ModuleSimplified.js
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
// source ./ModuleSimplified.js
|
|
297
|
+
var _src_persistence_TransportWorker;
|
|
298
|
+
(function () {
|
|
299
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
300
|
+
var define = null;
|
|
301
|
+
var exports = _src_persistence_TransportWorker != null ? _src_persistence_TransportWorker : {};
|
|
302
|
+
var module = { exports: exports };
|
|
303
|
+
|
|
304
|
+
"use strict";
|
|
305
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
306
|
+
exports.TransportWorker = void 0;
|
|
307
|
+
class TransportWorker {
|
|
308
|
+
cache;
|
|
309
|
+
transport;
|
|
310
|
+
isReady = false;
|
|
311
|
+
isAsync = false;
|
|
312
|
+
lastModified = null;
|
|
313
|
+
restorePromise = null;
|
|
314
|
+
// We duplicate collection, as Cache collections can store also promises.
|
|
315
|
+
coll = {};
|
|
316
|
+
flushRunner;
|
|
317
|
+
constructor(cache, transport) {
|
|
318
|
+
this.cache = cache;
|
|
319
|
+
this.transport = transport;
|
|
320
|
+
this.isAsync = Boolean(this.transport.isAsync);
|
|
321
|
+
this.flushRunner = new AsyncRunner(() => this.flushInner(), this.transport.debounceMs ?? 500);
|
|
322
|
+
}
|
|
323
|
+
restore() {
|
|
324
|
+
if (this.isReady) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (this.isAsync) {
|
|
328
|
+
throw new Error('Transport is Async');
|
|
329
|
+
}
|
|
330
|
+
let coll = this.transport.restore();
|
|
331
|
+
this.cache.setRestored(coll);
|
|
332
|
+
this.coll = coll ?? {};
|
|
333
|
+
this.isReady = true;
|
|
334
|
+
}
|
|
335
|
+
async restoreAsync() {
|
|
336
|
+
return this.restorePromise ?? (this.restorePromise = (async () => {
|
|
337
|
+
if (this.isReady) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (this.isAsync === false) {
|
|
341
|
+
this.restore();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
let coll = await this.transport.restoreAsync();
|
|
345
|
+
if (this.isReady) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
this.cache.setRestored(coll);
|
|
349
|
+
this.coll = coll ?? {};
|
|
350
|
+
this.isReady = true;
|
|
351
|
+
})());
|
|
352
|
+
}
|
|
353
|
+
flush(key, entry) {
|
|
354
|
+
this.isReady = true;
|
|
355
|
+
this.lastModified = new Date();
|
|
356
|
+
this.coll[key] = entry;
|
|
357
|
+
if (this.transport.debounceMs === 0) {
|
|
358
|
+
this.transport.flush(this.coll);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
this.flushRunner.run();
|
|
362
|
+
}
|
|
363
|
+
async flushAsync(key, entry, force) {
|
|
364
|
+
if (this.isReady === false) {
|
|
365
|
+
await this.restoreAsync();
|
|
366
|
+
}
|
|
367
|
+
this.lastModified = new Date();
|
|
368
|
+
this.coll[key] = entry;
|
|
369
|
+
return this.flushRunner.run();
|
|
370
|
+
}
|
|
371
|
+
async flushAllAsync(force) {
|
|
372
|
+
if (this.isReady === false) {
|
|
373
|
+
await this.restoreAsync();
|
|
374
|
+
}
|
|
375
|
+
this.lastModified = new Date();
|
|
376
|
+
return this.flushRunner.run(force);
|
|
377
|
+
}
|
|
378
|
+
clear() {
|
|
379
|
+
return this.flushRunner.run();
|
|
380
|
+
}
|
|
381
|
+
async clearAsync() {
|
|
382
|
+
return this.clear();
|
|
383
|
+
}
|
|
384
|
+
flushInner() {
|
|
385
|
+
let coll = this.coll;
|
|
386
|
+
if (this.transport.isAsync) {
|
|
387
|
+
return this.transport.flushAsync(coll);
|
|
388
|
+
}
|
|
389
|
+
this.transport.flush(coll);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
exports.TransportWorker = TransportWorker;
|
|
393
|
+
class AsyncRunner {
|
|
394
|
+
fn;
|
|
395
|
+
debounce;
|
|
396
|
+
isWaiting = false;
|
|
397
|
+
isBusy = false;
|
|
398
|
+
timeout = null;
|
|
399
|
+
dfr;
|
|
400
|
+
shouldRunNext = false;
|
|
401
|
+
constructor(fn, debounce) {
|
|
402
|
+
this.fn = fn;
|
|
403
|
+
this.debounce = debounce;
|
|
404
|
+
}
|
|
405
|
+
async run(force) {
|
|
406
|
+
if (this.isWaiting && !this.isBusy) {
|
|
407
|
+
this.defer(force);
|
|
408
|
+
return this.dfr.promise;
|
|
409
|
+
}
|
|
410
|
+
if (this.isBusy) {
|
|
411
|
+
this.shouldRunNext = true;
|
|
412
|
+
return this.dfr.promise;
|
|
413
|
+
}
|
|
414
|
+
this.isWaiting = true;
|
|
415
|
+
this.isBusy = false;
|
|
416
|
+
this.dfr = new Deferred;
|
|
417
|
+
this.defer(force);
|
|
418
|
+
return this.dfr.promise;
|
|
419
|
+
}
|
|
420
|
+
defer(force) {
|
|
421
|
+
if (this.isWaiting) {
|
|
422
|
+
clearTimeout(this.timeout);
|
|
423
|
+
}
|
|
424
|
+
if (force === true) {
|
|
425
|
+
this.runInner();
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
this.timeout = setTimeout(() => this.runInner(), this.debounce);
|
|
429
|
+
}
|
|
430
|
+
reset() {
|
|
431
|
+
clearTimeout(this.timeout);
|
|
432
|
+
this.isWaiting = false;
|
|
433
|
+
this.isBusy = false;
|
|
434
|
+
this.shouldRunNext = false;
|
|
435
|
+
}
|
|
436
|
+
async runInner() {
|
|
437
|
+
this.isWaiting = false;
|
|
438
|
+
this.isBusy = true;
|
|
439
|
+
try {
|
|
440
|
+
await this.fn();
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
console.error('Transport error', error);
|
|
444
|
+
}
|
|
445
|
+
const runNext = this.shouldRunNext;
|
|
446
|
+
this.dfr.resolve(null);
|
|
447
|
+
this.reset();
|
|
448
|
+
if (runNext) {
|
|
449
|
+
this.run();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
class Deferred {
|
|
454
|
+
promise;
|
|
455
|
+
resolve;
|
|
456
|
+
reject;
|
|
457
|
+
constructor() {
|
|
458
|
+
this.promise = new Promise((resolve, reject) => {
|
|
459
|
+
this.resolve = resolve;
|
|
460
|
+
this.reject = reject;
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
function wait(ms) {
|
|
465
|
+
return new Promise(resolve => {
|
|
466
|
+
setTimeout(resolve, ms);
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
//# sourceMappingURL=TransportWorker.js.map
|
|
470
|
+
//# sourceMappingURL=TransportWorker.ts.map;
|
|
471
|
+
|
|
472
|
+
function __isObj(x) {
|
|
473
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
474
|
+
}
|
|
475
|
+
if (_src_persistence_TransportWorker === module.exports) {
|
|
476
|
+
// do nothing if
|
|
477
|
+
} else if (__isObj(_src_persistence_TransportWorker) && __isObj(module.exports)) {
|
|
478
|
+
Object.assign(_src_persistence_TransportWorker, module.exports);
|
|
479
|
+
} else {
|
|
480
|
+
_src_persistence_TransportWorker = module.exports;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
;
|
|
484
|
+
}());
|
|
485
|
+
|
|
486
|
+
// end:source ./ModuleSimplified.js
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
// source ./ModuleSimplified.js
|
|
490
|
+
var _src_persistence_StoreWorker;
|
|
491
|
+
(function () {
|
|
492
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
493
|
+
var define = null;
|
|
494
|
+
var exports = _src_persistence_StoreWorker != null ? _src_persistence_StoreWorker : {};
|
|
495
|
+
var module = { exports: exports };
|
|
496
|
+
|
|
497
|
+
"use strict";
|
|
498
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
499
|
+
exports.StoreWorker = void 0;
|
|
500
|
+
class StoreWorker {
|
|
501
|
+
store;
|
|
502
|
+
options;
|
|
503
|
+
isAsync = false;
|
|
504
|
+
doNotWaitSave = false;
|
|
505
|
+
constructor(store, options = {}) {
|
|
506
|
+
this.store = store;
|
|
507
|
+
this.options = options;
|
|
508
|
+
this.isAsync = this.store.getAsync != null;
|
|
509
|
+
this.doNotWaitSave = options?.doNotWaitSave === true;
|
|
510
|
+
}
|
|
511
|
+
get(key, ...args) {
|
|
512
|
+
return this.store.get(key);
|
|
513
|
+
}
|
|
514
|
+
getAsync(key, ...args) {
|
|
515
|
+
return this.store.getAsync(key, ...args);
|
|
516
|
+
}
|
|
517
|
+
save(key, val) {
|
|
518
|
+
this.store.save(key, val);
|
|
519
|
+
}
|
|
520
|
+
saveAsync(key, val) {
|
|
521
|
+
let promise = this.store.saveAsync(key, val);
|
|
522
|
+
if (this.doNotWaitSave === true) {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
return promise;
|
|
526
|
+
}
|
|
527
|
+
clear(key) {
|
|
528
|
+
this.store.clear(key);
|
|
529
|
+
}
|
|
530
|
+
clearAsync(key) {
|
|
531
|
+
return this.store.clearAsync(key);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
exports.StoreWorker = StoreWorker;
|
|
535
|
+
//# sourceMappingURL=StoreWorker.js.map
|
|
536
|
+
//# sourceMappingURL=StoreWorker.ts.map;
|
|
537
|
+
|
|
538
|
+
function __isObj(x) {
|
|
539
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
540
|
+
}
|
|
541
|
+
if (_src_persistence_StoreWorker === module.exports) {
|
|
542
|
+
// do nothing if
|
|
543
|
+
} else if (__isObj(_src_persistence_StoreWorker) && __isObj(module.exports)) {
|
|
544
|
+
Object.assign(_src_persistence_StoreWorker, module.exports);
|
|
545
|
+
} else {
|
|
546
|
+
_src_persistence_StoreWorker = module.exports;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
;
|
|
550
|
+
}());
|
|
551
|
+
|
|
552
|
+
// end:source ./ModuleSimplified.js
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
// source ./ModuleSimplified.js
|
|
556
|
+
var _src_Cache;
|
|
557
|
+
(function () {
|
|
558
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
559
|
+
var define = null;
|
|
560
|
+
var exports = _src_Cache != null ? _src_Cache : {};
|
|
561
|
+
var module = { exports: exports };
|
|
562
|
+
|
|
563
|
+
"use strict";
|
|
564
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
565
|
+
exports.Cache = void 0;
|
|
566
|
+
const Args_1 = _src_fn_Args;
|
|
567
|
+
const TransportWorker_1 = _src_persistence_TransportWorker;
|
|
568
|
+
const StoreWorker_1 = _src_persistence_StoreWorker;
|
|
569
|
+
class Cache {
|
|
570
|
+
options;
|
|
571
|
+
static caches = [];
|
|
572
|
+
_cache = {};
|
|
573
|
+
/** We save/read ALL cached object to the backed store */
|
|
574
|
+
_transport;
|
|
575
|
+
/** We save/read single key based values to the backed store */
|
|
576
|
+
_store;
|
|
577
|
+
isAsync = false;
|
|
578
|
+
constructor(options = {}) {
|
|
579
|
+
this.options = options;
|
|
580
|
+
if (this.options.monitors) {
|
|
581
|
+
this.onChanged = this.onChanged.bind(this);
|
|
582
|
+
options.monitors.forEach(x => x.on('change', this.onChanged));
|
|
583
|
+
}
|
|
584
|
+
if (this.options.persistence) {
|
|
585
|
+
this._transport = new TransportWorker_1.TransportWorker(this, this.options.persistence);
|
|
586
|
+
this.isAsync = this._transport.isAsync;
|
|
587
|
+
}
|
|
588
|
+
if (this.options.store) {
|
|
589
|
+
this._store = new StoreWorker_1.StoreWorker(this.options.store, options);
|
|
590
|
+
this.isAsync = this._store.isAsync;
|
|
591
|
+
}
|
|
592
|
+
if (options.trackRef) {
|
|
593
|
+
Cache.caches.push(this);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
resolveKey(args, keyOptions) {
|
|
597
|
+
let key = this.options?.keyResolver?.(...args);
|
|
598
|
+
return key ?? Args_1.Args.getKey(args, keyOptions);
|
|
599
|
+
}
|
|
600
|
+
get(key, ...args) {
|
|
601
|
+
if (this._transport != null && this._transport.isReady === false) {
|
|
602
|
+
this._transport.restore();
|
|
603
|
+
}
|
|
604
|
+
let entry = this._cache[key];
|
|
605
|
+
if (entry == null) {
|
|
606
|
+
if (this._store == null) {
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
entry = this._store.get(key, ...args);
|
|
610
|
+
if (entry == null) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (this.options.maxAge != null && ((Date.now() - entry.timestamp) / 1000) > this.options.maxAge) {
|
|
615
|
+
this.clear(key);
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
return entry.value;
|
|
619
|
+
}
|
|
620
|
+
async getAsync(key, ...args) {
|
|
621
|
+
if (this._transport != null && this._transport.isReady === false) {
|
|
622
|
+
await this._transport.restoreAsync();
|
|
623
|
+
}
|
|
624
|
+
let entry = this._cache[key];
|
|
625
|
+
if (entry == null) {
|
|
626
|
+
if (this._store == null) {
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
entry = await this._store.getAsync(key, ...args);
|
|
630
|
+
if (entry == null) {
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (this.options.maxAge != null && ((Date.now() - entry.timestamp) / 1000) > this.options.maxAge) {
|
|
635
|
+
await this.clearAsync(key);
|
|
636
|
+
return null;
|
|
637
|
+
}
|
|
638
|
+
return entry.value;
|
|
639
|
+
}
|
|
640
|
+
set(key, val) {
|
|
641
|
+
const cached = {
|
|
642
|
+
timestamp: Date.now(),
|
|
643
|
+
value: val
|
|
644
|
+
};
|
|
645
|
+
this._cache[key] = cached;
|
|
646
|
+
this.persist(key, cached, false);
|
|
647
|
+
return val;
|
|
648
|
+
}
|
|
649
|
+
async persist(key, entry, isAsync) {
|
|
650
|
+
const transport = this._transport;
|
|
651
|
+
const store = this._store;
|
|
652
|
+
if (transport == null && store == null) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
let val = entry.value;
|
|
656
|
+
let isPromise = val != null && typeof val === 'object' && typeof val.then === 'function';
|
|
657
|
+
if (isPromise) {
|
|
658
|
+
try {
|
|
659
|
+
val = await val;
|
|
660
|
+
}
|
|
661
|
+
catch (error) {
|
|
662
|
+
// do nothing on rejection
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
entry = {
|
|
666
|
+
value: val,
|
|
667
|
+
timestamp: entry.timestamp,
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
if (isAsync) {
|
|
671
|
+
await this._transport?.flushAsync(key, entry);
|
|
672
|
+
await this._store?.saveAsync(key, entry);
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
this._transport?.flush(key, entry);
|
|
676
|
+
this._store?.save(key, entry);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
async setAsync(key, val) {
|
|
680
|
+
const cached = {
|
|
681
|
+
timestamp: Date.now(),
|
|
682
|
+
value: val
|
|
683
|
+
};
|
|
684
|
+
this._cache[key] = cached;
|
|
685
|
+
this.persist(key, cached, true);
|
|
686
|
+
return val;
|
|
687
|
+
}
|
|
688
|
+
setRestored(coll) {
|
|
689
|
+
this._cache = {
|
|
690
|
+
...(coll ?? {}),
|
|
691
|
+
...(this._cache ?? {}),
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
clear(key) {
|
|
695
|
+
if (typeof key === 'string') {
|
|
696
|
+
this._cache[key] = null;
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
this._cache = {};
|
|
700
|
+
}
|
|
701
|
+
this._transport?.clear();
|
|
702
|
+
this._store?.clear(key);
|
|
703
|
+
}
|
|
704
|
+
async clearAsync(key) {
|
|
705
|
+
if (typeof key === 'string') {
|
|
706
|
+
this._cache[key] = null;
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
this._cache = {};
|
|
710
|
+
}
|
|
711
|
+
await this._transport?.clearAsync();
|
|
712
|
+
this._store?.clearAsync(key);
|
|
713
|
+
}
|
|
714
|
+
destroy() {
|
|
715
|
+
this.clear();
|
|
716
|
+
this.options.monitors?.forEach(x => x.off('change', this.onChanged));
|
|
717
|
+
}
|
|
718
|
+
onChanged(key) {
|
|
719
|
+
this.clear(key);
|
|
720
|
+
}
|
|
721
|
+
async flushAsync(force) {
|
|
722
|
+
await this._transport?.flushAllAsync(force);
|
|
723
|
+
}
|
|
724
|
+
static async flushAllAsync() {
|
|
725
|
+
await Promise.all(Cache.caches.map(cache => cache.flushAsync(true)));
|
|
726
|
+
}
|
|
727
|
+
static async resolve(cache, resolver, key = '') {
|
|
728
|
+
let value = await cache.getAsync(key);
|
|
729
|
+
if (value != null) {
|
|
730
|
+
return value;
|
|
731
|
+
}
|
|
732
|
+
let promise = resolver();
|
|
733
|
+
cache.set(key, promise);
|
|
734
|
+
try {
|
|
735
|
+
value = await promise;
|
|
736
|
+
}
|
|
737
|
+
catch (error) {
|
|
738
|
+
cache.clear(key);
|
|
739
|
+
throw error;
|
|
740
|
+
}
|
|
741
|
+
await cache.flushAsync();
|
|
742
|
+
return value;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
exports.Cache = Cache;
|
|
746
|
+
//# sourceMappingURL=Cache.js.map
|
|
747
|
+
//# sourceMappingURL=Cache.ts.map;
|
|
748
|
+
|
|
749
|
+
function __isObj(x) {
|
|
750
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
751
|
+
}
|
|
752
|
+
if (_src_Cache === module.exports) {
|
|
753
|
+
// do nothing if
|
|
754
|
+
} else if (__isObj(_src_Cache) && __isObj(module.exports)) {
|
|
755
|
+
Object.assign(_src_Cache, module.exports);
|
|
756
|
+
} else {
|
|
757
|
+
_src_Cache = module.exports;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
;
|
|
761
|
+
}());
|
|
762
|
+
|
|
763
|
+
// end:source ./ModuleSimplified.js
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
// source ./ModuleSimplified.js
|
|
767
|
+
var _src_fn_memoize;
|
|
768
|
+
(function () {
|
|
769
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
770
|
+
var define = null;
|
|
771
|
+
var exports = _src_fn_memoize != null ? _src_fn_memoize : {};
|
|
772
|
+
var module = { exports: exports };
|
|
773
|
+
|
|
774
|
+
"use strict";
|
|
775
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
776
|
+
exports.fn_clearMemoized = exports.fn_memoize = void 0;
|
|
777
|
+
const Cache_1 = _src_Cache;
|
|
778
|
+
function fn_memoize(fn, opts = {}, key) {
|
|
779
|
+
let _cache = new Cache_1.Cache(opts);
|
|
780
|
+
if (_cache.isAsync) {
|
|
781
|
+
return fn_memoizeAsync(_cache, fn, opts, key);
|
|
782
|
+
}
|
|
783
|
+
let _perInstance = opts?.perInstance ?? false;
|
|
784
|
+
let _clearOnReady = opts?.clearOnReady ?? false;
|
|
785
|
+
let _clearOnReject = opts?.clearOnReject ?? false;
|
|
786
|
+
let _clearOn = opts?.clearOn ?? null;
|
|
787
|
+
let _caches = [];
|
|
788
|
+
let _thisArg = opts?.thisArg;
|
|
789
|
+
const Wrapper = function (...args) {
|
|
790
|
+
let cache = _cache;
|
|
791
|
+
if (_perInstance === true) {
|
|
792
|
+
const prop = `__$mem_${key}`;
|
|
793
|
+
cache = this[prop];
|
|
794
|
+
if (cache == null) {
|
|
795
|
+
cache = new Cache_1.Cache(opts);
|
|
796
|
+
Object.defineProperty(this, prop, {
|
|
797
|
+
value: cache,
|
|
798
|
+
enumerable: false
|
|
799
|
+
});
|
|
800
|
+
_caches.push(cache);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
const thisArg = _thisArg ?? this;
|
|
804
|
+
const id = (opts?.keyPfx?.(thisArg) ?? '') + (opts?.key?.({ this: thisArg }, ...args) ?? cache.resolveKey(args, opts?.keyOptions));
|
|
805
|
+
const cached = cache.get(id);
|
|
806
|
+
if (cached != null) {
|
|
807
|
+
return cached;
|
|
808
|
+
}
|
|
809
|
+
let isPromise = null;
|
|
810
|
+
let val = fn.apply(thisArg, args);
|
|
811
|
+
if (_clearOnReject === true) {
|
|
812
|
+
isPromise = val != null && typeof val === 'object' && typeof val.then === 'function';
|
|
813
|
+
if (isPromise) {
|
|
814
|
+
val = val.then(null, err => {
|
|
815
|
+
cache.clear(id);
|
|
816
|
+
return Promise.reject(err);
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
if (_clearOnReady === true) {
|
|
821
|
+
isPromise = val != null && typeof val === 'object' && typeof val.then === 'function';
|
|
822
|
+
if (isPromise) {
|
|
823
|
+
val = val.then(result => {
|
|
824
|
+
cache.clear(id);
|
|
825
|
+
return Promise.resolve(result);
|
|
826
|
+
}, err => {
|
|
827
|
+
cache.clear(id);
|
|
828
|
+
return Promise.reject(err);
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
if (_clearOn != null) {
|
|
833
|
+
isPromise = isPromise ?? (val != null && typeof val === 'object' && typeof val.then === 'function');
|
|
834
|
+
if (isPromise) {
|
|
835
|
+
val = val.then(result => {
|
|
836
|
+
if (_clearOn(result)) {
|
|
837
|
+
cache.clear(id);
|
|
838
|
+
}
|
|
839
|
+
return result;
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
else if (_clearOn(val)) {
|
|
843
|
+
// don't even set to cache
|
|
844
|
+
return val;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return cache.set(id, val);
|
|
848
|
+
};
|
|
849
|
+
Wrapper.clearArgs = function (...args) {
|
|
850
|
+
const id = _cache.resolveKey(args);
|
|
851
|
+
_cache.clear(id);
|
|
852
|
+
_caches.forEach(x => x.clear(id));
|
|
853
|
+
};
|
|
854
|
+
Wrapper.clearAll = function () {
|
|
855
|
+
_cache.clear();
|
|
856
|
+
_caches.forEach(x => x.clear());
|
|
857
|
+
};
|
|
858
|
+
return Wrapper;
|
|
859
|
+
}
|
|
860
|
+
exports.fn_memoize = fn_memoize;
|
|
861
|
+
;
|
|
862
|
+
function fn_memoizeAsync(_cache, fn, opts = {}, key) {
|
|
863
|
+
let _perInstance = opts?.perInstance ?? false;
|
|
864
|
+
let _clearOnReady = opts?.clearOnReady ?? false;
|
|
865
|
+
let _clearOnReject = opts?.clearOnReject ?? false;
|
|
866
|
+
let _clearOn = opts?.clearOn ?? null;
|
|
867
|
+
let _caches = [];
|
|
868
|
+
let _thisArg = opts?.thisArg;
|
|
869
|
+
const Wrapper = async function (...args) {
|
|
870
|
+
let cache = _cache;
|
|
871
|
+
if (_perInstance === true) {
|
|
872
|
+
let prop = `__$mem_${key}`;
|
|
873
|
+
cache = this[prop];
|
|
874
|
+
if (cache == null) {
|
|
875
|
+
cache = new Cache_1.Cache(opts);
|
|
876
|
+
Object.defineProperty(this, prop, {
|
|
877
|
+
value: cache,
|
|
878
|
+
enumerable: false
|
|
879
|
+
});
|
|
880
|
+
_caches.push(cache);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
const thisArg = _thisArg ?? this;
|
|
884
|
+
const id = opts?.key?.({ this: thisArg }, ...args) ?? cache.resolveKey(args, opts?.keyOptions);
|
|
885
|
+
const cached = await cache.getAsync(id, ...args);
|
|
886
|
+
if (cached != null) {
|
|
887
|
+
return cached;
|
|
888
|
+
}
|
|
889
|
+
let isPromise = null;
|
|
890
|
+
let val = fn.apply(thisArg, args);
|
|
891
|
+
if (_clearOnReject === true) {
|
|
892
|
+
isPromise = val != null && typeof val === 'object' && typeof val.then === 'function';
|
|
893
|
+
if (isPromise) {
|
|
894
|
+
val = val.then(null, err => {
|
|
895
|
+
cache.clearAsync(id);
|
|
896
|
+
return Promise.reject(err);
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
if (_clearOnReady === true) {
|
|
901
|
+
isPromise = val != null && typeof val === 'object' && typeof val.then === 'function';
|
|
902
|
+
if (isPromise) {
|
|
903
|
+
val = val.then(result => {
|
|
904
|
+
cache.clearAsync(id);
|
|
905
|
+
return Promise.resolve(result);
|
|
906
|
+
}, err => {
|
|
907
|
+
cache.clearAsync(id);
|
|
908
|
+
return Promise.reject(err);
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
if (_clearOn != null) {
|
|
913
|
+
isPromise = isPromise ?? (val != null && typeof val === 'object' && typeof val.then === 'function');
|
|
914
|
+
if (isPromise) {
|
|
915
|
+
val = val.then(result => {
|
|
916
|
+
if (_clearOn(result)) {
|
|
917
|
+
cache.clearAsync(id);
|
|
918
|
+
}
|
|
919
|
+
return result;
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
else if (_clearOn(val)) {
|
|
923
|
+
// don't even set to cache
|
|
924
|
+
return val;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return cache.setAsync(id, val);
|
|
928
|
+
};
|
|
929
|
+
Wrapper.clearArgs = function (...args) {
|
|
930
|
+
const id = _cache.resolveKey(args);
|
|
931
|
+
_cache.clearAsync(id);
|
|
932
|
+
_caches.forEach(x => x.clearAsync(id));
|
|
933
|
+
};
|
|
934
|
+
Wrapper.clearAll = function () {
|
|
935
|
+
_cache.clearAsync();
|
|
936
|
+
_caches.forEach(x => x.clearAsync());
|
|
937
|
+
};
|
|
938
|
+
return Wrapper;
|
|
939
|
+
}
|
|
940
|
+
function fn_clearMemoized(fn, ...args) {
|
|
941
|
+
if (args.length === 0) {
|
|
942
|
+
fn?.clearAll?.();
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
fn?.clearArgs?.(...args);
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
exports.fn_clearMemoized = fn_clearMemoized;
|
|
949
|
+
//# sourceMappingURL=memoize.js.map
|
|
950
|
+
//# sourceMappingURL=memoize.ts.map;
|
|
951
|
+
|
|
952
|
+
function __isObj(x) {
|
|
953
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
954
|
+
}
|
|
955
|
+
if (_src_fn_memoize === module.exports) {
|
|
956
|
+
// do nothing if
|
|
957
|
+
} else if (__isObj(_src_fn_memoize) && __isObj(module.exports)) {
|
|
958
|
+
Object.assign(_src_fn_memoize, module.exports);
|
|
959
|
+
} else {
|
|
960
|
+
_src_fn_memoize = module.exports;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
;
|
|
964
|
+
}());
|
|
965
|
+
|
|
966
|
+
// end:source ./ModuleSimplified.js
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
// source ./ModuleSimplified.js
|
|
970
|
+
var _src_deco_memoize;
|
|
971
|
+
(function () {
|
|
972
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
973
|
+
var define = null;
|
|
974
|
+
var exports = _src_deco_memoize != null ? _src_deco_memoize : {};
|
|
975
|
+
var module = { exports: exports };
|
|
976
|
+
|
|
977
|
+
"use strict";
|
|
978
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
979
|
+
exports.deco_memoize = void 0;
|
|
980
|
+
const memoize_1 = _src_fn_memoize;
|
|
981
|
+
function deco_memoize(opts) {
|
|
982
|
+
return function (target, propertyKey, descriptor) {
|
|
983
|
+
const viaProperty = descriptor == null;
|
|
984
|
+
const isGetter = !viaProperty && typeof descriptor.get === 'function';
|
|
985
|
+
const innerFn = viaProperty
|
|
986
|
+
? target[propertyKey]
|
|
987
|
+
: (isGetter ? descriptor.get : descriptor.value);
|
|
988
|
+
const fn = (0, memoize_1.fn_memoize)(innerFn, opts, propertyKey);
|
|
989
|
+
if (viaProperty) {
|
|
990
|
+
target[propertyKey] = fn;
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
if (isGetter) {
|
|
994
|
+
descriptor.get = fn;
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
descriptor.value = fn;
|
|
998
|
+
}
|
|
999
|
+
return descriptor;
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
exports.deco_memoize = deco_memoize;
|
|
1003
|
+
//# sourceMappingURL=memoize.js.map
|
|
1004
|
+
//# sourceMappingURL=memoize.ts.map;
|
|
1005
|
+
|
|
1006
|
+
function __isObj(x) {
|
|
1007
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1008
|
+
}
|
|
1009
|
+
if (_src_deco_memoize === module.exports) {
|
|
1010
|
+
// do nothing if
|
|
1011
|
+
} else if (__isObj(_src_deco_memoize) && __isObj(module.exports)) {
|
|
1012
|
+
Object.assign(_src_deco_memoize, module.exports);
|
|
1013
|
+
} else {
|
|
1014
|
+
_src_deco_memoize = module.exports;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
;
|
|
1018
|
+
}());
|
|
1019
|
+
|
|
1020
|
+
// end:source ./ModuleSimplified.js
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
// source ./ModuleSimplified.js
|
|
1024
|
+
var _src_deco_debounce;
|
|
1025
|
+
(function () {
|
|
1026
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1027
|
+
var define = null;
|
|
1028
|
+
var exports = _src_deco_debounce != null ? _src_deco_debounce : {};
|
|
1029
|
+
var module = { exports: exports };
|
|
1030
|
+
|
|
1031
|
+
"use strict";
|
|
1032
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1033
|
+
exports.deco_debounce = void 0;
|
|
1034
|
+
const requestFn = typeof requestAnimationFrame === 'undefined' ? setImmediate : requestAnimationFrame;
|
|
1035
|
+
const clearRequest = typeof requestAnimationFrame === 'undefined' ? clearImmediate : cancelAnimationFrame;
|
|
1036
|
+
/**
|
|
1037
|
+
*
|
|
1038
|
+
* @param timeoutMs ms to wait before calling inner fn
|
|
1039
|
+
*/
|
|
1040
|
+
function deco_debounce(timeoutMs) {
|
|
1041
|
+
return function (target, propertyKey, descriptor) {
|
|
1042
|
+
let viaProperty = descriptor == null;
|
|
1043
|
+
if (viaProperty) {
|
|
1044
|
+
descriptor = {
|
|
1045
|
+
configurable: true,
|
|
1046
|
+
value: target[propertyKey]
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
let fn = descriptor.value;
|
|
1050
|
+
if (timeoutMs == null || timeoutMs === 0) {
|
|
1051
|
+
let frame = 0;
|
|
1052
|
+
descriptor.value = function (...args) {
|
|
1053
|
+
const self = this;
|
|
1054
|
+
if (frame !== 0) {
|
|
1055
|
+
clearRequest(frame);
|
|
1056
|
+
}
|
|
1057
|
+
frame = requestFn(function () {
|
|
1058
|
+
frame = 0;
|
|
1059
|
+
fn.apply(self, args);
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
else {
|
|
1064
|
+
let timer = 0;
|
|
1065
|
+
descriptor.value = function (...args) {
|
|
1066
|
+
const self = this;
|
|
1067
|
+
clearTimeout(timer);
|
|
1068
|
+
timer = setTimeout(function () {
|
|
1069
|
+
fn.apply(self, args);
|
|
1070
|
+
}, timeoutMs);
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
if (viaProperty) {
|
|
1074
|
+
target[propertyKey] = descriptor.value;
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
return descriptor;
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
exports.deco_debounce = deco_debounce;
|
|
1081
|
+
;
|
|
1082
|
+
//# sourceMappingURL=debounce.js.map
|
|
1083
|
+
//# sourceMappingURL=debounce.ts.map;
|
|
1084
|
+
|
|
1085
|
+
function __isObj(x) {
|
|
1086
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1087
|
+
}
|
|
1088
|
+
if (_src_deco_debounce === module.exports) {
|
|
1089
|
+
// do nothing if
|
|
1090
|
+
} else if (__isObj(_src_deco_debounce) && __isObj(module.exports)) {
|
|
1091
|
+
Object.assign(_src_deco_debounce, module.exports);
|
|
1092
|
+
} else {
|
|
1093
|
+
_src_deco_debounce = module.exports;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
;
|
|
1097
|
+
}());
|
|
1098
|
+
|
|
1099
|
+
// end:source ./ModuleSimplified.js
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
// source ./ModuleSimplified.js
|
|
1103
|
+
var _src_model_Deferred;
|
|
1104
|
+
(function () {
|
|
1105
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1106
|
+
var define = null;
|
|
1107
|
+
var exports = _src_model_Deferred != null ? _src_model_Deferred : {};
|
|
1108
|
+
var module = { exports: exports };
|
|
1109
|
+
|
|
1110
|
+
"use strict";
|
|
1111
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1112
|
+
exports.Deferred = void 0;
|
|
1113
|
+
class Deferred {
|
|
1114
|
+
isResolved = false;
|
|
1115
|
+
isRejected = false;
|
|
1116
|
+
resolvedArg;
|
|
1117
|
+
rejectedArg;
|
|
1118
|
+
resolveFn;
|
|
1119
|
+
rejectFn;
|
|
1120
|
+
promise = new Promise((resolve, reject) => {
|
|
1121
|
+
this.resolveFn = resolve;
|
|
1122
|
+
this.rejectFn = reject;
|
|
1123
|
+
if (this.isResolved === true) {
|
|
1124
|
+
resolve(this.resolvedArg);
|
|
1125
|
+
}
|
|
1126
|
+
if (this.isRejected === true) {
|
|
1127
|
+
reject(this.rejectedArg);
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
resolve(arg) {
|
|
1131
|
+
if (this.resolveFn) {
|
|
1132
|
+
this.resolveFn(arg);
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
this.isResolved = true;
|
|
1136
|
+
this.resolvedArg = arg;
|
|
1137
|
+
}
|
|
1138
|
+
reject(arg) {
|
|
1139
|
+
if (this.rejectFn) {
|
|
1140
|
+
this.rejectFn(arg);
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
this.isRejected = true;
|
|
1144
|
+
this.rejectedArg = arg;
|
|
1145
|
+
}
|
|
1146
|
+
then(fnA, fnB) {
|
|
1147
|
+
this.promise.then(fnA, fnB);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
exports.Deferred = Deferred;
|
|
1151
|
+
//# sourceMappingURL=Deferred.js.map
|
|
1152
|
+
//# sourceMappingURL=Deferred.ts.map;
|
|
1153
|
+
|
|
1154
|
+
function __isObj(x) {
|
|
1155
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1156
|
+
}
|
|
1157
|
+
if (_src_model_Deferred === module.exports) {
|
|
1158
|
+
// do nothing if
|
|
1159
|
+
} else if (__isObj(_src_model_Deferred) && __isObj(module.exports)) {
|
|
1160
|
+
Object.assign(_src_model_Deferred, module.exports);
|
|
1161
|
+
} else {
|
|
1162
|
+
_src_model_Deferred = module.exports;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
;
|
|
1166
|
+
}());
|
|
1167
|
+
|
|
1168
|
+
// end:source ./ModuleSimplified.js
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
// source ./ModuleSimplified.js
|
|
1172
|
+
var _src_deco_throttle;
|
|
1173
|
+
(function () {
|
|
1174
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1175
|
+
var define = null;
|
|
1176
|
+
var exports = _src_deco_throttle != null ? _src_deco_throttle : {};
|
|
1177
|
+
var module = { exports: exports };
|
|
1178
|
+
|
|
1179
|
+
"use strict";
|
|
1180
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1181
|
+
exports.deco_throttle = void 0;
|
|
1182
|
+
const Args_1 = _src_fn_Args;
|
|
1183
|
+
const Deferred_1 = _src_model_Deferred;
|
|
1184
|
+
function deco_throttle(timeWindow, mix) {
|
|
1185
|
+
let options = typeof mix === 'boolean'
|
|
1186
|
+
? { shouldCallLater: mix }
|
|
1187
|
+
: mix;
|
|
1188
|
+
let shouldCallLater = options?.shouldCallLater ?? false;
|
|
1189
|
+
let perArguments = options?.perArguments ?? false;
|
|
1190
|
+
let perArgumentInfos = perArguments ? Object.create(null) : null;
|
|
1191
|
+
return function (target, propertyKey, descriptor) {
|
|
1192
|
+
let viaProperty = descriptor == null;
|
|
1193
|
+
let fn = viaProperty ? target[propertyKey] : descriptor.value;
|
|
1194
|
+
let timer = 0;
|
|
1195
|
+
let latestArgs = null;
|
|
1196
|
+
let latestCall = 0;
|
|
1197
|
+
let promise = null;
|
|
1198
|
+
let resultFn = function (...args) {
|
|
1199
|
+
let _key = perArguments !== true ? null : Args_1.Args.getKey(args);
|
|
1200
|
+
let _meta = perArguments !== true ? null : (perArgumentInfos[_key] ?? (perArgumentInfos[_key] = {
|
|
1201
|
+
latestCall: 0,
|
|
1202
|
+
latestArgs: null,
|
|
1203
|
+
promise: null,
|
|
1204
|
+
timer: 0
|
|
1205
|
+
}));
|
|
1206
|
+
let _latestCall = perArguments ? _meta.latestCall : latestCall;
|
|
1207
|
+
let _timer = perArguments ? _meta.timer : timer;
|
|
1208
|
+
let self = this;
|
|
1209
|
+
let now = Date.now();
|
|
1210
|
+
let diff = now - _latestCall;
|
|
1211
|
+
if (diff >= timeWindow) {
|
|
1212
|
+
latestCall = now;
|
|
1213
|
+
if (perArguments) {
|
|
1214
|
+
_meta.latestCall = now;
|
|
1215
|
+
}
|
|
1216
|
+
if (shouldCallLater !== true) {
|
|
1217
|
+
return fn.apply(self, args);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
latestArgs = args;
|
|
1221
|
+
if (perArguments) {
|
|
1222
|
+
_meta.latestArgs = args;
|
|
1223
|
+
}
|
|
1224
|
+
let _promise = perArguments ? _meta.promise : promise;
|
|
1225
|
+
if (_timer === 0) {
|
|
1226
|
+
_promise = promise = new Deferred_1.Deferred();
|
|
1227
|
+
if (perArguments) {
|
|
1228
|
+
_meta.promise = _promise;
|
|
1229
|
+
}
|
|
1230
|
+
_timer = setTimeout(function () {
|
|
1231
|
+
latestCall = Date.now();
|
|
1232
|
+
timer = 0;
|
|
1233
|
+
if (perArguments) {
|
|
1234
|
+
_meta.latestCall = latestCall;
|
|
1235
|
+
_meta.timer = 0;
|
|
1236
|
+
}
|
|
1237
|
+
let args = perArguments ? _meta.latestArgs : latestArgs;
|
|
1238
|
+
let r = fn.apply(self, args);
|
|
1239
|
+
promise.resolve(r);
|
|
1240
|
+
}, diff >= timeWindow ? timeWindow : timeWindow - diff);
|
|
1241
|
+
timer = _timer;
|
|
1242
|
+
if (perArguments) {
|
|
1243
|
+
_meta.timer = _timer;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return _promise;
|
|
1247
|
+
};
|
|
1248
|
+
if (viaProperty) {
|
|
1249
|
+
target[propertyKey] = resultFn;
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
descriptor.value = resultFn;
|
|
1253
|
+
return descriptor;
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
exports.deco_throttle = deco_throttle;
|
|
1257
|
+
//# sourceMappingURL=throttle.js.map
|
|
1258
|
+
//# sourceMappingURL=throttle.ts.map;
|
|
1259
|
+
|
|
1260
|
+
function __isObj(x) {
|
|
1261
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1262
|
+
}
|
|
1263
|
+
if (_src_deco_throttle === module.exports) {
|
|
1264
|
+
// do nothing if
|
|
1265
|
+
} else if (__isObj(_src_deco_throttle) && __isObj(module.exports)) {
|
|
1266
|
+
Object.assign(_src_deco_throttle, module.exports);
|
|
1267
|
+
} else {
|
|
1268
|
+
_src_deco_throttle = module.exports;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
;
|
|
1272
|
+
}());
|
|
1273
|
+
|
|
1274
|
+
// end:source ./ModuleSimplified.js
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
// source ./ModuleSimplified.js
|
|
1278
|
+
var _src_fn_queued;
|
|
1279
|
+
(function () {
|
|
1280
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1281
|
+
var define = null;
|
|
1282
|
+
var exports = _src_fn_queued != null ? _src_fn_queued : {};
|
|
1283
|
+
var module = { exports: exports };
|
|
1284
|
+
|
|
1285
|
+
"use strict";
|
|
1286
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1287
|
+
exports.fn_queued = void 0;
|
|
1288
|
+
const Deferred_1 = _src_model_Deferred;
|
|
1289
|
+
/** For original async method - ensure it is called one after another */
|
|
1290
|
+
function fn_queued(fn, opts = {}) {
|
|
1291
|
+
let queue = [];
|
|
1292
|
+
let busy = false;
|
|
1293
|
+
let lastResultAt = 0;
|
|
1294
|
+
let throttle = opts?.throttle;
|
|
1295
|
+
let resultFn = function (...args) {
|
|
1296
|
+
if (opts != null && opts.single === true && queue.length > 0) {
|
|
1297
|
+
return queue[0].promise;
|
|
1298
|
+
}
|
|
1299
|
+
let wrapped = Queued.prepair(fn, this, args, opts);
|
|
1300
|
+
if (opts != null && opts.trimQueue && queue.length > 0) {
|
|
1301
|
+
queue.splice(0);
|
|
1302
|
+
}
|
|
1303
|
+
queue.push(wrapped);
|
|
1304
|
+
if (busy === false) {
|
|
1305
|
+
busy = true;
|
|
1306
|
+
tick();
|
|
1307
|
+
}
|
|
1308
|
+
return wrapped.promise;
|
|
1309
|
+
};
|
|
1310
|
+
let tick = function () {
|
|
1311
|
+
if (queue.length === 0) {
|
|
1312
|
+
busy = false;
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
if (throttle != null) {
|
|
1316
|
+
let ms = throttle - (Date.now() - lastResultAt);
|
|
1317
|
+
if (ms > 0) {
|
|
1318
|
+
setTimeout(tick, ms);
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
let x = queue.shift();
|
|
1323
|
+
x.always(next);
|
|
1324
|
+
x.run();
|
|
1325
|
+
};
|
|
1326
|
+
let next = function () {
|
|
1327
|
+
lastResultAt = Date.now();
|
|
1328
|
+
tick();
|
|
1329
|
+
};
|
|
1330
|
+
return resultFn;
|
|
1331
|
+
}
|
|
1332
|
+
exports.fn_queued = fn_queued;
|
|
1333
|
+
const Queued = {
|
|
1334
|
+
prepair(innerFn, ctx, args, opts) {
|
|
1335
|
+
let dfr = new Deferred_1.Deferred;
|
|
1336
|
+
let completed = false;
|
|
1337
|
+
let timeout = null;
|
|
1338
|
+
return {
|
|
1339
|
+
promise: dfr,
|
|
1340
|
+
run() {
|
|
1341
|
+
let result = innerFn.apply(ctx, args);
|
|
1342
|
+
if ('then' in result === false) {
|
|
1343
|
+
dfr.resolve(result);
|
|
1344
|
+
}
|
|
1345
|
+
else {
|
|
1346
|
+
if (opts?.timeout > 0) {
|
|
1347
|
+
timeout = setTimeout(() => {
|
|
1348
|
+
if (completed) {
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
dfr.reject(new Error(`Queue Worker: the inner function ${innerFn.name} timeouted: ${opts.timeout}`));
|
|
1352
|
+
}, opts.timeout);
|
|
1353
|
+
}
|
|
1354
|
+
result.then(_result => {
|
|
1355
|
+
if (timeout != null) {
|
|
1356
|
+
clearTimeout(timeout);
|
|
1357
|
+
}
|
|
1358
|
+
if (completed) {
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
completed = true;
|
|
1362
|
+
dfr.resolve(_result);
|
|
1363
|
+
}, _error => {
|
|
1364
|
+
if (timeout != null) {
|
|
1365
|
+
clearTimeout(timeout);
|
|
1366
|
+
}
|
|
1367
|
+
if (completed) {
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
completed = true;
|
|
1371
|
+
dfr.reject(_error);
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
return result;
|
|
1375
|
+
},
|
|
1376
|
+
always(fn) {
|
|
1377
|
+
dfr.then(fn, fn);
|
|
1378
|
+
}
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
//# sourceMappingURL=queued.js.map
|
|
1383
|
+
//# sourceMappingURL=queued.ts.map;
|
|
1384
|
+
|
|
1385
|
+
function __isObj(x) {
|
|
1386
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1387
|
+
}
|
|
1388
|
+
if (_src_fn_queued === module.exports) {
|
|
1389
|
+
// do nothing if
|
|
1390
|
+
} else if (__isObj(_src_fn_queued) && __isObj(module.exports)) {
|
|
1391
|
+
Object.assign(_src_fn_queued, module.exports);
|
|
1392
|
+
} else {
|
|
1393
|
+
_src_fn_queued = module.exports;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
;
|
|
1397
|
+
}());
|
|
1398
|
+
|
|
1399
|
+
// end:source ./ModuleSimplified.js
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
// source ./ModuleSimplified.js
|
|
1403
|
+
var _src_deco_queued;
|
|
1404
|
+
(function () {
|
|
1405
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1406
|
+
var define = null;
|
|
1407
|
+
var exports = _src_deco_queued != null ? _src_deco_queued : {};
|
|
1408
|
+
var module = { exports: exports };
|
|
1409
|
+
|
|
1410
|
+
"use strict";
|
|
1411
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1412
|
+
exports.deco_queued = void 0;
|
|
1413
|
+
const queued_1 = _src_fn_queued;
|
|
1414
|
+
function deco_queued(opts = null) {
|
|
1415
|
+
return function (target, propertyKey, descriptor) {
|
|
1416
|
+
let viaProperty = descriptor == null;
|
|
1417
|
+
let fn = viaProperty ? target[propertyKey] : descriptor.value;
|
|
1418
|
+
let resultFn = (0, queued_1.fn_queued)(fn, opts);
|
|
1419
|
+
if (viaProperty) {
|
|
1420
|
+
target[propertyKey] = resultFn;
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
descriptor.value = resultFn;
|
|
1424
|
+
return descriptor;
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
exports.deco_queued = deco_queued;
|
|
1428
|
+
//# sourceMappingURL=queued.js.map
|
|
1429
|
+
//# sourceMappingURL=queued.ts.map;
|
|
1430
|
+
|
|
1431
|
+
function __isObj(x) {
|
|
1432
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1433
|
+
}
|
|
1434
|
+
if (_src_deco_queued === module.exports) {
|
|
1435
|
+
// do nothing if
|
|
1436
|
+
} else if (__isObj(_src_deco_queued) && __isObj(module.exports)) {
|
|
1437
|
+
Object.assign(_src_deco_queued, module.exports);
|
|
1438
|
+
} else {
|
|
1439
|
+
_src_deco_queued = module.exports;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
;
|
|
1443
|
+
}());
|
|
1444
|
+
|
|
1445
|
+
// end:source ./ModuleSimplified.js
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
// source ./ModuleSimplified.js
|
|
1449
|
+
var _src_utils_requireLib;
|
|
1450
|
+
(function () {
|
|
1451
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1452
|
+
var define = null;
|
|
1453
|
+
var exports = _src_utils_requireLib != null ? _src_utils_requireLib : {};
|
|
1454
|
+
var module = { exports: exports };
|
|
1455
|
+
|
|
1456
|
+
"use strict";
|
|
1457
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1458
|
+
exports.requireLib = void 0;
|
|
1459
|
+
var requireLib;
|
|
1460
|
+
(function (requireLib) {
|
|
1461
|
+
async function load(name) {
|
|
1462
|
+
//#if (CJS)
|
|
1463
|
+
const r = require;
|
|
1464
|
+
return Promise.resolve(r(name));
|
|
1465
|
+
//#endif
|
|
1466
|
+
}
|
|
1467
|
+
requireLib.load = load;
|
|
1468
|
+
})(requireLib = exports.requireLib || (exports.requireLib = {}));
|
|
1469
|
+
//# sourceMappingURL=requireLib.js.map
|
|
1470
|
+
//# sourceMappingURL=requireLib.ts.map;
|
|
1471
|
+
|
|
1472
|
+
function __isObj(x) {
|
|
1473
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1474
|
+
}
|
|
1475
|
+
if (_src_utils_requireLib === module.exports) {
|
|
1476
|
+
// do nothing if
|
|
1477
|
+
} else if (__isObj(_src_utils_requireLib) && __isObj(module.exports)) {
|
|
1478
|
+
Object.assign(_src_utils_requireLib, module.exports);
|
|
1479
|
+
} else {
|
|
1480
|
+
_src_utils_requireLib = module.exports;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
;
|
|
1484
|
+
}());
|
|
1485
|
+
|
|
1486
|
+
// end:source ./ModuleSimplified.js
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
// source ./ModuleSimplified.js
|
|
1490
|
+
var _src_persistence_FsTransport;
|
|
1491
|
+
(function () {
|
|
1492
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1493
|
+
var define = null;
|
|
1494
|
+
var exports = _src_persistence_FsTransport != null ? _src_persistence_FsTransport : {};
|
|
1495
|
+
var module = { exports: exports };
|
|
1496
|
+
|
|
1497
|
+
"use strict";
|
|
1498
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1499
|
+
exports.FsTransport = void 0;
|
|
1500
|
+
const requireLib_1 = _src_utils_requireLib;
|
|
1501
|
+
class FsTransport {
|
|
1502
|
+
opts;
|
|
1503
|
+
_file = null;
|
|
1504
|
+
isAsync = true;
|
|
1505
|
+
constructor(opts) {
|
|
1506
|
+
this.opts = opts;
|
|
1507
|
+
}
|
|
1508
|
+
async restoreAsync() {
|
|
1509
|
+
let file = await this.getFileSafeCtor();
|
|
1510
|
+
if (file == null) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
try {
|
|
1514
|
+
let json = await file.readAsync();
|
|
1515
|
+
return typeof json === 'string'
|
|
1516
|
+
? JSON.parse(json)
|
|
1517
|
+
: json;
|
|
1518
|
+
}
|
|
1519
|
+
catch (error) {
|
|
1520
|
+
return {};
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
async flushAsync(coll) {
|
|
1524
|
+
let file = await this.getFileSafeCtor();
|
|
1525
|
+
if (file == null) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
let json = JSON.stringify(coll);
|
|
1529
|
+
return await file.writeAsync(json);
|
|
1530
|
+
}
|
|
1531
|
+
async getFileSafeCtor() {
|
|
1532
|
+
let isBrowser = typeof process === 'undefined' || typeof process.exit !== 'function';
|
|
1533
|
+
if (isBrowser) {
|
|
1534
|
+
let useLocalStorage = this.opts?.browser?.localStorage;
|
|
1535
|
+
if (useLocalStorage) {
|
|
1536
|
+
this._file = new LocalStorageFile(this.opts.path);
|
|
1537
|
+
}
|
|
1538
|
+
return null;
|
|
1539
|
+
}
|
|
1540
|
+
const { path } = this.opts;
|
|
1541
|
+
if (path in CACHED_STORAGES) {
|
|
1542
|
+
this._file = CACHED_STORAGES[path];
|
|
1543
|
+
}
|
|
1544
|
+
else {
|
|
1545
|
+
/** lazy load require and preventing bundler's build */
|
|
1546
|
+
const module = await requireLib_1.requireLib.load('atma-io');
|
|
1547
|
+
const FileSafeCtor = module.FileSafe;
|
|
1548
|
+
this._file = new FileSafeCtor(this.opts.path, { threadSafe: true });
|
|
1549
|
+
CACHED_STORAGES[path] = this._file;
|
|
1550
|
+
}
|
|
1551
|
+
return this._file;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
exports.FsTransport = FsTransport;
|
|
1555
|
+
class LocalStorageFile {
|
|
1556
|
+
path;
|
|
1557
|
+
key = `memd:fs:${this.path}`;
|
|
1558
|
+
constructor(path) {
|
|
1559
|
+
this.path = path;
|
|
1560
|
+
}
|
|
1561
|
+
async readAsync() {
|
|
1562
|
+
return localStorage.getItem(this.key);
|
|
1563
|
+
}
|
|
1564
|
+
async writeAsync(content) {
|
|
1565
|
+
localStorage.setItem(this.key, content);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
const CACHED_STORAGES = {};
|
|
1569
|
+
//# sourceMappingURL=FsTransport.js.map
|
|
1570
|
+
//# sourceMappingURL=FsTransport.ts.map;
|
|
1571
|
+
|
|
1572
|
+
function __isObj(x) {
|
|
1573
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1574
|
+
}
|
|
1575
|
+
if (_src_persistence_FsTransport === module.exports) {
|
|
1576
|
+
// do nothing if
|
|
1577
|
+
} else if (__isObj(_src_persistence_FsTransport) && __isObj(module.exports)) {
|
|
1578
|
+
Object.assign(_src_persistence_FsTransport, module.exports);
|
|
1579
|
+
} else {
|
|
1580
|
+
_src_persistence_FsTransport = module.exports;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
;
|
|
1584
|
+
}());
|
|
1585
|
+
|
|
1586
|
+
// end:source ./ModuleSimplified.js
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
// source ./ModuleSimplified.js
|
|
1590
|
+
var _src_persistence_LocalStorageTransport;
|
|
1591
|
+
(function () {
|
|
1592
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1593
|
+
var define = null;
|
|
1594
|
+
var exports = _src_persistence_LocalStorageTransport != null ? _src_persistence_LocalStorageTransport : {};
|
|
1595
|
+
var module = { exports: exports };
|
|
1596
|
+
|
|
1597
|
+
"use strict";
|
|
1598
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1599
|
+
exports.LocalStorageTransport = void 0;
|
|
1600
|
+
class LocalStorageTransport {
|
|
1601
|
+
opts;
|
|
1602
|
+
isAsync = false;
|
|
1603
|
+
constructor(opts) {
|
|
1604
|
+
this.opts = opts;
|
|
1605
|
+
if (typeof localStorage === 'undefined' || typeof localStorage.setItem !== 'function') {
|
|
1606
|
+
throw new Error('Browser expected');
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
restore() {
|
|
1610
|
+
try {
|
|
1611
|
+
return JSON.parse(localStorage.getItem(this.opts.key));
|
|
1612
|
+
}
|
|
1613
|
+
catch (error) {
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
flush(coll) {
|
|
1617
|
+
try {
|
|
1618
|
+
localStorage.getItem(JSON.stringify(this.opts.key));
|
|
1619
|
+
}
|
|
1620
|
+
catch (error) {
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
exports.LocalStorageTransport = LocalStorageTransport;
|
|
1625
|
+
//# sourceMappingURL=LocalStorageTransport.js.map
|
|
1626
|
+
//# sourceMappingURL=LocalStorageTransport.ts.map;
|
|
1627
|
+
|
|
1628
|
+
function __isObj(x) {
|
|
1629
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1630
|
+
}
|
|
1631
|
+
if (_src_persistence_LocalStorageTransport === module.exports) {
|
|
1632
|
+
// do nothing if
|
|
1633
|
+
} else if (__isObj(_src_persistence_LocalStorageTransport) && __isObj(module.exports)) {
|
|
1634
|
+
Object.assign(_src_persistence_LocalStorageTransport, module.exports);
|
|
1635
|
+
} else {
|
|
1636
|
+
_src_persistence_LocalStorageTransport = module.exports;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
;
|
|
1640
|
+
}());
|
|
1641
|
+
|
|
1642
|
+
// end:source ./ModuleSimplified.js
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
// source ./ModuleSimplified.js
|
|
1646
|
+
var _src_workers_CachedWorker;
|
|
1647
|
+
(function () {
|
|
1648
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1649
|
+
var define = null;
|
|
1650
|
+
var exports = _src_workers_CachedWorker != null ? _src_workers_CachedWorker : {};
|
|
1651
|
+
var module = { exports: exports };
|
|
1652
|
+
|
|
1653
|
+
"use strict";
|
|
1654
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1655
|
+
exports.CachedWorker = void 0;
|
|
1656
|
+
const FsTransport_1 = _src_persistence_FsTransport;
|
|
1657
|
+
const LocalStorageTransport_1 = _src_persistence_LocalStorageTransport;
|
|
1658
|
+
const Cache_1 = _src_Cache;
|
|
1659
|
+
class CachedWorker {
|
|
1660
|
+
opts;
|
|
1661
|
+
cache;
|
|
1662
|
+
worker;
|
|
1663
|
+
workerDfr;
|
|
1664
|
+
constructor(opts) {
|
|
1665
|
+
this.opts = opts;
|
|
1666
|
+
const persistence = opts.persistence ?? /* typo fallback */ opts.persistance ?? this.getTransport();
|
|
1667
|
+
if (persistence) {
|
|
1668
|
+
persistence.debounceMs = 0;
|
|
1669
|
+
}
|
|
1670
|
+
this.cache = new Cache_1.Cache({
|
|
1671
|
+
persistence: persistence,
|
|
1672
|
+
maxAge: opts.maxAge,
|
|
1673
|
+
monitors: opts.monitors,
|
|
1674
|
+
});
|
|
1675
|
+
this.worker = opts.worker;
|
|
1676
|
+
}
|
|
1677
|
+
getTransport() {
|
|
1678
|
+
let t = this.opts.transport;
|
|
1679
|
+
if (t == null) {
|
|
1680
|
+
return null;
|
|
1681
|
+
}
|
|
1682
|
+
if ('path' in t) {
|
|
1683
|
+
return new FsTransport_1.FsTransport(t);
|
|
1684
|
+
}
|
|
1685
|
+
if ('key' in t) {
|
|
1686
|
+
return new LocalStorageTransport_1.LocalStorageTransport(t);
|
|
1687
|
+
}
|
|
1688
|
+
throw new Error('Invalid transport options');
|
|
1689
|
+
}
|
|
1690
|
+
run() {
|
|
1691
|
+
let result = this.cache.get('result');
|
|
1692
|
+
if (result != null) {
|
|
1693
|
+
return result;
|
|
1694
|
+
}
|
|
1695
|
+
result = this.worker();
|
|
1696
|
+
this.cache.set('result', result);
|
|
1697
|
+
return result;
|
|
1698
|
+
}
|
|
1699
|
+
async runAsync() {
|
|
1700
|
+
return this.workerDfr ?? (this.workerDfr = (async () => {
|
|
1701
|
+
let result = await this.cache.getAsync('result');
|
|
1702
|
+
if (result) {
|
|
1703
|
+
return result;
|
|
1704
|
+
}
|
|
1705
|
+
result = await this.opts.worker();
|
|
1706
|
+
await this.cache.setAsync('result', result);
|
|
1707
|
+
return result;
|
|
1708
|
+
})());
|
|
1709
|
+
}
|
|
1710
|
+
static run(opts) {
|
|
1711
|
+
return new CachedWorker(opts).run();
|
|
1712
|
+
}
|
|
1713
|
+
static runAsync(opts) {
|
|
1714
|
+
return new CachedWorker(opts).runAsync();
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
exports.CachedWorker = CachedWorker;
|
|
1718
|
+
//# sourceMappingURL=CachedWorker.js.map
|
|
1719
|
+
//# sourceMappingURL=CachedWorker.ts.map;
|
|
1720
|
+
|
|
1721
|
+
function __isObj(x) {
|
|
1722
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1723
|
+
}
|
|
1724
|
+
if (_src_workers_CachedWorker === module.exports) {
|
|
1725
|
+
// do nothing if
|
|
1726
|
+
} else if (__isObj(_src_workers_CachedWorker) && __isObj(module.exports)) {
|
|
1727
|
+
Object.assign(_src_workers_CachedWorker, module.exports);
|
|
1728
|
+
} else {
|
|
1729
|
+
_src_workers_CachedWorker = module.exports;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
;
|
|
1733
|
+
}());
|
|
1734
|
+
|
|
1735
|
+
// end:source ./ModuleSimplified.js
|
|
1736
|
+
|
|
1737
|
+
"use strict";
|
|
1738
|
+
const memoize_1 = _src_deco_memoize;
|
|
1739
|
+
const debounce_1 = _src_deco_debounce;
|
|
1740
|
+
const throttle_1 = _src_deco_throttle;
|
|
1741
|
+
const queued_1 = _src_deco_queued;
|
|
1742
|
+
const memoize_2 = _src_fn_memoize;
|
|
1743
|
+
const Cache_1 = _src_Cache;
|
|
1744
|
+
const FsTransport_1 = _src_persistence_FsTransport;
|
|
1745
|
+
const LocalStorageTransport_1 = _src_persistence_LocalStorageTransport;
|
|
1746
|
+
const CachedWorker_1 = _src_workers_CachedWorker;
|
|
1747
|
+
const queued_2 = _src_fn_queued;
|
|
1748
|
+
class Memd {
|
|
1749
|
+
static Cache = Cache_1.Cache;
|
|
1750
|
+
static fn = {
|
|
1751
|
+
memoize: memoize_2.fn_memoize,
|
|
1752
|
+
queued: queued_2.fn_queued,
|
|
1753
|
+
clearMemoized: memoize_2.fn_clearMemoized
|
|
1754
|
+
};
|
|
1755
|
+
static deco = {
|
|
1756
|
+
memoize: memoize_1.deco_memoize,
|
|
1757
|
+
throttle: throttle_1.deco_throttle,
|
|
1758
|
+
debounce: debounce_1.deco_debounce,
|
|
1759
|
+
queued: queued_1.deco_queued
|
|
1760
|
+
};
|
|
1761
|
+
static FsTransport = FsTransport_1.FsTransport;
|
|
1762
|
+
static LocalStorageTransport = LocalStorageTransport_1.LocalStorageTransport;
|
|
1763
|
+
static CachedWorker = CachedWorker_1.CachedWorker;
|
|
1764
|
+
static default;
|
|
1765
|
+
}
|
|
1766
|
+
Memd.default = Memd;
|
|
1767
|
+
module.exports = Memd;
|
|
1768
|
+
//# sourceMappingURL=export.js.map
|
|
1769
|
+
//# sourceMappingURL=export.ts.map
|
|
1770
|
+
|
|
1771
|
+
}));
|
|
1772
|
+
|
|
1773
|
+
// end:source ./UMD.js
|
|
1774
|
+
;
|
|
1775
|
+
|
|
1776
|
+
function __isObj(x) {
|
|
1777
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1778
|
+
}
|
|
1779
|
+
if (_node_modules_memd_lib_umd_memd === module.exports) {
|
|
1780
|
+
// do nothing if
|
|
1781
|
+
} else if (__isObj(_node_modules_memd_lib_umd_memd) && __isObj(module.exports)) {
|
|
1782
|
+
Object.assign(_node_modules_memd_lib_umd_memd, module.exports);
|
|
1783
|
+
} else {
|
|
1784
|
+
_node_modules_memd_lib_umd_memd = module.exports;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
;
|
|
1788
|
+
}());
|
|
1789
|
+
|
|
1790
|
+
// end:source ./ModuleSimplified.js
|
|
1791
|
+
|
|
1792
|
+
|
|
1793
|
+
// source ./ModuleSimplified.js
|
|
1794
|
+
var _src_coverage__coverage;
|
|
1795
|
+
(function () {
|
|
1796
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1797
|
+
var define = null;
|
|
1798
|
+
var exports = _src_coverage__coverage != null ? _src_coverage__coverage : {};
|
|
1799
|
+
var module = { exports: exports };
|
|
1800
|
+
|
|
1801
|
+
"use strict";
|
|
1802
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1803
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1804
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1805
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1806
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1807
|
+
};
|
|
1808
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1809
|
+
exports.$coverage = void 0;
|
|
1810
|
+
const Api = require("solidity-coverage/api");
|
|
1811
|
+
const alot_1 = require("alot");
|
|
1812
|
+
const memd_1 = _node_modules_memd_lib_umd_memd;
|
|
1813
|
+
const atma_io_1 = require("atma-io");
|
|
1814
|
+
const _path_1 = _src_utils__path;
|
|
1815
|
+
const HardhatProvider_1 = require("dequanto/hardhat/HardhatProvider");
|
|
1816
|
+
const constants_1 = require("hardhat/internal/constants");
|
|
1817
|
+
var $coverage;
|
|
1818
|
+
(function ($coverage) {
|
|
1819
|
+
async function compile(params) {
|
|
1820
|
+
const hh = new HardhatProvider_1.HardhatProvider();
|
|
1821
|
+
const hardhat = await hh.getHardhat();
|
|
1822
|
+
// Ensure optimizer is disabled, otherwise instrumented code will be removed as unused.
|
|
1823
|
+
hardhat.config.solidity.compilers.forEach(compiler => {
|
|
1824
|
+
compiler.settings.optimizer.enabled = false;
|
|
1825
|
+
});
|
|
1826
|
+
const client = await hh.client('hardhat');
|
|
1827
|
+
const result = await hh.compileSolDirectory(params.contracts, {
|
|
1828
|
+
tsgen: true
|
|
1829
|
+
});
|
|
1830
|
+
await attachToHardhatVM(client);
|
|
1831
|
+
return result;
|
|
1832
|
+
}
|
|
1833
|
+
$coverage.compile = compile;
|
|
1834
|
+
async function attachToHardhatVM(client) {
|
|
1835
|
+
const provider = await client.options.web3;
|
|
1836
|
+
const api = await ApiUtil.getApi();
|
|
1837
|
+
await api.attachToHardhatVM(provider);
|
|
1838
|
+
provider.on(constants_1.HARDHAT_NETWORK_RESET_EVENT, async () => {
|
|
1839
|
+
await api.attachToHardhatVM(provider);
|
|
1840
|
+
});
|
|
1841
|
+
await api.attachToHardhatVM(provider);
|
|
1842
|
+
}
|
|
1843
|
+
$coverage.attachToHardhatVM = attachToHardhatVM;
|
|
1844
|
+
async function instrumentFiles(params) {
|
|
1845
|
+
var _a;
|
|
1846
|
+
let source = params.source;
|
|
1847
|
+
let targetDir = (_a = params.target) !== null && _a !== void 0 ? _a : './coverage/contracts/';
|
|
1848
|
+
let files;
|
|
1849
|
+
if (/\.\w+$/.test(source)) {
|
|
1850
|
+
files = [new atma_io_1.File(source)];
|
|
1851
|
+
}
|
|
1852
|
+
else {
|
|
1853
|
+
let rgx = /\*/.exec(source);
|
|
1854
|
+
if (rgx == null) {
|
|
1855
|
+
files = await atma_io_1.Directory.readFilesAsync(source, '**/*.sol');
|
|
1856
|
+
}
|
|
1857
|
+
else {
|
|
1858
|
+
let dir = source.substring(0, rgx.index);
|
|
1859
|
+
let glob = source.substring(rgx.index);
|
|
1860
|
+
files = await atma_io_1.Directory.readFilesAsync(dir, glob);
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
let targets = await (0, alot_1.default)(files)
|
|
1864
|
+
.mapAsync(async (file) => {
|
|
1865
|
+
let canonicalPath = file.uri.toLocalFile();
|
|
1866
|
+
let relativePath = file.uri.toRelativeString(atma_io_1.env.currentDir);
|
|
1867
|
+
let source = await file.readAsync();
|
|
1868
|
+
return {
|
|
1869
|
+
canonicalPath,
|
|
1870
|
+
relativePath,
|
|
1871
|
+
source,
|
|
1872
|
+
};
|
|
1873
|
+
})
|
|
1874
|
+
.toArrayAsync({ threads: 5 });
|
|
1875
|
+
const api = await ApiUtil.getApi();
|
|
1876
|
+
const result = await api.instrument(targets);
|
|
1877
|
+
await (0, alot_1.default)(result)
|
|
1878
|
+
.forEachAsync(async (target) => {
|
|
1879
|
+
let path = target.relativePath.replace(/^[\/.]*contracts/, '');
|
|
1880
|
+
let output = _path_1.$path.join(targetDir, path);
|
|
1881
|
+
await atma_io_1.File.writeAsync(output, target.source);
|
|
1882
|
+
})
|
|
1883
|
+
.toArrayAsync({ threads: 5 });
|
|
1884
|
+
}
|
|
1885
|
+
$coverage.instrumentFiles = instrumentFiles;
|
|
1886
|
+
async function report(params) {
|
|
1887
|
+
var _a;
|
|
1888
|
+
const targetDir = (_a = params === null || params === void 0 ? void 0 : params.target) !== null && _a !== void 0 ? _a : './coverage/report';
|
|
1889
|
+
const api = await ApiUtil.getApi();
|
|
1890
|
+
const result = await api.report(targetDir);
|
|
1891
|
+
}
|
|
1892
|
+
$coverage.report = report;
|
|
1893
|
+
class ApiUtil {
|
|
1894
|
+
static async getApi() {
|
|
1895
|
+
return new Api();
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
__decorate([
|
|
1899
|
+
memd_1.default.deco.memoize()
|
|
1900
|
+
], ApiUtil, "getApi", null);
|
|
1901
|
+
})($coverage = exports.$coverage || (exports.$coverage = {}));
|
|
1902
|
+
//# sourceMappingURL=$coverage.js.map
|
|
1903
|
+
//# sourceMappingURL=$coverage.ts.map;
|
|
1904
|
+
|
|
1905
|
+
function __isObj(x) {
|
|
1906
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1907
|
+
}
|
|
1908
|
+
if (_src_coverage__coverage === module.exports) {
|
|
1909
|
+
// do nothing if
|
|
1910
|
+
} else if (__isObj(_src_coverage__coverage) && __isObj(module.exports)) {
|
|
1911
|
+
Object.assign(_src_coverage__coverage, module.exports);
|
|
1912
|
+
} else {
|
|
1913
|
+
_src_coverage__coverage = module.exports;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
;
|
|
1917
|
+
}());
|
|
1918
|
+
|
|
1919
|
+
// end:source ./ModuleSimplified.js
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
// source ./ModuleSimplified.js
|
|
1923
|
+
var _src_utils__command;
|
|
1924
|
+
(function () {
|
|
1925
|
+
// ensure AMD is not active for the model, so that any UMD exports as commonjs
|
|
1926
|
+
var define = null;
|
|
1927
|
+
var exports = _src_utils__command != null ? _src_utils__command : {};
|
|
1928
|
+
var module = { exports: exports };
|
|
1929
|
+
|
|
1930
|
+
"use strict";
|
|
1931
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1932
|
+
exports.$command = void 0;
|
|
1933
|
+
var $command;
|
|
1934
|
+
(function ($command) {
|
|
1935
|
+
async function utest() {
|
|
1936
|
+
const originalExit = process.exit;
|
|
1937
|
+
return new Promise((resolve, reject) => {
|
|
1938
|
+
process.exit = function (code) {
|
|
1939
|
+
resolve(null);
|
|
1940
|
+
process.exit = originalExit;
|
|
1941
|
+
};
|
|
1942
|
+
process.argv = ['node', 'atma', 'test'];
|
|
1943
|
+
require('atma');
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
$command.utest = utest;
|
|
1947
|
+
})($command = exports.$command || (exports.$command = {}));
|
|
1948
|
+
//# sourceMappingURL=$command.js.map
|
|
1949
|
+
//# sourceMappingURL=$command.ts.map;
|
|
1950
|
+
|
|
1951
|
+
function __isObj(x) {
|
|
1952
|
+
return x != null && typeof x === 'object' && x.constructor === Object;
|
|
1953
|
+
}
|
|
1954
|
+
if (_src_utils__command === module.exports) {
|
|
1955
|
+
// do nothing if
|
|
1956
|
+
} else if (__isObj(_src_utils__command) && __isObj(module.exports)) {
|
|
1957
|
+
Object.assign(_src_utils__command, module.exports);
|
|
1958
|
+
} else {
|
|
1959
|
+
_src_utils__command = module.exports;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
;
|
|
1963
|
+
}());
|
|
1964
|
+
|
|
1965
|
+
// end:source ./ModuleSimplified.js
|
|
1966
|
+
|
|
152
1967
|
"use strict";
|
|
153
1968
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1969
|
+
exports.coverage = void 0;
|
|
154
1970
|
const alot_1 = require("alot");
|
|
155
1971
|
const atma_io_1 = require("atma-io");
|
|
156
1972
|
const _0xweb_1 = require("0xweb");
|
|
@@ -159,6 +1975,8 @@ const config_1 = require("hardhat/config");
|
|
|
159
1975
|
const config_2 = _src_config;
|
|
160
1976
|
const constants_1 = _src_constants;
|
|
161
1977
|
const _path_1 = _src_utils__path;
|
|
1978
|
+
const _coverage_1 = _src_coverage__coverage;
|
|
1979
|
+
const _command_1 = _src_utils__command;
|
|
162
1980
|
const taskArgsStore = { compileAll: false };
|
|
163
1981
|
(0, config_1.extendConfig)((config) => {
|
|
164
1982
|
config['0xweb'] = (0, config_2.resolveConfig)(config);
|
|
@@ -275,11 +2093,28 @@ const taskArgsStore = { compileAll: false };
|
|
|
275
2093
|
})
|
|
276
2094
|
.toArrayAsync({ threads: 4 });
|
|
277
2095
|
});
|
|
278
|
-
(0, config_1.task)(constants_1.TASK_0xWEB, 'Generate
|
|
2096
|
+
(0, config_1.task)(constants_1.TASK_0xWEB, 'Generate 0xweb classes for compiled contracts')
|
|
279
2097
|
.setAction(async (_, { run }) => {
|
|
280
2098
|
taskArgsStore.compileAll = true;
|
|
281
2099
|
await run(task_names_1.TASK_COMPILE, { quiet: true });
|
|
282
2100
|
});
|
|
2101
|
+
(0, config_1.task)(constants_1.TASK_COVERAGE, 'Instrument sol files, compile')
|
|
2102
|
+
.addOptionalParam('contracts', 'Optionally the contracts folder', './contracts/')
|
|
2103
|
+
.addOptionalParam('out', 'Optionally the output folder', './coverage/contracts/')
|
|
2104
|
+
.addOptionalParam('report', 'Optionally the output folder', './coverage/report/')
|
|
2105
|
+
.addOptionalParam('test', 'Test command (should be the npx compatible command)')
|
|
2106
|
+
.setAction(async (cliArgs, { run }) => {
|
|
2107
|
+
await run(task_names_1.TASK_CLEAN, { quiet: true });
|
|
2108
|
+
const source = cliArgs.contracts || './contracts/';
|
|
2109
|
+
const target = cliArgs.out || './coverage/contracts/';
|
|
2110
|
+
await _coverage_1.$coverage.instrumentFiles({
|
|
2111
|
+
source,
|
|
2112
|
+
target,
|
|
2113
|
+
});
|
|
2114
|
+
await _coverage_1.$coverage.compile({ contracts: target });
|
|
2115
|
+
await _command_1.$command.utest();
|
|
2116
|
+
await _coverage_1.$coverage.report();
|
|
2117
|
+
});
|
|
283
2118
|
(0, config_1.task)(task_names_1.TASK_CLEAN, 'Clears the cache and deletes all artifacts')
|
|
284
2119
|
.addOptionalParam('package', 'Optionally clears the 0xc classes for a specific mono-repo package')
|
|
285
2120
|
.setAction(async (cliArgs, { config }, runSuper) => {
|
|
@@ -369,6 +2204,7 @@ var ConfigHelper;
|
|
|
369
2204
|
}
|
|
370
2205
|
ConfigHelper.resetPaths = resetPaths;
|
|
371
2206
|
})(ConfigHelper || (ConfigHelper = {}));
|
|
2207
|
+
exports.coverage = _coverage_1.$coverage;
|
|
372
2208
|
//# sourceMappingURL=index.js.map
|
|
373
2209
|
//# sourceMappingURL=index.ts.map
|
|
374
2210
|
|