mol_db 0.0.1513 → 0.0.1514
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 +4 -0
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +122 -5
- package/node.js.map +1 -1
- package/node.mjs +122 -5
- package/node.test.js +143 -34
- package/node.test.js.map +1 -1
- package/package.json +3 -2
- package/web.test.js +4 -23
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
|
@@ -90,6 +90,21 @@ var $;
|
|
|
90
90
|
$.$mol_fail_catch = $mol_fail_catch;
|
|
91
91
|
})($ || ($ = {}));
|
|
92
92
|
|
|
93
|
+
;
|
|
94
|
+
"use strict";
|
|
95
|
+
var $;
|
|
96
|
+
(function ($) {
|
|
97
|
+
function $mol_try(handler) {
|
|
98
|
+
try {
|
|
99
|
+
return handler();
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
return error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
$.$mol_try = $mol_try;
|
|
106
|
+
})($ || ($ = {}));
|
|
107
|
+
|
|
93
108
|
;
|
|
94
109
|
"use strict";
|
|
95
110
|
var $;
|
|
@@ -99,7 +114,7 @@ var $;
|
|
|
99
114
|
return false;
|
|
100
115
|
if (!$mol_fail_catch(error))
|
|
101
116
|
return false;
|
|
102
|
-
|
|
117
|
+
$mol_try(() => { $mol_fail_hidden(error); });
|
|
103
118
|
return true;
|
|
104
119
|
}
|
|
105
120
|
$.$mol_fail_log = $mol_fail_log;
|
|
@@ -216,7 +231,7 @@ var $;
|
|
|
216
231
|
get: () => stack_get() + '\n' + [
|
|
217
232
|
this.cause ?? 'no cause',
|
|
218
233
|
...this.errors.flatMap(e => [
|
|
219
|
-
e.stack,
|
|
234
|
+
String(e.stack),
|
|
220
235
|
...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
|
|
221
236
|
])
|
|
222
237
|
].map(frame_normalize).join('\n')
|
|
@@ -552,6 +567,17 @@ var $;
|
|
|
552
567
|
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
553
568
|
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
554
569
|
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
570
|
+
function $mol_dev_format_button(label, click) {
|
|
571
|
+
return $mol_dev_format_auto({
|
|
572
|
+
[$.$mol_dev_format_head]() {
|
|
573
|
+
return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
|
|
574
|
+
},
|
|
575
|
+
[$.$mol_dev_format_body]() {
|
|
576
|
+
Promise.resolve().then(click);
|
|
577
|
+
return $mol_dev_format_span({});
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
555
581
|
$mol_dev_format_register({
|
|
556
582
|
header: (val, config = false) => {
|
|
557
583
|
if (config)
|
|
@@ -569,13 +595,41 @@ var $;
|
|
|
569
595
|
if (typeof val === 'function') {
|
|
570
596
|
return $mol_dev_format_native(val);
|
|
571
597
|
}
|
|
598
|
+
if (Error.isError(val)) {
|
|
599
|
+
return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
|
|
600
|
+
}
|
|
601
|
+
if (val instanceof Promise) {
|
|
602
|
+
return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
|
|
603
|
+
}
|
|
572
604
|
if (Symbol.toStringTag in val) {
|
|
573
605
|
return $mol_dev_format_native(val);
|
|
574
606
|
}
|
|
575
607
|
return null;
|
|
576
608
|
},
|
|
577
|
-
hasBody: val =>
|
|
578
|
-
|
|
609
|
+
hasBody: (val, config = false) => {
|
|
610
|
+
if (config)
|
|
611
|
+
return false;
|
|
612
|
+
if (!val)
|
|
613
|
+
return false;
|
|
614
|
+
if (val[$.$mol_dev_format_body])
|
|
615
|
+
return true;
|
|
616
|
+
return false;
|
|
617
|
+
},
|
|
618
|
+
body: (val, config = false) => {
|
|
619
|
+
if (config)
|
|
620
|
+
return null;
|
|
621
|
+
if (!val)
|
|
622
|
+
return null;
|
|
623
|
+
if ($.$mol_dev_format_body in val) {
|
|
624
|
+
try {
|
|
625
|
+
return val[$.$mol_dev_format_body]();
|
|
626
|
+
}
|
|
627
|
+
catch (error) {
|
|
628
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return null;
|
|
632
|
+
},
|
|
579
633
|
});
|
|
580
634
|
function $mol_dev_format_native(obj) {
|
|
581
635
|
if (typeof obj === 'undefined')
|
|
@@ -641,6 +695,69 @@ var $;
|
|
|
641
695
|
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
642
696
|
'margin-left': '13px'
|
|
643
697
|
});
|
|
698
|
+
class Stack extends Array {
|
|
699
|
+
toString() {
|
|
700
|
+
return this.join('\n');
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
class Call extends Object {
|
|
704
|
+
type;
|
|
705
|
+
function;
|
|
706
|
+
method;
|
|
707
|
+
eval;
|
|
708
|
+
source;
|
|
709
|
+
offset;
|
|
710
|
+
pos;
|
|
711
|
+
object;
|
|
712
|
+
flags;
|
|
713
|
+
[Symbol.toStringTag];
|
|
714
|
+
constructor(call) {
|
|
715
|
+
super();
|
|
716
|
+
this.type = call.getTypeName() ?? '';
|
|
717
|
+
this.function = call.getFunctionName() ?? '';
|
|
718
|
+
this.method = call.getMethodName() ?? '';
|
|
719
|
+
if (this.method === this.function)
|
|
720
|
+
this.method = '';
|
|
721
|
+
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
|
722
|
+
this.eval = call.getEvalOrigin() ?? '';
|
|
723
|
+
this.source = call.getScriptNameOrSourceURL() ?? '';
|
|
724
|
+
this.object = call.getThis();
|
|
725
|
+
this.offset = call.getPosition();
|
|
726
|
+
const flags = [];
|
|
727
|
+
if (call.isAsync())
|
|
728
|
+
flags.push('async');
|
|
729
|
+
if (call.isConstructor())
|
|
730
|
+
flags.push('constructor');
|
|
731
|
+
if (call.isEval())
|
|
732
|
+
flags.push('eval');
|
|
733
|
+
if (call.isNative())
|
|
734
|
+
flags.push('native');
|
|
735
|
+
if (call.isPromiseAll())
|
|
736
|
+
flags.push('PromiseAll');
|
|
737
|
+
if (call.isToplevel())
|
|
738
|
+
flags.push('top');
|
|
739
|
+
this.flags = flags;
|
|
740
|
+
const type = this.type ? this.type + '.' : '';
|
|
741
|
+
const func = this.function || '<anon>';
|
|
742
|
+
const method = this.method ? ' [' + this.method + '] ' : '';
|
|
743
|
+
this[Symbol.toStringTag] = `${type}${func}${method}`;
|
|
744
|
+
}
|
|
745
|
+
[Symbol.toPrimitive]() {
|
|
746
|
+
return this.toString();
|
|
747
|
+
}
|
|
748
|
+
toString() {
|
|
749
|
+
const object = this.object || '';
|
|
750
|
+
const label = this[Symbol.toStringTag];
|
|
751
|
+
const source = `${this.source}:${this.pos.join(':')} #${this.offset}`;
|
|
752
|
+
return `\tat ${object}${label} (${source})`;
|
|
753
|
+
}
|
|
754
|
+
[$.$mol_dev_format_head]() {
|
|
755
|
+
return $.$mol_dev_format_div({}, $mol_dev_format_native(this), $.$mol_dev_format_shade(' '), ...this.object ? [
|
|
756
|
+
$mol_dev_format_native(this.object),
|
|
757
|
+
] : [], ...this.method ? [$.$mol_dev_format_shade(' ', ' [', this.method, ']')] : [], $.$mol_dev_format_shade(' ', this.flags.join(', ')));
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
Error.prepareStackTrace ??= (error, stack) => new Stack(...stack.map(call => new Call(call)));
|
|
644
761
|
})($ || ($ = {}));
|
|
645
762
|
|
|
646
763
|
;
|
|
@@ -1090,7 +1207,7 @@ var $;
|
|
|
1090
1207
|
if (left instanceof RegExp)
|
|
1091
1208
|
return left.source === right.source && left.flags === right.flags;
|
|
1092
1209
|
if (left instanceof Error)
|
|
1093
|
-
return left.message === right.message && left.stack
|
|
1210
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
|
1094
1211
|
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
1095
1212
|
if (left_cache) {
|
|
1096
1213
|
const right_cache = left_cache.get(right);
|
package/node.test.js
CHANGED
|
@@ -81,6 +81,21 @@ var $;
|
|
|
81
81
|
$.$mol_fail_catch = $mol_fail_catch;
|
|
82
82
|
})($ || ($ = {}));
|
|
83
83
|
|
|
84
|
+
;
|
|
85
|
+
"use strict";
|
|
86
|
+
var $;
|
|
87
|
+
(function ($) {
|
|
88
|
+
function $mol_try(handler) {
|
|
89
|
+
try {
|
|
90
|
+
return handler();
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
return error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
$.$mol_try = $mol_try;
|
|
97
|
+
})($ || ($ = {}));
|
|
98
|
+
|
|
84
99
|
;
|
|
85
100
|
"use strict";
|
|
86
101
|
var $;
|
|
@@ -90,7 +105,7 @@ var $;
|
|
|
90
105
|
return false;
|
|
91
106
|
if (!$mol_fail_catch(error))
|
|
92
107
|
return false;
|
|
93
|
-
|
|
108
|
+
$mol_try(() => { $mol_fail_hidden(error); });
|
|
94
109
|
return true;
|
|
95
110
|
}
|
|
96
111
|
$.$mol_fail_log = $mol_fail_log;
|
|
@@ -207,7 +222,7 @@ var $;
|
|
|
207
222
|
get: () => stack_get() + '\n' + [
|
|
208
223
|
this.cause ?? 'no cause',
|
|
209
224
|
...this.errors.flatMap(e => [
|
|
210
|
-
e.stack,
|
|
225
|
+
String(e.stack),
|
|
211
226
|
...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
|
|
212
227
|
])
|
|
213
228
|
].map(frame_normalize).join('\n')
|
|
@@ -543,6 +558,17 @@ var $;
|
|
|
543
558
|
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
544
559
|
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
545
560
|
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
561
|
+
function $mol_dev_format_button(label, click) {
|
|
562
|
+
return $mol_dev_format_auto({
|
|
563
|
+
[$.$mol_dev_format_head]() {
|
|
564
|
+
return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
|
|
565
|
+
},
|
|
566
|
+
[$.$mol_dev_format_body]() {
|
|
567
|
+
Promise.resolve().then(click);
|
|
568
|
+
return $mol_dev_format_span({});
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
546
572
|
$mol_dev_format_register({
|
|
547
573
|
header: (val, config = false) => {
|
|
548
574
|
if (config)
|
|
@@ -560,13 +586,41 @@ var $;
|
|
|
560
586
|
if (typeof val === 'function') {
|
|
561
587
|
return $mol_dev_format_native(val);
|
|
562
588
|
}
|
|
589
|
+
if (Error.isError(val)) {
|
|
590
|
+
return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
|
|
591
|
+
}
|
|
592
|
+
if (val instanceof Promise) {
|
|
593
|
+
return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
|
|
594
|
+
}
|
|
563
595
|
if (Symbol.toStringTag in val) {
|
|
564
596
|
return $mol_dev_format_native(val);
|
|
565
597
|
}
|
|
566
598
|
return null;
|
|
567
599
|
},
|
|
568
|
-
hasBody: val =>
|
|
569
|
-
|
|
600
|
+
hasBody: (val, config = false) => {
|
|
601
|
+
if (config)
|
|
602
|
+
return false;
|
|
603
|
+
if (!val)
|
|
604
|
+
return false;
|
|
605
|
+
if (val[$.$mol_dev_format_body])
|
|
606
|
+
return true;
|
|
607
|
+
return false;
|
|
608
|
+
},
|
|
609
|
+
body: (val, config = false) => {
|
|
610
|
+
if (config)
|
|
611
|
+
return null;
|
|
612
|
+
if (!val)
|
|
613
|
+
return null;
|
|
614
|
+
if ($.$mol_dev_format_body in val) {
|
|
615
|
+
try {
|
|
616
|
+
return val[$.$mol_dev_format_body]();
|
|
617
|
+
}
|
|
618
|
+
catch (error) {
|
|
619
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return null;
|
|
623
|
+
},
|
|
570
624
|
});
|
|
571
625
|
function $mol_dev_format_native(obj) {
|
|
572
626
|
if (typeof obj === 'undefined')
|
|
@@ -632,6 +686,69 @@ var $;
|
|
|
632
686
|
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
633
687
|
'margin-left': '13px'
|
|
634
688
|
});
|
|
689
|
+
class Stack extends Array {
|
|
690
|
+
toString() {
|
|
691
|
+
return this.join('\n');
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
class Call extends Object {
|
|
695
|
+
type;
|
|
696
|
+
function;
|
|
697
|
+
method;
|
|
698
|
+
eval;
|
|
699
|
+
source;
|
|
700
|
+
offset;
|
|
701
|
+
pos;
|
|
702
|
+
object;
|
|
703
|
+
flags;
|
|
704
|
+
[Symbol.toStringTag];
|
|
705
|
+
constructor(call) {
|
|
706
|
+
super();
|
|
707
|
+
this.type = call.getTypeName() ?? '';
|
|
708
|
+
this.function = call.getFunctionName() ?? '';
|
|
709
|
+
this.method = call.getMethodName() ?? '';
|
|
710
|
+
if (this.method === this.function)
|
|
711
|
+
this.method = '';
|
|
712
|
+
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
|
713
|
+
this.eval = call.getEvalOrigin() ?? '';
|
|
714
|
+
this.source = call.getScriptNameOrSourceURL() ?? '';
|
|
715
|
+
this.object = call.getThis();
|
|
716
|
+
this.offset = call.getPosition();
|
|
717
|
+
const flags = [];
|
|
718
|
+
if (call.isAsync())
|
|
719
|
+
flags.push('async');
|
|
720
|
+
if (call.isConstructor())
|
|
721
|
+
flags.push('constructor');
|
|
722
|
+
if (call.isEval())
|
|
723
|
+
flags.push('eval');
|
|
724
|
+
if (call.isNative())
|
|
725
|
+
flags.push('native');
|
|
726
|
+
if (call.isPromiseAll())
|
|
727
|
+
flags.push('PromiseAll');
|
|
728
|
+
if (call.isToplevel())
|
|
729
|
+
flags.push('top');
|
|
730
|
+
this.flags = flags;
|
|
731
|
+
const type = this.type ? this.type + '.' : '';
|
|
732
|
+
const func = this.function || '<anon>';
|
|
733
|
+
const method = this.method ? ' [' + this.method + '] ' : '';
|
|
734
|
+
this[Symbol.toStringTag] = `${type}${func}${method}`;
|
|
735
|
+
}
|
|
736
|
+
[Symbol.toPrimitive]() {
|
|
737
|
+
return this.toString();
|
|
738
|
+
}
|
|
739
|
+
toString() {
|
|
740
|
+
const object = this.object || '';
|
|
741
|
+
const label = this[Symbol.toStringTag];
|
|
742
|
+
const source = `${this.source}:${this.pos.join(':')} #${this.offset}`;
|
|
743
|
+
return `\tat ${object}${label} (${source})`;
|
|
744
|
+
}
|
|
745
|
+
[$.$mol_dev_format_head]() {
|
|
746
|
+
return $.$mol_dev_format_div({}, $mol_dev_format_native(this), $.$mol_dev_format_shade(' '), ...this.object ? [
|
|
747
|
+
$mol_dev_format_native(this.object),
|
|
748
|
+
] : [], ...this.method ? [$.$mol_dev_format_shade(' ', ' [', this.method, ']')] : [], $.$mol_dev_format_shade(' ', this.flags.join(', ')));
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
Error.prepareStackTrace ??= (error, stack) => new Stack(...stack.map(call => new Call(call)));
|
|
635
752
|
})($ || ($ = {}));
|
|
636
753
|
|
|
637
754
|
;
|
|
@@ -1081,7 +1198,7 @@ var $;
|
|
|
1081
1198
|
if (left instanceof RegExp)
|
|
1082
1199
|
return left.source === right.source && left.flags === right.flags;
|
|
1083
1200
|
if (left instanceof Error)
|
|
1084
|
-
return left.message === right.message && left.stack
|
|
1201
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
|
1085
1202
|
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
1086
1203
|
if (left_cache) {
|
|
1087
1204
|
const right_cache = left_cache.get(right);
|
|
@@ -2338,13 +2455,6 @@ var $;
|
|
|
2338
2455
|
$.$mol_test_complete = $mol_test_complete;
|
|
2339
2456
|
})($ || ($ = {}));
|
|
2340
2457
|
|
|
2341
|
-
;
|
|
2342
|
-
"use strict";
|
|
2343
|
-
var $;
|
|
2344
|
-
(function ($_1) {
|
|
2345
|
-
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
2346
|
-
})($ || ($ = {}));
|
|
2347
|
-
|
|
2348
2458
|
;
|
|
2349
2459
|
"use strict";
|
|
2350
2460
|
var $;
|
|
@@ -2370,7 +2480,7 @@ var $;
|
|
|
2370
2480
|
catch (error) {
|
|
2371
2481
|
$.$mol_fail = fail;
|
|
2372
2482
|
if (typeof ErrorRight === 'string') {
|
|
2373
|
-
$mol_assert_equal(error.message, ErrorRight);
|
|
2483
|
+
$mol_assert_equal(error.message ?? error, ErrorRight);
|
|
2374
2484
|
}
|
|
2375
2485
|
else {
|
|
2376
2486
|
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
@@ -2394,7 +2504,7 @@ var $;
|
|
|
2394
2504
|
continue;
|
|
2395
2505
|
if (!$mol_compare_deep(args[i], args[j]))
|
|
2396
2506
|
continue;
|
|
2397
|
-
$mol_fail(new Error(`
|
|
2507
|
+
return $mol_fail(new Error(`Uniquesess assertion failure`, { cause: { [i]: args[i], [i]: args[i] } }));
|
|
2398
2508
|
}
|
|
2399
2509
|
}
|
|
2400
2510
|
}
|
|
@@ -2405,29 +2515,10 @@ var $;
|
|
|
2405
2515
|
continue;
|
|
2406
2516
|
if (args[0] instanceof $mol_dom_context.Element && args[i] instanceof $mol_dom_context.Element && args[0].outerHTML === args[i].outerHTML)
|
|
2407
2517
|
continue;
|
|
2408
|
-
return $mol_fail(new Error(`args[0]
|
|
2518
|
+
return $mol_fail(new Error(`Equality assertion failure`, { cause: { 0: args[0], [i]: args[i] } }));
|
|
2409
2519
|
}
|
|
2410
2520
|
}
|
|
2411
2521
|
$.$mol_assert_equal = $mol_assert_equal;
|
|
2412
|
-
const print = (val) => {
|
|
2413
|
-
if (!val)
|
|
2414
|
-
return val;
|
|
2415
|
-
if (typeof val === 'bigint')
|
|
2416
|
-
return String(val) + 'n';
|
|
2417
|
-
if (typeof val === 'symbol')
|
|
2418
|
-
return `Symbol(${val.description})`;
|
|
2419
|
-
if (typeof val !== 'object')
|
|
2420
|
-
return val;
|
|
2421
|
-
if ('outerHTML' in val)
|
|
2422
|
-
return val.outerHTML;
|
|
2423
|
-
try {
|
|
2424
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
2425
|
-
}
|
|
2426
|
-
catch (error) {
|
|
2427
|
-
console.error(error);
|
|
2428
|
-
return val;
|
|
2429
|
-
}
|
|
2430
|
-
};
|
|
2431
2522
|
})($ || ($ = {}));
|
|
2432
2523
|
|
|
2433
2524
|
;
|
|
@@ -2468,6 +2559,24 @@ var $;
|
|
|
2468
2559
|
});
|
|
2469
2560
|
})($ || ($ = {}));
|
|
2470
2561
|
|
|
2562
|
+
;
|
|
2563
|
+
"use strict";
|
|
2564
|
+
var $;
|
|
2565
|
+
(function ($) {
|
|
2566
|
+
$mol_test({
|
|
2567
|
+
'return result without errors'() {
|
|
2568
|
+
$mol_assert_equal($mol_try(() => false), false);
|
|
2569
|
+
},
|
|
2570
|
+
});
|
|
2571
|
+
})($ || ($ = {}));
|
|
2572
|
+
|
|
2573
|
+
;
|
|
2574
|
+
"use strict";
|
|
2575
|
+
var $;
|
|
2576
|
+
(function ($_1) {
|
|
2577
|
+
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
2578
|
+
})($ || ($ = {}));
|
|
2579
|
+
|
|
2471
2580
|
;
|
|
2472
2581
|
"use strict";
|
|
2473
2582
|
var $;
|