mol_jsx_lib 0.0.43 → 0.0.44
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.d.ts +34 -2
- package/node.deps.json +1 -1
- package/node.esm.js +84 -18
- package/node.esm.js.map +1 -1
- package/node.js +84 -18
- package/node.js.map +1 -1
- package/node.test.js +185 -100
- package/node.test.js.map +1 -1
- package/package.json +3 -2
- package/web.d.ts +5 -2
- package/web.deps.json +1 -1
- package/web.esm.js +34 -11
- package/web.esm.js.map +1 -1
- package/web.js +34 -11
- package/web.js.map +1 -1
- package/web.test.js +108 -89
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -38,6 +38,8 @@ var $node = new Proxy({ require }, {
|
|
|
38
38
|
const mod = target.require('module');
|
|
39
39
|
if (mod.builtinModules.indexOf(name) >= 0)
|
|
40
40
|
return target.require(name);
|
|
41
|
+
if (name[0] === '.')
|
|
42
|
+
return target.require(name);
|
|
41
43
|
const path = target.require('path');
|
|
42
44
|
const fs = target.require('fs');
|
|
43
45
|
let dir = path.resolve('.');
|
|
@@ -595,29 +597,72 @@ var $;
|
|
|
595
597
|
;
|
|
596
598
|
"use strict";
|
|
597
599
|
var $;
|
|
600
|
+
(function ($) {
|
|
601
|
+
class $mol_term_color {
|
|
602
|
+
static reset = this.ansi(0, 0);
|
|
603
|
+
static bold = this.ansi(1, 22);
|
|
604
|
+
static italic = this.ansi(3, 23);
|
|
605
|
+
static underline = this.ansi(4, 24);
|
|
606
|
+
static inverse = this.ansi(7, 27);
|
|
607
|
+
static hidden = this.ansi(8, 28);
|
|
608
|
+
static strike = this.ansi(9, 29);
|
|
609
|
+
static gray = this.ansi(90, 39);
|
|
610
|
+
static red = this.ansi(91, 39);
|
|
611
|
+
static green = this.ansi(92, 39);
|
|
612
|
+
static yellow = this.ansi(93, 39);
|
|
613
|
+
static blue = this.ansi(94, 39);
|
|
614
|
+
static magenta = this.ansi(95, 39);
|
|
615
|
+
static cyan = this.ansi(96, 39);
|
|
616
|
+
static white = this.ansi(97, 39);
|
|
617
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
618
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
619
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
620
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
621
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
622
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
623
|
+
static White = (str) => this.inverse(this.white(str));
|
|
624
|
+
static ansi(open, close) {
|
|
625
|
+
if (typeof process === 'undefined')
|
|
626
|
+
return String;
|
|
627
|
+
if (!process.stdout.isTTY)
|
|
628
|
+
return String;
|
|
629
|
+
const prefix = `\x1b[${open}m`;
|
|
630
|
+
const postfix = `\x1b[${close}m`;
|
|
631
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
632
|
+
return function colorer(str) {
|
|
633
|
+
str = String(str);
|
|
634
|
+
if (str === '')
|
|
635
|
+
return str;
|
|
636
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
637
|
+
return prefix + suffix + postfix;
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
$.$mol_term_color = $mol_term_color;
|
|
642
|
+
})($ || ($ = {}));
|
|
643
|
+
//mol/term/color/color.ts
|
|
644
|
+
;
|
|
645
|
+
"use strict";
|
|
646
|
+
var $;
|
|
598
647
|
(function ($) {
|
|
599
648
|
function $mol_log3_node_make(level, output, type, color) {
|
|
600
649
|
return function $mol_log3_logger(event) {
|
|
601
650
|
if (!event.time)
|
|
602
651
|
event = { time: new Date().toISOString(), ...event };
|
|
603
652
|
const tree = this.$mol_tree.fromJSON(event).clone({ type });
|
|
604
|
-
let str = tree.toString();
|
|
605
|
-
if (process[output].isTTY) {
|
|
606
|
-
str = $node.colorette[color + 'Bright'](str);
|
|
607
|
-
}
|
|
608
|
-
;
|
|
653
|
+
let str = color(tree.toString());
|
|
609
654
|
this.console[level](str);
|
|
610
655
|
const self = this;
|
|
611
656
|
return () => self.console.groupEnd();
|
|
612
657
|
};
|
|
613
658
|
}
|
|
614
659
|
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
615
|
-
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come',
|
|
616
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done',
|
|
617
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail',
|
|
618
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn',
|
|
619
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise',
|
|
620
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area',
|
|
660
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
661
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
662
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
663
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
664
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
665
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
621
666
|
})($ || ($ = {}));
|
|
622
667
|
//mol/log3/log3.node.ts
|
|
623
668
|
;
|
|
@@ -885,7 +930,7 @@ var $;
|
|
|
885
930
|
promote() {
|
|
886
931
|
$mol_wire_auto()?.track_next(this);
|
|
887
932
|
}
|
|
888
|
-
|
|
933
|
+
fresh() { }
|
|
889
934
|
complete() { }
|
|
890
935
|
emit(quant = $mol_wire_cursor.stale) {
|
|
891
936
|
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
@@ -1088,7 +1133,7 @@ var $;
|
|
|
1088
1133
|
}
|
|
1089
1134
|
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
1090
1135
|
const pub = this.data[cursor];
|
|
1091
|
-
pub.
|
|
1136
|
+
pub.fresh();
|
|
1092
1137
|
}
|
|
1093
1138
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1094
1139
|
}
|
|
@@ -1224,7 +1269,7 @@ var $;
|
|
|
1224
1269
|
continue;
|
|
1225
1270
|
if (fiber.cursor === $mol_wire_cursor.final)
|
|
1226
1271
|
continue;
|
|
1227
|
-
fiber.
|
|
1272
|
+
fiber.fresh();
|
|
1228
1273
|
}
|
|
1229
1274
|
}
|
|
1230
1275
|
while (this.reaping.size) {
|
|
@@ -1292,7 +1337,7 @@ var $;
|
|
|
1292
1337
|
else
|
|
1293
1338
|
super.emit(quant);
|
|
1294
1339
|
}
|
|
1295
|
-
|
|
1340
|
+
fresh() {
|
|
1296
1341
|
if (this.cursor === $mol_wire_cursor.fresh)
|
|
1297
1342
|
return;
|
|
1298
1343
|
if (this.cursor === $mol_wire_cursor.final)
|
|
@@ -1300,7 +1345,7 @@ var $;
|
|
|
1300
1345
|
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1301
1346
|
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1302
1347
|
;
|
|
1303
|
-
this.data[i]?.
|
|
1348
|
+
this.data[i]?.fresh();
|
|
1304
1349
|
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1305
1350
|
break check;
|
|
1306
1351
|
}
|
|
@@ -1356,12 +1401,16 @@ var $;
|
|
|
1356
1401
|
this.track_off(bu);
|
|
1357
1402
|
this.put(result);
|
|
1358
1403
|
}
|
|
1404
|
+
refresh() {
|
|
1405
|
+
this.cursor = $mol_wire_cursor.stale;
|
|
1406
|
+
this.fresh();
|
|
1407
|
+
}
|
|
1359
1408
|
sync() {
|
|
1360
1409
|
if (!$mol_wire_fiber.warm) {
|
|
1361
1410
|
return this.result();
|
|
1362
1411
|
}
|
|
1363
1412
|
this.promote();
|
|
1364
|
-
this.
|
|
1413
|
+
this.fresh();
|
|
1365
1414
|
if (this.cache instanceof Error) {
|
|
1366
1415
|
return $mol_fail_hidden(this.cache);
|
|
1367
1416
|
}
|
|
@@ -1372,7 +1421,7 @@ var $;
|
|
|
1372
1421
|
}
|
|
1373
1422
|
async async() {
|
|
1374
1423
|
while (true) {
|
|
1375
|
-
this.
|
|
1424
|
+
this.fresh();
|
|
1376
1425
|
if (this.cache instanceof Error) {
|
|
1377
1426
|
$mol_fail_hidden(this.cache);
|
|
1378
1427
|
}
|
|
@@ -1674,6 +1723,22 @@ var $;
|
|
|
1674
1723
|
};
|
|
1675
1724
|
}
|
|
1676
1725
|
}
|
|
1726
|
+
static watching = new Set();
|
|
1727
|
+
static watch() {
|
|
1728
|
+
new $mol_after_frame($mol_wire_atom.watch);
|
|
1729
|
+
for (const atom of $mol_wire_atom.watching) {
|
|
1730
|
+
if (atom.cursor === $mol_wire_cursor.final) {
|
|
1731
|
+
$mol_wire_atom.watching.delete(atom);
|
|
1732
|
+
}
|
|
1733
|
+
else {
|
|
1734
|
+
atom.cursor = $mol_wire_cursor.stale;
|
|
1735
|
+
atom.fresh();
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
watch() {
|
|
1740
|
+
$mol_wire_atom.watching.add(this);
|
|
1741
|
+
}
|
|
1677
1742
|
resync(args) {
|
|
1678
1743
|
return this.put(this.task.call(this.host, ...args));
|
|
1679
1744
|
}
|
|
@@ -1728,6 +1793,7 @@ var $;
|
|
|
1728
1793
|
$mol_wire_method
|
|
1729
1794
|
], $mol_wire_atom.prototype, "once", null);
|
|
1730
1795
|
$.$mol_wire_atom = $mol_wire_atom;
|
|
1796
|
+
$mol_wire_atom.watch();
|
|
1731
1797
|
})($ || ($ = {}));
|
|
1732
1798
|
//mol/wire/atom/atom.ts
|
|
1733
1799
|
;
|
|
@@ -1938,6 +2004,20 @@ var $;
|
|
|
1938
2004
|
;
|
|
1939
2005
|
"use strict";
|
|
1940
2006
|
var $;
|
|
2007
|
+
(function ($_1) {
|
|
2008
|
+
$mol_test_mocks.push($ => {
|
|
2009
|
+
$.$mol_log3_come = () => { };
|
|
2010
|
+
$.$mol_log3_done = () => { };
|
|
2011
|
+
$.$mol_log3_fail = () => { };
|
|
2012
|
+
$.$mol_log3_warn = () => { };
|
|
2013
|
+
$.$mol_log3_rise = () => { };
|
|
2014
|
+
$.$mol_log3_area = () => () => { };
|
|
2015
|
+
});
|
|
2016
|
+
})($ || ($ = {}));
|
|
2017
|
+
//mol/log3/log3.test.ts
|
|
2018
|
+
;
|
|
2019
|
+
"use strict";
|
|
2020
|
+
var $;
|
|
1941
2021
|
(function ($) {
|
|
1942
2022
|
function $mol_dom_serialize(node) {
|
|
1943
2023
|
const serializer = new $mol_dom_context.XMLSerializer;
|
|
@@ -2093,20 +2173,6 @@ var $;
|
|
|
2093
2173
|
;
|
|
2094
2174
|
"use strict";
|
|
2095
2175
|
var $;
|
|
2096
|
-
(function ($_1) {
|
|
2097
|
-
$mol_test_mocks.push($ => {
|
|
2098
|
-
$.$mol_log3_come = () => { };
|
|
2099
|
-
$.$mol_log3_done = () => { };
|
|
2100
|
-
$.$mol_log3_fail = () => { };
|
|
2101
|
-
$.$mol_log3_warn = () => { };
|
|
2102
|
-
$.$mol_log3_rise = () => { };
|
|
2103
|
-
$.$mol_log3_area = () => () => { };
|
|
2104
|
-
});
|
|
2105
|
-
})($ || ($ = {}));
|
|
2106
|
-
//mol/log3/log3.test.ts
|
|
2107
|
-
;
|
|
2108
|
-
"use strict";
|
|
2109
|
-
var $;
|
|
2110
2176
|
(function ($) {
|
|
2111
2177
|
$mol_test({
|
|
2112
2178
|
'get'() {
|
|
@@ -2327,6 +2393,25 @@ var $;
|
|
|
2327
2393
|
;
|
|
2328
2394
|
"use strict";
|
|
2329
2395
|
var $;
|
|
2396
|
+
(function ($) {
|
|
2397
|
+
function $mol_promise() {
|
|
2398
|
+
let done;
|
|
2399
|
+
let fail;
|
|
2400
|
+
const promise = new Promise((d, f) => {
|
|
2401
|
+
done = d;
|
|
2402
|
+
fail = f;
|
|
2403
|
+
});
|
|
2404
|
+
return Object.assign(promise, {
|
|
2405
|
+
done,
|
|
2406
|
+
fail,
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
$.$mol_promise = $mol_promise;
|
|
2410
|
+
})($ || ($ = {}));
|
|
2411
|
+
//mol/promise/promise.ts
|
|
2412
|
+
;
|
|
2413
|
+
"use strict";
|
|
2414
|
+
var $;
|
|
2330
2415
|
(function ($) {
|
|
2331
2416
|
$.$mol_after_mock_queue = [];
|
|
2332
2417
|
function $mol_after_mock_warp() {
|
|
@@ -2365,6 +2450,59 @@ var $;
|
|
|
2365
2450
|
;
|
|
2366
2451
|
"use strict";
|
|
2367
2452
|
var $;
|
|
2453
|
+
(function ($_1) {
|
|
2454
|
+
$mol_test_mocks.push($ => {
|
|
2455
|
+
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
2456
|
+
});
|
|
2457
|
+
})($ || ($ = {}));
|
|
2458
|
+
//mol/after/timeout/timeout.test.ts
|
|
2459
|
+
;
|
|
2460
|
+
"use strict";
|
|
2461
|
+
var $;
|
|
2462
|
+
(function ($) {
|
|
2463
|
+
function $mol_wire_sync(obj) {
|
|
2464
|
+
return new Proxy(obj, {
|
|
2465
|
+
get(obj, field) {
|
|
2466
|
+
const val = obj[field];
|
|
2467
|
+
if (typeof val !== 'function')
|
|
2468
|
+
return val;
|
|
2469
|
+
const temp = $mol_wire_task.getter(val);
|
|
2470
|
+
return function $mol_wire_sync(...args) {
|
|
2471
|
+
const fiber = temp(obj, args);
|
|
2472
|
+
return fiber.sync();
|
|
2473
|
+
};
|
|
2474
|
+
},
|
|
2475
|
+
apply(obj, self, args) {
|
|
2476
|
+
const temp = $mol_wire_task.getter(obj);
|
|
2477
|
+
const fiber = temp(self, args);
|
|
2478
|
+
return fiber.sync();
|
|
2479
|
+
},
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
2483
|
+
})($ || ($ = {}));
|
|
2484
|
+
//mol/wire/sync/sync.ts
|
|
2485
|
+
;
|
|
2486
|
+
"use strict";
|
|
2487
|
+
var $;
|
|
2488
|
+
(function ($) {
|
|
2489
|
+
function $mol_wait_timeout_async(timeout) {
|
|
2490
|
+
const promise = $mol_promise();
|
|
2491
|
+
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
2492
|
+
return Object.assign(promise, {
|
|
2493
|
+
destructor: () => task.destructor()
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
2497
|
+
function $mol_wait_timeout(timeout) {
|
|
2498
|
+
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2499
|
+
}
|
|
2500
|
+
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
2501
|
+
})($ || ($ = {}));
|
|
2502
|
+
//mol/wait/timeout/timeout.ts
|
|
2503
|
+
;
|
|
2504
|
+
"use strict";
|
|
2505
|
+
var $;
|
|
2368
2506
|
(function ($_1) {
|
|
2369
2507
|
$mol_test({
|
|
2370
2508
|
async 'Latest Calls Wins on Concurrency'($) {
|
|
@@ -2386,6 +2524,15 @@ var $;
|
|
|
2386
2524
|
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
2387
2525
|
$mol_assert_like(NameLogger.last, ['jin']);
|
|
2388
2526
|
},
|
|
2527
|
+
async 'Wrap function'($) {
|
|
2528
|
+
const name = $mol_wire_async(function (name) {
|
|
2529
|
+
$.$mol_wait_timeout(0);
|
|
2530
|
+
return name;
|
|
2531
|
+
});
|
|
2532
|
+
const promise = name('jin');
|
|
2533
|
+
$.$mol_after_mock_warp();
|
|
2534
|
+
$mol_assert_like(await promise, 'jin');
|
|
2535
|
+
},
|
|
2389
2536
|
});
|
|
2390
2537
|
})($ || ($ = {}));
|
|
2391
2538
|
//mol/wire/async/async.test.ts
|
|
@@ -2406,7 +2553,12 @@ var $;
|
|
|
2406
2553
|
fiber = temp(obj, args);
|
|
2407
2554
|
return fiber.async();
|
|
2408
2555
|
};
|
|
2409
|
-
}
|
|
2556
|
+
},
|
|
2557
|
+
apply(obj, self, args) {
|
|
2558
|
+
const temp = $mol_wire_task.getter(obj);
|
|
2559
|
+
const fiber = temp(self, args);
|
|
2560
|
+
return fiber.async();
|
|
2561
|
+
},
|
|
2410
2562
|
});
|
|
2411
2563
|
}
|
|
2412
2564
|
$.$mol_wire_async = $mol_wire_async;
|
|
@@ -2473,15 +2625,6 @@ var $;
|
|
|
2473
2625
|
;
|
|
2474
2626
|
"use strict";
|
|
2475
2627
|
var $;
|
|
2476
|
-
(function ($_1) {
|
|
2477
|
-
$mol_test_mocks.push($ => {
|
|
2478
|
-
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
2479
|
-
});
|
|
2480
|
-
})($ || ($ = {}));
|
|
2481
|
-
//mol/after/timeout/timeout.test.ts
|
|
2482
|
-
;
|
|
2483
|
-
"use strict";
|
|
2484
|
-
var $;
|
|
2485
2628
|
(function ($_1) {
|
|
2486
2629
|
$mol_test_mocks.push($ => {
|
|
2487
2630
|
$.$mol_after_frame = $mol_after_mock_commmon;
|
|
@@ -2668,64 +2811,6 @@ var $;
|
|
|
2668
2811
|
;
|
|
2669
2812
|
"use strict";
|
|
2670
2813
|
var $;
|
|
2671
|
-
(function ($) {
|
|
2672
|
-
function $mol_wire_sync(obj) {
|
|
2673
|
-
return new Proxy(obj, {
|
|
2674
|
-
get(obj, field) {
|
|
2675
|
-
const val = obj[field];
|
|
2676
|
-
if (typeof val !== 'function')
|
|
2677
|
-
return val;
|
|
2678
|
-
const temp = $mol_wire_task.getter(val);
|
|
2679
|
-
return function $mol_wire_sync(...args) {
|
|
2680
|
-
const fiber = temp(obj, args);
|
|
2681
|
-
return fiber.sync();
|
|
2682
|
-
};
|
|
2683
|
-
}
|
|
2684
|
-
});
|
|
2685
|
-
}
|
|
2686
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
2687
|
-
})($ || ($ = {}));
|
|
2688
|
-
//mol/wire/sync/sync.ts
|
|
2689
|
-
;
|
|
2690
|
-
"use strict";
|
|
2691
|
-
var $;
|
|
2692
|
-
(function ($) {
|
|
2693
|
-
function $mol_promise() {
|
|
2694
|
-
let done;
|
|
2695
|
-
let fail;
|
|
2696
|
-
const promise = new Promise((d, f) => {
|
|
2697
|
-
done = d;
|
|
2698
|
-
fail = f;
|
|
2699
|
-
});
|
|
2700
|
-
return Object.assign(promise, {
|
|
2701
|
-
done,
|
|
2702
|
-
fail,
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2705
|
-
$.$mol_promise = $mol_promise;
|
|
2706
|
-
})($ || ($ = {}));
|
|
2707
|
-
//mol/promise/promise.ts
|
|
2708
|
-
;
|
|
2709
|
-
"use strict";
|
|
2710
|
-
var $;
|
|
2711
|
-
(function ($) {
|
|
2712
|
-
function $mol_wait_timeout_async(timeout) {
|
|
2713
|
-
const promise = $mol_promise();
|
|
2714
|
-
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
2715
|
-
return Object.assign(promise, {
|
|
2716
|
-
destructor: () => task.destructor()
|
|
2717
|
-
});
|
|
2718
|
-
}
|
|
2719
|
-
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
2720
|
-
function $mol_wait_timeout(timeout) {
|
|
2721
|
-
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
2722
|
-
}
|
|
2723
|
-
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
2724
|
-
})($ || ($ = {}));
|
|
2725
|
-
//mol/wait/timeout/timeout.ts
|
|
2726
|
-
;
|
|
2727
|
-
"use strict";
|
|
2728
|
-
var $;
|
|
2729
2814
|
(function ($_1) {
|
|
2730
2815
|
$mol_test({
|
|
2731
2816
|
'Cached channel'($) {
|