mol_jsx_lib 0.0.42 → 0.0.45
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.js
CHANGED
|
@@ -46,6 +46,8 @@ var $node = new Proxy({ require }, {
|
|
|
46
46
|
const mod = target.require('module');
|
|
47
47
|
if (mod.builtinModules.indexOf(name) >= 0)
|
|
48
48
|
return target.require(name);
|
|
49
|
+
if (name[0] === '.')
|
|
50
|
+
return target.require(name);
|
|
49
51
|
const path = target.require('path');
|
|
50
52
|
const fs = target.require('fs');
|
|
51
53
|
let dir = path.resolve('.');
|
|
@@ -603,29 +605,72 @@ var $;
|
|
|
603
605
|
;
|
|
604
606
|
"use strict";
|
|
605
607
|
var $;
|
|
608
|
+
(function ($) {
|
|
609
|
+
class $mol_term_color {
|
|
610
|
+
static reset = this.ansi(0, 0);
|
|
611
|
+
static bold = this.ansi(1, 22);
|
|
612
|
+
static italic = this.ansi(3, 23);
|
|
613
|
+
static underline = this.ansi(4, 24);
|
|
614
|
+
static inverse = this.ansi(7, 27);
|
|
615
|
+
static hidden = this.ansi(8, 28);
|
|
616
|
+
static strike = this.ansi(9, 29);
|
|
617
|
+
static gray = this.ansi(90, 39);
|
|
618
|
+
static red = this.ansi(91, 39);
|
|
619
|
+
static green = this.ansi(92, 39);
|
|
620
|
+
static yellow = this.ansi(93, 39);
|
|
621
|
+
static blue = this.ansi(94, 39);
|
|
622
|
+
static magenta = this.ansi(95, 39);
|
|
623
|
+
static cyan = this.ansi(96, 39);
|
|
624
|
+
static white = this.ansi(97, 39);
|
|
625
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
626
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
627
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
628
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
629
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
630
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
631
|
+
static White = (str) => this.inverse(this.white(str));
|
|
632
|
+
static ansi(open, close) {
|
|
633
|
+
if (typeof process === 'undefined')
|
|
634
|
+
return String;
|
|
635
|
+
if (!process.stdout.isTTY)
|
|
636
|
+
return String;
|
|
637
|
+
const prefix = `\x1b[${open}m`;
|
|
638
|
+
const postfix = `\x1b[${close}m`;
|
|
639
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
640
|
+
return function colorer(str) {
|
|
641
|
+
str = String(str);
|
|
642
|
+
if (str === '')
|
|
643
|
+
return str;
|
|
644
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
645
|
+
return prefix + suffix + postfix;
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
$.$mol_term_color = $mol_term_color;
|
|
650
|
+
})($ || ($ = {}));
|
|
651
|
+
//mol/term/color/color.ts
|
|
652
|
+
;
|
|
653
|
+
"use strict";
|
|
654
|
+
var $;
|
|
606
655
|
(function ($) {
|
|
607
656
|
function $mol_log3_node_make(level, output, type, color) {
|
|
608
657
|
return function $mol_log3_logger(event) {
|
|
609
658
|
if (!event.time)
|
|
610
659
|
event = { time: new Date().toISOString(), ...event };
|
|
611
660
|
const tree = this.$mol_tree.fromJSON(event).clone({ type });
|
|
612
|
-
let str = tree.toString();
|
|
613
|
-
if (process[output].isTTY) {
|
|
614
|
-
str = $node.colorette[color + 'Bright'](str);
|
|
615
|
-
}
|
|
616
|
-
;
|
|
661
|
+
let str = color(tree.toString());
|
|
617
662
|
this.console[level](str);
|
|
618
663
|
const self = this;
|
|
619
664
|
return () => self.console.groupEnd();
|
|
620
665
|
};
|
|
621
666
|
}
|
|
622
667
|
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
623
|
-
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come',
|
|
624
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done',
|
|
625
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail',
|
|
626
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn',
|
|
627
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise',
|
|
628
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area',
|
|
668
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
669
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
670
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
671
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
672
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
673
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
629
674
|
})($ || ($ = {}));
|
|
630
675
|
//mol/log3/log3.node.ts
|
|
631
676
|
;
|
|
@@ -893,7 +938,7 @@ var $;
|
|
|
893
938
|
promote() {
|
|
894
939
|
$mol_wire_auto()?.track_next(this);
|
|
895
940
|
}
|
|
896
|
-
|
|
941
|
+
fresh() { }
|
|
897
942
|
complete() { }
|
|
898
943
|
emit(quant = $mol_wire_cursor.stale) {
|
|
899
944
|
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
@@ -1096,7 +1141,7 @@ var $;
|
|
|
1096
1141
|
}
|
|
1097
1142
|
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
1098
1143
|
const pub = this.data[cursor];
|
|
1099
|
-
pub.
|
|
1144
|
+
pub.fresh();
|
|
1100
1145
|
}
|
|
1101
1146
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1102
1147
|
}
|
|
@@ -1232,7 +1277,7 @@ var $;
|
|
|
1232
1277
|
continue;
|
|
1233
1278
|
if (fiber.cursor === $mol_wire_cursor.final)
|
|
1234
1279
|
continue;
|
|
1235
|
-
fiber.
|
|
1280
|
+
fiber.fresh();
|
|
1236
1281
|
}
|
|
1237
1282
|
}
|
|
1238
1283
|
while (this.reaping.size) {
|
|
@@ -1300,7 +1345,7 @@ var $;
|
|
|
1300
1345
|
else
|
|
1301
1346
|
super.emit(quant);
|
|
1302
1347
|
}
|
|
1303
|
-
|
|
1348
|
+
fresh() {
|
|
1304
1349
|
if (this.cursor === $mol_wire_cursor.fresh)
|
|
1305
1350
|
return;
|
|
1306
1351
|
if (this.cursor === $mol_wire_cursor.final)
|
|
@@ -1308,7 +1353,7 @@ var $;
|
|
|
1308
1353
|
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
1309
1354
|
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
1310
1355
|
;
|
|
1311
|
-
this.data[i]?.
|
|
1356
|
+
this.data[i]?.fresh();
|
|
1312
1357
|
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
1313
1358
|
break check;
|
|
1314
1359
|
}
|
|
@@ -1364,12 +1409,16 @@ var $;
|
|
|
1364
1409
|
this.track_off(bu);
|
|
1365
1410
|
this.put(result);
|
|
1366
1411
|
}
|
|
1412
|
+
refresh() {
|
|
1413
|
+
this.cursor = $mol_wire_cursor.stale;
|
|
1414
|
+
this.fresh();
|
|
1415
|
+
}
|
|
1367
1416
|
sync() {
|
|
1368
1417
|
if (!$mol_wire_fiber.warm) {
|
|
1369
1418
|
return this.result();
|
|
1370
1419
|
}
|
|
1371
1420
|
this.promote();
|
|
1372
|
-
this.
|
|
1421
|
+
this.fresh();
|
|
1373
1422
|
if (this.cache instanceof Error) {
|
|
1374
1423
|
return $mol_fail_hidden(this.cache);
|
|
1375
1424
|
}
|
|
@@ -1380,7 +1429,7 @@ var $;
|
|
|
1380
1429
|
}
|
|
1381
1430
|
async async() {
|
|
1382
1431
|
while (true) {
|
|
1383
|
-
this.
|
|
1432
|
+
this.fresh();
|
|
1384
1433
|
if (this.cache instanceof Error) {
|
|
1385
1434
|
$mol_fail_hidden(this.cache);
|
|
1386
1435
|
}
|
|
@@ -1682,6 +1731,22 @@ var $;
|
|
|
1682
1731
|
};
|
|
1683
1732
|
}
|
|
1684
1733
|
}
|
|
1734
|
+
static watching = new Set();
|
|
1735
|
+
static watch() {
|
|
1736
|
+
new $mol_after_frame($mol_wire_atom.watch);
|
|
1737
|
+
for (const atom of $mol_wire_atom.watching) {
|
|
1738
|
+
if (atom.cursor === $mol_wire_cursor.final) {
|
|
1739
|
+
$mol_wire_atom.watching.delete(atom);
|
|
1740
|
+
}
|
|
1741
|
+
else {
|
|
1742
|
+
atom.cursor = $mol_wire_cursor.stale;
|
|
1743
|
+
atom.fresh();
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
watch() {
|
|
1748
|
+
$mol_wire_atom.watching.add(this);
|
|
1749
|
+
}
|
|
1685
1750
|
resync(args) {
|
|
1686
1751
|
return this.put(this.task.call(this.host, ...args));
|
|
1687
1752
|
}
|
|
@@ -1736,6 +1801,7 @@ var $;
|
|
|
1736
1801
|
$mol_wire_method
|
|
1737
1802
|
], $mol_wire_atom.prototype, "once", null);
|
|
1738
1803
|
$.$mol_wire_atom = $mol_wire_atom;
|
|
1804
|
+
$mol_wire_atom.watch();
|
|
1739
1805
|
})($ || ($ = {}));
|
|
1740
1806
|
//mol/wire/atom/atom.ts
|
|
1741
1807
|
;
|