mol_dump_lib 0.0.180 → 0.0.181
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 +0 -53
- package/node.deps.json +1 -1
- package/node.js +4 -283
- package/node.js.map +1 -1
- package/node.meta.tree +0 -58
- package/node.mjs +4 -283
- package/node.test.js +42 -345
- package/node.test.js.map +1 -1
- package/package.json +2 -10
- package/web.audit.js +1 -1
- package/web.d.ts +0 -12
- package/web.deps.json +1 -1
- package/web.js +0 -106
- package/web.js.map +1 -1
- package/web.meta.tree +0 -58
- package/web.mjs +0 -106
- package/web.test.js +33 -57
- package/web.test.js.map +1 -1
package/web.meta.tree
CHANGED
|
@@ -12,64 +12,6 @@
|
|
|
12
12
|
pack icon git \https://github.com/nin-jin/mol_icon.git
|
|
13
13
|
\/mol/view
|
|
14
14
|
include \/mol/view/tree/test
|
|
15
|
-
\/hyoo
|
|
16
|
-
pack about git \https://github.com/hyoo-ru/about.hyoo.ru.git
|
|
17
|
-
pack artist git \https://github.com/hyoo-ru/artist.hyoo.ru.git
|
|
18
|
-
pack apps git \https://github.com/hyoo-ru/apps.hyoo.ru.git
|
|
19
|
-
pack aura git \https://github.com/hyoo-ru/aura.hyoo.ru.git
|
|
20
|
-
pack bench git \https://github.com/hyoo-ru/bench.hyoo.ru.git
|
|
21
|
-
pack board git \https://github.com/hyoo-ru/board.hyoo.ru.git
|
|
22
|
-
pack calc git \https://github.com/hyoo-ru/calc.hyoo.ru.git
|
|
23
|
-
pack case git \https://github.com/hyoo-ru/case.hyoo.ru.git
|
|
24
|
-
pack crowd git \https://github.com/hyoo-ru/crowd.hyoo.ru.git
|
|
25
|
-
pack draw git \https://github.com/hyoo-ru/draw.hyoo.ru.git
|
|
26
|
-
pack game git \https://github.com/hyoo-ru/game.hyoo.ru.git
|
|
27
|
-
pack github git \https://github.com/hyoo-ru/github.hyoo.ru.git
|
|
28
|
-
pack habhub git \https://github.com/hyoo-ru/habhub.hyoo.ru.git
|
|
29
|
-
pack harp git \https://github.com/hyoo-ru/harp.hyoo.ru.git
|
|
30
|
-
pack http git \https://github.com/hyoo-ru/http.hyoo.ru.git
|
|
31
|
-
pack fallacy git \https://github.com/hyoo-ru/fallacy.hyoo.ru.git
|
|
32
|
-
pack invest git \https://github.com/hyoo-ru/invest.hyoo.ru.git
|
|
33
|
-
pack iq git \https://github.com/hyoo-ru/iq.hyoo.ru.git
|
|
34
|
-
pack js git \https://github.com/hyoo-ru/hyoo_js.git
|
|
35
|
-
pack lamps git \https://github.com/hyoo-ru/lamps.hyoo.ru.git
|
|
36
|
-
pack life git \https://github.com/hyoo-ru/life.hyoo.ru.git
|
|
37
|
-
pack lingua git \https://github.com/hyoo-ru/lingua.hyoo.ru.git
|
|
38
|
-
pack lupa git \https://github.com/hyoo-ru/lupa.hyoo.ru.git
|
|
39
|
-
pack mail git \https://github.com/hyoo-ru/mail.hyoo.ru.git
|
|
40
|
-
pack map git \https://github.com/hyoo-ru/map.hyoo.ru.git
|
|
41
|
-
pack marked git \https://github.com/hyoo-ru/marked.hyoo.ru.git
|
|
42
|
-
pack match git \https://github.com/hyoo-ru/match.hyoo.ru.git
|
|
43
|
-
pack meme git \https://github.com/hyoo-ru/meme.hyoo.ru.git
|
|
44
|
-
pack meta git \https://github.com/hyoo-ru/hyoo_meta.git
|
|
45
|
-
pack mill git \https://github.com/hyoo-ru/mill.git
|
|
46
|
-
pack mol git \https://github.com/hyoo-ru/mol.hyoo.ru.git
|
|
47
|
-
pack notes git \https://github.com/hyoo-ru/notes.hyoo.ru.git
|
|
48
|
-
pack offer git \https://github.com/hyoo-ru/offer.hyoo.ru.git
|
|
49
|
-
pack page git \https://github.com/hyoo-ru/page.hyoo.ru.git
|
|
50
|
-
pack play git \https://github.com/hyoo-ru/play.hyoo.ru.git
|
|
51
|
-
pack rdf git \https://github.com/hyoo-ru/rdf.hyoo.ru.git
|
|
52
|
-
pack realworld git \https://github.com/hyoo-ru/realworld.hyoo.ru.git
|
|
53
|
-
pack scout git \https://github.com/hyoo-ru/scout.hyoo.ru.git
|
|
54
|
-
pack search git \https://github.com/hyoo-ru/search.hyoo.ru.git
|
|
55
|
-
pack shelter git \https://github.com/hyoo-ru/shelter.hyoo.ru.git
|
|
56
|
-
pack showcase git \https://github.com/hyoo-ru/showcase.hyoo.ru.git
|
|
57
|
-
pack speculant git \https://github.com/hyoo-ru/speculant.hyoo.ru.git
|
|
58
|
-
pack sketch git \https://github.com/hyoo-ru/sketch.hyoo.ru.git
|
|
59
|
-
pack slides git \https://github.com/hyoo-ru/slides.hyoo.ru.git
|
|
60
|
-
pack studio git \https://github.com/hyoo-ru/studio.hyoo.ru.git
|
|
61
|
-
pack sporno git \https://github.com/hyoo-ru/hyoo_sporno.git
|
|
62
|
-
pack static git \https://github.com/hyoo-ru/hyoo_static.git
|
|
63
|
-
pack talks git \https://github.com/hyoo-ru/talks.hyoo.ru.git
|
|
64
|
-
pack todomvc git \https://github.com/hyoo-ru/todomvc.hyoo.ru.git
|
|
65
|
-
pack toys git \https://github.com/hyoo-ru/toys.hyoo.ru.git
|
|
66
|
-
pack tree git \https://github.com/hyoo-ru/tree.hyoo.ru.git
|
|
67
|
-
pack webdav git \https://github.com/hyoo-ru/webdav.hyoo.ru.git
|
|
68
|
-
pack when git \https://github.com/hyoo-ru/when.hyoo.ru.git
|
|
69
|
-
pack sync git \https://github.com/hyoo-ru/sync.hyoo.ru.git
|
|
70
|
-
pack home git \https://github.com/hyoo-ru/hyoo.ru.git
|
|
71
|
-
pack idea git \https://github.com/hyoo-ru/idea.hyoo.ru.git
|
|
72
|
-
pack intern git \https://github.com/hyoo-ru/intern.hyoo.ru.git
|
|
73
15
|
\/mol/dump/lib
|
|
74
16
|
include \/mol/view/component
|
|
75
17
|
include \/mol/dump/value
|
package/web.mjs
CHANGED
|
@@ -5183,106 +5183,6 @@ var $;
|
|
|
5183
5183
|
//mol/file/file.web.ts
|
|
5184
5184
|
;
|
|
5185
5185
|
"use strict";
|
|
5186
|
-
//hyoo/hyoo.ts
|
|
5187
|
-
;
|
|
5188
|
-
"use strict";
|
|
5189
|
-
var $;
|
|
5190
|
-
(function ($) {
|
|
5191
|
-
function $mol_huggingface_run(space, method, ...data) {
|
|
5192
|
-
while (true) {
|
|
5193
|
-
try {
|
|
5194
|
-
if (typeof method === 'number') {
|
|
5195
|
-
return $mol_wire_sync(this).$mol_huggingface_ws(space, method, ...data);
|
|
5196
|
-
}
|
|
5197
|
-
else {
|
|
5198
|
-
return this.$mol_huggingface_rest(space, method, ...data);
|
|
5199
|
-
}
|
|
5200
|
-
}
|
|
5201
|
-
catch (error) {
|
|
5202
|
-
if ($mol_promise_like(error))
|
|
5203
|
-
$mol_fail_hidden(error);
|
|
5204
|
-
if (error instanceof Error && error.message === `Queue full`) {
|
|
5205
|
-
$mol_fail_log(error);
|
|
5206
|
-
continue;
|
|
5207
|
-
}
|
|
5208
|
-
$mol_fail_hidden(error);
|
|
5209
|
-
}
|
|
5210
|
-
}
|
|
5211
|
-
}
|
|
5212
|
-
$.$mol_huggingface_run = $mol_huggingface_run;
|
|
5213
|
-
function $mol_huggingface_rest(space, method, ...data) {
|
|
5214
|
-
const uri = `https://${space}.hf.space/run/${method}`;
|
|
5215
|
-
const response = $mol_fetch.json(uri, {
|
|
5216
|
-
method: 'post',
|
|
5217
|
-
headers: { "Content-Type": "application/json" },
|
|
5218
|
-
body: JSON.stringify({ data }),
|
|
5219
|
-
});
|
|
5220
|
-
if ('error' in response) {
|
|
5221
|
-
$mol_fail(new Error(response.error ?? 'Unknown API error'));
|
|
5222
|
-
}
|
|
5223
|
-
return response.data;
|
|
5224
|
-
}
|
|
5225
|
-
$.$mol_huggingface_rest = $mol_huggingface_rest;
|
|
5226
|
-
function $mol_huggingface_ws(space, fn_index, ...data) {
|
|
5227
|
-
const session_hash = $mol_guid();
|
|
5228
|
-
const socket = new WebSocket(`wss://${space}.hf.space/queue/join`);
|
|
5229
|
-
const promise = new Promise((done, fail) => {
|
|
5230
|
-
socket.onclose = event => {
|
|
5231
|
-
if (event.reason)
|
|
5232
|
-
fail(new Error(event.reason));
|
|
5233
|
-
};
|
|
5234
|
-
socket.onerror = event => {
|
|
5235
|
-
fail(new Error(`Socket error`));
|
|
5236
|
-
};
|
|
5237
|
-
socket.onmessage = event => {
|
|
5238
|
-
const message = JSON.parse(event.data);
|
|
5239
|
-
switch (message.msg) {
|
|
5240
|
-
case 'send_hash':
|
|
5241
|
-
return socket.send(JSON.stringify({ session_hash, fn_index }));
|
|
5242
|
-
case 'estimation': return;
|
|
5243
|
-
case 'queue_full':
|
|
5244
|
-
fail(new Error(`Queue full`));
|
|
5245
|
-
case 'send_data':
|
|
5246
|
-
return socket.send(JSON.stringify({ session_hash, fn_index, data }));
|
|
5247
|
-
case 'process_starts': return;
|
|
5248
|
-
case 'process_completed':
|
|
5249
|
-
if (message.success) {
|
|
5250
|
-
return done(message.output.data);
|
|
5251
|
-
}
|
|
5252
|
-
else {
|
|
5253
|
-
return fail(new Error(message.output.error ?? `Unknown API error`));
|
|
5254
|
-
}
|
|
5255
|
-
default:
|
|
5256
|
-
return fail(new Error(`Unknown message type: ${message.msg}`));
|
|
5257
|
-
}
|
|
5258
|
-
};
|
|
5259
|
-
});
|
|
5260
|
-
return Object.assign(promise, {
|
|
5261
|
-
destructor: () => socket.close()
|
|
5262
|
-
});
|
|
5263
|
-
}
|
|
5264
|
-
$.$mol_huggingface_ws = $mol_huggingface_ws;
|
|
5265
|
-
})($ || ($ = {}));
|
|
5266
|
-
//mol/huggingface/huggingface.ts
|
|
5267
|
-
;
|
|
5268
|
-
"use strict";
|
|
5269
|
-
var $;
|
|
5270
|
-
(function ($) {
|
|
5271
|
-
function $hyoo_lingua_translate(lang, text) {
|
|
5272
|
-
if (!text.trim())
|
|
5273
|
-
return '';
|
|
5274
|
-
const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
|
|
5275
|
-
const cached = this.$mol_state_local.value(cache_key);
|
|
5276
|
-
if (cached)
|
|
5277
|
-
return String(cached);
|
|
5278
|
-
const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
|
|
5279
|
-
return this.$mol_state_local.value(cache_key, translated);
|
|
5280
|
-
}
|
|
5281
|
-
$.$hyoo_lingua_translate = $hyoo_lingua_translate;
|
|
5282
|
-
})($ || ($ = {}));
|
|
5283
|
-
//hyoo/lingua/translate/translate.ts
|
|
5284
|
-
;
|
|
5285
|
-
"use strict";
|
|
5286
5186
|
var $;
|
|
5287
5187
|
(function ($) {
|
|
5288
5188
|
class $mol_locale extends $mol_object {
|
|
@@ -5319,12 +5219,6 @@ var $;
|
|
|
5319
5219
|
const en = this.texts('en')[key];
|
|
5320
5220
|
if (!en)
|
|
5321
5221
|
return key;
|
|
5322
|
-
try {
|
|
5323
|
-
return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
|
|
5324
|
-
}
|
|
5325
|
-
catch (error) {
|
|
5326
|
-
$mol_fail_log(error);
|
|
5327
|
-
}
|
|
5328
5222
|
return en;
|
|
5329
5223
|
}
|
|
5330
5224
|
static warn(key) {
|
package/web.test.js
CHANGED
|
@@ -712,17 +712,6 @@ var $;
|
|
|
712
712
|
;
|
|
713
713
|
"use strict";
|
|
714
714
|
var $;
|
|
715
|
-
(function ($) {
|
|
716
|
-
function $mol_dom_serialize(node) {
|
|
717
|
-
const serializer = new $mol_dom_context.XMLSerializer;
|
|
718
|
-
return serializer.serializeToString(node);
|
|
719
|
-
}
|
|
720
|
-
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
721
|
-
})($ || ($ = {}));
|
|
722
|
-
//mol/dom/serialize/serialize.ts
|
|
723
|
-
;
|
|
724
|
-
"use strict";
|
|
725
|
-
var $;
|
|
726
715
|
(function ($) {
|
|
727
716
|
function $mol_assert_ok(value) {
|
|
728
717
|
if (value)
|
|
@@ -743,14 +732,12 @@ var $;
|
|
|
743
732
|
handler();
|
|
744
733
|
}
|
|
745
734
|
catch (error) {
|
|
746
|
-
if (!ErrorRight)
|
|
747
|
-
return error;
|
|
748
735
|
$.$mol_fail = fail;
|
|
749
736
|
if (typeof ErrorRight === 'string') {
|
|
750
737
|
$mol_assert_equal(error.message, ErrorRight);
|
|
751
738
|
}
|
|
752
739
|
else {
|
|
753
|
-
$
|
|
740
|
+
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
754
741
|
}
|
|
755
742
|
return error;
|
|
756
743
|
}
|
|
@@ -760,58 +747,47 @@ var $;
|
|
|
760
747
|
$mol_fail(new Error('Not failed'));
|
|
761
748
|
}
|
|
762
749
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
763
|
-
function $
|
|
764
|
-
|
|
765
|
-
for (let j = 0; j < args.length; ++j) {
|
|
766
|
-
if (i === j)
|
|
767
|
-
continue;
|
|
768
|
-
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
769
|
-
continue;
|
|
770
|
-
if (args[i] !== args[j])
|
|
771
|
-
$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
772
|
-
}
|
|
773
|
-
}
|
|
750
|
+
function $mol_assert_like(...args) {
|
|
751
|
+
$mol_assert_equal(...args);
|
|
774
752
|
}
|
|
775
|
-
$.$
|
|
753
|
+
$.$mol_assert_like = $mol_assert_like;
|
|
776
754
|
function $mol_assert_unique(...args) {
|
|
777
755
|
for (let i = 0; i < args.length; ++i) {
|
|
778
756
|
for (let j = 0; j < args.length; ++j) {
|
|
779
757
|
if (i === j)
|
|
780
758
|
continue;
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
}
|
|
759
|
+
if (!$mol_compare_deep(args[i], args[j]))
|
|
760
|
+
continue;
|
|
761
|
+
$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
784
762
|
}
|
|
785
763
|
}
|
|
786
764
|
}
|
|
787
765
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
788
|
-
function $
|
|
789
|
-
for (let
|
|
790
|
-
if (
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
return val;
|
|
796
|
-
if ('outerHTML' in val)
|
|
797
|
-
return val.outerHTML;
|
|
798
|
-
try {
|
|
799
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
800
|
-
}
|
|
801
|
-
catch (error) {
|
|
802
|
-
console.error(error);
|
|
803
|
-
return val;
|
|
804
|
-
}
|
|
805
|
-
};
|
|
806
|
-
return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
807
|
-
}
|
|
766
|
+
function $mol_assert_equal(...args) {
|
|
767
|
+
for (let i = 1; i < args.length; ++i) {
|
|
768
|
+
if ($mol_compare_deep(args[0], args[i]))
|
|
769
|
+
continue;
|
|
770
|
+
if (args[0] instanceof Element && args[i] instanceof Element && args[0].outerHTML === args[i].outerHTML)
|
|
771
|
+
continue;
|
|
772
|
+
return $mol_fail(new Error(`args[0] ≠ args[${i}]\n${print(args[0])}\n---\n${print(args[i])}`));
|
|
808
773
|
}
|
|
809
774
|
}
|
|
810
|
-
$.$
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
775
|
+
$.$mol_assert_equal = $mol_assert_equal;
|
|
776
|
+
const print = (val) => {
|
|
777
|
+
if (!val)
|
|
778
|
+
return val;
|
|
779
|
+
if (typeof val !== 'object')
|
|
780
|
+
return val;
|
|
781
|
+
if ('outerHTML' in val)
|
|
782
|
+
return val.outerHTML;
|
|
783
|
+
try {
|
|
784
|
+
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
785
|
+
}
|
|
786
|
+
catch (error) {
|
|
787
|
+
console.error(error);
|
|
788
|
+
return val;
|
|
789
|
+
}
|
|
790
|
+
};
|
|
815
791
|
})($ || ($ = {}));
|
|
816
792
|
//mol/assert/assert.ts
|
|
817
793
|
;
|
|
@@ -832,10 +808,10 @@ var $;
|
|
|
832
808
|
$mol_assert_equal(2, 2, 2);
|
|
833
809
|
},
|
|
834
810
|
'two must be unique'() {
|
|
835
|
-
$mol_assert_unique([
|
|
811
|
+
$mol_assert_unique([2], [3]);
|
|
836
812
|
},
|
|
837
813
|
'three must be unique'() {
|
|
838
|
-
$mol_assert_unique([
|
|
814
|
+
$mol_assert_unique([1], [2], [3]);
|
|
839
815
|
},
|
|
840
816
|
'two must be alike'() {
|
|
841
817
|
$mol_assert_like([3], [3]);
|
|
@@ -1602,7 +1578,7 @@ var $;
|
|
|
1602
1578
|
], App, "result", null);
|
|
1603
1579
|
$mol_assert_equal(App.result(), 1);
|
|
1604
1580
|
App.condition(true);
|
|
1605
|
-
$mol_assert_fail(() => App.result());
|
|
1581
|
+
$mol_assert_fail(() => App.result(), 'test error');
|
|
1606
1582
|
App.condition(false);
|
|
1607
1583
|
$mol_assert_equal(App.result(), 1);
|
|
1608
1584
|
},
|