mol_dump_lib 0.0.180 → 0.0.182
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.audit.js +1 -1
- package/node.d.ts +3 -54
- package/node.deps.json +1 -1
- package/node.js +15 -285
- package/node.js.map +1 -1
- package/node.meta.tree +0 -58
- package/node.mjs +15 -285
- package/node.test.js +53 -347
- package/node.test.js.map +1 -1
- package/package.json +2 -10
- package/web.audit.js +1 -1
- package/web.d.ts +3 -13
- package/web.deps.json +1 -1
- package/web.js +11 -108
- package/web.js.map +1 -1
- package/web.meta.tree +0 -58
- package/web.mjs +11 -108
- package/web.test.js +33 -57
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1129,7 +1129,7 @@ var $;
|
|
|
1129
1129
|
};
|
|
1130
1130
|
}
|
|
1131
1131
|
error(message, Class = Error) {
|
|
1132
|
-
return new Class(`${message}${this}`);
|
|
1132
|
+
return new Class(`${message} (${this})`);
|
|
1133
1133
|
}
|
|
1134
1134
|
span(row, col, length) {
|
|
1135
1135
|
return new $mol_span(this.uri, this.source, row, col, length);
|
|
@@ -1144,11 +1144,11 @@ var $;
|
|
|
1144
1144
|
if (end < 0)
|
|
1145
1145
|
end += len;
|
|
1146
1146
|
if (begin < 0 || begin > len)
|
|
1147
|
-
this.$.$mol_fail(`Begin value '${begin}' out of range
|
|
1147
|
+
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
1148
1148
|
if (end < 0 || end > len)
|
|
1149
|
-
this.$.$mol_fail(`End value '${end}' out of range
|
|
1149
|
+
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
1150
1150
|
if (end < begin)
|
|
1151
|
-
this.$.$mol_fail(`End value '${end}' can't be less than begin value
|
|
1151
|
+
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
1152
1152
|
return this.span(this.row, this.col + begin, end - begin);
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
@@ -2195,7 +2195,9 @@ var $;
|
|
|
2195
2195
|
var $;
|
|
2196
2196
|
(function ($) {
|
|
2197
2197
|
function $mol_wire_solid() {
|
|
2198
|
-
|
|
2198
|
+
let current = $mol_wire_auto();
|
|
2199
|
+
if (current.temp)
|
|
2200
|
+
current = current.host;
|
|
2199
2201
|
if (current.reap !== nothing) {
|
|
2200
2202
|
current?.sub_on(sub, sub.data.length);
|
|
2201
2203
|
}
|
|
@@ -3735,6 +3737,13 @@ var $;
|
|
|
3735
3737
|
rules.push(`${key} ${query} {\n`);
|
|
3736
3738
|
}
|
|
3737
3739
|
}
|
|
3740
|
+
else if (key[0] === '[' && key[key.length - 1] === ']') {
|
|
3741
|
+
const attr = key.slice(1, -1);
|
|
3742
|
+
const vals = config[key];
|
|
3743
|
+
for (let val in vals) {
|
|
3744
|
+
make_class(selector(prefix, path) + ':where([' + attr + '=' + JSON.stringify(val) + '])', [], vals[val]);
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3738
3747
|
else {
|
|
3739
3748
|
make_class(selector(prefix, path) + key, [], config[key]);
|
|
3740
3749
|
}
|
|
@@ -5162,7 +5171,7 @@ var $;
|
|
|
5162
5171
|
native.persist().then(actual => {
|
|
5163
5172
|
setTimeout(() => this.persisted(actual, 'cache'), 5000);
|
|
5164
5173
|
if (actual)
|
|
5165
|
-
this.$.$
|
|
5174
|
+
this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
|
|
5166
5175
|
else
|
|
5167
5176
|
this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
|
|
5168
5177
|
});
|
|
@@ -5601,279 +5610,6 @@ var $;
|
|
|
5601
5610
|
//mol/file/file.node.ts
|
|
5602
5611
|
;
|
|
5603
5612
|
"use strict";
|
|
5604
|
-
//hyoo/hyoo.ts
|
|
5605
|
-
;
|
|
5606
|
-
"use strict";
|
|
5607
|
-
var $;
|
|
5608
|
-
(function ($) {
|
|
5609
|
-
$.$mol_action = $mol_wire_method;
|
|
5610
|
-
})($ || ($ = {}));
|
|
5611
|
-
//mol/action/action.ts
|
|
5612
|
-
;
|
|
5613
|
-
"use strict";
|
|
5614
|
-
var $;
|
|
5615
|
-
(function ($) {
|
|
5616
|
-
function $mol_dom_parse(text, type = 'application/xhtml+xml') {
|
|
5617
|
-
const parser = new $mol_dom_context.DOMParser();
|
|
5618
|
-
const doc = parser.parseFromString(text, type);
|
|
5619
|
-
const error = doc.getElementsByTagName('parsererror');
|
|
5620
|
-
if (error.length)
|
|
5621
|
-
throw new Error(error[0].textContent);
|
|
5622
|
-
return doc;
|
|
5623
|
-
}
|
|
5624
|
-
$.$mol_dom_parse = $mol_dom_parse;
|
|
5625
|
-
})($ || ($ = {}));
|
|
5626
|
-
//mol/dom/parse/parse.ts
|
|
5627
|
-
;
|
|
5628
|
-
"use strict";
|
|
5629
|
-
var $;
|
|
5630
|
-
(function ($) {
|
|
5631
|
-
class $mol_fetch_response extends $mol_object2 {
|
|
5632
|
-
native;
|
|
5633
|
-
constructor(native) {
|
|
5634
|
-
super();
|
|
5635
|
-
this.native = native;
|
|
5636
|
-
}
|
|
5637
|
-
status() {
|
|
5638
|
-
const types = ['unknown', 'inform', 'success', 'redirect', 'wrong', 'failed'];
|
|
5639
|
-
return types[Math.floor(this.native.status / 100)];
|
|
5640
|
-
}
|
|
5641
|
-
code() {
|
|
5642
|
-
return this.native.status;
|
|
5643
|
-
}
|
|
5644
|
-
message() {
|
|
5645
|
-
return this.native.statusText || `HTTP Error ${this.code()}`;
|
|
5646
|
-
}
|
|
5647
|
-
headers() {
|
|
5648
|
-
return this.native.headers;
|
|
5649
|
-
}
|
|
5650
|
-
mime() {
|
|
5651
|
-
return this.headers().get('content-type');
|
|
5652
|
-
}
|
|
5653
|
-
stream() {
|
|
5654
|
-
return this.native.body;
|
|
5655
|
-
}
|
|
5656
|
-
text() {
|
|
5657
|
-
const buffer = this.buffer();
|
|
5658
|
-
const native = this.native;
|
|
5659
|
-
const mime = native.headers.get('content-type') || '';
|
|
5660
|
-
const [, charset] = /charset=(.*)/.exec(mime) || [, 'utf-8'];
|
|
5661
|
-
const decoder = new TextDecoder(charset);
|
|
5662
|
-
return decoder.decode(buffer);
|
|
5663
|
-
}
|
|
5664
|
-
json() {
|
|
5665
|
-
return $mol_wire_sync(this.native).json();
|
|
5666
|
-
}
|
|
5667
|
-
buffer() {
|
|
5668
|
-
return $mol_wire_sync(this.native).arrayBuffer();
|
|
5669
|
-
}
|
|
5670
|
-
xml() {
|
|
5671
|
-
return $mol_dom_parse(this.text(), 'application/xml');
|
|
5672
|
-
}
|
|
5673
|
-
xhtml() {
|
|
5674
|
-
return $mol_dom_parse(this.text(), 'application/xhtml+xml');
|
|
5675
|
-
}
|
|
5676
|
-
html() {
|
|
5677
|
-
return $mol_dom_parse(this.text(), 'text/html');
|
|
5678
|
-
}
|
|
5679
|
-
}
|
|
5680
|
-
__decorate([
|
|
5681
|
-
$mol_action
|
|
5682
|
-
], $mol_fetch_response.prototype, "stream", null);
|
|
5683
|
-
__decorate([
|
|
5684
|
-
$mol_action
|
|
5685
|
-
], $mol_fetch_response.prototype, "text", null);
|
|
5686
|
-
__decorate([
|
|
5687
|
-
$mol_action
|
|
5688
|
-
], $mol_fetch_response.prototype, "buffer", null);
|
|
5689
|
-
__decorate([
|
|
5690
|
-
$mol_action
|
|
5691
|
-
], $mol_fetch_response.prototype, "xml", null);
|
|
5692
|
-
__decorate([
|
|
5693
|
-
$mol_action
|
|
5694
|
-
], $mol_fetch_response.prototype, "xhtml", null);
|
|
5695
|
-
__decorate([
|
|
5696
|
-
$mol_action
|
|
5697
|
-
], $mol_fetch_response.prototype, "html", null);
|
|
5698
|
-
$.$mol_fetch_response = $mol_fetch_response;
|
|
5699
|
-
class $mol_fetch extends $mol_object2 {
|
|
5700
|
-
static request(input, init = {}) {
|
|
5701
|
-
const native = globalThis.fetch ?? $node['undici'].fetch;
|
|
5702
|
-
const controller = new AbortController();
|
|
5703
|
-
let done = false;
|
|
5704
|
-
const promise = native(input, {
|
|
5705
|
-
...init,
|
|
5706
|
-
signal: controller.signal,
|
|
5707
|
-
}).finally(() => {
|
|
5708
|
-
done = true;
|
|
5709
|
-
});
|
|
5710
|
-
return Object.assign(promise, {
|
|
5711
|
-
destructor: () => {
|
|
5712
|
-
if (!done && !controller.signal.aborted)
|
|
5713
|
-
controller.abort();
|
|
5714
|
-
},
|
|
5715
|
-
});
|
|
5716
|
-
}
|
|
5717
|
-
static response(input, init) {
|
|
5718
|
-
return new $mol_fetch_response($mol_wire_sync(this).request(input, init));
|
|
5719
|
-
}
|
|
5720
|
-
static success(input, init) {
|
|
5721
|
-
const response = this.response(input, init);
|
|
5722
|
-
if (response.status() === 'success')
|
|
5723
|
-
return response;
|
|
5724
|
-
throw new Error(response.message());
|
|
5725
|
-
}
|
|
5726
|
-
static stream(input, init) {
|
|
5727
|
-
return this.success(input, init).stream();
|
|
5728
|
-
}
|
|
5729
|
-
static text(input, init) {
|
|
5730
|
-
return this.success(input, init).text();
|
|
5731
|
-
}
|
|
5732
|
-
static json(input, init) {
|
|
5733
|
-
return this.success(input, init).json();
|
|
5734
|
-
}
|
|
5735
|
-
static buffer(input, init) {
|
|
5736
|
-
return this.success(input, init).buffer();
|
|
5737
|
-
}
|
|
5738
|
-
static xml(input, init) {
|
|
5739
|
-
return this.success(input, init).xml();
|
|
5740
|
-
}
|
|
5741
|
-
static xhtml(input, init) {
|
|
5742
|
-
return this.success(input, init).xhtml();
|
|
5743
|
-
}
|
|
5744
|
-
static html(input, init) {
|
|
5745
|
-
return this.success(input, init).html();
|
|
5746
|
-
}
|
|
5747
|
-
}
|
|
5748
|
-
__decorate([
|
|
5749
|
-
$mol_action
|
|
5750
|
-
], $mol_fetch, "response", null);
|
|
5751
|
-
__decorate([
|
|
5752
|
-
$mol_action
|
|
5753
|
-
], $mol_fetch, "success", null);
|
|
5754
|
-
__decorate([
|
|
5755
|
-
$mol_action
|
|
5756
|
-
], $mol_fetch, "stream", null);
|
|
5757
|
-
__decorate([
|
|
5758
|
-
$mol_action
|
|
5759
|
-
], $mol_fetch, "text", null);
|
|
5760
|
-
__decorate([
|
|
5761
|
-
$mol_action
|
|
5762
|
-
], $mol_fetch, "json", null);
|
|
5763
|
-
__decorate([
|
|
5764
|
-
$mol_action
|
|
5765
|
-
], $mol_fetch, "buffer", null);
|
|
5766
|
-
__decorate([
|
|
5767
|
-
$mol_action
|
|
5768
|
-
], $mol_fetch, "xml", null);
|
|
5769
|
-
__decorate([
|
|
5770
|
-
$mol_action
|
|
5771
|
-
], $mol_fetch, "xhtml", null);
|
|
5772
|
-
__decorate([
|
|
5773
|
-
$mol_action
|
|
5774
|
-
], $mol_fetch, "html", null);
|
|
5775
|
-
$.$mol_fetch = $mol_fetch;
|
|
5776
|
-
})($ || ($ = {}));
|
|
5777
|
-
//mol/fetch/fetch.ts
|
|
5778
|
-
;
|
|
5779
|
-
"use strict";
|
|
5780
|
-
var $;
|
|
5781
|
-
(function ($) {
|
|
5782
|
-
function $mol_huggingface_run(space, method, ...data) {
|
|
5783
|
-
while (true) {
|
|
5784
|
-
try {
|
|
5785
|
-
if (typeof method === 'number') {
|
|
5786
|
-
return $mol_wire_sync(this).$mol_huggingface_ws(space, method, ...data);
|
|
5787
|
-
}
|
|
5788
|
-
else {
|
|
5789
|
-
return this.$mol_huggingface_rest(space, method, ...data);
|
|
5790
|
-
}
|
|
5791
|
-
}
|
|
5792
|
-
catch (error) {
|
|
5793
|
-
if ($mol_promise_like(error))
|
|
5794
|
-
$mol_fail_hidden(error);
|
|
5795
|
-
if (error instanceof Error && error.message === `Queue full`) {
|
|
5796
|
-
$mol_fail_log(error);
|
|
5797
|
-
continue;
|
|
5798
|
-
}
|
|
5799
|
-
$mol_fail_hidden(error);
|
|
5800
|
-
}
|
|
5801
|
-
}
|
|
5802
|
-
}
|
|
5803
|
-
$.$mol_huggingface_run = $mol_huggingface_run;
|
|
5804
|
-
function $mol_huggingface_rest(space, method, ...data) {
|
|
5805
|
-
const uri = `https://${space}.hf.space/run/${method}`;
|
|
5806
|
-
const response = $mol_fetch.json(uri, {
|
|
5807
|
-
method: 'post',
|
|
5808
|
-
headers: { "Content-Type": "application/json" },
|
|
5809
|
-
body: JSON.stringify({ data }),
|
|
5810
|
-
});
|
|
5811
|
-
if ('error' in response) {
|
|
5812
|
-
$mol_fail(new Error(response.error ?? 'Unknown API error'));
|
|
5813
|
-
}
|
|
5814
|
-
return response.data;
|
|
5815
|
-
}
|
|
5816
|
-
$.$mol_huggingface_rest = $mol_huggingface_rest;
|
|
5817
|
-
function $mol_huggingface_ws(space, fn_index, ...data) {
|
|
5818
|
-
const session_hash = $mol_guid();
|
|
5819
|
-
const socket = new WebSocket(`wss://${space}.hf.space/queue/join`);
|
|
5820
|
-
const promise = new Promise((done, fail) => {
|
|
5821
|
-
socket.onclose = event => {
|
|
5822
|
-
if (event.reason)
|
|
5823
|
-
fail(new Error(event.reason));
|
|
5824
|
-
};
|
|
5825
|
-
socket.onerror = event => {
|
|
5826
|
-
fail(new Error(`Socket error`));
|
|
5827
|
-
};
|
|
5828
|
-
socket.onmessage = event => {
|
|
5829
|
-
const message = JSON.parse(event.data);
|
|
5830
|
-
switch (message.msg) {
|
|
5831
|
-
case 'send_hash':
|
|
5832
|
-
return socket.send(JSON.stringify({ session_hash, fn_index }));
|
|
5833
|
-
case 'estimation': return;
|
|
5834
|
-
case 'queue_full':
|
|
5835
|
-
fail(new Error(`Queue full`));
|
|
5836
|
-
case 'send_data':
|
|
5837
|
-
return socket.send(JSON.stringify({ session_hash, fn_index, data }));
|
|
5838
|
-
case 'process_starts': return;
|
|
5839
|
-
case 'process_completed':
|
|
5840
|
-
if (message.success) {
|
|
5841
|
-
return done(message.output.data);
|
|
5842
|
-
}
|
|
5843
|
-
else {
|
|
5844
|
-
return fail(new Error(message.output.error ?? `Unknown API error`));
|
|
5845
|
-
}
|
|
5846
|
-
default:
|
|
5847
|
-
return fail(new Error(`Unknown message type: ${message.msg}`));
|
|
5848
|
-
}
|
|
5849
|
-
};
|
|
5850
|
-
});
|
|
5851
|
-
return Object.assign(promise, {
|
|
5852
|
-
destructor: () => socket.close()
|
|
5853
|
-
});
|
|
5854
|
-
}
|
|
5855
|
-
$.$mol_huggingface_ws = $mol_huggingface_ws;
|
|
5856
|
-
})($ || ($ = {}));
|
|
5857
|
-
//mol/huggingface/huggingface.ts
|
|
5858
|
-
;
|
|
5859
|
-
"use strict";
|
|
5860
|
-
var $;
|
|
5861
|
-
(function ($) {
|
|
5862
|
-
function $hyoo_lingua_translate(lang, text) {
|
|
5863
|
-
if (!text.trim())
|
|
5864
|
-
return '';
|
|
5865
|
-
const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
|
|
5866
|
-
const cached = this.$mol_state_local.value(cache_key);
|
|
5867
|
-
if (cached)
|
|
5868
|
-
return String(cached);
|
|
5869
|
-
const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
|
|
5870
|
-
return this.$mol_state_local.value(cache_key, translated);
|
|
5871
|
-
}
|
|
5872
|
-
$.$hyoo_lingua_translate = $hyoo_lingua_translate;
|
|
5873
|
-
})($ || ($ = {}));
|
|
5874
|
-
//hyoo/lingua/translate/translate.ts
|
|
5875
|
-
;
|
|
5876
|
-
"use strict";
|
|
5877
5613
|
var $;
|
|
5878
5614
|
(function ($) {
|
|
5879
5615
|
class $mol_locale extends $mol_object {
|
|
@@ -5910,12 +5646,6 @@ var $;
|
|
|
5910
5646
|
const en = this.texts('en')[key];
|
|
5911
5647
|
if (!en)
|
|
5912
5648
|
return key;
|
|
5913
|
-
try {
|
|
5914
|
-
return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
|
|
5915
|
-
}
|
|
5916
|
-
catch (error) {
|
|
5917
|
-
$mol_fail_log(error);
|
|
5918
|
-
}
|
|
5919
5649
|
return en;
|
|
5920
5650
|
}
|
|
5921
5651
|
static warn(key) {
|
|
@@ -7575,17 +7305,6 @@ var $;
|
|
|
7575
7305
|
;
|
|
7576
7306
|
"use strict";
|
|
7577
7307
|
var $;
|
|
7578
|
-
(function ($) {
|
|
7579
|
-
function $mol_dom_serialize(node) {
|
|
7580
|
-
const serializer = new $mol_dom_context.XMLSerializer;
|
|
7581
|
-
return serializer.serializeToString(node);
|
|
7582
|
-
}
|
|
7583
|
-
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
7584
|
-
})($ || ($ = {}));
|
|
7585
|
-
//mol/dom/serialize/serialize.ts
|
|
7586
|
-
;
|
|
7587
|
-
"use strict";
|
|
7588
|
-
var $;
|
|
7589
7308
|
(function ($) {
|
|
7590
7309
|
function $mol_assert_ok(value) {
|
|
7591
7310
|
if (value)
|
|
@@ -7606,14 +7325,12 @@ var $;
|
|
|
7606
7325
|
handler();
|
|
7607
7326
|
}
|
|
7608
7327
|
catch (error) {
|
|
7609
|
-
if (!ErrorRight)
|
|
7610
|
-
return error;
|
|
7611
7328
|
$.$mol_fail = fail;
|
|
7612
7329
|
if (typeof ErrorRight === 'string') {
|
|
7613
7330
|
$mol_assert_equal(error.message, ErrorRight);
|
|
7614
7331
|
}
|
|
7615
7332
|
else {
|
|
7616
|
-
$
|
|
7333
|
+
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
7617
7334
|
}
|
|
7618
7335
|
return error;
|
|
7619
7336
|
}
|
|
@@ -7623,58 +7340,47 @@ var $;
|
|
|
7623
7340
|
$mol_fail(new Error('Not failed'));
|
|
7624
7341
|
}
|
|
7625
7342
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
7626
|
-
function $
|
|
7627
|
-
|
|
7628
|
-
for (let j = 0; j < args.length; ++j) {
|
|
7629
|
-
if (i === j)
|
|
7630
|
-
continue;
|
|
7631
|
-
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
7632
|
-
continue;
|
|
7633
|
-
if (args[i] !== args[j])
|
|
7634
|
-
$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
7635
|
-
}
|
|
7636
|
-
}
|
|
7343
|
+
function $mol_assert_like(...args) {
|
|
7344
|
+
$mol_assert_equal(...args);
|
|
7637
7345
|
}
|
|
7638
|
-
$.$
|
|
7346
|
+
$.$mol_assert_like = $mol_assert_like;
|
|
7639
7347
|
function $mol_assert_unique(...args) {
|
|
7640
7348
|
for (let i = 0; i < args.length; ++i) {
|
|
7641
7349
|
for (let j = 0; j < args.length; ++j) {
|
|
7642
7350
|
if (i === j)
|
|
7643
7351
|
continue;
|
|
7644
|
-
if (
|
|
7645
|
-
|
|
7646
|
-
}
|
|
7352
|
+
if (!$mol_compare_deep(args[i], args[j]))
|
|
7353
|
+
continue;
|
|
7354
|
+
$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
7647
7355
|
}
|
|
7648
7356
|
}
|
|
7649
7357
|
}
|
|
7650
7358
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
7651
|
-
function $
|
|
7652
|
-
for (let
|
|
7653
|
-
if (
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
return val;
|
|
7659
|
-
if ('outerHTML' in val)
|
|
7660
|
-
return val.outerHTML;
|
|
7661
|
-
try {
|
|
7662
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
7663
|
-
}
|
|
7664
|
-
catch (error) {
|
|
7665
|
-
console.error(error);
|
|
7666
|
-
return val;
|
|
7667
|
-
}
|
|
7668
|
-
};
|
|
7669
|
-
return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
7670
|
-
}
|
|
7359
|
+
function $mol_assert_equal(...args) {
|
|
7360
|
+
for (let i = 1; i < args.length; ++i) {
|
|
7361
|
+
if ($mol_compare_deep(args[0], args[i]))
|
|
7362
|
+
continue;
|
|
7363
|
+
if (args[0] instanceof $mol_dom_context.Element && args[i] instanceof $mol_dom_context.Element && args[0].outerHTML === args[i].outerHTML)
|
|
7364
|
+
continue;
|
|
7365
|
+
return $mol_fail(new Error(`args[0] ≠ args[${i}]\n${print(args[0])}\n---\n${print(args[i])}`));
|
|
7671
7366
|
}
|
|
7672
7367
|
}
|
|
7673
|
-
$.$
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7368
|
+
$.$mol_assert_equal = $mol_assert_equal;
|
|
7369
|
+
const print = (val) => {
|
|
7370
|
+
if (!val)
|
|
7371
|
+
return val;
|
|
7372
|
+
if (typeof val !== 'object')
|
|
7373
|
+
return val;
|
|
7374
|
+
if ('outerHTML' in val)
|
|
7375
|
+
return val.outerHTML;
|
|
7376
|
+
try {
|
|
7377
|
+
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
7378
|
+
}
|
|
7379
|
+
catch (error) {
|
|
7380
|
+
console.error(error);
|
|
7381
|
+
return val;
|
|
7382
|
+
}
|
|
7383
|
+
};
|
|
7678
7384
|
})($ || ($ = {}));
|
|
7679
7385
|
//mol/assert/assert.ts
|
|
7680
7386
|
;
|
|
@@ -7695,10 +7401,10 @@ var $;
|
|
|
7695
7401
|
$mol_assert_equal(2, 2, 2);
|
|
7696
7402
|
},
|
|
7697
7403
|
'two must be unique'() {
|
|
7698
|
-
$mol_assert_unique([
|
|
7404
|
+
$mol_assert_unique([2], [3]);
|
|
7699
7405
|
},
|
|
7700
7406
|
'three must be unique'() {
|
|
7701
|
-
$mol_assert_unique([
|
|
7407
|
+
$mol_assert_unique([1], [2], [3]);
|
|
7702
7408
|
},
|
|
7703
7409
|
'two must be alike'() {
|
|
7704
7410
|
$mol_assert_like([3], [3]);
|
|
@@ -8445,7 +8151,7 @@ var $;
|
|
|
8445
8151
|
], App, "result", null);
|
|
8446
8152
|
$mol_assert_equal(App.result(), 1);
|
|
8447
8153
|
App.condition(true);
|
|
8448
|
-
$mol_assert_fail(() => App.result());
|
|
8154
|
+
$mol_assert_fail(() => App.result(), 'test error');
|
|
8449
8155
|
App.condition(false);
|
|
8450
8156
|
$mol_assert_equal(App.result(), 1);
|
|
8451
8157
|
},
|
|
@@ -9384,14 +9090,14 @@ var $;
|
|
|
9384
9090
|
},
|
|
9385
9091
|
'slice span - out of range'($) {
|
|
9386
9092
|
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
9387
|
-
$mol_assert_fail(() => span.slice(-1, 3));
|
|
9388
|
-
$mol_assert_fail(() => span.slice(1, 6));
|
|
9389
|
-
$mol_assert_fail(() => span.slice(1, 10));
|
|
9093
|
+
$mol_assert_fail(() => span.slice(-1, 3), `End value '3' can't be less than begin value (test.ts#1:3/5)`);
|
|
9094
|
+
$mol_assert_fail(() => span.slice(1, 6), `End value '6' out of range (test.ts#1:3/5)`);
|
|
9095
|
+
$mol_assert_fail(() => span.slice(1, 10), `End value '10' out of range (test.ts#1:3/5)`);
|
|
9390
9096
|
},
|
|
9391
9097
|
'error handling'($) {
|
|
9392
9098
|
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
9393
|
-
const error = span.error('Some error
|
|
9394
|
-
$mol_assert_equal(error.message, 'Some error
|
|
9099
|
+
const error = span.error('Some error');
|
|
9100
|
+
$mol_assert_equal(error.message, 'Some error (test.ts#1:3/4)');
|
|
9395
9101
|
}
|
|
9396
9102
|
});
|
|
9397
9103
|
})($ || ($ = {}));
|