mol_jsx_lib 0.0.48 → 0.0.49
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/node.test.js +183 -174
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.test.js +204 -195
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -2392,180 +2392,6 @@ var $;
|
|
|
2392
2392
|
;
|
|
2393
2393
|
"use strict";
|
|
2394
2394
|
var $;
|
|
2395
|
-
(function ($) {
|
|
2396
|
-
function $mol_promise() {
|
|
2397
|
-
let done;
|
|
2398
|
-
let fail;
|
|
2399
|
-
const promise = new Promise((d, f) => {
|
|
2400
|
-
done = d;
|
|
2401
|
-
fail = f;
|
|
2402
|
-
});
|
|
2403
|
-
return Object.assign(promise, {
|
|
2404
|
-
done,
|
|
2405
|
-
fail,
|
|
2406
|
-
});
|
|
2407
|
-
}
|
|
2408
|
-
$.$mol_promise = $mol_promise;
|
|
2409
|
-
})($ || ($ = {}));
|
|
2410
|
-
//mol/promise/promise.ts
|
|
2411
|
-
;
|
|
2412
|
-
"use strict";
|
|
2413
|
-
var $;
|
|
2414
|
-
(function ($) {
|
|
2415
|
-
$.$mol_after_mock_queue = [];
|
|
2416
|
-
function $mol_after_mock_warp() {
|
|
2417
|
-
const queue = $.$mol_after_mock_queue.splice(0);
|
|
2418
|
-
for (const task of queue)
|
|
2419
|
-
task();
|
|
2420
|
-
}
|
|
2421
|
-
$.$mol_after_mock_warp = $mol_after_mock_warp;
|
|
2422
|
-
class $mol_after_mock_commmon extends $mol_object2 {
|
|
2423
|
-
task;
|
|
2424
|
-
promise = Promise.resolve();
|
|
2425
|
-
cancelled = false;
|
|
2426
|
-
id;
|
|
2427
|
-
constructor(task) {
|
|
2428
|
-
super();
|
|
2429
|
-
this.task = task;
|
|
2430
|
-
$.$mol_after_mock_queue.push(task);
|
|
2431
|
-
}
|
|
2432
|
-
destructor() {
|
|
2433
|
-
const index = $.$mol_after_mock_queue.indexOf(this.task);
|
|
2434
|
-
if (index >= 0)
|
|
2435
|
-
$.$mol_after_mock_queue.splice(index, 1);
|
|
2436
|
-
}
|
|
2437
|
-
}
|
|
2438
|
-
$.$mol_after_mock_commmon = $mol_after_mock_commmon;
|
|
2439
|
-
class $mol_after_mock_timeout extends $mol_after_mock_commmon {
|
|
2440
|
-
delay;
|
|
2441
|
-
constructor(delay, task) {
|
|
2442
|
-
super(task);
|
|
2443
|
-
this.delay = delay;
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
$.$mol_after_mock_timeout = $mol_after_mock_timeout;
|
|
2447
|
-
})($ || ($ = {}));
|
|
2448
|
-
//mol/after/mock/mock.test.ts
|
|
2449
|
-
;
|
|
2450
|
-
"use strict";
|
|
2451
|
-
var $;
|
|
2452
|
-
(function ($_1) {
|
|
2453
|
-
$mol_test_mocks.push($ => {
|
|
2454
|
-
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
2455
|
-
});
|
|
2456
|
-
})($ || ($ = {}));
|
|
2457
|
-
//mol/after/timeout/timeout.test.ts
|
|
2458
|
-
;
|
|
2459
|
-
"use strict";
|
|
2460
|
-
var $;
|
|
2461
|
-
(function ($) {
|
|
2462
|
-
function $mol_wire_sync(obj) {
|
|
2463
|
-
return new Proxy(obj, {
|
|
2464
|
-
get(obj, field) {
|
|
2465
|
-
const val = obj[field];
|
|
2466
|
-
if (typeof val !== 'function')
|
|
2467
|
-
return val;
|
|
2468
|
-
const temp = $mol_wire_task.getter(val);
|
|
2469
|
-
return function $mol_wire_sync(...args) {
|
|
2470
|
-
const fiber = temp(obj, args);
|
|
2471
|
-
return fiber.sync();
|
|
2472
|
-
};
|
|
2473
|
-
},
|
|
2474
|
-
apply(obj, self, args) {
|
|
2475
|
-
const temp = $mol_wire_task.getter(obj);
|
|
2476
|
-
const fiber = temp(self, args);
|
|
2477
|
-
return fiber.sync();
|
|
2478
|
-
},
|
|
2479
|
-
});
|
|
2480
|
-
}
|
|
2481
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
2482
|
-
})($ || ($ = {}));
|
|
2483
|
-
//mol/wire/sync/sync.ts
|
|
2484
|
-
;
|
|
2485
|
-
"use strict";
|
|
2486
|
-
var $;
|
|
2487
|
-
(function ($) {
|
|
2488
|
-
function $mol_wait_timeout_async(timeout) {
|
|
2489
|
-
const promise = $mol_promise();
|
|
2490
|
-
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
2491
|
-
return Object.assign(promise, {
|
|
2492
|
-
destructor: () => task.destructor()
|
|
2493
|
-
});
|
|
2494
|
-
}
|
|
2495
|
-
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
2496
|
-
function $mol_wait_timeout(timeout) {
|
|
2497
|
-
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2498
|
-
}
|
|
2499
|
-
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
2500
|
-
})($ || ($ = {}));
|
|
2501
|
-
//mol/wait/timeout/timeout.ts
|
|
2502
|
-
;
|
|
2503
|
-
"use strict";
|
|
2504
|
-
var $;
|
|
2505
|
-
(function ($_1) {
|
|
2506
|
-
$mol_test({
|
|
2507
|
-
async 'Latest Calls Wins on Concurrency'($) {
|
|
2508
|
-
class NameLogger extends $mol_object2 {
|
|
2509
|
-
static $ = $;
|
|
2510
|
-
static first = [];
|
|
2511
|
-
static last = [];
|
|
2512
|
-
static send(next) {
|
|
2513
|
-
$mol_wire_sync(this.first).push(next);
|
|
2514
|
-
this.$.$mol_wait_timeout(0);
|
|
2515
|
-
this.last.push(next);
|
|
2516
|
-
}
|
|
2517
|
-
}
|
|
2518
|
-
const name = $mol_wire_async(NameLogger).send;
|
|
2519
|
-
name('john');
|
|
2520
|
-
const promise = name('jin');
|
|
2521
|
-
$.$mol_after_mock_warp();
|
|
2522
|
-
await promise;
|
|
2523
|
-
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
2524
|
-
$mol_assert_like(NameLogger.last, ['jin']);
|
|
2525
|
-
},
|
|
2526
|
-
async 'Wrap function'($) {
|
|
2527
|
-
const name = $mol_wire_async(function (name) {
|
|
2528
|
-
$.$mol_wait_timeout(0);
|
|
2529
|
-
return name;
|
|
2530
|
-
});
|
|
2531
|
-
const promise = name('jin');
|
|
2532
|
-
$.$mol_after_mock_warp();
|
|
2533
|
-
$mol_assert_like(await promise, 'jin');
|
|
2534
|
-
},
|
|
2535
|
-
});
|
|
2536
|
-
})($ || ($ = {}));
|
|
2537
|
-
//mol/wire/async/async.test.ts
|
|
2538
|
-
;
|
|
2539
|
-
"use strict";
|
|
2540
|
-
var $;
|
|
2541
|
-
(function ($) {
|
|
2542
|
-
function $mol_wire_async(obj) {
|
|
2543
|
-
return new Proxy(obj, {
|
|
2544
|
-
get(obj, field) {
|
|
2545
|
-
const val = obj[field];
|
|
2546
|
-
if (typeof val !== 'function')
|
|
2547
|
-
return val;
|
|
2548
|
-
let fiber;
|
|
2549
|
-
const temp = $mol_wire_task.getter(val);
|
|
2550
|
-
return function $mol_wire_async(...args) {
|
|
2551
|
-
fiber?.destructor();
|
|
2552
|
-
fiber = temp(obj, args);
|
|
2553
|
-
return fiber.async();
|
|
2554
|
-
};
|
|
2555
|
-
},
|
|
2556
|
-
apply(obj, self, args) {
|
|
2557
|
-
const temp = $mol_wire_task.getter(obj);
|
|
2558
|
-
const fiber = temp(self, args);
|
|
2559
|
-
return fiber.async();
|
|
2560
|
-
},
|
|
2561
|
-
});
|
|
2562
|
-
}
|
|
2563
|
-
$.$mol_wire_async = $mol_wire_async;
|
|
2564
|
-
})($ || ($ = {}));
|
|
2565
|
-
//mol/wire/async/async.ts
|
|
2566
|
-
;
|
|
2567
|
-
"use strict";
|
|
2568
|
-
var $;
|
|
2569
2395
|
(function ($_1) {
|
|
2570
2396
|
$mol_test({
|
|
2571
2397
|
'Collect deps'() {
|
|
@@ -2624,6 +2450,53 @@ var $;
|
|
|
2624
2450
|
;
|
|
2625
2451
|
"use strict";
|
|
2626
2452
|
var $;
|
|
2453
|
+
(function ($) {
|
|
2454
|
+
$.$mol_after_mock_queue = [];
|
|
2455
|
+
function $mol_after_mock_warp() {
|
|
2456
|
+
const queue = $.$mol_after_mock_queue.splice(0);
|
|
2457
|
+
for (const task of queue)
|
|
2458
|
+
task();
|
|
2459
|
+
}
|
|
2460
|
+
$.$mol_after_mock_warp = $mol_after_mock_warp;
|
|
2461
|
+
class $mol_after_mock_commmon extends $mol_object2 {
|
|
2462
|
+
task;
|
|
2463
|
+
promise = Promise.resolve();
|
|
2464
|
+
cancelled = false;
|
|
2465
|
+
id;
|
|
2466
|
+
constructor(task) {
|
|
2467
|
+
super();
|
|
2468
|
+
this.task = task;
|
|
2469
|
+
$.$mol_after_mock_queue.push(task);
|
|
2470
|
+
}
|
|
2471
|
+
destructor() {
|
|
2472
|
+
const index = $.$mol_after_mock_queue.indexOf(this.task);
|
|
2473
|
+
if (index >= 0)
|
|
2474
|
+
$.$mol_after_mock_queue.splice(index, 1);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
$.$mol_after_mock_commmon = $mol_after_mock_commmon;
|
|
2478
|
+
class $mol_after_mock_timeout extends $mol_after_mock_commmon {
|
|
2479
|
+
delay;
|
|
2480
|
+
constructor(delay, task) {
|
|
2481
|
+
super(task);
|
|
2482
|
+
this.delay = delay;
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
$.$mol_after_mock_timeout = $mol_after_mock_timeout;
|
|
2486
|
+
})($ || ($ = {}));
|
|
2487
|
+
//mol/after/mock/mock.test.ts
|
|
2488
|
+
;
|
|
2489
|
+
"use strict";
|
|
2490
|
+
var $;
|
|
2491
|
+
(function ($_1) {
|
|
2492
|
+
$mol_test_mocks.push($ => {
|
|
2493
|
+
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
2494
|
+
});
|
|
2495
|
+
})($ || ($ = {}));
|
|
2496
|
+
//mol/after/timeout/timeout.test.ts
|
|
2497
|
+
;
|
|
2498
|
+
"use strict";
|
|
2499
|
+
var $;
|
|
2627
2500
|
(function ($_1) {
|
|
2628
2501
|
$mol_test_mocks.push($ => {
|
|
2629
2502
|
$.$mol_after_frame = $mol_after_mock_commmon;
|
|
@@ -2810,6 +2683,142 @@ var $;
|
|
|
2810
2683
|
;
|
|
2811
2684
|
"use strict";
|
|
2812
2685
|
var $;
|
|
2686
|
+
(function ($) {
|
|
2687
|
+
function $mol_wire_sync(obj) {
|
|
2688
|
+
return new Proxy(obj, {
|
|
2689
|
+
get(obj, field) {
|
|
2690
|
+
const val = obj[field];
|
|
2691
|
+
if (typeof val !== 'function')
|
|
2692
|
+
return val;
|
|
2693
|
+
const temp = $mol_wire_task.getter(val);
|
|
2694
|
+
return function $mol_wire_sync(...args) {
|
|
2695
|
+
const fiber = temp(obj, args);
|
|
2696
|
+
return fiber.sync();
|
|
2697
|
+
};
|
|
2698
|
+
},
|
|
2699
|
+
apply(obj, self, args) {
|
|
2700
|
+
const temp = $mol_wire_task.getter(obj);
|
|
2701
|
+
const fiber = temp(self, args);
|
|
2702
|
+
return fiber.sync();
|
|
2703
|
+
},
|
|
2704
|
+
});
|
|
2705
|
+
}
|
|
2706
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
2707
|
+
})($ || ($ = {}));
|
|
2708
|
+
//mol/wire/sync/sync.ts
|
|
2709
|
+
;
|
|
2710
|
+
"use strict";
|
|
2711
|
+
var $;
|
|
2712
|
+
(function ($) {
|
|
2713
|
+
function $mol_promise() {
|
|
2714
|
+
let done;
|
|
2715
|
+
let fail;
|
|
2716
|
+
const promise = new Promise((d, f) => {
|
|
2717
|
+
done = d;
|
|
2718
|
+
fail = f;
|
|
2719
|
+
});
|
|
2720
|
+
return Object.assign(promise, {
|
|
2721
|
+
done,
|
|
2722
|
+
fail,
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
$.$mol_promise = $mol_promise;
|
|
2726
|
+
})($ || ($ = {}));
|
|
2727
|
+
//mol/promise/promise.ts
|
|
2728
|
+
;
|
|
2729
|
+
"use strict";
|
|
2730
|
+
var $;
|
|
2731
|
+
(function ($) {
|
|
2732
|
+
function $mol_wait_timeout_async(timeout) {
|
|
2733
|
+
const promise = $mol_promise();
|
|
2734
|
+
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
2735
|
+
return Object.assign(promise, {
|
|
2736
|
+
destructor: () => task.destructor()
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
2740
|
+
function $mol_wait_timeout(timeout) {
|
|
2741
|
+
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2742
|
+
}
|
|
2743
|
+
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
2744
|
+
})($ || ($ = {}));
|
|
2745
|
+
//mol/wait/timeout/timeout.ts
|
|
2746
|
+
;
|
|
2747
|
+
"use strict";
|
|
2748
|
+
var $;
|
|
2749
|
+
(function ($_1) {
|
|
2750
|
+
$mol_test({
|
|
2751
|
+
async 'Latest method calls wins'($) {
|
|
2752
|
+
class NameLogger extends $mol_object2 {
|
|
2753
|
+
static $ = $;
|
|
2754
|
+
static first = [];
|
|
2755
|
+
static last = [];
|
|
2756
|
+
static send(next) {
|
|
2757
|
+
$mol_wire_sync(this.first).push(next);
|
|
2758
|
+
this.$.$mol_wait_timeout(0);
|
|
2759
|
+
this.last.push(next);
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
const name = $mol_wire_async(NameLogger).send;
|
|
2763
|
+
name('john');
|
|
2764
|
+
const promise = name('jin');
|
|
2765
|
+
$.$mol_after_mock_warp();
|
|
2766
|
+
await promise;
|
|
2767
|
+
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
2768
|
+
$mol_assert_like(NameLogger.last, ['jin']);
|
|
2769
|
+
},
|
|
2770
|
+
async 'Latest function calls wins'($) {
|
|
2771
|
+
const first = [];
|
|
2772
|
+
const last = [];
|
|
2773
|
+
function send_name(next) {
|
|
2774
|
+
$mol_wire_sync(first).push(next);
|
|
2775
|
+
$.$mol_wait_timeout(0);
|
|
2776
|
+
last.push(next);
|
|
2777
|
+
}
|
|
2778
|
+
const name = $mol_wire_async(send_name);
|
|
2779
|
+
name('john');
|
|
2780
|
+
const promise = name('jin');
|
|
2781
|
+
$.$mol_after_mock_warp();
|
|
2782
|
+
await promise;
|
|
2783
|
+
$mol_assert_like(first, ['john', 'jin']);
|
|
2784
|
+
$mol_assert_like(last, ['jin']);
|
|
2785
|
+
},
|
|
2786
|
+
});
|
|
2787
|
+
})($ || ($ = {}));
|
|
2788
|
+
//mol/wire/async/async.test.ts
|
|
2789
|
+
;
|
|
2790
|
+
"use strict";
|
|
2791
|
+
var $;
|
|
2792
|
+
(function ($) {
|
|
2793
|
+
function $mol_wire_async(obj) {
|
|
2794
|
+
let fiber;
|
|
2795
|
+
const temp = $mol_wire_task.getter(obj);
|
|
2796
|
+
return new Proxy(obj, {
|
|
2797
|
+
get(obj, field) {
|
|
2798
|
+
const val = obj[field];
|
|
2799
|
+
if (typeof val !== 'function')
|
|
2800
|
+
return val;
|
|
2801
|
+
let fiber;
|
|
2802
|
+
const temp = $mol_wire_task.getter(val);
|
|
2803
|
+
return function $mol_wire_async(...args) {
|
|
2804
|
+
fiber?.destructor();
|
|
2805
|
+
fiber = temp(obj, args);
|
|
2806
|
+
return fiber.async();
|
|
2807
|
+
};
|
|
2808
|
+
},
|
|
2809
|
+
apply(obj, self, args) {
|
|
2810
|
+
fiber?.destructor();
|
|
2811
|
+
fiber = temp(self, args);
|
|
2812
|
+
return fiber.async();
|
|
2813
|
+
},
|
|
2814
|
+
});
|
|
2815
|
+
}
|
|
2816
|
+
$.$mol_wire_async = $mol_wire_async;
|
|
2817
|
+
})($ || ($ = {}));
|
|
2818
|
+
//mol/wire/async/async.ts
|
|
2819
|
+
;
|
|
2820
|
+
"use strict";
|
|
2821
|
+
var $;
|
|
2813
2822
|
(function ($_1) {
|
|
2814
2823
|
$mol_test({
|
|
2815
2824
|
'Cached channel'($) {
|